Grasshopper - Notifications for updated components

Hey everyone!

I recently joined the team at Arup working on Speckle, so I’m very excited that I’ll be a lot more active within the community!

As the structural objects continue to develop and change, we are hoping to get some thoughts on the best way to represent these changes within grasshopper components. Presently, when placing a generated element component, there is no warning if the element does not match the latest structural object. Components in existing GH scripts would therefore need to be updated manually.

We were hoping to work towards a quality of life feature where we can use the built-in Solution > Upgrade Components to take care of this as components are updated. Are there any thoughts on how to best manage this?


Hey Dan,

Congratulations on the move! I believe @AlanRynne already did some magic thanks to which the Grasshopper BIM components can be automatically updated using the “Upgrade Components” function.
I’ll let him explain how it works as I have no idea :slight_smile:
A warning would be nice though, could maybe be done caching locally the version of the objects kit.

1 Like

Hey @d.naughton!!

Glad to hear about you joining the Arup Speckle team! :slight_smile:

Auto-upgrading schema nodes is a bit tricky, and sadly it’s still a semi-manual process.

As you may have already noticed, all Schema nodes are generated using a t4 template file. This creates a .cs file with all the necessary classes inheriting from GH_Component. This basically searches for any constructor with the SchemaInfo attribute and generates a component for it.

Before I left on vacation, I added a new attribute to core → SchemaDeprecated, which when applied to a constructor with the Schema attribute, will flag it as deprecated in Grasshopper (adding the old tag in the icon) and will hide it from the ribbon and search too.

You can see it in action here:

This will only take care of flagging them as old, but not auto-upgrade them.

In order to do so, unfortunately for now it is a manual process (though, I’d be happy to hear ideas on this).

To add auto-upgrade functionality:

You must create a new class that implements IGH_UpgradeObject in the Grasshopper Connector for each of the constructors you add the SchemaDeprecated attribute.

It’s basically a class that tells Grasshopper which components are the “upgraded” version of another one, and allow you to re-adjust the input/outputs. For example, if an input changes from object to List<object>, you’ll have to update the access in the corresponding parameter.

This operations is quite delicate and needs to be done right on the first try, or it can corrupt your GH file, which is why it was left as a manual process.

Wrapping it up

So, in essence, every time you want to modify the constructor of a Schema class; instead of modifying the existing constructor, i’d suggest:

  • Flagging the constructor with SchemaDeprecated attribute, and update it’s implementation to work with the new changes (for backward compatibility)
  • Adding a new constructor with the necessary parameters and copy over the SchemaInfo attribute (updating any descriptions if needed)
  • Creating a class that implements IGH_UpgradeObject and update any changes in inputs or outputs.

I’m thinking this may need to go into our dev docs!

You can see some of our IGH_UpgradeObject implementations here:

1 Like