WireCut with Python?

first of all, I’m a total newbie in both 3D and Python. so I’m sorry if my inquiry seems obvious to you.

I would need to create a script that will automatically WireCut several curves from one single Polysurface. I’m really trying to make holes in Polysurface. that’s pretty much it. but I got a ton of files to generate and scripting this step would help me a lot!

all my curves have their own names, so I guess I’ll have to do a script that selects my base Polysurface and WireCut using A curve, then B curve and so on. as I suppose it’s not possible to select all my curves and wirecut them all from the base Poly?

how would I go about doing it?

thanks in advance for your help!

Do you really need Wirecut? Are you simply projecting the curves to cut all the way through the object? In that case it may be better to script an extrusion of each curve, then use BooleanDifference…

There is no native Wirecut method in rhinoscriptsyntax/python, but you could script it with rs.Command(). Perhaps you could post a small example of what you want to do.

–Mitch

right I was thinking of that as well.

I do use the curves to cut all the way through the object.

but I assume it would be faster to WireCut rather than extrusion + Boolean, no ? as it’s not possible to Boolean several several objects at the same time, or am I wrong? (I would not be surprised if I were wrong haha)

I’d love to see an example if you have time to write a fast one, so I can try to play around with it.

:slight_smile:

oh sorry you mean I post an example.

well, yeah it’s about creating holes on an object, using already set and names curves.

so I was thinking of doing a script where I could select each curve and the polysurface then run wirecut, and repeat for all the curves instances I have.

For this type of operation, one important thing will be determining the direction of projection - no matter if it’s Wirecut, Extrusion or something else. If the cutting curves are planar, it could be the curve plane normal direction; otherwise it could also be the direction normal to the active viewport’s CPlane. Once the direction is established, the rest is not too hard.

If you have multiple closed curves to cut through one single polysurface, you might just try the MakeHole command (allows cutting with multiple curves)…

–Mitch

hooo I didn’t know about the MakeHole command! I’ll have to check that out!

I usually go to Z direction both sides et make my holes with WireCut.

ok I’m been trying to use RoundHole.

rs.Command( ‘_RoundHole’)

it will prompt the command options in Rhino.

how do I define the options in the script itself?

Depth: 1
Radius: 0.5
Drill Point Angle: 180
Direction: C Plane Normal

?

actually I manage to do a Macro that use the curves I have.

_SelClosedCrv
_MakeHole
_SelClosedPolysrf
_Enter
_SelAll
_Export

now if possible I need this macro to process several files at once. and export each file in OBJ.

right now I still have to go through the Export Options window and press Enter 3 times.

can I set the options in the Macro itself or at least simulate Enter 3 times ? what I tried so far didn’t work.