Anonymous
in reply to:
Anonymous
11-04-2019
08:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-04-2019
08:35 AM
no longer need weight just a count of new parts. here's what i have so far. it seems to miss all the part numbers
Sub Main() ' Get the active assembly. Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument ' Get the assembly component definition. Dim oAsmDef As AssemblyComponentDefinition oAsmDef = oAsmDoc.ComponentDefinition.iProperties.Value("Project", "Part Number") oNum = oAsmDef.iProperties.Value("Project", "Part Number",Left(12345000,5)) ' Get all of the leaf occurrences of the assembly. Dim oLeafOccs As ComponentOccurrencesEnumerator oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences ' Iterate through the occurrences and print the name. Dim cnt As Integer cnt = 0 Dim oOcc As ComponentOccurrence oOcc = oLeafOccs(iProperties.Value("Project", "Part Number",Left(12345000,5))) For Each oOcc In oLeafOccs If oLeafOccs = oNum Then cnt = cnt + 1 MessageBox.Show(oOcc.Name) End If Next MessageBox.Show(cnt) End Sub
.