I am posting this again because I did not get a reply on my previous post almost a month back. I am really trying to fix this issue for our web app and the speckle functionality has been totally unusable without this fix.
I am trying to automate Rhino conversion to Revit through compute using a grasshopper script but the output geometry is in mm and not in metres as I require for Revit. Commit
I have tried putting a python script in my gh script to create a headless doc with meters as default units but it doesnt work.
Hey @Rivindu_Bandara sorry we missed you other post!
I’m not sure I understand how you’ve set up things, but have you tried changing units in your grasshopper/rhino environment?
So this is a grasshopper script running on rhino compute. It pushes some geometry to a speckle stream. I have created a python component that has a headless doc and set the units to meters. But the output geometry is still in millimetres. You can see from the link to this commit for example. Speckle
I think that Speckle might not be able to properly get units form the document when inside Rhino Compute… Adding @AlanRynne who might have some more ideas.
One thing to note is that when planning to override the ActiveDoc, you must ensure this is done before any other components run in your solution. In my file I just ensured this happened by connecting it to one of the inputs and passing the input data through.
This ensures that this component is a dependency of everything else, which automatically ensures every following component uses the right doc.
If you override your ActiveDoc in a component with no inputs/outputs (disconnected from everything), Grasshopper will choose the order it solves the components. I’ve heard you can influence this by sending the component to be drawn in the back, but I haven’t personally tested it. I wouldn’t recommend the “draw to back” approach as it is not obvious to other users editing your script.
You can find the files here. Do let us know if the issue persists in your setup, we’d be happy to look into this further. If this is the case, could you also provide us with a sample script we could use to reproduce the issue?
Thanks for the reply. I’m still having trouble trying to get this to work. The arrange function doesn’t really seem to work. I moved the python script to the back but it didn’t work. Now I used your C# function and it doesn’t seem to change the units, it also somehow duplicated each of the commits for some odd reason too.
In order to guarantee you are in fact running the script before any other speckle node is run, you need to connect the output of that script to the input of whatever is next.
In your screenshot, you are not connecting the c# script to anything, and hence letting Grasshopper figure out when would it solve it. Since It has no dependent nodes, my educated guess would be that this is running last.
Grasshopper will solve the graph in mysterious ways, I’ve heard the send to back trick would work, but I personally don’t use it as it feels wrong…
Could you connect the B output of the script to the displayMesh input of the RevitTopography node? Does this fix the issue?