Select face by expression

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
FredOP
Posts: 65
Joined: Sat Sep 26, 2020 1:25 pm

Select face by expression

Post by FredOP »

Is there a notion in FreeCAD of using some code to selection faces and edges, rather than by name ?
Coming from SideFX Houdini, I'm used to just throw some code in a point wrangle when I need a feature that doesn't exist, and I'm looking for something that feels that way in FreeCAD.
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Select face by expression

Post by chrisb »

You can throw in some Python code in the Python console.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
FredOP
Posts: 65
Joined: Sat Sep 26, 2020 1:25 pm

Re: Select face by expression

Post by FredOP »

chrisb wrote: Thu Oct 29, 2020 11:19 am You can throw in some Python code in the Python console.
But this would be executed just once ?
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Select face by expression

Post by openBrain »

Can you try to better explain what exactly you're trying to achieve? Ideally give an example.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Select face by expression

Post by jmaustpc »

FredOP wrote: Thu Oct 29, 2020 1:09 pm
chrisb wrote: Thu Oct 29, 2020 11:19 am You can throw in some Python code in the Python console.
But this would be executed just once ?
You can save any Python code as a macro, see the FreeCAD macro tool

Like openbrain said,explain what you mean. Your post doesn't make sense at least not to me.
FredOP
Posts: 65
Joined: Sat Sep 26, 2020 1:25 pm

Re: Select face by expression

Post by FredOP »

openBrain wrote: Thu Oct 29, 2020 1:11 pm Can you try to better explain what exactly you're trying to achieve? Ideally give an example.
Select the faces which normal is parallel to a given direction within a certain angular deviation.
Pad them.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Select face by expression

Post by openBrain »

FredOP wrote: Thu Oct 29, 2020 1:22 pm Select the faces which normal is parallel to a given direction within a certain angular deviation.
Pad them.
You can write a macro that will take as input a selected edge, compute all face normals, check which one are in a defined deviation tolerance, and extrude them. Just a bit of Python, maths and FC API. ;)
FredOP
Posts: 65
Joined: Sat Sep 26, 2020 1:25 pm

Re: Select face by expression

Post by FredOP »

openBrain wrote: Thu Oct 29, 2020 1:32 pm
FredOP wrote: Thu Oct 29, 2020 1:22 pm Select the faces which normal is parallel to a given direction within a certain angular deviation.
Pad them.
You can write a macro that will take as input a selected edge, compute all face normals, check which one are in a defined deviation tolerance, and extrude them. Just a bit of Python, maths and FC API. ;)
Can a macro be executed at a certain point in the workflow, like any other feature ?
chrisb
Veteran
Posts: 54201
Joined: Tue Mar 17, 2015 9:14 am

Re: Select face by expression

Post by chrisb »

FredOP wrote: Thu Oct 29, 2020 1:22 pm Select the faces which normal is parallel to a given direction within a certain angular deviation.
Pad them.
Your explanation is still rather short. Do you want to perform the select via code? And how is the direction given? And how do you provide the angular deviation?
Please note that we have absolutely no idea what you are modeling, what you want to have in the end, and I dare to say, most people here don't know SideFX Houdini. At least the name sounds like a magician's trick.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Select face by expression

Post by openBrain »

FredOP wrote: Thu Oct 29, 2020 1:43 pm Can a macro be executed at a certain point in the workflow, like any other feature ?
Sort of. You can create a so-called 'scripted object' that will appear in the tree as a feature and define a specific behavior.
In your case looks possible to have such an object with a property holding the edge defining the direction, and another one a list of child objects (and eventually another for deviation tolerance, another for extrude length,...) and implementing your wanted behavior.
Post Reply