GH or GH/Python: Manipulate existing Rhino document objects...?

Hi all,

I’m just wondering if it’s possible to execute some simple transformations (move, rotate) on existing objects in a Rhino document referenced in GH… I know I can do stuff in GH and then bake new ones, but in this case, the objects need to retain all of their original characteristics, ID’s, layers, applied materials, etc…

All this can be done with a normal Python script outside of GH, but this particular project is sufficiently complex that I would like an interactive preview to set things up the way the user wants, then set the changes. I was thinking that all the relevant stuff could be done with normal GH components and a custom preview, then when everything is set, send the transformation data into a Python component and have it apply the transformations (once) to the objects in the document…

Possible? Pipe dream? Going down a wrong-way street here? I don’t know enough about GH and its relation to existing RhinoDoc objects to figure it out on my own yet…

Thanks, --Mitch

1 Like

Hi Mitch

if I am understanding what you are asking, in part this is possible.
One part, I think, concerns applying rhinoscriptsyntax with the right document as target. This is supported. See this post for an example.

The “once” part might prove a bit more difficult (how are you going to handle the “undo” properly? Will you keep a “shadow copy”? The latter would be my choice.

I hope this helps


Giulio Piacentino
for Robert McNeel & Associates

1 Like

Hi Giulio,

Thanks for the response… I will attempt to make a mockup of what I want to so with some simple objects and see how far I get… Undo… hmmm, that I hadn’t considered, I guess there is no method for adding the transformation to the normal Rhino undo stack…

Cheers, --Mitch

Operations you do from Python will be recorded in the Undo stack. But you cannot simply undo, as maybe the user will have done something between your original operation and your need to undo.


Giulio Piacentino
for Robert McNeel & Associates

Mitch, Checkout the RhinoObject class:

Specifically the CommitChanges method:

I used this before to do what you are saying.

Try this. I think that’s what Giulio meant, when he said “shadow copy” too.

rhino_grass_rhino.3dm (27.6 KB) (13.7 KB)