Login  Register

Re: how to check if every entity/polyline on your drawing is closed? and strange behaviour of creating polylines

Posted by LordOfBikes on Jan 29, 2022; 11:11am
URL: https://forum.librecad.org/how-to-check-if-every-entity-polyline-on-your-drawing-is-closed-and-strange-behaviour-of-creating-pos-tp5721401p5721403.html

Sadly there is no better way than the properties dialog, as you already described.

You probably can use the List entities plugin.
Select all entities and use the plugin will give you a list with all entities, where you can also see the closed property.
But there is no way to bulk-change this. And it will be hard to identify listed polylines to modify them.

For explanation:
When you create a new polyline using the Polyline tools, there is a button in the tool option bar to close the polyline. This button sets the closed property for the polyline and close it.
On the other hand you can use snapping and finish the polyline on the starting vertex. This results also in a visually closed polyline, but the closed property is not set.
You can check this with the List plugin too. Create two polyline rectangles, both cases as described.
One U shaped with the close button and one with snap on starting point.
Then look at them in the List plugin.
The closed polyline has only 4 vertices, where the first and last one are not identical. These 4 vertices create 3 lines and the closed flag creates the 4th line between the first and last vertex.
The other one has 5 vertices and the first and last one are the same. These 5 vertices create 4 lines and a closed shape too.

The DXF reference is not detailed about the closed flag, so it leaves room for interpretation.
- The interpretation of LibreCAD is, that a polyline, with closed flag set, has to be drawn closed.
- Without the closed flag set, the polyline is not modified.
- There is no rule which says that the closed flag has to be set for polylines with identical first and last vertex.

So this is just the current state and background of polyline in LibreCAD. I can't and won't say if this is all correct. I also don't know how AutoCAD handle this, to use this as reference.
Inside LibreCAD we need closed polylines too, e.g. for Hatch. We use the condition closed flag set OR first vertex match with last vertex to identify closed contours.

We could check if first vertex is equal to the last and set closed flag then. But without a clear reference I can't estimate what will happen then in other CAD software with this kind of polylines.

My recommendation is, that the photolithography application should accept both kind of closed polylines (the OR approach).
Even when we modify LibreCAD behavior, there are other DXF creating applications which may have same DXF interpretation.
What I can imagine is a plugin for LibreCAD, which does the bulk-conversion. This way the current, long approved functionality doesn't change.
investing less than half an hour into Search function can save hours or days of waiting for a solution