I wonder I somebody knows how can I access custom properties Speckle data from a seleted object in a python script in Blender? For example Family, category, and height. Any example would be useful.
/Max
I wonder I somebody knows how can I access custom properties Speckle data from a seleted object in a python script in Blender? For example Family, category, and height. Any example would be useful.
/Max
hey max!
since properties on eg revit elements are on the element itself and blender only converts the displayValue
meshes, speckle blender does a bit of a tricky thing and passes the parent RevitElement
properties onto each Mesh
's custom properties
since they’ve already been added to the blender object’s custom props for you, you’ll be able to access all of them form there
note that since the props are passed down to each item in a displayValue
list, if the revit element has more than one mesh in the display value, all meshes will have the same custom properties attached to them
Thanks a lot. If I would for example like to get the render material, category and dimensions from a selected window, what would the code look like?
hey max,
if you’re not familiar with the blender api, I’d highly recommend having a look at the docs so you can get your bearings
https://docs.blender.org/api/current/index.html
but I’m happy to help you get started. let’s have a look at the blender internal scripting environment which already has C
set to the current context
if you think of an object as a dictionary, all custom properties are just keys on the object. here’s an example of all the available keys on this random revit object I received
materials are stores in a material_slots
dictionary on the object which you can also access as a dictionary
the blender scripting env has some nice autocomplete suggestions when pressing tab which is helpful when exploring the API