
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm using the rule below at the assembly level to go through all parts in the assembly and change the schedule to whatever is set at the assembly level. I used a Try/Catch statement since not all parts will have the "Sch" parameter - only piping and fittings will have that parameter. Maybe I am not using this statement correctly though? I have message boxes for debugging purposes on both the Try and Catch. When I run the rule, I get the Catch message box for all parts as if it couldn't find that Parameter, but then the parts update as expected anyway! Note, the "Sch" parameter at both the assembly and part levels are multivalue text. Could that have something to do with it?
See code below and I've also attached a sample part, so feel free to try it out for yourself. As always, any help is much appreciated!
' Set a reference to the assembly component definintion Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Iterate through all occurrences Dim oOcc As ComponentOccurrence For Each oOcc In oAsmCompDef.Occurrences Try Parameter(oOcc.Name,"Sch") = PipeSch Parameter(oOcc.Name,"PipeSch") = PipeSch ' For debugging: MessageBox.Show(oOcc.Name & " was updated." & vbLf & "Schedule set to: " & iProperties.Value(oOcc.Name,"Project","Description"), "Debug Message - Pipe_Sch") Catch MsgBox(oOcc.Name & vbLf & "Parameter 'Sch' not found. Proceeding to next part...") End Try Next
Solved! Go to Solution.