iLogic supress all constraints

iLogic supress all constraints

Ezekiel12
Collaborator Collaborator
1,198 Views
6 Replies
Message 1 of 7

iLogic supress all constraints

Ezekiel12
Collaborator
Collaborator

Hi,

can someone point me in right direction? Suppress specific constraint relationship in assembly is easy. But how should i proceed if I need to suppress them all?

 

Thx,

Matt

0 Likes
Accepted solutions (1)
1,199 Views
6 Replies
Replies (6)
Message 2 of 7

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi Ezekiel12,

 

This should do it:

 

 

Dim oAssDoc As AssemblyDocument
oAssDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAssDoc.ComponentDefinition.Constraints
	oConstraint.Suppressed = True
Next 

 

And this to turn them all back on:

 

Dim oAssDoc As AssemblyDocument
oAssDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAssDoc.ComponentDefinition.Constraints
	oConstraint.Suppressed = False
Next 

 

 

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

EESignature

Message 3 of 7

Ezekiel12
Collaborator
Collaborator

Thank you very much, thats exactly it 🙂

0 Likes
Message 4 of 7

Anonymous
Not applicable

Could you suppress and ground all parts using this method? Then also unground and unsuppress all constraints?

0 Likes
Message 5 of 7

RoyWickrama_RWEI
Advisor
Advisor

Hi Curtise;

I would like to see the the constraint (say XXX) in the browser. Could you help. Thanks.

 

 

Dim oAssDoc As AssemblyDocument
oAssDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAssDoc.ComponentDefinition.Constraints
'	oConstraint.Suppressed = True
MessageBox.Show("Constraint: " & oConstraint.name, "Title")
oConstraint_Name = "XXX"

'Find constraint XXX in browser Next

 

0 Likes
Message 6 of 7

R.Mabery
Advocate
Advocate

To ground all components, you could add something similar to below (assuming the oAssDoc declaration from Curtis' code is already there):

 

    ' Iterate through all of the occurrences and ground them.
    Dim oOccurrence As ComponentOccurrence
    For Each oOccurrence In oAssDoc.ComponentDefinition.Occurrences
      oOccurrence.Grounded = True
    Next

Set the Grounded property to False to unground them.

 


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
0 Likes
Message 7 of 7

R.Mabery
Advocate
Advocate

Hi rwickrama,

 

I don't know of a way to select the browser node for the constraint, but you can search for it with something like this:

 

Dim oAssDoc As AssemblyDocument
oAssDoc = ThisApplication.ActiveDocument
Dim oConstraint As AssemblyConstraint
Dim oPane as BrowserPane
oPane = oAssDoc.BrowserPanes("AmBrowserArrangement")
Dim oSearchBox as SearchBox
oSearchBox = oPane.SearchBox
oSearchBox.Enabled = True
oSearchBox.Visible = True

For Each oConstraint In oAssDoc.ComponentDefinition.Constraints
	' Find constraint XXX in browser
	sConName = oConstraint.Name
	MessageBox.Show("Constraint: " & sConName, "Title")
	Call oSearchBox.Search(sConName)	
Next 

Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies