Highlight points/edges/faces over a mesh? (C++ SDK)


#1

Hi,

I’d want to dynamically highlight (i.e. draw with other color/shading) a point/edge/face of a custom mesh when dragging the mouse over it, to later apply a transform. The selection boils down to points (i.e. selecting an edge will select 2 points and a face will select 4 points). What’s an easy, simple way to do it?

Many thanks,
Pablo


(Dale Fugier) #2

Rhino does not have native mouse-over highlight. So doing something like this will be hard, I guess…


#3

Hi Dale,

It shouldn’t be that hard. Actually you have something very similar in your cmdSampleGumball, using CRhinoGetXform and CRhinoPickContext, giving this:

Now I’m struggling with this:

  • In your sample, you run the command
    -> click-select your object
    -> enter key (highlight appears)
    -> transform gumball
    -> enter key
    -> done

  • In my case, I’d want to run the command
    -> click-select the object (highlight appears with mouseover)
    -> transform gumball
    -> done

Basically, the enter steps are removed to make a faster workflow. But doing this proves to be hard. I’d thank you a lot for any hint!

Pablo


#4

Hi there,

I would like to implement something similar for my plugin. Could you give me some hints or advice how to proceed?


(Dale Fugier) #5

Hi Susanne,

What is it that you are trying to do and why?

Thanks,

– Dale


#6

Hi Dale,

I am developing a plugin to create my own custom meshes that I can modify with a set of UI commands (e.g., splitting, merging).
This work is part of a side project I am working on at a small manufacturing firm.

I have been dealing with custom grips for a while and I found the following difficulties:

  • I cannot highlight elements (e.g., points, edges) when hovering with the mouse (I don’t know how to access the context picker in order to do this).
  • I cannot have occlusion of elements (e.g., if I drag a selection box over a mesh, the grips of the back are also selected, which I don’t want).

I have familiarity with T-splines, where these features are given. I was wondering, how difficult could it be to implement them in my own plugin? Up to now, I have been working from your custom grips samples + display conduit elements within Rhino utility commands, but I don’t know how to go further than that.

Thank you,

Susanne


(Dale Fugier) #7

Hi @Susanne,

Thanks for the additional details.

I cannot highlight elements (e.g., points, edges) when hovering with the mouse…

As I mentioned previously, Rhino does not have native mouse-over highlighting. Thus anything you do will be custom. Without giving this much thought, you’ll probably need a derived CRhinoGetPoint object and perhaps a custom conduit as well.

For example, the ExtractSubCrv kinda has mouse over highlighting. This is done by using a CRhinoGetPoint object that is constrained to a curve. In the OnMouseMove override, the closest segment to the active mouse location is detected and the segment is highlighted.

This kind of approach might work, depending on what you want to light up when you move the mouse.

I cannot have occlusion of elements…

Rhino will pick what it can see. Thus, if you are working in wireframe, then yes you can end up picking more mesh vertices than you want (by window selecting).

Custom objects, however, can provide their own picking code by overriding CRhinoObject::Pick. Picking code can be complicated, so you will want to leverage the base class if you can.

I was wondering, how difficult could it be to implement them in my own plugin?

Unfortunately I am not familiar enough with T-Splines to be respond to this. I do know it is written in C++, which (hopefully) is encouraging to you.

– Dale


#8

Hi Dale,

Thank you for your detailed answer, now I can move forward with my project. I was familiar with the GetPoint class, but did not know about its Constrain method. It would be indeed great if I could constrain a selection to my own custom objects (like a special type of mesh).
I will get back to you with further requests.

Susanne