I would like to be able to cast object attributes (Rhino.DocObjects.ObjectAttributes) to the new ModelContent -format in Rhino 8’s Grasshopper.
I can cast an object Reference (GUID) in Grasshopper directly by plugging it into the ModelObject’s “Object” parameter, but I can’t find a way to cast the data type Rhino.DocObjects.ObjectAttributes, which I have in isolation in Grasshopper, into ModelObjects.
I want this because I am trying to migrate my Grasshopper definitions to Rhino 8 bit by bit and up until now have used custom baking methods, Human and Elefront, all of which involve separating geometry and ObjectAttributes a lot of the time.
I’d like it if I could just cast some of those final, very-down-stream and separated ObjectAttributes (or eleFront Attributes) into ModelObject -style, so I could then reattach geometry, bake, and call it a day.
I’m more versed in Python than c# and I’ve tried to sniff out whether there’s a constructor or method in Grasshopper.Rhinoceros.Model.ModelObject.[…] to ‘inherit’ attributes or just cast them, but I haven’t had any success.
Is there a way to do this? If not, could I have it put on a feature wishlist, please?
Hi, sorry to come knocking at my old thread again (should I start a new one?) but I’m wondering, is there any way, within Grasshopper, to cast ModelObjects to RhinoObjects (with ObjectAttributes) and vice versa?
The only way I’m able to do this reliably at the moment is by baking objects in between into Rhino.
Constructing a ModelObject from ObjectAttributes is working and I’m happy with that, but I’d like to convert ModelObjects back to RhinoObject+ObjectAttributes again, so I could, for example, do custom export functions without baking into the current Rhino document first.
This ModelObject-to-RhinoObject conversion must of course exist under the hood for the Content Cache -components to do their job. I’d like to have this conversion/casting function/method available in python (or c#), please. If it’s already possible somehow I have not been able to figure out how to do it myself.
RhinoObject can’t exist outside of a RhinoDoc. So the only way to convert a ModelObject to a RhinoObject is baking it.
This is exactly what ‘Content Cache’ does.
Not really.
Keep in mind that a ModelObject may have references to other things that are still not in the model, this includes a Linetype, or a Material, or a Section style, Annotation Style…
So I can’t give you an ObjectAttributes because it can’t reference things that are not in the model. It’s designed to reference these things using an index on each reference type table.
Best it can do is returning null or -1 on these cases, but I think this may become confusing or error prone at least.