I’m trying to create a simple python component that imports geometry from Rhino files into a grasshopper. The component works when I am in Procedural Script Mode, however it breaks under certain conditions now that I am converting it to SDK mode.
In SDK mode the component works as long as I have opened up the script editor. If I have opened the script editor at least once, the code runs as expected.
If I open a new Rhino file, and try to run the component (without opening the script editor) I get a breakpoint error “Paths must have at least one element.”
I think there is a problem between importing geometry from external Rhino files into the current file and grabbing the imported objects to create a data tree. In my last post, Mr. Rutten suggested I use a callback with ScheduleSolution. But, I haven’t figured out how to use this correctly…
As a rough alternative, I used time.sleep() to see if waiting for the geometry to finish importing would fix the problem. It did not…
Here is some pseudo code to reference what I am doing:
delete_existing_geometry() #deletes geometry and layers from scene, returns None
import_Rhino_files() #imports geometry from Rhino files, returns None
#problem happens here.
rhino_geom_to_datatree() #constructs datatree from rhino geometry, returns (geometry_in_datatree, status_string)
return (geometry_in_datatree, status_string)
Does anyone know how to fix this problem?