List Select Macro (Select hidden sub-objects)

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

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

Post by HoWil »

realthunder wrote: Thu Aug 22, 2019 11:11 am Yes, it's already in the upstream.
:D yippie :!:
bernd wrote: Ping
Hey Bernd, Is it possible to use it that way in FEM?
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

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

Post by HoWil »

realthunder wrote: Thu Aug 22, 2019 11:11 am Yes, it's already in the upstream.
I did test it with the 0.19_pre appimage and noticed that no solids are listed. Is it possible to add solids as well? A simple test-case is creating a cube and a sphere in Part-wb and applying 'Boolean Fragmenst'. After that there exists a third solid-domain between the cube and the sphere which is the target to select.
Thanks in advance,
BR,
HoWil
Attachments
Screenshot from 2019-08-23 13-36-31.png
Screenshot from 2019-08-23 13-36-31.png (268.22 KiB) Viewed 1720 times
BooleanFragments_of_cube_and_sphere.FCStd
sample file for selection
(11.31 KiB) Downloaded 60 times
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

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

Post by realthunder »

HoWil wrote: Fri Aug 23, 2019 11:37 am I did test it with the 0.19_pre appimage and noticed that no solids are listed. Is it possible to add solids as well? A simple test-case is creating a cube and a sphere in Part-wb and applying 'Boolean Fragmenst'. After that there exists a third solid-domain between the cube and the sphere which is the target to select.
That's a very useful feature that is lacking in the current selection framework. I actually thought about this in the past too. Not easy to add. Let me think about it.
Try Assembly3 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
tthomas20
Posts: 10
Joined: Thu Jan 16, 2020 1:16 pm

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

Post by tthomas20 »

I have updated the code for this macro and it is working in 0.18.4, but when I am in FEM it will not let me select the inner object. I have been trying to follow the tutorial

https://www.freecadweb.org/wiki/FEM_She ... site_Block

and I am stuck on selecting the second object for the second mesh region.

The report view gives me
Traceback (most recent call last):
File "C:\Users\tthomas\AppData\Local\FreeCAD 0.18\Mod\Fem\femguiobjects\FemSelectionWidgets.py", line 496, in addSelection
self.parseSelectionFunction(self.added_obj)
File "C:\Users\tthomas\AppData\Local\FreeCAD 0.18\Mod\Fem\femguiobjects\FemSelectionWidgets.py", line 411, in selectionParser
elt = selection[0].Shape.getElement(selection[1])
<class 'SystemError'>: <built-in method getElement of Part.CompSolid object at 0x000001CACF71DD58> returned NULL without setting an error
I am not quite sure what to do at this point and any help would be appriciated
Attachments
FEM Of 2 Materials Tutorial.FCStd
(12.9 KiB) Downloaded 40 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

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

Post by HoWil »

tthomas20 wrote: Tue Jan 28, 2020 8:21 pm I have updated the code for this macro and it is working in 0.18.4
Hi tthomas20,
Can you please share your code. This will make it easier for others to review it and give maybe necessary feedback.
BR
tthomas20
Posts: 10
Joined: Thu Jan 16, 2020 1:16 pm

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

Post by tthomas20 »

Sure. This should be the most up to date version on GitHub.
Attachments
SelectionTools_rc.py
(21.89 KiB) Downloaded 72 times
ListSelect.py
(6.21 KiB) Downloaded 69 times
User avatar
HarryvL
Veteran
Posts: 1283
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

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

Post by HarryvL »

Does anybody have (positive) experience with installing the tool under Windows? I put it in a directory .../Src/Mod/SelectionTool but don't know how to get FC to recognise it. It doesn't show up in menu item Edit > Preference > Display as I automatically got under Ubuntu

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19409 (Git)
Build type: Release
Branch: master
Hash: 94280f15cafbabb4af601d78e435f021b261c3d0
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Denmark (en_DK)
alexu
Posts: 30
Joined: Tue Nov 26, 2019 2:14 pm

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

Post by alexu »

HarryvL wrote: Thu Feb 13, 2020 12:15 pm Does anybody have (positive) experience with installing the tool under Windows? I put it in a directory .../Src/Mod/SelectionTool but don't know how to get FC to recognise it.
Under Windows, Macros and Workbenches are normally located in:
C:\Users\<$YOUR_USER_NAME>\AppData\Roaming\FreeCAD

Add to Macros or Mod directory as appropriate.
tthomas20
Posts: 10
Joined: Thu Jan 16, 2020 1:16 pm

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

Post by tthomas20 »

HarryvL wrote: Thu Feb 13, 2020 12:15 pm Does anybody have (positive) experience with installing the tool under Windows? I put it in a directory .../Src/Mod/SelectionTool but don't know how to get FC to recognise it. It doesn't show up in menu item Edit > Preference > Display as I automatically got under Ubuntu
It worked for me on Windows with FC 0.18.4. I didn't put it in …/src/Mod, nor did I put it in the Macro directory.

I added it to...AppData\Local\FreeCAD 0.18\Mod\SelectionTools. After restarting FC it showed up in my preferences.

The only issue I am having now is the one mentioned above where it will not let me select internal objects in the FEM workbench such as to assign a material
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

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

Post by HoWil »

tthomas20 wrote: Thu Feb 13, 2020 6:29 pm
Hi tthomas20
Only to be sure, is this your repo? https://github.com/tomate44/SelectionTools
Post Reply