I’m struggling to find the reference object through GUID.
My initial goal is to use rhino group as an input in grasshopper, and keep it separately in data structure.
I found useful to use plug-in fabtool to obtain group-like data structure in grasshopper.
Now, the issus is I’m not able to get the object in grasshopper through GUID, somehow the rs.coercebrep only return None.
Hello - I poked at this a little and I see that it does not work as is, but similar code in a straight python gets the breps. I’ll need to defer to the GH experts - I’ll shift this to the GH forum.
I’m pretty sure @shaunwu25 is referring to GUIDs and objects referenced from the Rhino document, not GUIDs of objects on the Grasshopper canvas (to prevent further confusion). In which case, one should be able to use the coerce functions to get the RhinoCommon object from a GUID. There are several of these functions for the various geometry types etc. So you’ll likely have to do some checking and call the appropriate one. For some reason I can’t seem to get the rhinoscriptsyntax search/documentation to play nice (there appears to be no coerceFoo functions in there!), but perhaps trawl through here:
@AndersDeleuran thanks for the explanation and your support.
The truth is I wasn’t sure the GUID from fabtool is referencing Rhino or Grasshopper document.
Now is working perfectly.
I upload the code below in case anyone is interested.
You could probably negate fabtools entirely by digging a bit further into the available rhinoscriptsyntax functions for this stuff. Here’s a basic example of getting the RhinoCommon geometry objects of guids referenced from the Rhino document, and then adding these to a dictionary based on which groups they belong to, and finally shoving this into a DataTree:
That said, I personally recommend operating with layers for structuring interfaces between Rhino objects and Grasshopper, using the standard geometry pipeline, or through scripting where appropriate. I suspect you might run into some unforeseen kinks with things like un-grouping, re-grouping, nested groups, deleted groups and such.