Reply

How to know if a part in the assembly is a member of family part?

If a family member is used in an assembly, how can I know it is a member of family and also how can I know what the family template is?

For example, family part SE20150824.par have two members of SE20150824-01 and SE20150824-01.

When  SE20150824-01 is used in SE20150824A01.sam, How can I get the relationship from SE20150824-01 to SE20150824.par using  c# API?

2 REPLIES

Re: How to know if a part in the assembly is a member of family part?

You can check the IsFamilyOfParts property of the Occurrence object to know, if your part belongs to a family of parts, but I don't have an easy way to get the name of the master document.

In C++, I would access directly the occurrence document and read this back link from its structured document API, but in C# I don't know.

Re: How to know if a part in the assembly is a member of family part?

I just found an easy way to get back to the master document.

 

If your occurrence is a FamilyOfPart member, then you can access its PartDocument and get the first CopiedPart feature from the DesignEdgebarFeatures collection. It's typically the 4th item.

This CopiedPart object has a FamilyOfPartsMember and a FileName property which return the currently used member name and the full path to the master document.

' ASM: Show the member and master of any FamilyOfParts occurrence in this assembly
Dim objAsmDoc As AssemblyDocument = objApp.ActiveDocument
For Each objOcc As Occurrence In objAsmDoc.Occurrences
  Debug.WriteLine("* Occurrence:    " & objOcc.Name)
  If objOcc.IsFamilyOfParts Then
    Dim objParDoc As PartDocument = objOcc.OccurrenceDocument
    Dim objPartCopy As CopiedPart = objParDoc.DesignEdgebarFeatures.Item(4)
    Debug.WriteLine("  - FamilyMember:    " & objPartCopy.FamilyOfPartsMember)
    Debug.WriteLine("  - MasterDocument:  " & objPartCopy.FileName)
  End If
Next