I am developing a Rhinocommon plugin which adds a large number of custom objects to the Rhino document. Ideally I would like these objects to be selectable, but not modifiable. I could alternatively use a conduit for the display but then I don't get the befit of the rhino selection logic. So I guess my questions are:
- Is there are way to lock an object but still allow selection?
- Can the Rhino selection logic be extended to included object drawn using a conduit in some way?
- Is there a RhinoGet function which allows a set of objects to be temporarily added to the set, in a similar way to AddConstructionPoints for the GetPoint class
As far as I can see the answers to the above are no, no and no, but I thought it was still worthwhile asking.
UPDATE : Moved to SDK developers list
I am thinking about the exact same thing, ultimately to have something like a selectable preview that eventually can expose context menues on a per-object basis ..!
A basic yes / no / constraint / maybe in the future could help me a lot, deciding to go further with my own viewport development or using rhino..!
Sorry for the delay on this, I got quite a bit sidetracked with other stuff. It seems that selecting conduit geometry is not possible. The bottom line is that if you want to use rhino selection logic then it has to be in the Rhino object table. So one solution is to temporarily add the preview geometry as a concrete object in the Rhino workspace and then delete it when you are done with it. You can then bind to Rhino.RhinoDoc.SelectObjects to handle selection events and then cross reference the object Guid's for use in your context menus.
I have also been looking into writing my own pick selector with the aid of some the Rhino mesh intersection tools. Works well for me with a few hundred objects, but I don't know how well it would scale. Let me know if you are interested in this and I can send you a sample.
Hi Tom- please check in with the developers' forum, here:
I also would like the ability to lock an object but still allow it to be selected. I usually create template subobjects, refine them, annotate them, etc., then copy them to their place(s) on a composite object. Once a template subobject is complete, I would like to lock it so I can't accidentally modify it, but I still want to be able to select it so I can copy it.
The nearest I have got with this sort of thing is to override the classes in the
Geometry.Custom namespace. You can then block the pick event by overriding OnPick. This might then allow you do conditional selection if you were inside a custom Move command of some kind. However, the OnPick event appears to be bypassed when a window box selection is used, so you can't always block it. I guess in this case there is a bounding box check taking place, and so Rhino thinks OnPick doesn't need to be tested.
Alternatively you could watch the RhinoDoc.DeleteRhinoObject event and make sure that nothing happens to one of your objects that wasn't sanctioned by your plugin. I don't think you can block the delete, but you can always restore the correct geometry again afterwards when RhinoDoc.OnEndCommand is fired.