Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
I have an Excel sheet that lists all of an assembly's components, and a "Part Number" parameter for each component. My problem is, the parameter isn't read if the component is a sub-assembly, or a part that is an instance of a family table.
Does anyone have an example of how to check if the component is a subassembly or FT instance, and if so...how to get a parameter value from it?
Here is a code snippet of how I'm reading the parameter from every componet (which works if its a part)
For iCnt = 0 To (pathArray.Count - 1)
Set eachPath = pathArray.item(iCnt + 1)
Set mdl = eachPath.Leaf
' if model is part
If mdl.Type = EpfcModelType.EpfcMDL_PART Then
iRow = iRow + 1
Range("Components").Cells(iRow, colFileName).Value = mdl.Filename
Set paramOwner = mdl
Set params = paramOwner.ListParams()
For i = 1 To (params.Count - 1)
' Get part number and extrusion
Set param = params(i)
Set paramValue = param.Value
Set paramName = param
If paramName.Name = "PART_NUMBER" Then
PartNumber = paramValue.StringValue
Range("Components").Cells(iRow, colPartNumber).Value = PartNumber
Exit For
End If
Next i
End If
End If
Next iCnt
Solved! Go to Solution.
The problem was I was starting at index one on a zero-based array (ListParams).
Seems to be working now.
You have there condition
If mdl.Type = EpfcModelType.EpfcMDL_PART Then
so it cannot process nothing else but parts.
What is in the pathArray list? How do you get this list?
Regards,
Tom
The problem was I was starting at index one on a zero-based array (ListParams).
Seems to be working now.