Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
in reply to: Anonymous

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

.