How to Create a Solid Shape in "Generic Model Adaptive.rtf" Using Family API

How to Create a Solid Shape in "Generic Model Adaptive.rtf" Using Family API

Anonymous
Not applicable
898 Views
1 Reply
Message 1 of 2

How to Create a Solid Shape in "Generic Model Adaptive.rtf" Using Family API

Anonymous
Not applicable

Hello everyone

 

I'd like to create a parametric solid shape in "Generic Model Adaptive.rtf" template. However, I faced with some problems.

First, I don't know how to draw a sketch while 3D snapping feature is active. In UI, there is a check-box that can be marked while drawing a chain of lines (please see the attached pic), but How can I turn this feature on through API.

 

Second, in this template, there is only a "Create Form" item that takes into account all the other functionalities like

Extrusion, loft, sweeps, and so on. But, I don't know how to use that item through API. Which method does correspond to that item. "NewExtrusion" doesn't work in this template.

 

Hint: I've written a code that works in Generic Model.rtf perfectly, but I couldn't do the same in this template.

 

 

f1.PNG

0 Likes
899 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor

You can't create families with  the API the same way you can in the UI, there is no sketch mode. Also 3D snapping is a UI feature I doubt you need with the API since it is more about knowing coordinate values and host ids rather than snapping to things.

 

As a starting point refer to objects within Autodesk.Revit.Creation namespace namely:

FamilyItemFactory class which is accessed via: Document.FamilyCreate

 

Also you should be familiar with Document.FamilyManager

 

Personally I'd say that if you have good knowledge of creating families via the UI then you can more often than not do so and add them as resources. It's not a necessity to do everything via the API (some things in the family environment you can't do anyway with the API).

 

I think also sometimes there is a tendency for developers to create with the API non-parametric families with dimensional properties established by the routine at run time, these are not that useful in the BIM world. There is also in my view no logical reason to create a parametric family via the API (since it's behaviour would not be fixed at runtime).  What I mean is what would be the advantage of creating such a parametric family in the API at the time you run the program? It is just not essential because you can change parameter values upon insertion and at anytime from that point on.