Hatching always failed (working with ellipse and line)
This post was updated on .
I am just new with LibreCAD, but not so blind in drawing. I have used this LibreCAD for months and have used almost all the functions/tools, include using HATCH, ELLIPSE and LINES. Here is what I did that got problem:
1. I drew ellipse with center coordinate 100,100 with major radius=8 and minor radius=6.
2. I drew the 2nd ellipse with center coordinate: 200,100 with major radius=8 and minor radius=6.
3. From 100,100 (center of the first ellipse), then I run command (to draw line with relative coordinates):
4. Then I divide the ellipse ellipse I divide (with Divide command) just at the end of the lines corner.
You know, that intention is to draw something like pipe that seen from a point of view (from the right side). To make it representative, I need to hatch the part so will show the hole. Then both the long lines, the left side of both ellipse I clicked then I hatch. But got problem as the comment in the command line pane said:
Invalid hatch area. Please check that the entities chosen form one or more closed contours.
I have tried to create polyline from those four segments, but also failed, even to create polyline also failed. Trust me, I have tried so many times.
Then I zoomed every connection to make sure that still any open contour, but no one I found.
Then I have tried the same work but with major radius=40 and the minor radius=30, and I FOUND that they are working.
So, what is the problem to make close contour with the small ellipse?
Appreciate your help in this case. I wonder that there is wrong algorithm here. Please remember that I used relative coordinate here when drawing the lines rather than using snap. But however, snapping also I have tried several times and didn't work.
If we check the comment in the Command Line, the comment is:
Hatch failed due to a gap=2.70516e-06 between (200, 78) and (200, 78).
Re: Hatching always failed (working with ellipse and line)
this may happen because of rounding errors with the ellipse.
You can try to use "Trim two" command from "Modify" tools to close the gap.
Or construct and trim the ellipses first and then draw the lines with the mouse using appropriate snap modes.
I tried using snap when drawing. Hatching didn't recognize the left half of the right ellipse at all, got a gap=16. I deleted the right ellipse and mirrored the right half of the left ellipse to the right side. Now hatching worked.
Is this the shape you wanted?
If it's a rounding error issue, we will have to live with that it sometimes works and sometimes doesn't. And try a different approach. Or, as a workaround, if it works with the larger ellipses, do that and scale it down afterwards.
I understand that the problem is due to rounding error so there is very tiny gap mentioned in the error pane. But the problem is no method to fix such that error. There should be any method to force two or more lines or entities to be joined to make it closed.
The method using trim two, however is not working due to no two intersection to be cut.
Today I got new experience that could be useful for hatching.
I created rectangle using command line from coordinate 10,0 as below:
Then I run command sa (select all) to select all the entities which I want to hatch, then I clicked hatched tool, and it was success.
Hatch created successfully.
Total hatch area = 8000
Then I modify the right most using lengthen command so the right line lengthened from 100 to 101. Then I run again command sa to select all and I hatched, but failed with command:
Hatch failed due to a gap=1 between (90, 100) and (90, 101)
Quite strange as the line actually was excessive, not gap.
So to understand the hatching error message, we also need to check if the line was excessive (rather then just to verify whether any gap or not).
So, the way to solve this problem is to trim the excessive line to make it perfectly ended one in another.
This is expected behavior.
The meaning of gap is, that the entities endpoints doesn't build a continuous chain, no matter if there is a hole or overlap.
The hatching tool doesn't search for possible intersections and modify entities to get a valid area.
Maybe we can implement some tolerance to solve the small gaps issue, when endpoints are in the range of a fraction of the entity length or an adjustable tolerance.
There are already a couple of hatching issues on github. I will link this thread there to keep it tracked.
Sometimes I can make the hatch with the ellipses, but sometimes can not. If it is success, the way I did is to drag the line and activate ONLY ONE snap by activating the EXCLUSIVE SNAP MODE and chose the SNAP END. That is intended to make no option than the snap end, so the tips of the lines will meet. But again, sometimes that way also failed and I have to try and repeat many times.
Another thing in identifying the problem, for example I draw as below:
Line 1: 0, 100 to 150,100 (horizontal line above).
Line 2: 0,60 to 150,60 (horizontal line below)
Line 3: 0,60 to 0,100 (vertical line left)
Line 4: 150,60 to 150,100 (vertical line right)
Then I drew two ellipses connecting both the vertical line with major, minor radius = 20,10.
Then again, I cut the ellipses at the point it meet to both vertical and the horizontal lines. By selecting the required part, then I hatched. At first try, it failed with comment as below:
Hatch failed due to a gap=3.36832e-06 between (150, 60) and (150, 60)
If you see the comment, it is failed with the connection in the right below corner. So the ellipse in the right side I deleted and I then just copied and pasted the left ellipse, and I tried again to hatch, and success.