I am working on a plug-in for Grasshopper that has a component that creates and interacts with a Rhino display conduit to display a textured mesh. It works great… almost too great… I can’t figure out how to shut it off automatically when the component is deleted or grasshopper is closed. I tried putting myConduit.Enabled=false in the visualization component’s destructor, but that code is not being executed when the component is deleted from Grasshopper.
How do I go about disabling or deleting the conduit when the owning grasshopper component disappears?
I’ll have experiment with DrawViewportMeshes as well to see if it gives me any additional functionality. e.g. disabling the mesh drawing when the component’s Preview is turned off.
DrawViewportMeshes works perfectly! I just took my old conduit code and put it into DrawViewportMeshes using the IGH_PreviewArgs parameter in place of the conduit’s DrawEventArgs parameter. Disabling on delete is automatic as well.