Check face participation in constraint

Check face participation in constraint

fakeru
Advocate Advocate
498 Views
2 Replies
Message 1 of 3

Check face participation in constraint

fakeru
Advocate
Advocate

Hi all,

What would a good method to check if a given face (of occurrence) in assembly participates in a constraint?

 

Thanks

 

 

Autodesk Inventor 2015 Certified Professional
0 Likes
499 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

You can loop over all constraint and check if one of the used entities is the face. some thing like this iLogic rule:

Dim face As Object = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllEntitiesFilter, "Select face")

Dim doc As AssemblyDocument = ThisDoc.Document
For Each constraint As AssemblyConstraint In doc.ComponentDefinition.Constraints
    If ((constraint.EntityOne.Equals(face)) Or (constraint.EntityTwo.Equals(face))) Then
        MsgBox("This face is in a constraint: " + constraint.Name)
    End If
Next

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

fakeru
Advocate
Advocate

Thanks! I was kind of thinking about this. I didn't know the "Equals" can be used for that 🙂

I might also have to tweak the code so it looks into subassemblies constraints. Basically I need to check for constraints at any assembly level.

 

 

Autodesk Inventor 2015 Certified Professional
0 Likes