How to highlight datum planes
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 554
- Joined: Sat Apr 07, 2012 2:42 am
How to highlight datum planes
Hi,
I implemented datum planes/lines/points but now I am at a loss on how to highlight them when they are pre-selected and selected?
Any hints?
Thanks,
Jan
I implemented datum planes/lines/points but now I am at a loss on how to highlight them when they are pre-selected and selected?
Any hints?
Thanks,
Jan
Re: How to highlight datum planes
Hello jan,
is your question regarding implementation of basic selection or how to show the selection in a comprehensible way? About the selection presentation you can look at my constraint selection implementation, it highlights the faces/edges/verteices used for the constraints and makes them visible through all parts. This makes it easy for the user to see what is selected even if it's deeply hidden inside the part, what would be the case for your planes too, I belive. I used the soannotation node for that. (But my implementation is rather hacky, not the best source for inspiration )
is your question regarding implementation of basic selection or how to show the selection in a comprehensible way? About the selection presentation you can look at my constraint selection implementation, it highlights the faces/edges/verteices used for the constraints and makes them visible through all parts. This makes it easy for the user to see what is selected even if it's deeply hidden inside the part, what would be the case for your planes too, I belive. I used the soannotation node for that. (But my implementation is rather hacky, not the best source for inspiration )
Re: How to highlight datum planes
I'm also interested in that (show the selection).. Can you point to an example code ickby?
Re: How to highlight datum planes
As I said, It's not the cleanest implementation I abused the ViewProviderPart to create the coin nodes for the selected shape and just reorderd it's main node beneath a SoAnnotation node. This can be seen here: https://github.com/ickby/FreeCAD_constr ... traint.cpp
The node renders every node it owns on top of everything else in the scene, and if you make everything added to annotation a bit transparent it looks like it's shining through. Can't post a picture now, my freecad crashes
The node renders every node it owns on top of everything else in the scene, and if you make everything added to annotation a bit transparent it looks like it's shining through. Can't post a picture now, my freecad crashes
Re: How to highlight datum planes
Hm interesting... I should try something like that for the Draft dimensions (currently selectable but not highlighted). Anyway, this is a good trick indeed... Thanks! (half-transparent "glowing" stuff seems cool, I'll try that too)
-
- Posts: 554
- Joined: Sat Apr 07, 2012 2:42 am
Re: How to highlight datum planes
When I hover the mouse over any solid geometry (e.g. face) it gets pre-selected and is visually highlighted. When I click on the face, it gets selected and highlighted in a different way.is your question regarding implementation of basic selection or how to show the selection in a comprehensible way?
With the datum planes which I implemented, they can be pre-selected and selected in the same way, but there is not visual feedback. Thats what I am trying to implement. The pre-selection and selection happens automatically (I didn't have to code it) but I must have missed a hook somewhere to make the visual feedback happen.
Re: How to highlight datum planes
I think I had the opposite problem when I implemented the ghost visualization of rejected pattern transformations.
As far as I remember I had to use SoIndexedFaceSet instead of SoBrepFaceSet. So you probably have to do the opposite.
As far as I remember I had to use SoIndexedFaceSet instead of SoBrepFaceSet. So you probably have to do the opposite.
-
- Posts: 554
- Joined: Sat Apr 07, 2012 2:42 am
Re: How to highlight datum planes
That didn't make any difference unfortunately. SoBrepFaceSet defines a highlightColor which is (0,0,0) by default but I can't see how to set it since the field is private in the classAs far as I remember I had to use SoIndexedFaceSet instead of SoBrepFaceSet. So you probably have to do the opposite.
Re: How to highlight datum planes
what do the following functions return on your viewprovider:
?
if you use the SoFCUnifiedSelection.h model you shouldn't have to specify any highlight color or anything. I am 99% sure that SoBrepFaceSet supports this model and it should work by default.
Code: Select all
useNewSelectionModel()
isSelectable()
if you use the SoFCUnifiedSelection.h model you shouldn't have to specify any highlight color or anything. I am 99% sure that SoBrepFaceSet supports this model and it should work by default.
-
- Posts: 554
- Joined: Sat Apr 07, 2012 2:42 am
Re: How to highlight datum planes
Both return true. I am deriving from ViewProviderGeometryObject.