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: 

API code to Suppress Assembly constraints

1 REPLY 1
SOLVED
Reply
Message 1 of 2
luismestre
545 Views, 1 Reply

API code to Suppress Assembly constraints

Hi

 

I'm looking for API code to suppress and unsupress some constraints within an assembly.

 

Manly:

 

1- Access the constraints by name ( Assembly constraints have a parameter name)

2- Suppress the constraints and unsuppress

 

I want to allocate a form with 2 command buttons one for  suppress and another one for Unsupress.

 

i.e : oConstraint.Suppressed = False  ( how do I access the constraint name ?)

  oConstraint.Suppressed = True

 

 

Thanks in advance

Luis

 

 

 

 

 

Luis Mestre
Oil&Gas Sr.3D & Subsea/Structural Designer
"Autodesk Autocad/Inventor & 3D Studio Max"
Email:lmsmestre@gmail.com
1 REPLY 1
Message 2 of 2
luismestre
in reply to: luismestre

I think I'm not far to have the code.

I'm having problems with the last part , ... accessing the constraint.

 

Any help would be very appreciated.Smiley Happy

 

 

 

my code:

 

Private Sub CommandButton1_Click()

 

' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

 

' Get the assembly component definition.
Dim oAsmDef As AssemblyComponentDefinition
Set oAsmDef = oAsmDoc.ComponentDefinition

 

Dim oConstraints As AssemblyConstraints
Set oConstraints = oAsmDef.Constraints

 

Dim oCons As AssemblyConstraint
Set oCons = oConstraints(Angle)


' get component occurrence.
Dim oOcc As ComponentOccurrence
Dim obj As AngleConstraint

For Each obj In oCons
oOcc = obj
oOcc.Constraints.Item(1).Suppressed = True

Next

End Sub

Luis Mestre
Oil&Gas Sr.3D & Subsea/Structural Designer
"Autodesk Autocad/Inventor & 3D Studio Max"
Email:lmsmestre@gmail.com

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

Post to forums  

Autodesk Design & Make Report