Absolute point inputs in command line script

I am trying to write a script in ghpython that runs a command taking in point inputs. The points are written in rs.Command() as parts of the string with the format x,y,z. This works in the standard perspective view, but creates wrong results in the orthographic views. I am guessing this is because of how point user inputs are interpreted in ortho, but I want this script to run correctly regardless of which view and settings I am using. Is there a way to create point inputs that are always 3d points regardless of this?

Also, an additional question. I want this script to cancel any current commands. I am trying to do this with having rs.Command(“_Cancel”) before my own command. This seems to work to cancel a command by itself, but for some reason, if it cancels a command, it will prevent the command in my script from running. Any ideas why?

for a point in global / world coordinates

x=1.23;
y=34.56;
z= 7.89;

write

w1.23,34.56,7.89

w stand s for world.

Why are you doing this? Why don’t you just create the points with Rhino.Geometry.Point3d(x,y,z) ? That will always create 3d points with x, y and z in world coordinates.

I don’t understand this either… Are you perhaps writing a script that runs in Grasshopper when you should be writing a script that simply runs in Rhino without going through Grasshopper?

Thank you, this works very well.

I am writing a script that automates cageedit with inputs from grasshopper. To my knowledge, this function can only be accessed using command.

1 Like

you might try a “!” at the beginning
rs.Command("!_line w0,0,0 w100,0,0");

for macro s
https://wiki.mcneel.com/rhino/basicmacros

for entering numbers (V5)… not sure where this topic went in the new V8 help
https://docs.mcneel.com/rhino/5/help/en-us/index.htm#user_interface/unit_systems.htm

cageEdit via macro… if you manage to do this, I would love to see the result.

The method with “!” does not work either. The documentation here actually mentions that this method does not work, but does not mention any alternatives. Command (rhino3d.com)

I will share it when finished. The core functionality of the script already works, so now I just need to fix some bugs.
The results are super smooth and consistent for very complex and irregular deformations. I believe many people could have use for this.

ok - sorry that does not work…

did you see this 6 year old topic:

at least at this time, it looks like it was not possible

I just found RhinoApp.Incommand (V8) - this might allow you at least to check if there is command active:
https://developer.rhino3d.com/api/rhinocommon/rhino.rhinoapp/incommand