How to populate member in Family of Parts?

Valued Contributor
Valued Contributor

Hi!

 

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");

mem.Populate();

 

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

2 REPLIES

Re: How to populate member in Family of Parts?

Valued Contributor
Valued Contributor

Hi,

 

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
partDoc.Save();

// now mem is ready to be populated
mem.Populate()

// file should have been created on disk

 

Hope that helps,

Jay

 

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

Re: How to populate member in Family of Parts?

Experimenter
Experimenter
Hi,

I'm new programming for Solid Edge and I'm having problems populating the members of the family of parts.
I run my program and I can see the created members and their correct dimensions, but when I try to populate the created members I get an error:

Steps -
I add new members to the family of Parts
I modify its dimensions
I try to assign the path to mem. DocumentName = path (does not get it and remains null)
I save the changes of the PartDocument (anyway)
I try to populate the new member mem.Populate(); and it throws me an unknown error
Additional information: Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

Is there something I'm missing

Please advice

Thank you