I’m working on writing some custom python commands for use within Rhino 6 (version 6.2.18065.11031, 3/6/2018) and am running into an issue using the rs.Command().
Can you provide a small sample script file that works inside of the EditPythonScript editor but does not work with the RunPythonScript command? Or is what you’ve posted sufficient?
To offer a little more explanation, when I create and install the command to rhino using python, the command is failing to execute any rs.Command() line. If I run the code directly as a script, it will work just fine. The code below is sufficient to test it.
Just using an object ID I have in a test file for the select object. Calling “test1” from the command line will select the object, but it will not delete it. If i were to run the 2 lines
import rhinoscriptsyntax as rs
rs.SelectObject("bb3b227e-5d5a-461d-9196-bbbbc00142a4")
rs.Command("_Delete")
Here is an image of after running test1 as a command. The square is the object ID used in the command, where it successfully gets selected. The delete command is called, as seen in the command history, but it is not executed successfully.
Did you figure out a way? I’m running into the same issue.
I guess a work-around question is, how do I script something like rs.Command('_Line') without using the rs.Command()
Either using rs.AddLine() - if you already have 2 points to determine the line, or rs.GetLine() if you need user interactive… See Help for optional arguments on the second.
That did it!
But still wonder if rs.Command() should be made available through custom python command. It’d be much easier to script on-the-flight user interactions for me.