Creating family from a project document

Creating family from a project document

Anonymous
Not applicable
1,748 Views
7 Replies
Message 1 of 8

Creating family from a project document

Anonymous
Not applicable

Hello,

 

I am trying to create a family from a project document. In other words, I want to open a common project document and programmatically (there is a button) create an extrusion. Until now I saw that to create an extrusion I can use the FamilyCreate command. However it seems like FamilyCreate can only be used from a family document. 

Is there any way to open the FamilyEditor or something like this from a project document?

 

Thank you,

 

Carolina.

0 Likes
1,749 Views
7 Replies
Replies (7)
Message 2 of 8

rosalesduquej
Alumni
Alumni

Hi Carolina,

 

What I know is that from the Revit Project you could edit the Family previusly created. To edit an existing family while working in a Project document, use the EditFamily() functions available from the Document class, and then use LoadFamily() to reload the family back into the owner document after editing is complete.

 

To create a new family document use Application.NewFamilyDocument().

Also keep in mind that API access to system family editing is not available. 

The ability to modify Revit Family documents and access family types and parameters is available from the Document class if the Document is a Family document, as determined by the IsFamilyDocument property.

 

 

You can read about this in the Revit Help file. 

http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-DC143EB8-43CB-48AB-938E-7ADE3A9D2E63

 

I don't know a way to create a family within a Revit Project. Maybe the workflow you are planning could get a different route to achieve what you are trying to do. 

 

Also when in doubt I always re-visit Jeremy's explanation about Revit Families, an old post but very very informative.

http://thebuildingcoder.typepad.com/blog/2009/08/the-revit-family-api.html#2



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
Message 3 of 8

Revitalizer
Advisor
Advisor

Hi Carolina,

 

you may have a look at the DirectShape classes.

Using these, you can create Elements from any input geometry, both in project and family context.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 4 of 8

Anonymous
Not applicable

It seems like it can solve my problem. However I am not getting to access the DirectShape classes. What namespace I need to use? Are DirectShape classes available in Revit 2014? 

 

0 Likes
Message 5 of 8

rosalesduquej
Alumni
Alumni

Hi Carolina,

 

I'm afraid DirectShape class got first introduced for Revit API 2015. 



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 6 of 8

Anonymous
Not applicable

It's sad... I think I will have to change the way that I was pretending to do this.

Thank you Jaime Rosales and Revitalizer.

0 Likes
Message 7 of 8

Revitalizer
Advisor
Advisor

Dear Jaime,

 

wouldn't it be useful to let the thread poster choose a Revit version for his (or her) problem ?

Just provide a combobox containing all versions up to 2016, with multiple selection enabled.

A compulsory input field, to be filled in before the new posting is published.

 

I wouldn't have suggested DirectShape if I would have read "2014" in the initial posting.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 8 of 8

rosalesduquej
Alumni
Alumni

Hi Revitalizer,

 

This is a completly valid request, let me speak to my team about it, It will help the community a lot. Thank you for your idea.



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes