# Full Version: Planar Holes Finder : a script for 2D workflows!

From: Michael Gibson [#19]
26 Oct 2017
To: ALL

Hi Marco, also for direction I think you should be able to automatically figure out a projection direction by getting the bounding box of your containment curve and then seeing which direction has a zero extent.

- Michael

From: mkdm [#20]
26 Oct 2017
To: ALL

@You : "...But another problem is it sounds like you're not just looking for "holes" anymore, to make a "hole" it has to be a closed curve..."

You're right Michael :)

The fact is that I wanted initially to start a script for "2D workflows" not for "solids" or "solids boolean" stuff.

My script does this main things :

1) Capture all curves that can be considered "holes" of another flat curve.
I know that this part of the sentence was not very clear.
When Is said "Hole" I wanted to say : closed curves that, when projected, are totally enclosed into the "planar surface" created using the"container" curve.

2) During my coding I also wanted to add capabilities to capture also other situations.
So, now I'm coding my script to be fired in 3 different ways :

A) Capture all "totally enclosed" in "container curve"
B) Capture all "partially enclosed" in "container curve", that is the curves that when projected they intersect the boundary of the "container"
3) Capture both of them

But...during the coding and also during the various experiments and tests popped into my mind that the scripts also could works with
other planes, not only TOP plane, and I started to face with the problem of "Direction" vs "ClosestPt."

Now I try to switch to "Direction" mode and leave the script with the minimum interaction with the user,
assuming that the direction in forced to TOP plane.

Later, when the first official version of the script will be tested by other users, I will try to make it more complex.

I'm also writing the variant for a quick "Lasso" selection !

Thanks for all your help :)

I think I need some suggestion for using the "Project" factory with "Direction", but I want first to try.

We'll catch up!

Ciao!

Marco (mkdm)

From: Michael Gibson [#21]
26 Oct 2017
To: ALL

Hi Marco, we might have been writing posts at the same time so make sure not to miss my additional message above about how to automatically determine the projection direction.

Also another thing you might be able to use for containment detection is Construct > Curve > Isect - if you build a planarsrf with your main boundary you could then run intersect on other curves and it will return points if the curve is on the face.

- Michael

From: Michael Gibson [#22]
26 Oct 2017
To: ALL

Also project factory inputs are like this:

0: ObjectList - BaseObjects
1: ObjectList - TargetObjects
2: String - Mode
3: Point - Direction start pt
4: Point - Direction end pt
5: Bool - Delete inputs
6: CoordinateFrame - Projection plane - When set project to this plane rather than onto target objects.

- Michael

From: mkdm [#23]
26 Oct 2017
To: ALL

Michael thanks you very much for your precious help! Much appreciated !!

Well...I hold in the highest regards all your suggestions and I keep them into my mind.

But for the moment I decided to publish the very first official version of this script using "closestpt" mode of Project command.

I have seen that, apart some rare cases, it gives me much more flexibility and I can work on all views.

In a few hours I will post the first version 1.0 beta also with the variant for lasso selection.

I hope that many users will try these scripts and will report me all issues or strange things.

In this case I will switch to a more complex "curve detection" using "Direction" mode or other ways.

For the moment I think and hope that this couple of scripts, including "Lasso" selection, will be very useful for many 2D workflows and
for other Moi's use cases in general.

Just a final question : Do you think I should create a brand new thread for this first official release to give it the chance to be viewed and tried by
as many users as possible ?

I don't want to spam this forum with all my things ... :)

Thanks again.

Wel'll catch up!

Ciao.

From: mkdm [#24]
26 Oct 2017
To: ALL

P.S. ...

Meanwhile could you please remove the old thread that I created some days ago named : "A possible script for finding "holes" of a planar closed curve" ?

Thanks a lot.

Message 8646.25 was deleted

From: Michael Gibson [#26]
26 Oct 2017
To: ALL

Hi Marco,

re:
> Do you think I should create a brand new thread for this first official release to give
> it the chance to be viewed and tried by as many users as possible ?

Sure, that sounds like a good idea.

re:
> Meanwhile could you please remove the old thread that I created some days ago named : "A
> possible script for finding "holes" of a planar closed curve" ?

Are you sure you need to have it removed? Since there was some discussion there about possible strategies maybe it could be useful for someone doing research on how to approach a particular kind of script in the future...

- Michael

From: mkdm [#27]
26 Oct 2017
To: ALL

Hello Michael.

Ok. I will publish this first beta version of these two scripts in a new thread.

I'm doing some final test and I hope that in a couple of hours, starting now, I should be done.

Unfortunately, like you said, during the last tests the "ClosePt" method for the "Project" command is proving to be too unreliable in many cases.

But I want to close this first beta soon, so i think I should switch to "Direction" mode and calculate the direction based on the bounding box of the container curve.

This will take at least one hour to make some test.

@You : "...Are you sure you need to have it removed? Since there was some discussion there about possible strategies..."

I asked you to remove the other thread because I thought that all the most important things have been addressed here
and all the 5 posts there are only from you and me. No other users.

If you want you can remove it.

Now I go to make the final coding and test.

We'll catch up!