Curtis, just perfect! Thanks very much for the fast reply!
Worked very well with this code!
And sorry, but It just linked me to another doubt 🙂
The code is working perfectly on my templates that i got my custom property, but if the assembly got any other part, from CC i.e. thaa doesnt have this custom property ? then i shoul sum with the original mass of that part.
So how can i make a division if dont have the custom property, to sum with the mass of the part ? cuz i guess its easier then change all the CC files to add this property...
I tried just to verify with an IF, but didnt work :S
the problem is to validate if have or no the property, i tried if xxxx=true, or just like below, and nothn 😞
like this:
'clear the custom property in the assembly iProperties.Value("Custom", "pLiquido") = 0
'set a reference to the assembly component definintion.'This assumes an assembly document is open.Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrencesDim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components'(in case a virtual component trips things up)If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
'custom property in the assembly xNumber = iProperties.Value("Custom", "pLiquido")
'custom property in the parts
'changed this part only ***************************************************
If iProperties.Value(oOccurrence.Name, "Custom", "pLiquido") Then
yNumber = iProperties.Value(oOccurrence.Name, "Custom", "pLiquido")
sumNumber = xNumber + yNumber
Else
yNumber = iProperties.Mass
sumNumber = xNumber + yNumber
End If
'till here***************************************************************
'set custom property valuesiProperties.Value("Custom", "pLiquido") = sumNumber
Else
End If
Thanks very much again,
Túlio Barata
IV 2013