Grasshopper

algorithmic modeling for Rhino

Hi all, I'm new to GHPython and trying to understand something more ...

I've been able to add objects to the Rhino document, but what about deleting a Rhino object ?

If I understand it correctly, Guid's in GHPython come from ghdoc, not from RhinoDoc.ActiveDoc, so they cannot be used to reference RhinoDoc objects.

Is there a way to reference a RhinoDoc object from a GHPython script ?

Thanks

emilio

Views: 1969

Replies to This Discussion

Hi Emilio, You can switch between Rhino and Grasshopper if you want to access Rhino objects.

import scriptcontext as sc
import Rhino as rc


# switch to Rhino

sc.doc = rc.RhinoDoc.ActiveDoc

# Modify the RhinoDoc here (e.g. select object by layer, delete)

# switch back to grasshopper

sc.doc = ghdoc

Hi Mostapha.

Yes, I can add an object to RhinoDoc.ActiveDoc, because all I need is a Rhino.Geometry instance, which the GHPython component is able to get when the user selects an input object.

But to be able to delete or replace an object into RhinoDoc.ActiveDoc, I need a Guid or a RhinoObject or an ObjRef.

That's my problem: how can a GHPython script get one of those ?

I think that the input parameters of the component can only get Rhino.Geometry data when input objects are selected. Am I correct ?

What I'm looking for is a way to get Guid's or other data that would allow me to delete or replace an object into Rhino's RhinoDoc.ActiveDoc.

Does that make sense ? Or am I too much confused ? ...

Thanks for your reply ! Cheers.

emilio

Well, it seems it was quite simple: just use  Rhino.Input.Custom.GetObject.

Sorry for the stupid question ...

Cheers

emilio

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service