Preview or 'Unselectable' Geometry


(Luis Fraguada) #1

Hi! Looking for a way to generate preview geometry, or geometry that is not directly editable/selectable. This geometry should be able to have object colors and such, so just locking it it is not sufficient for my purposes as it turns it all grey. I have created a plugin from the example Dale posted dealing with a ui panel: https://github.com/dalefugier/SampleCsPanel
In the panel I have some controls, buttons, checkboxes, etc. Lets say that I would like to toggle the visibility of the object with a checkbox. If the checkbox is checked, show the object. Currently I lock the object as I do not want the user to mess with it. Still, in this situation I have a few setbacks:

  • User can just unlock the item
  • The geometry is grey like all locked objects in the default rhino install

Would I need to create my own object class and override some attributes in order to create an un selectable object?

Thanks!
Luis


Generating custom thumbnails
(Menno Deij - van Rijswijk) #2

Have you considered using a DisplayConduit to “overlay” the unselectable geometry? We use this all the time in e.g. commands to show the user a preview of the command result.

The display conduit allows you to draw geometry in any color, line thickness, line pattern, etc.

When the user clicks a button, the previewed geometry can be placed in the document. This can even be done outside of a command, but the you have to take care to support undo using a custom undo action. Alternatively, the button can trigger a command that gets the latest preview geometry and adds it to the document. This will give you undo automatically.

See also http://wiki.mcneel.com/developer/rhinocommonsamples/displayconduit


(Luis Fraguada) #3

@menno I think this is just the path I was looking for! I had explored this before, but never had a good use case. time to take it for a ride. Thx.


(Menno Deij - van Rijswijk) #4

This is the code we use for preview display conduit (remove .txt extension of course)

PreviewDisplayConduit.cs.txt (17.3 KB)


(Luis Fraguada) #5

That is incredibly helpful! I have already been playing around with the DisplayConduit and all of the things I imagined I wanted to do with this can be done. Very cool! Thanks again.