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

How do delete the Angle Constraint of Selected Components in Assembly ILogic

Anonymous

How do delete the Angle Constraint of Selected Components in Assembly ILogic

Anonymous
Not applicable

Hi,
I want to delete the Angle Constraint of Components which are selecting by me.
I have tried below Loop code but it showing attached error. Can you please help me to find the error in this code.

Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Line1 :
comp = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kAssemblyOccurrenceFilter,
"Select a components")
AngleConstraint.Delete(comp)
GoTo Line1

Thanks & Regards,
Manoj Sampath

0 Likes
Reply
Accepted solutions (1)
464 Views
2 Replies
Replies (2)

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Anonymous,

 

Try below iLogic code

 

Dim oAsm As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Line1 :
comp = ThisApplication.CommandManager.Pick(
SelectionFilterEnum.kAssemblyOccurrenceFilter,
"Select a components")

Dim oConstraint As AssemblyConstraint
For Each oConstraint In comp.Constraints
    If oConstraint.Type = kAngleConstraintObject Then
         Call oConstraint.Delete()		 
    End If
Next

GoTo Line1

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes

Anonymous
Not applicable

@chandra.shekar.g 

Hi Sir,

I have done some update the Loop Code. Now I'm using below code and it is working fine.

 

Dim oAsm As AssemblyDocument
oAsm = ThisApplication.ActiveDocument

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAsm.ComponentDefinition

Line1 :

Dim oComp As ComponentOccurrence
oComp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Select a components")

If oComp Is Nothing Then
Exit Sub
End If

Dim oCons As AssemblyConstraint

For Each oCons In oComp.Constraints
If oCons.Type = Inventor.ObjectTypeEnum.kAngleConstraintObject Or oCons.Type = Inventor.ObjectTypeEnum.kAngleConstraintProxyObject Then
oCons.Delete
End If
Next

GoTo Line1

 

Thanks & Regards,

Manoj Sampath

0 Likes