Hatching always failed (working with ellipse and line)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Hatching always failed (working with ellipse and line)

sunggus
This post was updated on .
Hatching failed when drawing lines and ellipses

Hi,

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):
- @8<90
- @100<0
- @16<-90
- @100<180
- @8<90

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.


Another thing:

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).

There is a very small gap in the same line.

Best regard.

Best regard,
Reply | Threaded
Open this post in threaded view
|

Re: Hatching always failed (working with ellipse and line)

LordOfBikes
Administrator
Hello sunggus,

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.

Hope this helps.

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution
Reply | Threaded
Open this post in threaded view
|

Re: Hatching always failed (working with ellipse and line)

dellus
In reply to this post by sunggus
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.
Reply | Threaded
Open this post in threaded view
|

Re: Hatching always failed (working with ellipse and line)

sunggus
In reply to this post by LordOfBikes
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.

Best regard,
Reply | Threaded
Open this post in threaded view
|

Re: Hatching always failed (working with ellipse and line)

sunggus
Using snap look like better rather than using relative coordinate. But so far it only work if the the lines are just vertical and horizontal. Still not working with lines with angle.

Using scaling also help. But however it is not the right method. Should be any method how to "force" to join two or more lines to be ended at exactly one coordinate.

But thank you anyway for the help.

Best regard,
Reply | Threaded
Open this post in threaded view
|

Hatching, how to solve

sunggus
This post was updated on .
Hi,

Today I got new experience that could be useful for hatching.

I created rectangle using command line from coordinate 10,0 as below:
@80<0
@100<90
@80<180
@100<-90


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).

Hatching error

So, the way to solve this problem is to trim the excessive line to make it perfectly ended one in another.

Best regard,
Reply | Threaded
Open this post in threaded view
|

Re: Hatching, how to solve

LordOfBikes
Administrator
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.

Armin
investing less than half an hour into Search function can save hours or days of waiting for a solution
pwp
Reply | Threaded
Open this post in threaded view
|

Re: Hatching, how to solve

pwp
In reply to this post by sunggus
Dear Sunggus,

Did you finally succeed in hatching the drawing with the ellipse arcs?

The too long side of the rectangle is also a possible problem when trying to hatch, but hatching with ellipse arcs is definitely a much more difficult one, I''m afraid...

... and a different one.

pwp
Reply | Threaded
Open this post in threaded view
|

Re: Hatching, how to solve

sunggus
This post was updated on .
Dear pwp,

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.


Best regard,
Reply | Threaded
Open this post in threaded view
|

Re: Hatching, how to solve

sunggus
Hatching with Ellipse

Here the hatching I mentioned above.

Best regard,