Planar Holes Finder : a script for 2D workflows!

 From:  mkdm
8646.1 
Hi Michael and everyone!

I put my hand on keyboard again and I coded a bunch of JS code that I hope will be very helpful for many people :)

With this work I tried to solve a long-standing problem that almost daily I meet during my 2D workflow session involving Moi and Affinity Designer.

The problem is that I often need to select in Moi all the closed curves that can be considered "holes" of a given closed curve.
And I always had to do this operation manually.
A very tedious task!

So, I have written this "PlanarHolesFinder" script.

Get it at : http://take.ms/BhYv0
Unzip the file and copy it into the "scripts" folder of your Moi installation.

This is the very first 0.1 version but I must say that I'm already very satisfied with it and with its performance on my 7700K :)

To show you some stuff to evaluate I made two tests with two Moi 3dm files, containing only planar curves laying on the TOP plane.

In both files I replicated a "block" composed of 9 planar curves for a total of 179 control points.

1) Scene 1
400 "blocks" for a total of 3600 planar curves and an total of 286400 control points

Total elaboration time : about 6 secs

2) Scene 2
1600 "blocks" for a total of 14400 planar curves and an total of 2577600 control points

Total elaboration time : about 23 secs

The script is totally not optimized but IMHO the performance are already good.

I have in mind some kind of optimization but I have to make some test.

**************************************************************************
**************************************************************************
The script is very easy to use :

1) Select first the PLANAR CLOSED curve that should be the "container" of the holes
2) Select all the other curves that we can consider "candidate holes"
3) Run the script!

At the end of the elaboration, if the script found some "holes", all the "holes" will be automatically selected.
Also the original "container" curve will be selected.

N.B. :

THE SCRIPT IS A LITTLE BIT LIMITED FOR THE MOMENT BECAUSE ONLY THE PROJECTION ON THE TOP PLANE IS TAKEN INTO ACCOUNT.

But anyway the script is capable to recognize as "holes" also NON-Planar curves.

//////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

This is the DEMO video of the scene 1 : http://take.ms/gCbyh

This is the DEMO video of the scene 2 : http://take.ms/YETKu

This is the scene 1 screenshot :



This is the scene 2 screenshot :








Ciao a tutti! (Hello everyone!)

- Marco (mkdm)