By Adam Nagy
If there are some features that you would like to get from an iPart instance, then you'll have to get inside the factory, because the instance is just like a derived part referencing the solid from another part document:
If you're using an iPart member inside an assembly then the Open command will take you to the factory, since it's more useful, I guess:
However, when using the API, you'll have to get to the factory from the member.
If we have the above assembly open and run the following VBA code then it will list the parameters that the iFeature has been placed with inside the iPart factory document:
Sub iFeatureFromFactory() Dim asm As AssemblyDocument Set asm = ThisApplication.ActiveDocument Dim coMember As ComponentOccurrence Set coMember = asm.ComponentDefinition.Occurrences(1) ' This will give you back the definition of the ' iPart member, not the factory "iPart-01.ipt" Dim pcdMember As PartComponentDefinition Set pcdMember = coMember.Definition ' Now this is the actual factory document "iPart.ipt" Dim factoryDoc As PartDocument Set factoryDoc = pcdMember.iPartMember. _ ReferencedDocumentDescriptor.ReferencedDocument Dim pcdFactory As PartComponentDefinition Set pcdFactory = factoryDoc.ComponentDefinition Dim ifFactory As iFeature Set ifFactory = pcdFactory.Features.iFeatures(1) Dim text As String text = ifFactory.Name ' Values are in internal units, e.g. length is cm Dim param As Parameter For Each param In ifFactory.Parameters text = text + vbCrLf + _ param.Name + " = " + _ Str(param.Value) Next MsgBox (text) End Sub