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.