Ticket #3932 - Selecting solids on interior of CompSolid

About the development of the FEM module/workbench.

Moderator: bernd

realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by realthunder »

HoWil wrote: Mon Jan 20, 2020 9:27 am Nice finding. But :D until now this does only work for faces, isn't it?

Can you please extend the selection dialogue for selecting solids.
It is certainly a very useful feature. Another good use case is for wire selection. But it is not easy to implement with the current 3D selection framework. I'll add this feature some day, but not soon. On the other hand, obtain solid from face is quite easy, assuming you have the whole shape of the object, and the face shape, the following code give you the solid. Note it return a list, because there maybe multiple ancestor shapes, e.g. an edge maybe in more than one wires.

Code: Select all

shape.ancestorOfType(face, Part.Solid)
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
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by HoWil »

realthunder wrote: Mon Jan 20, 2020 9:46 pm
Just for my above 'booleanFragments.fcstd' model:
The following code finds the inner solid of the boolean fragements from a face connecting the outer and the inner solid.

Code: Select all

doc = App.getDocument('booleanFragments')

bf = doc.getObjectsByLabel('BooleanFragments')[0]
f8 = bf.getSubObject('Face8')

f8.Area
shapes = shape.Shape.ancestorsOfType(f8, Part.Solid)

sh0 = shapes[0]  # the solid of the outer cube in the BooleanFragments
sh1 = shapes[1]  # the solid of the inner cube in the BooleanFragments
How do I now add SD h1 to the selection?
BR HoWil
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by realthunder »

HoWil wrote: Fri Jan 24, 2020 7:06 pm How do I now add SD h1 to the selection?
BR HoWil
Right, almost forgot that the whole purpose of CompSolid is for solids with shared faces. With the current selection framework this is going to be inefficient, especially for large model. Here is a little script for selection with visual feedback. Put the file in your Macro directory. Do normal face selection first, and then run

Code: Select all

import sel
sel.getElement()

The code is generalized to handle all combinations of parent child shapes. The other useful combination is to select wire by edge.

Code: Select all

sel.getElement('Wire','Edge')

Image
Attachments
sel.py
(6.97 KiB) Downloaded 91 times
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
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by HoWil »

realthunder wrote: Sat Jan 25, 2020 11:12 pm
This helps a lot!!! :!: We are almost there :D .
We can use your script for the selection of inner domains/solids for material or mesh definition.
bernd wrote: ping
As you can see in the attached video the selection of inner domains does not work properly in ?FEM?. I can select with the help of realthunders script solid1 (the outer solid of the boolean fragments) but not solid2 (the inner solid of bf). Is there any exclusion in your material-solids dialogue for solids with name> solid1 like solid2, solid3 and so on?
Thanks in advance,
BR,
HoWil
Peek 2020-01-26 19-59.webm
Screencast of the selection of solid1 and solid2 in FEM Material.
(845.93 KiB) Downloaded 79 times
The code used with the following script/macro from realthunder:

Code: Select all

import sel_RealThunder_Selection_Macro
Gui.Selection.addSelection('booleanFragments','BooleanFragments','Face8',8.88178e-16,7.00988,0.858056)
sel_RealThunder_Selection_Macro.getElement()
Attachments
sel_RealThunder_Selection_Macro.py
(6.97 KiB) Downloaded 85 times
booleanFragments.FCStd
(9.67 KiB) Downloaded 70 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by HoWil »

bernd wrote: ping
What do you think is it ready a issue with your domain/selection tool?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by bernd »

OK I see the problem and I have found the problem with the macro. A fast fix is not possible ...

I will have a look. For reference the file I have tested with. attached. A innner solid inside a inner solid is still missing in the example ...



booleanFragments2.FCStd
(23.94 KiB) Downloaded 71 times
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by HoWil »

bernd wrote: Thu Mar 26, 2020 2:12 pm A innner solid inside a inner solid is still missing in the example ...
So, whom can we ask for help? Realthunder should be able to solve this? Or do we nee Werner?
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by realthunder »

HoWil wrote: Tue May 26, 2020 7:49 pm
bernd wrote: Thu Mar 26, 2020 2:12 pm A innner solid inside a inner solid is still missing in the example ...
So, whom can we ask for help? Realthunder should be able to solve this? Or do we nee Werner?
I have already implemented this. The core will have support of selecting all types of high level geometries.
compsolid-pick.gif
compsolid-pick.gif (218.9 KiB) Viewed 2113 times
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
HoWil
Veteran
Posts: 1279
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by HoWil »

Wow.
Is this in your ASM3 app-image or already in master?
I am eager to test this. :)
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Ticket #3932 - Selecting solids on interior of CompSolid

Post by realthunder »

HoWil wrote: Wed May 27, 2020 5:17 am Wow.
Is this in your ASM3 app-image or already in master?
I am eager to test this. :)
In my image only for now. Most likely too late for 0.19.
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
Post Reply