List Select Macro (Select hidden sub-objects)

Need help, or want to share a macro? Post here!
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

List Select Macro (Select hidden sub-objects)

Postby m42kus » Fri Jul 07, 2017 8:17 am

Hello,
I created a tool which helps selecting hidden or difficult to reach sub-objects (solids, faces, edges and vertexes). This is often required when using the FEM workbench. Atm it's a macro that must be assigned a shortcut. Otherwise there is no way to invoke it while hovering on a object in the 3D view.

Two things don't work right now: Highlighting of solids and edges. Highlighting of solids isn't supported by FreeCAD so there is no easy way to do that right now. Highlighting of edges is problematic from pure python. The way I do the highlighing is setting the highlightIndex directely via coin. This works for faces and vertexes but not for edges. For edges a SoHighlightAction would be required but that object isn't accessable in python. Anybody able to help me out here?

Here is a short demo:
phpBB [video]
Attachments
ListSelect.py
(5.95 KiB) Downloaded 155 times
My GSoC Devlog: ceeli.github.io/gsoc
realthunder
Posts: 1233
Joined: Tue Jan 03, 2017 10:55 am

Re: List Select Macro (Select hidden sub-objects)

Postby realthunder » Fri Jul 07, 2017 8:46 am

Your macro is nicely done. But as you've already pointed out, it has its limitation, and it is due to the current FC coin selection architecture.

You've probably missed my reply in your original post. Doing transparency while selecting/preselecting requires non-trivial changes to FC coin selection rendering mechanism. I've done it in my branch. But it may need some time to be able to merge into the master, due to its complexity. See here https://forum.freecadweb.org/viewtopic. ... 89#p175533
Try Assembly3 (latest version 0.10.2) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: List Select Macro (Select hidden sub-objects)

Postby m42kus » Fri Jul 07, 2017 11:22 am

realthunder wrote:
Fri Jul 07, 2017 8:46 am
Your macro is nicely done. But as you've already pointed out, it has its limitation, and it is due to the current FC coin selection architecture.
Thanks! Having transparency while selectin/preselection would be very nice indeed. The issue I'm having with pre-selecting nodes is caused by a different problem though. The problem is that I can't set the highlightIndex of SoBrepEdgeSet directely. SoBrepFaceSet and SoBrepPointSet support that. In SoBrepEdgeSet a action callback method must be called before the highlighter can render the highlight. This method is only called if the highlightIndex is set via the SoHighlightAction and not if the highlighIndex is set directely. This shoud be easy to fix I think, maybe I'll write a patch for it.
My GSoC Devlog: ceeli.github.io/gsoc
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: List Select Macro (Select hidden sub-objects)

Postby m42kus » Fri Jul 07, 2017 4:53 pm

For all that got a segfault, it should be fixed now. I created the addon for Qt5 by mistake, sry.
My GSoC Devlog: ceeli.github.io/gsoc
HoWil
Posts: 842
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: List Select Macro (Select hidden sub-objects)

Postby HoWil » Fri Jul 07, 2017 7:16 pm

Two points/questions:
* Is it possible to switch off pre-selection until e.g. a click? Even if the part is transparent, preselected faces (on top) hide the inner faces and make a allocation of smaller, inner features difficult.
* In my test case is the transparency of a part switched to 0% during the use of your menu. But in the shown video at 1:00min is the part switched to transparent. What do I do wrong?
HoWil
Posts: 842
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: List Select Macro (Select hidden sub-objects)

Postby HoWil » Fri Jul 07, 2017 7:44 pm

m42kus wrote:
Fri Jul 07, 2017 8:17 am
Two things don't work right now: Highlighting of solids ...
Is it possible to highlight a solid by highlighting all its faces?
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: List Select Macro (Select hidden sub-objects)

Postby m42kus » Sat Jul 08, 2017 6:54 am

HoWil wrote:
Fri Jul 07, 2017 7:16 pm
Two points/questions:
* Is it possible to switch off pre-selection until e.g. a click? Even if the part is transparent, preselected faces (on top) hide the inner faces and make a allocation of smaller, inner features difficult.
All slections and pre-selection should be cleared already upon invoking the selection process. Does it not work for you?
HoWil wrote:
Fri Jul 07, 2017 7:16 pm
* In my test case is the transparency of a part switched to 0% during the use of your menu. But in the shown video at 1:00min is the part switched to transparent. What do I do wrong?
The only thing I could think of is that you set the Preferences->Display->Selection Sools->List Select->Transparency setting to 0? This setting defines the value of transparency during selection.
HoWil wrote:
Fri Jul 07, 2017 7:44 pm
Is it possible to highlight a solid by highlighting all its faces?
Unfortunately not because it's only possible to highlight one sub object at a time. But a solid doesn't count as a sub object in the scene graph of coin.
My GSoC Devlog: ceeli.github.io/gsoc
HoWil
Posts: 842
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: List Select Macro (Select hidden sub-objects)

Postby HoWil » Sun Jul 09, 2017 6:39 pm

m42kus wrote:
Sat Jul 08, 2017 6:54 am
The only thing I could think of is that you set the Preferences->Display->Selection Sools->List Select->Transparency setting to 0? This setting defines the value of transparency during selection.
Tested this on two machines ... simply had to go into the described menu without changing a thing. And now it works!!
BR,
HoWil
HoWil
Posts: 842
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: List Select Macro (Select hidden sub-objects)

Postby HoWil » Sun Jul 09, 2017 7:00 pm

m42kus wrote:
Sat Jul 08, 2017 6:54 am
HoWil wrote:
Fri Jul 07, 2017 7:16 pm
Two points/questions:
* Is it possible to switch off pre-selection until e.g. a click? Even if the part is transparent, preselected faces (on top) hide the inner faces and make a allocation of smaller, inner features difficult.
All slections and pre-selection should be cleared already upon invoking the selection process. Does it not work for you?
Please see my screencast where I would like to select the rel. small inner spherical face. Even if the Body is transparent, when I move the cursor over the body preselection comes into play and hides the inner face making a localization of the small face difficult.
sreenfc_select.webm
Pre-selection hides inner faces.
(193.48 KiB) Downloaded 81 times
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: List Select Macro (Select hidden sub-objects)

Postby m42kus » Mon Jul 10, 2017 8:23 am

HoWil wrote:
Sun Jul 09, 2017 6:39 pm
Tested this on two machines ... simply had to go into the described menu without changing a thing. And now it works!!
BR,
HoWil
Hmmm doesn't happen on my machine... Could you please try it with a prestine configuration? Just move the config file temporarily:

Code: Select all

mv ~/.config/FreeCAD/FreeCAD.conf{,.backup}
My GSoC Devlog: ceeli.github.io/gsoc