I made a python script for rhino5 which uses scripted make2d command.
Since Rhino 7 is out I have adopted the script and it now scripts make2d under rhino7
However, it turns out that scripted make2d in Rhino7 much slower than it was in Rhino5.
The script works in a loop and does a lot of make2d, one after another, each consists of a solid and multiple curves
speed difference goes up to 5-6x depending on the objects selected for make2d
here are the both scripted commands, the rest of the script is identical so no side effects should influence the result
Unlike Rhino 5, the Make2d command in Rhino 6 and 7 is multi-threaded. I’m going to speculate the the slowness you are seeing, in your small model, is the time it takes to setup threading and the booking keeping to support it.
The Make2d functionality is available in RhinoCommon, where you can choose to have the solution computed with our without multiple threads. You might try rolling your own, non-threaded version and see if it works better for your situation.
While it is about 20% faster comparing to directly scripting make2d command, it is unfortunately still ~4x slower (on average) than scripted make2d in rhino5.
I will send you the script by email.
There are some parts of the code in the examples (and in my script) that I did not fully understood.
Tweaking the code may bring further speed increase, but I doubt it can come anywhere close to rhino5 speed.
I will try to find some other way to achieve the goal, not by using make2d.
I managed to make the python script to perform “custom” make2d command
( the script will come to you by wetransfer , as well as one more test file )
The script is just a sub that replaces the scripted make2d in my plugin command, so I made a “wrapper” to provide the input data it needs to perform
It returns the curves which are then processed further
Honestly, I did not understood fully the examples you provided, so I may did some parts not as efficient as is could be, but I doubt it can change the speed dramatically
I did measures on 2 separate models, each consisting of approx. 800 solids…
My command takes each solid, one by one, and finds the intersection lines for it and the neighbouring solids. Then the ‘make2d’ is performed on the solid and the created intersection lines…
here are the measurement results:
model1:
Rhino 5 scripted make2d 166 s
Rhino 7 custom make2d multithreading=false 698 s
Rhino 7 custom make2d multithreading=true 706 s
Rhino 7 scripted make2d 892 s
model2:
Rhino 5 scripted make2d 401 s
Rhino 7 custom make2d multithreading=false 1452 s
Rhino 7 custom make2d multithreading=true 1525 s
Rhino 7 scripted make2d 1911 s
Note:
given times are for the complete command to finish. In the entire command only the make2d part is replaced for each test case, the rest of the command is unchanged.
This should lead to the conclusion that time difference is mainly due to the different make2d