Hello there,
The question is at the title. Is there a way you guys know?
Thank you so much.
Is there a way to find child, parent closed polylines?
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Newbie Member
- Posts: 9
- Joined: Sat Nov 19, 2022 3:20 pm
Re: Is there a way to find child, parent closed polylines?
There is no such thing as parent or child Polylines or any other relation between entities.ilyasozkurt wrote: ↑Sat Nov 19, 2022 11:57 pmIs there a way to find child, parent closed polylines?
I think that you mean a closed Polyline that is fully inside another closed Polyline.
Or better, the enclosed area of one is fully inside the other enclosed area.
That is surely a tough one because a Polyline is merely some line art.
QCAD is all about line art and doesn't work with surfaces.
The solution may sit in the purpose.
Let's assume that you need the area of the larger minus the areas of the smaller ones.
In that case the differential hatched area of a Hatch may be a solution.
There are two ways to do that.
The Centroid resource .getHatchedAreaCentroid(entity)
https://github.com/qcad/qcad/blob/maste ... entroid.js
Or
The recent added Hatch property resource RHatchData.getArea()
https://github.com/qcad/qcad/blob/ca30e ... chData.cpp
First you need to create an RHatchData with the boundaries shapes in question.
https://qcad.org/doc/qcad/3.0/developer ... _data.html
Some words of caution:
- Boundaries or resulting Polylines should not intersect.
This is not checked.
- A Boundary / Polyline should not self-intersect.
There is no good resource to check this. Included for Centroids based on no false positives.
- Boundaries / Polylines should be perfectly closed at every node.
- Boundaries / Polylines must have an unambiguous orientation.
All seems easy enough but created from arc segments things can become tricky.
If the differential hatched area is not what you are looking for ...
... then the mentioned resources may still give you some insight on how they find shapes inside shapes.
I know, these are not perfectly conclusive methods but they return correct values for all/most common cases.
Regards,
CVH
-
- Newbie Member
- Posts: 9
- Joined: Sat Nov 19, 2022 3:20 pm
Re: Is there a way to find child, parent closed polylines?
Thank you for your suggestions. I'll try to find a proper way.
Re: Is there a way to find child, parent closed polylines?
Me, we are very curious about some good methods to deal with surfaces in a simpler way.
If you would like to share your code with us, we could assist and figure it out together.
Regards,
CVH