Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - delete all erroneous iMates

2 REPLIES 2
Reply
Message 1 of 3
waynehelley
531 Views, 2 Replies

iLogic - delete all erroneous iMates

Hi there,

 

I have some code I use to delete all assembly constraint errors...

 

Dim oAssDoc As AssemblyDocument
oAssDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint


RUSure = MessageBox.Show _
("Are you sure you want to Delete all sick constraints?", _
"iLogic",MessageBoxButtons.YesNo)


If RUSure = vbNo Then
Return
Else
i = 0
For Each oConstraint In oAssDoc.ComponentDefinition.Constraints
If oConstraint.HealthStatus <> oConstraint.HealthStatus.kUpToDateHealth And _
oConstraint.HealthStatus <> oConstraint.HealthStatus.kSuppressedHealth Then
oConstraint.Delete
i = i + 1
End If
Next
End If
MessageBox.Show(" A total of "& i & " constraints were deleted.", "iLogic")

 

 

 

I would like it to make it work with iMates too!  Does anybody know if this is possible?

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Tags (2)
2 REPLIES 2
Message 2 of 3
Yadow
in reply to: waynehelley

I´m currently looking for this solution as well. Have you had any progress? 🙂
Message 3 of 3
waynehelley
in reply to: Yadow

I never found a solution at the time and I'm no longer at the company I was at so I don't actually have an example to test.  I have had a little look around in the API and something like this might work.

 

Dim iMate As iMateResult

For Each iMate In oAssDoc.ComponentDefinition.iMateResults

For Each oConstraint In iMate.Constraints

If oConstraint.HealthStatus <> oConstraint.HealthStatus.kUpToDateHealth And

oConstraint.HealthStatus <> oConstraint.HealthStatus.kSuppressedHealth Then

oConstraint.Delete()

End If

Next

Next

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report