Passing arguments to scripted commands

I have a C# command I want to call from Python that looks roughly as follows.

-_Import filename
-_SelLast _Enter
(C# logic to delete non-Brep objects that were imported)
-_Group _Enter
-_PickMotionAxis ‘object1’ w0,0,0 w0,1,0

The arguments I want the command to consume are shown in bold. So from a top level I want the command to be able to consume these arguments from RunScript call like this (from python)-

rs.Command("-_MyCommand filename w0,0,0 w0,1,0 ")

The arguments should be consumed in the order I hand them over to the top-level call. In practice I find that not all arguments make it to their final location. You can see the w0,0,0 point is treated like another command even before the context gets to the PickMotionAxis sub-command. So by the time this final sub-command is called, it asks for the point I already tried to send it.

Imported 106 entities from IGES file myfile.igs.
File " myfile.igs" successfully read
File " myfile.igs" imported successfully.
Command: w0,0,0
Unknown command: w0,0,0
Command: -_SelLast
Change SelLast option. Press Enter when done ( DeselectOthersBeforeSelect=Yes ): _Enter
Change SelLast option. Press Enter when done ( DeselectOthersBeforeSelect=Yes ):
106 surfaces added to selection.
Command: -_Group
Command: _Enter
Command: -_PickMotionAxis
Specify the name <0>: object1
–Prompted for point argument here, which I attempted to hand to the Run method.

Thoughts?

Thank you,
Kevin

If this is the flow of your custom command, then your custom command need to prompt for a string, using GetString following by prompting for 2 points using GetPoint.

Thank you for confirming that. I wasn’t sure if I was missing something with the command system.

Hey I just checked out your web site. What can you tell me about your Rhino plug-in?

Hi Dale, curious where you got the website info; what website are you referring to?

-Willem

http://mstarcfd.com/dmt-software

1 Like