Internalize geometry into a python component

Is there a way to internalize geometry inside a python component?

Maybe by loading the geometry from an external file or something like that?

You can load geometry from an external file, but that wouldn’t count as ‘Internalizing’ inside a Grasshopper file (.GHX/GH file). In fact, no scripting component at this moment has inputs that allow for internalized geometry. But you can easily fix that by internalizing geometry in normal Params, then passing the data to the script input.



Giulio Piacentino
for Robert McNeel & Associates

Isn’t it possible through encoding like icons and images?

Base64 method

Yes, that’s what I’m doing at the moment: internalize the geometry inside normal params and the plug them into the python script.

If I wanted to load specific geometry from another file into the script… what will be the best way?

Thank u!

Oh, you want to dig into 3dm file and get the model/object with python? That’s interesting

I like to use the standard Python pickle module for serialising data to/from file. This works with most of the RhinoCommon geometry types I’ve thrown at it so far.

@AndersDeleuran, is it theoretically possible to embed (serialise/deserialise) dll and refer to the embeded file with clr?

Cool. I haven’t tried cPickle… so far. I will give it a try! Thanks!

I’m not sure how that would make any sense.

The sense of portability.