Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

duplicate family type when no types exist

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
2569 Views, 2 Replies

duplicate family type when no types exist

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?
}

2 REPLIES 2
Message 2 of 3
FAIR59
in reply to: Anonymous

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

 

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

 

Message 3 of 3
joshua.lumley
in reply to: FAIR59

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community