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?
}
Solved! Go to Solution.
Solved by FAIR59. Go to Solution.
You can open the family in the family editor, make a new type and reload the family.
famdoc.FamilyManager.NewType("new typeName");
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.