Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic to delete a particular constraint

Anonymous

iLogic to delete a particular constraint

Anonymous
Not applicable

Is there any syntax that uses iLogic to delete two particular constriants? I already looked through the threads and I see that its possible to fix constraints and delete certain types of constraints. Thanks

0 Likes
Reply
Accepted solutions (1)
1,180 Views
3 Replies
Replies (3)

ASchlaack
Collaborator
Collaborator
Would supressing the contrait work just as well? I could help you do that.
Thanks,
Aaron Schlaack
---------------------------------------------------------------------------------
Autodesk Inventor 2018
Dell Windows 8.1 64 bit Intel(R) Xeon(R) @ 3.50GHz 32GB Ram
0 Likes

Curtis_Waguespack
Consultant
Consultant
Accepted solution

 

Hi dtowngurl51,

 

Here is a quick iLogic example that deletes two assembly constraints by name.

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

' set a reference to the assembly component definintion.
Dim oAsmCompDef As AssemblyComponentDefinition 
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 

' Iterate through all of the constraints in this assembly 
Dim oConstraint As AssemblyConstraint 
For Each oConstraint In oAsmCompDef.Constraints 
If oConstraint.Name = "Mate:2" Then
oConstraint.Delete
ElseIf oConstraint.Name = "Insert:1" Then
oConstraint.Delete
Else
End If
Next

 

0 Likes

Anonymous
Not applicable

This works! Thank you so much! I have been trying to find code to do this for a few weeks now. I tried writing my own but it always returned an error. Thank you again!

0 Likes