Hi,
I was wondering if it was possible to create a component to replace data on an existing object. I constantly need to update only one property of an object.
Hi,
I was wondering if it was possible to create a component to replace data on an existing object. I constantly need to update only one property of an object.
Are you trying to change data on a received object?
PS. You can use GhPython node to quickly replace the value of any key in a Speckle object.
Amazing! I didn’t know about this. I mainly work in C#, is something like this possible? Also something with auto-complete for the properties?
There are ways of accessing and modifying the Speckle objects in a C# script, but it does require adding the speckle assemblies to that script. This is a bit more cumbersome that python, since C# is statically typed it doesn’t like getting unknown objects passed around.
You can see how to set it up here: Grasshopper | Speckle Docs
As another option, you could use dynamic types inside your script Using type dynamic - C# Programming Guide | Microsoft Learn (also a bit of a pain to use though). This is the closest you’ll get to the python script Bilal shared, but comes with it’s own issues.
As for the autocomplete, if you cast a specific Speckle object (such as a Wall or a Beam), you’ll be able to get autocomplete on their static properties, but not for any dynamically added properties, such as the ones you create in a CSO or ESO components, as there is no way to know what the names and types of those properties would be.