I need a rule to have it auto update/ rerun all constraits, is there a rule that can be written for that? If so what is it?
Thanks,
Solved! Go to Solution.
I need a rule to have it auto update/ rerun all constraits, is there a rule that can be written for that? If so what is it?
Thanks,
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi Aschlaack,
Here is the code:
Constraint.IsActive("Name of Mate") = True : To turn the Mate On
Constraint.IsActive("Name of Mate") = False : To turn the Mate Off
You might be able to loop the Routine to turn on all mates if they all have Similar Stabilized names.
(example: Mate_1, Mate_2, Mate_3, etc don't leave them the way they are if you reuse the assembly it will regenerate the Mates and they will no longer be correct in the code that why we stabilize them)
I don't have any code for looping... so hopefully someone sees this post and can help you out further.
I hope this helps,
James
Hi Aschlaack,
Here is the code:
Constraint.IsActive("Name of Mate") = True : To turn the Mate On
Constraint.IsActive("Name of Mate") = False : To turn the Mate Off
You might be able to loop the Routine to turn on all mates if they all have Similar Stabilized names.
(example: Mate_1, Mate_2, Mate_3, etc don't leave them the way they are if you reuse the assembly it will regenerate the Mates and they will no longer be correct in the code that why we stabilize them)
I don't have any code for looping... so hopefully someone sees this post and can help you out further.
I hope this helps,
James
Thanks James but that's not quite what I needed..
To be a little more exact about what I need:
I have over 500 constraits so I more of need a way to just have them all be updated at once. I'm doing a lot with iRules and iParts/iAssembolies and when I change them too drastically it doesn't always want to have all the constrants be correct anymore. Normally how I go about fixing them is to set it to a different iAssemboly value and that causes everything to reload and that constrant suddenly kicks in and works correctly.
Thanks James but that's not quite what I needed..
To be a little more exact about what I need:
I have over 500 constraits so I more of need a way to just have them all be updated at once. I'm doing a lot with iRules and iParts/iAssembolies and when I change them too drastically it doesn't always want to have all the constrants be correct anymore. Normally how I go about fixing them is to set it to a different iAssemboly value and that causes everything to reload and that constrant suddenly kicks in and works correctly.
Hi ASchlaack,
Building on what jalger suggested, here is a rule that will toggle the suppression of each assembly component in the assembly. Note that the rule currently sets the Master level of detail active before looking at the constraints, but that might not be needed for your situaton, and could be removed.
' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'set the Master LOD active
Dim oLODRep As LevelofDetailRepresentation
oLODRep = oAsmCompDef.RepresentationsManager. _
LevelOfDetailRepresentations.Item("Master")
oLODRep.Activate
' Iterate through all of the constraints in this assembly twice
i = 0
Do Until i = 2
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAsmCompDef.Constraints
‘toggle constrain supression
If oConstraint.Suppressed = False Then
oConstraint.Suppressed = True
Else
oConstraint.Suppressed = False
End If
Next
i = i + 1
‘rebuild all
InventorVb.DocumentUpdate()
‘ adds a small delay here
PauseTime = 0.2 'seconds
Start = Timer
Do While Timer < Start + PauseTime
ThisApplication.UserInterfaceManager.DoEvents
'present a status bar message
ThisApplication.StatusBarText = "File is updating...."
Loop
Loop
'set status bar message
ThisApplication.StatusBarText = “Rule Complete!”
Note though that you might only need this one line. You might try it to see if will do what you're aftar.
‘rebuild all InventorVb.DocumentUpdate()
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi ASchlaack,
Building on what jalger suggested, here is a rule that will toggle the suppression of each assembly component in the assembly. Note that the rule currently sets the Master level of detail active before looking at the constraints, but that might not be needed for your situaton, and could be removed.
' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'set the Master LOD active
Dim oLODRep As LevelofDetailRepresentation
oLODRep = oAsmCompDef.RepresentationsManager. _
LevelOfDetailRepresentations.Item("Master")
oLODRep.Activate
' Iterate through all of the constraints in this assembly twice
i = 0
Do Until i = 2
Dim oConstraint As AssemblyConstraint
For Each oConstraint In oAsmCompDef.Constraints
‘toggle constrain supression
If oConstraint.Suppressed = False Then
oConstraint.Suppressed = True
Else
oConstraint.Suppressed = False
End If
Next
i = i + 1
‘rebuild all
InventorVb.DocumentUpdate()
‘ adds a small delay here
PauseTime = 0.2 'seconds
Start = Timer
Do While Timer < Start + PauseTime
ThisApplication.UserInterfaceManager.DoEvents
'present a status bar message
ThisApplication.StatusBarText = "File is updating...."
Loop
Loop
'set status bar message
ThisApplication.StatusBarText = “Rule Complete!”
Note though that you might only need this one line. You might try it to see if will do what you're aftar.
‘rebuild all InventorVb.DocumentUpdate()
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
In my case I'm working in LevelofDetail1, what needs to be changed? And once that's changed I can just paste that into a rule and It's good to go correct?
In my case I'm working in LevelofDetail1, what needs to be changed? And once that's changed I can just paste that into a rule and It's good to go correct?
@ASchlaack wrote:
In my case I'm working in LevelofDetail1, what needs to be changed? And once that's changed I can just paste that into a rule and It's good to go correct?
Hi ASchlaack,
Here is the rule with the LOD stuff removed. It ran it real quick and it didn't seem to cause me any issues. And yes, you can just paste this in to a new iLogic rule and run it.
Also, not that I edited my last post to suggest a possible single line solution using: InventorVb.DocumentUpdate()
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. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Iterate through all of the constraints in this assembly twice i = 0 Do Until i = 2 Dim oConstraint As AssemblyConstraint For Each oConstraint In oAsmCompDef.Constraints ‘toggle constrain supression If oConstraint.Suppressed = False Then oConstraint.Suppressed = True Else oConstraint.Suppressed = False End If Next i = i + 1 ‘rebuild all InventorVb.DocumentUpdate() ‘ adds a small delay here PauseTime = 0.2 'seconds Start = Timer Do While Timer < Start + PauseTime ThisApplication.UserInterfaceManager.DoEvents 'present a status bar message ThisApplication.StatusBarText = "File is updating...." Loop Loop 'set status bar message ThisApplication.StatusBarText = “Rule Complete!”
@ASchlaack wrote:
In my case I'm working in LevelofDetail1, what needs to be changed? And once that's changed I can just paste that into a rule and It's good to go correct?
Hi ASchlaack,
Here is the rule with the LOD stuff removed. It ran it real quick and it didn't seem to cause me any issues. And yes, you can just paste this in to a new iLogic rule and run it.
Also, not that I edited my last post to suggest a possible single line solution using: InventorVb.DocumentUpdate()
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. ' This assumes an assembly document is open. Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Iterate through all of the constraints in this assembly twice i = 0 Do Until i = 2 Dim oConstraint As AssemblyConstraint For Each oConstraint In oAsmCompDef.Constraints ‘toggle constrain supression If oConstraint.Suppressed = False Then oConstraint.Suppressed = True Else oConstraint.Suppressed = False End If Next i = i + 1 ‘rebuild all InventorVb.DocumentUpdate() ‘ adds a small delay here PauseTime = 0.2 'seconds Start = Timer Do While Timer < Start + PauseTime ThisApplication.UserInterfaceManager.DoEvents 'present a status bar message ThisApplication.StatusBarText = "File is updating...." Loop Loop 'set status bar message ThisApplication.StatusBarText = “Rule Complete!”
Can't find what you're looking for? Ask the community or share your knowledge.