Creating new system type for an empty system family.

Creating new system type for an empty system family.

Anonymous
Not applicable
1,041 Views
5 Replies
Message 1 of 6

Creating new system type for an empty system family.

Anonymous
Not applicable

Im trying to create a new type with the Revit API for a system family. Specifically trying to create a new MullionType if a project has purged any of the Rectangular and Quad Corner types. 

 

What I know:

There is plenty of documentation to create a duplicate of an existing type using the familyType.Duplicate(stringName) method.

Also, I know that one can use the document.EditFamily(family).FamilyManager.NewType(stringName) method if you have an editable family.

 

But for system families, such as the Rectangular Mullion Family, you cannot use the document.EditFamily(family).FamilyManager.NewType(stringName) method. This throws the exception note: "This family is not editable".

 

Question:

How do I create a new type for an empty system family without manually selecting "New Type". Halp!

 

Thanks!

 

image.png

0 Likes
1,042 Views
5 Replies
Replies (5)
Message 2 of 6

Revitalizer
Advisor
Advisor

Hi,

 

have you tried to copy a system family from another document ?

There is a method named ElementTransformUtils.CopyElements.

Once a family has been loaded, you could continue as usual.

 

Haven't tested it myself.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 6

Anonymous
Not applicable

I'll give it a shot.

 

But I would prefer not to rely on a separate document to load from.

Also, I'm assuming that this separate document would have to be open or linked into the Active doc. 

 

Let me know if you you think of another method! 😄

0 Likes
Message 4 of 6

FAIR59
Advisor
Advisor

you could open a new document

 

Document doc2 = commandData.Application.Application.NewProjectDocument(UnitSystem.Metric);

 

0 Likes
Message 5 of 6

Anonymous
Not applicable

That's a good idea. 

 

I actually now have resolved to prompt the user to create some template types for any system families that are empty before running the tool. 

Once there is at least a single type in any of those families then they can be duplicated to make new types. 

0 Likes
Message 6 of 6

jeremytammik
Autodesk
Autodesk

I checked with the development team, and they say:

 

I do not think it is possible without copying the Type from other document.

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes