-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we depend on "Element"s to track the ID of a face on geometry changes? #236
Comments
@realthunder Could you please take a look at this? Briefly, I'm asking how to add the face that an |
It is a bit complicated. So assuming the element = App.ActiveDocument.Element.Proxy
partGroup = element.getAssembly().getPartGroup()
subname = element.getElementSubname(True)
Gui.Selection.addSelection(partGroup, subname) There are two complications. 1) The returned subname is flattened, meaning that any plain group you created will not be in it. So tree view sync may not work. 2) The element you want may not in the current document. It may be external linked. Alternatively, you may want to try using two asm3 commands. You need to first select the element you want in the tree view, then run Gui.runCommand('Std_LinkSelectLinked',0) This is equivalent to click the Gui.runCommand('Std_LinkSelectLinked',1) |
The problem with The example for the element doc_name="driver_base"
elem_label="wall_unfold_face"
# ------------------------------------------------------------
Gui.ActiveDocument=Gui.getDocument(doc_name)
App.ActiveDocument=App.getDocument(doc_name)
App.setActiveDocument(App.ActiveDocument.Name) # Interesting. Why do we need to assign this manually?
doc=App.ActiveDocument
element = doc.getObjectsByLabel(elem_label)[0].Proxy
partGroup = element.getAssembly().getPartGroup()
subname = element.getElementSubname(True)
Gui.Selection.addSelection(partGroup, subname) Works pretty well for now. Thanks. |
Fully deterministic ID generation for
Face
s,Edge
s andVertex
es of an object is impossible and the enumeration starts from beginning after any geometry change.However, I noticed that the
Element
s does track itsLinked Object
as much as possible, which exactly fits my needs. Question 1/2: Can we depend on this behavior?Intention and problem
I'm trying to provide a solution to shaise/FreeCAD_SheetMetal#40, basically a script that will re-unfold a processed object after every geometry change by using a manually provided face ID, such as
Gui.Selection.addSelection('Unnamed','Cut','Face11')
.Even though we don't touch the geometry of the selected face with a careful development, ID's may change:
Possible approach
Element
for the faceLinkedObject
property to determine the ID of the previous face:Question 2/2: If it's a valid usage, how can I properly translate
';#11f;:T559:4:F.Face12'
to'Assembly','Parts.Cut.Face12'
?The text was updated successfully, but these errors were encountered: