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?
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