How to populate member in Family of Parts?



I have a part with family and i want to populate some members. Here is a part of my code:


FamilyMember mem = part.FamilyMembers.Item("member1");



But in the second line exception appeared.

Is anybody know what is my problem? Maybe it is needed to observe some conditions?


Posted by: Walker
Post date: 6/29/2012 7:51:58 AM


Re: How to populate member in Family of Parts?



Have you saved the part document before calling Populate? Also, according to the help file the DocumentName property on the FamilyMember must be set before calling Populate.


so, for example, in C#:

// assign a file name to the member
mem.DocumentName = "C:\\temp\\mypart.par"; // only 1 backslash for VB .NET, 2 for C#
 // assuming partDoc is a PartDocument object that owns the FamilyMembers collection, from which the member is to be created

// now mem is ready to be populated

// file should have been created on disk


Hope that helps,



Posted by: Jay Carlton
Post date: 6/29/2012 1:14:57 PM