Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I need to add to all the components (parts and subassies) of an assembly an iproperty that is an extract of the filename
I tried the code below but is working just for the parts not the subassies.
Sub Main
On Error Resume Next
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
Dim oLeafOccs As ComponentOccurrencesEnumerator = oAsmDef.Occurrences.AllLeafOccurrences
'when you turn this on, you should also turn it back off when done
ThisApplication.SilentOperation = True
Dim oOcc As ComponentOccurrence
For Each oOcc In oLeafOccs
iProperties.Value(oOcc.Name, "Custom", "PN5") =(Mid(oOcc.Name, 11, 3))
Next
End Sub
Solved! Go to Solution.