Regenerate part rule from assembly

Regenerate part rule from assembly

Anonymous
Not applicable
364 Views
1 Reply
Message 1 of 2

Regenerate part rule from assembly

Anonymous
Not applicable

Hello, all.

 

I have run into a slight problem. I have an assembly with many parts in it. I have a rule called "Gage" in each and every part, which controls a parameter called "Gage" for each part itself. For some reason or another my parameter on some parts is not recognized as being driven by the rule "Gage." If I run the rule Gage then my parameter will not update. However, if I right click and click regenerate then my parameter will update and then it will recognize the parameter as being driven by the rule. I want to write a rule for my assembly that will run through each part and regenerate the rule called "Gage." 

 

Any help is appreciated. Thank you, all.

0 Likes
365 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

I have this rule here

 

Sub Main()
question = MessageBox.Show("Click OK to run the rule Gage in each part of the assembly.", "Run Rule",MessageBoxButtons.OKCancel)
Dim oAsmDoc As AssemblyDocument 
oAsmDoc = ThisApplication.ActiveDocument  
Call Iterate(oAsmDoc.ComponentDefinition.Occurrences, 1)
End Sub 

Private Sub Iterate(Occurrences As ComponentOccurrences, Level As Integer) 
'Iterate through Assembly

Dim oOcc As ComponentOccurrence 
For Each oOcc In Occurrences 

'Find Parts in Assembly
Dim SheetMetalAssembly As String
SheetMetalAssembly = oOcc.Name
Try

'Write iProps to Parts
iLogicVb.RunRule("Gage")


Catch
'MsgBox("Message!")
iLogicVb.UpdateWhenDone = True
End Try
        
'Run through the sub assemblies 
If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
Call Iterate(oOcc.SubOccurrences, Level + 1) 
End If 
Next 

MessageBox.Show ("You have successfully updated iProperties for each of the following parts:" , "Success!")


End Sub

 That I took from another rule and just reworded it, so that it would run the rules "Gage." Nevertheless, I would still like to have a rule that will regenerate the rules instead of just run the rules.

0 Likes