Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone. Our goal is to create a new iProperty called "TEST" in just the first level of children of an assembly. With this code, it does what we want, but it goes all the way down, if there are subassemblies with parts in them. Is it possible to only run this on the top level items? Thanks!
Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all Of the occurrences Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef) If iProperties.Value(oOccurrence.Name, "Status", "Status") = "" iProperties.Value(oOccurrence.Name, "Custom", "TEST") = iProperties.Value(oOccurrence.Name, "Project", "Part Number") & iProperties.Value(oOccurrence.Name, "Project", "Revision Number") Else iProperties.Value(oOccurrence.Name, "Custom", "TEST") = iProperties.Value(oOccurrence.Name, "Project", "Part Number") & iProperties.Value(oOccurrence.Name, "Project", "Revision Number") & "_P" & iProperties.Value(oOccurrence.Name, "Status", "Status") End If Next 'auf .iam Ebene If iProperties.Value("Status", "Status") = "" iProperties.Value("Custom", "TEST") = iProperties.Value("Project", "Part Number") & iProperties.Value("Project", "Revision Number") Else iProperties.Value("Custom", "TEST") = iProperties.Value("Project", "Part Number") & iProperties.Value("Project", "Revision Number") & "_P" & iProperties.Value("Status", "Status") End If
Solved! Go to Solution.