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 »

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, 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
Get equivalent errors like:

Code: Select all

Traceback (most recent call last):
  File "/usr/share/freecad-daily/Mod/Fem/femguiobjects/FemSelectionWidgets.py", line 581, in addSelection
    self.parseSelectionFunction(self.added_obj)
  File "/usr/share/freecad-daily/Mod/Fem/femguiobjects/FemSelectionWidgets.py", line 471, in selectionParser
    elt = selection[0].Shape.getElement(selection[1])
<class 'SystemError'>: <built-in method getElement of Part.Compound object at 0x559434323fa8> returned NULL without setting an error
on
OS: Ubuntu 18.04.4 LTS (GNOME/gnome-xorg)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

BTW: for me it did also not work on 0.18.4

I tried also to use the FEM-clipping tools but get 'Face belongs to more than one solid' when I select a inner face which is the contact surface of two part of a boolean-fragments. See...
Screenshot from 2020-02-21 20-02-57.png
Screenshot from 2020-02-21 20-02-57.png (252.07 KiB) Viewed 688 times
Attachments
selectionTools_test_object.FCStd
The FCStd used for testing.
(24.52 KiB) Downloaded 40 times
magnetron224
Posts: 1
Joined: Mon May 24, 2021 5:03 pm

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

Post by magnetron224 »

Hello,

I had used this macro https://github.com/drhooves/SelectionTools in the past and it worked like a charm for me, but when I tried to use it just recently it didn't work at all with the windows 10, 64-bit OS, and v0.19 of FreeCAD. So, after spending hours unsuccessfully trying to get this macro to work with FC v0.19 I finally decided to stick with FC v0.17 which works very well with this macro. At least for the FEM workbench, the macro works beautifully and the FC v0.17 is very similar to the v0.19. One can also create their model from parts and meshes in v0.17 so they can take advantage of this tool and then continue their simulation in v0.19 or higher. I really hope this macro gets integrated into future versions of FC. Non of the solutions discussed in this forum worked for me including the selection view (with the 'picked object list' check box) or the clipping tool.

To get this macro (feature really) to work with windows, you have to do the following:
1. Go to https://github.com/drhooves/SelectionTools
2. click on code and download the zip file
downloadcode.PNG
downloadcode.PNG (34.38 KiB) Viewed 596 times
3. Go to the downloaded folder on your PC and 'extract all' to same directory
4. this creates a folder called 'SelectionTools-master', double click it and copy the folder inside it, called 'SelectionTools'
5. Now go to the folder location on your PC where you installed your FreeCAD v0.17 program. Usually this is the default location where all windows programs are installed. Mine was located at C:\Program Files\FreeCAD 0.17
6. locate the folder named 'Mod' and double click it
7. now paste the 'SelectionTools' folder here (the one you copied from step 4 above)
8. if you have FC v0.17 open, close it and re-launch the program

To check that this feature was added to FC correctly; launch FC v0.17 and go to Edit > Preferences, click on Display from the left menu and check that the 'Selection Tools' tab is added along with the other tabs '3D View' and 'Colors'. if so, then create a new document, switch to the Part workbench, go to Parts menu > primitives > cube. Now with the mouse cursor, hover over the cube in the graphical window and press the S key, then E key on your keyboard, you should see this menu:
cubeexample.PNG
cubeexample.PNG (13.76 KiB) Viewed 596 times
One little detail important to remember when using the macro to select the inner parts is that after pressing the S and E keys, you must select a 'Face' from the list that belongs to the inner 'solid' in order to pick it. if you highlight the Solid itself in the list, it won't work. In the example below you have to pick 'Face12' in order to select the smaller cube, which is solid2 in this example, but if I highlighted Solid2 nothing would happen.

to my knowledge, this macro is the only way thus far to complete this tutorial https://wiki.freecadweb.org/FEM_Shear_o ... site_Block

I hope this helps! sorry for the long post but I figured more details are always helpful when you're troubleshooting :)
SelectionTool.PNG
SelectionTool.PNG (25.47 KiB) Viewed 596 times
and just one final note, this macro also didn't work on either v0.18 or v0.16 of windows OS.
Post Reply