Running Speckle on Rhino Compute

@stevedowning I think the ball might be in Elefront’s court at this point to provide multiple ways to supply the appropriate document - as they are closed source.

2 Likes

Sadly, this may be the case. Although I would argue the ball is on McNeel :sweat_smile:

Assuming that ActiveDoc is always null forces every developer to come up with some sort of document creation strategy, which will clearly not be compatible with each other. Maybe this should be revised, or a new strategy to provide headlessDocs should be implemented.

This can still be solved on our side though

I can see a way for our “solution” to not interfere with the current workflow @stevedowning was describing:

  • We still create a “fallback” headless document on each solution (just in case, may be revised later)
  • On GetCurrentDocument, instead of checking if GH is running headless, we can just check if ActiveDoc is null instead. This will give preference to any user-overriden ActiveDoc before our own “fallback” doc. If no ActiveDoc is set, we use the fallback.

Does this sound reasonable to you @stevedowning? This seems like a very small change that could allow you to keep doing what you’re doing.

Would love to hear anyone’s thoughts on this too!

Thanks for all the feedback :raised_hands:t3: I would love to have Speckle+Rhino.Compute running as seamlessly as possible and this is super helpful.

3 Likes

Hi there!

Just bumping this thread to let you know that the changes required to override the ActiveDoc have been released in 2.12.

The default behaviour remains (i.e. we will create a headless doc as backup, and use it if no ActiveDoc is found).
But now, in addition to this, any override in the ActiveDoc will have priority over our default.

As discussed above, it is the GH user responsibility to make sure the active doc override is the first thing that get’s executed in the script, or at least, before any Speckle conversions happen (these nodes will have a message displaying the converter/kit they’re using: i.e. Using Objects Kit.

I’ll flag this as resolved but feel free to come back to us if there are any edge cases we did not cover yet.

6 Likes

Thanks so much @AlanRynne I think that’s a really solid foundation to work from - thanks so much for your hard work!

4 Likes

@AlanRynne one addendum to this conversation -

These comments should callout where the template is so they can be easily tracked down for update, and there should be a note in the comments indicating that it’s Speckle is updating the template, as it’s hard to tell from the log that it’s being triggered by Speckle!

1 Like

Hey there @chris.welch!

Good points! But the reason it doesn’t say “which template” we’re using is because were using the default document that is created by Rhino with RhinoDoc.CreateHeadless(null), and it is not stored anywhere, just kept in memory.

My initial idea was to allow to specify a template path but that had some issues I couldn’t work out.

I’d recommend if you want to make changes to the Doc we use, that you should override the ActiveDoc in a C#/python script that loads a headless document you want and assigns it to RhinoDoc.ActiveDoc. Since other plugins also rely upon ActiveDoc (elefront…), this may be the most consistent way of setting the doc for everyone in Rhino.Compute (although I’m sure McNeel peeps would have something to say about it :sweat_smile:).

We will respect any override of ActiveDoc so long as it’s done before our nodes run, if any of our nodes runs before that, it will use the default doc.

Hope this helps, but if this way causes some extra pain do let us know and we’d be happy to try and find a solution.

Cheers Alan, thank you! I’ll whip something up on the weekends and show you how I go!

2 Likes