Hi fellow Rhino users and Developers,
trying to automate a boring task I have found what I believe is a bug in rhino.
The following script starts Grasshopper, loads a script and bakes an object. That all works per se. Object is baked and I can interact with it inside rhino. Commenting out the layout part of the script shows this.
The second part of the script adds a new layout and adds a detail to the layout. Executed by itself - skipping the GH part of the script - it works fine - layout is created, detail added.
Executing them after each other however (as in the script below) crashes Rhino on the line where it should add the detail. I tried switching away from the Layout back to a viewport but that did not help…
import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc
# GRASSHOPPER PART
objPlugin = rs.GetPlugInObject("Grasshopper")
if objPlugin is None:
print("Error")
if objPlugin is not None:
#objPlugin.LoadEditor()
objPlugin.ShowEditor()
doc = objPlugin.OpenDocument("E:\\test.ghx")
if doc is False:
print("Error loading doc")
objPlugin.RunSolver(True)
objs = []
objs = objPlugin.BakeDataInObject("e9eb1dcf-92f6-4d4d-84ae-96222d60f56b")
# LAYOUT PART
a4_height = 297
a4_width = 210
lay = rs.AddLayout("Teste",(a4_height,a4_width))
if not lay:
print("Error in creating layout")
# Tried switching away from the layout in order to prevent crash, failed.
rs.CurrentView("Top")
# Crashes on next line
sideview = rs.AddDetail(lay,(0,0),(a4_height,a4_width),"Side View",3)
test.ghx (69.7 KB)
BugReport_AddLayout.py (822 Bytes)
Does anyone have an idea what could provoke this? I have included an .GHX file that creates 10 cones called test.ghx, put it somewhere and change the path in the python script to reproduce. I think the GUID for the component to be baked should remain the same.
Rhino Version is 7 SR23 . It crashes without a “Report crash window”.
Any hints as to what I may do to resolve this issue (updating some obscure object table before adding detail or what not…) would be greatly appreciated!
Thank you very much and best regards
Malte
5 posts - 2 participants