MoI discussion forum
MoI discussion forum

Full Version: A possible script for finding "holes" of a planar closed curve

Show messages: All  1  2-5

From: Michael Gibson
24 Oct 2017   [#2] In reply to [#1]
Hi Marco, it sounds like that might work but I haven't analyzed what you've got there in detail yet.

The Construct > Planar command does do this type of hole detection as part of how it functions, so maybe another possible way could be to just send all the curves through PlanarSrf, then in the breps that were generated from that get the brep face and on the face call getLoops() - if a face has more than one loop all the loops after the first one are holes, the first loop is the outer boundary. So for every hole you detected there you'd need to identify the original curve it came from, maybe scanning through your curves and seeing if they have the same start/end points would work. For segmented curves like a square with 4 segments in it that will have 4 separate edges in the loop.

- Michael
From: mkdm
24 Oct 2017   [#3] In reply to [#2]
Hi Michael.

Thanks a lot for the prompt reply!

Well...I too have considered a solution like the one you told me but for what I've simulated manually it seem not to work and also
maybe it's a little bit more complex than the solution I have though.

For example, using my example scene if I select all curves and apply a single PlananrSfr I get no useful resulting surfaces.
I mean that I can't get the main surface with the holes inside, but only many separated surfaces from each input curve.

Please check this brief video if you can : http://take.ms/QtaWo

Here you can get the example scene file : http://take.ms/uO3Eu




Thanks for your support :)
From: Michael Gibson
24 Oct 2017   [#4] In reply to [#3]
Hi Marco, yeah you're right, it turns out for a case with some of the curves intersecting each other like you've got there it won't make nested holes. So for that method to work you'd need to detect curves that intersect with your outer boundary and remove those from what you give to PlanarSrf. With the intersected curves removed you could probably use PlanarSrf to detect whether a curve is either inside or outside the outline though, if your other method doesn't work out.

- Michael
From: mkdm
24 Oct 2017   [#5] In reply to [#4]
Hi Michael.

Thanks a lot for your suggestion.

All in all is almost like the method I thought :)

Ok. I'm going to code a bunch of JS code for a first rough version of the script.

I think that it could be very useful for many use cases.

We'll catch up.

Ciao!

Marco (mkdm)

Show messages: All  1  2-5