I’m trying to figure out how to run some code when an object is selected. I came across this old topic which I think just about answers it for me but need a bit of help. If I understand correctly, I’ll put the OnSelectObjects sub in my plugin class. But where to I put the following line?
I tried placing it in my OnLoad function as well as in a function in a command. I get an error saying it’s an event and can’t be called directly.
Protected Overrides Function OnLoad(ByRef errorMessage As String) As Rhino.PlugIns.LoadReturnCode
RhinoDoc.SelectObjects = (RhinoDoc.SelectObjects + OnSelectObjects())
End Function
Am I maybe not getting the right conversion from your c# to VB.net? Here was your c#:
RhinoDoc.SelectObjects += OnSelectObjects;
And here is the VB I’m trying:
RhinoDoc.SelectObjects = (RhinoDoc.SelectObjects + OnSelectObjects())
And I’m not quite sure what you mean by putting in a Plugin.OnLoad. Perhaps you could do a quick VB.net example for me please?