MeshSplit with curve from code

Hi all,

I am having no success performing a simple mesh cutting operation with a curve from within my code (C# and Python). The main problem is that there seems to be no function available like the “_MeshSplit” command. As an alternative, I tried automating the “_meshSplit” command. I first found a valid string command that performs the operation by experimenting in the Rhino command line, but when I try to call this command from my code it keeps failing. What seems to work in Rhino is the following:

-_MeshSplit _SelID <mesh_guid> _Enter _SelID <curve_guid> _Enter

However, when I try to automate this via C#, the operation always fails:

// Execute the command
string cmd_str = "-_MeshSplit " + "_SelID " + meshId.ToString() + " _Enter " + "_SelID " + contourId.ToString() + " _Enter ";
bool res = RhinoApp.RunScript(cmd_str, true);

Strangely, when I automate it in Python and run the Python script, it works:

cmd_str = "-_MeshSplit _SelID " + str(mesh_id) + " _Enter _SelID " + str(crv_id) + " _Enter "
res = rs.application.Command(cmd_str)

However, when I run the Python script from my C# code using a Rhino.Runtime.PythonScript object, the command fails again (just like my C# code).

Could anyone tell me a good way to perform mesh cutting with a spline from my code? This is really driving me insane.



Hi Lukas,

Did you say your command is a scriptrunner?

<System.Runtime.InteropServices.Guid("00000-00000-00000-00000-00000"), CommandStyle(Style.ScriptRunner)> 

the guid is an exmaple but this should be on the top of your command.


It works, thanks a lot! My bad: somehow I never read that part of the documentation.

You don’t really need the Guid attribute. We will be removing this from our command wizards in the future.