Detecting solid face highlight in Python script

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
steve.white
Posts: 15
Joined: Tue May 06, 2014 3:58 pm

Detecting solid face highlight in Python script

Post by steve.white »

I wish create a special file related to a set of triangular faces. I also wish to add additional information about the faces to indicate which is the outfacing side. (This is for an electromagnetic solving problem, which will define which permittivity sits which side of a face. I already have the solving software, but wish to enter data through FreeCAD.)

When I highlight the face in the GUI I see no change in the message console, but presumably something exists internally so the user can find which face is highlighted. I could then create the special file needed by the solver.

Where should I look for this information?

Thanks in advance for any help in this issue.
Steve
steve.white
Posts: 15
Joined: Tue May 06, 2014 3:58 pm

Re: Detecting solid face highlight in Python script

Post by steve.white »

To add to my question:

I notice in the status bar that when I highlight a face its identity does appear in the status bar
e.g. Unnamed.Shape.Face6.

How do I access this mouse clicked information in script?
steve.white
Posts: 15
Joined: Tue May 06, 2014 3:58 pm

Re: Detecting solid face highlight in Python script

Post by steve.white »

To further add to my question:

I think I found a clue in the Code Snippets part of the wiki
http://www.freecadweb.org/wiki/index.ph ... via_Python

Next is how to use the event to find the highlighted face...?
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Detecting solid face highlight in Python script

Post by ickby »

best is to use the selection mechanism:

Code: Select all

>>> Gui.Selection.getSelection()  #selected object only
[<Part::PartFeature>]
>>> Gui.Selection.getSelectionEx()  #selected object plus child shape which is select
[<SelectionObject>]
Post Reply