Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

duplicate family type when no types exist

Anonymous

duplicate family type when no types exist

Anonymous
Not applicable

I need to be able to create new family types in the Project, I have implemented the duplicate method fine. However if a user deletes all types from the project I cant duplicate an existing type, yet this can be done from the project browser> family browser.  

 

 

if (typeCount > 0)
{
//Duplicate the element type, works perfectly when types exist already
FamilySymbol famSym = oldfamilyObj.Duplicate(newFamilyType) as FamilySymbol;
}
else
{

//if no types exist by default after user deletes all types in family......

//how can i now duplicate the type?
//FamilySymbol famSym = //can i use the default type of create new type like can be done in the revit project browser?
}

0 Likes
Reply
Accepted solutions (1)
2,688 Views
2 Replies
Replies (2)

FAIR59
Advisor
Advisor
Accepted solution

You can open the family in the family editor, make a new type  and reload the family.

 

famdoc.FamilyManager.NewType("new typeName");

 

joshua.lumley
Advocate
Advocate

Don't forget to close the family document after LoadFamily and Commit. Otherwise the residue one in memory could overwrite the parameters. (I lost an evening learning this lesson).

 

famDoc.LoadFamily(doc, new FamilyOption());
y.Commit();
famDoc.Close(false);