The Revit Family API

Here is a rather lengthy and rich post to start off the week, describing the new family API introduced in Revit 2010 and including both an overview and in-depth information.

These are the main topics covered:

The text presented here is also a script for the Revit Family API slide deck which was used for the webcast mentioned at the end of this post.
If a picture says more than a thousand words to you, then you should download that slide deck, which will provide a couple of thousand words’ worth of images to accompany this raw text.

Background

The concept of families is an enormous strength of Revit, but until Revit 2010, no programming access was available in the family context. Therefore, two large and completely disjunct developer communities have evolved around the Revit products, creating either:

  • Revit applications using the API.
  • Revit content with no API access.

The Family API was the

top wish list item

and was made available for the first time in Revit 2010. It provides huge potential for synergy uniting the two separate camps. It enables:

  • Use of the Revit API in the family editor.
  • Extract and modify existing or create new family content.
  • Automatic library generation.

Creating a Family through the User Interface

A non-trivial family can have a complex internal structure and many decisions need to be taken. A large body of experience around building families and family libraries has been developed before the introduction of the API. It is useful to gather some experience creating families manually before implementing code to do so automatically. Just like the standard Revit API, almost all the features provided by the family API are available through the user interface as well.

What is a Revit Family?

Before discussing the family API, it is important to understand the basics of Revit families and their definition.

A Revit family is a graphic representation of building objects and symbols. It can include geometry in 2D or 3D as well as data that supports the definition and creation of object instances. A family defines one or more types or symbols. A type or symbol can be inserted into the project to create a family instance.

There are three different classes of families, system, standard and in-place:

  • System families are stored in the project template and used for objects such as Walls, Roofs, Floors, Ceilings, Rebar, etc.
  • Standard families are defined externally in freestanding “.rfa” files and used for objects such as Windows, Doors, Furniture, Beams, Ductwork, etc.
  • In-Place families are used for “one of kind objects”.

The new family API provided in Revit 2010 addresses the standard families.

Revit Families – Where to Begin

A new family is always based on a family template file, if created from scratch, or on an existing family, which is enhanced in some way. Regardless of whether you are using the UI or API, the first thing you will need to decide is which template or family file you want to begin with.

  • Create a completely new family starting from a family template.
  • Enhance an existing family.

You need to choose which approach to take, as well as which template or family file to start with. There are plenty of templates to choose from. Other decisions that need to be taken and which influence this choice include

  • Category?
  • Is the family 2D or 3D?
  • Model or detail component?
  • Hosted or non-hosted: Wall, Ceiling, etc.
  • Placement type: Free, two point…
  • Specialty: Lighting, RPC…
Revit Family Flavours

Just like the Revit product, Revit families also come in three flavours for architecture, MEP (mechanical, engineering, and plumbing), and structure. Most of the functionality is common to all three. Here are some aspects of the flavours:

Revit Architecture:

  • Basic building components with simplistic interactions in the model.
  • Free placement objects – casework, furniture, etc.
  • Two point placement objects – detail components, hosted objects.
  • Hosted objects: windows, doors, columns (“level to level”), ceiling or “wall based” lighting fixtures.

Revit Structure:

  • Additional components with complex interactions with other objects.
  • Framing – beams (“beams to beam”, “beam to column”), columns.
  • Trusses – layout for girder trusses; boundary conditions.
  • Span direction symbols; reinforcement symbols – area reinforcement expands to find edges, path reinforcement.

Revit MEP:

  • Connectors allowing objects to resize based on connected neighbour elements.
Revit Family Editor

Revit offers six basic family editors:

  • 3D model, annotation, detail, rebar, truss and new conceptual mass.

Of the six basic family editors, the conceptual mass creation one is new to 2010. Depending on the editor, you will see a different set of available tools and building blocks. For instance, you will see tools to create forms in the model editor, but not in the annotation one. If you are using the truss editor, you will have access to the top and bottom chord, which will be shown in the model editor.

Each family editor is tied to the chosen family template and provides a specific feature set:

  • Geometry – extrusions, blends, sweeps, revolves.
  • Lines – model, symbolic, detail.
  • Basic tools – copy, mirror, paint, join/unjoin, cut geometry/don’t cut.
  • References – reference planes, reference lines.
  • Annotation tools – labels.
  • Advanced tools – formulas, nesting, arrays, type catalogues.
  • MEP tools – add connectors.
Revit Families Best Practice

Families are a powerful feature in Revit. Creating a family can be fun, and it can also be complex. When it becomes complex, it requires good planning. Here are some suggestions for a process for building families by the Autodesk Revit content manager Steve Campbell. It describes the manual definition of a family. The same applies to a programmatic approach as well. A key to understanding the family API is to understand the UI.

It is highly recommended to follow this structured process when building families. It needs to be learned and practiced. Systematically following this process is one of the most important aspects of family creation.

Process order:

  1. Plan (insertion point, parametric origin).
  2. Lay out reference planes (the bones).
  3. Add parameters.
  4. Add multiple host thickness types.
  5. Add two or more types.
  6. Flex types and host (testing procedure).
  7. Add a single level of geometry.
  8. Repeat steps 6 and 7 until you are satisfied with the results.
  9. Test in project environment (create testing project).
Revit Family Possibilities

You can create quite complex objects and behaviour using Revit families. Here are a few of the possibilities:

  • Formulas to control behaviour, visibility, arrays.
  • Arrays and nesting for repeatable, resizable elements across an array.
  • Advanced nesting with subcomponents that can be swapped.
  • Reference lines and angular movement.

Formulas can be used to control behaviour, visibility, arrays, e.g. to define arrays of bolts depending on the size of a plate.

Arraying nested components allows the user to create families with repeatable elements across an array that can resize based on user input or rules. For example, a bookshelf with arrayed shelves, mullion patterns based on rules, and open web joists that adjust based on length and height.

Advanced nesting can make use of nested families with family type parameters that can provide flexible components with swappable sub-components such as nested door panels, frames, hardware, playground equipment, swappable panels and components.

Reference lines allow geometry to move about in an angular fashion. They contain two endpoints and two built in work planes that can be parametrically controlled. Some simple examples include a door swing that can change the opening angle, or a light fixture head that moves and points. A more complex example is an excavator arm that can bend and rotate about three or more pivot points.

Creating a Family Programmatically

Now that the basics of Revit families are clear, we can look at the new access to this functionality provided by the new family API.

Family API Usage

Exposure of the family API is probably the most important enhancement to the Revit API in 2010. The concept of component family is a unique feature and strength of Revit. This was the most wanted feature in the Revit API community and we expect the effect and growth in possibilities with the availability of family API will be dramatic.

An obvious opportunity provided by the new family API is the automatic generation of content from databases or other library sources. It is also possible to extract a family definition out of a project and store it back into an external family file. The document Revit Platform API Changes and Additions.doc in the Revit SDK folder provides an overview of the family API. Family API specific samples are located in the Revit SDK samples FamilyCreation subfolder.

Here are some of the new supported features:

  • Enable use of the Revit API within the family editor context.
  • Create and modify family content.
  • Automatic library generation from database or other library specification.
  • Extract family definitions from existing projects.
  • Define references and constraints to drive model geometry parametrically, formulas to drive parameter values, and annotation and dimensioning.
  • Control detailed visibility of family types and their elements.
  • Control loading behaviour of a family.
Document and Family Manager Classes

The Revit API Document now has some added methods and properties for managing families:

  • EditFamily – edit a family loaded in a project document.
  • FamilyCreate – return a FamilyItemCreate object to create new instances of elements within a family document, analogous to the Create object in a project.
  • FamilyManager – return a FamilyManager object providing access to family types and parameters.
  • IsFamilyDocument – identify whether the current document is a family document.
  • OwnerFamily – return the owning family of this family document.

Within a family document, the family manager class provides the following new functionality:

  • Add, remove and rename types.
  • Add and remove parameters.
  • Set values and formulas.
Creating Family Content

The FamilyCreate property on the family document returns a FamilyItemFactory instance. This family item factory object is a utility object used to create new instances of elements within the family document. Just like other Revit elements, these are instantiated using dedicated methods instead of the .NET new operator. This ensures that the elements created are correctly added to and hooked up within the family document. A wide range of elements types can be created, including alignments, dimensioning, annotation, curves, levels, and solid forms for conceptual design.

The family item factory utility object

  • Creates new instances of elements within the family document.
  • Provides dedicated creation methods instead of the .NET new operator.

Elements types that can be created include:

  • Alignment.
  • Connector (MEP only).
  • Dimensioning.
  • Annotation.
  • Curves.
  • Levels.
  • Solids forms.
Visibility Settings

A critical topic when building family content are the visibility settings. They are now accessible for each element in a family through the new FamilyElementVisibility class.

Each element in a family has its own visibility settings which define which levels of detail and which types of views it appears in. These options are critical to building good content. For example, intricate details of a family should only be visible in the fine detail views. 3D solid content could optionally be suppressed in plan views, where light weight 2D line work could be displayed instead. Such an approach can make a substantial performance difference, especially in large building models.

Every element in the family has own visibility settings managed by the FamilyElementVisibility class defining:

  • Which levels of detail it appears in.
  • Which types of views it appears in.
Loading Control

The Document.LoadFamily method has been enhanced and new overloads have been added, which can help to handle situations such as when a family already exists in the project. The following overloads are now provided:

  • LoadFamily(Document) – loads the contents of this family document into another document.
  • LoadFamily(String) – loads an entire family and all its types into the document.
  • LoadFamily(String, Family) – loads an entire family and all its types into the document and provides a reference to the loaded family.
  • LoadFamily(Document, IFamilyLoadOptions) – loads the contents of this family document into another document.

The IFamilyLoadOptions argument to the last overload defines an interface which specifies two call-backs for handling family load situations: OnFamilyFound and OnSharedFamilyFound. These are called when a family or a shared family is already present in the target document.

Family API Samples in the Revit SDK

A number of new samples illustrating the family API have been added to the Revit SDK. They are located in the FamilyCreation subfolder in the SDK Samples directory.

AutoJoin

AutoJoin automatically joins geometry of multiple generic forms for use in family modelling and massing. It uses the method Document.CombineElements to join geometry between overlapping generic forms. It also includes a utility method to check geometry object overlap, based on the Face.Intersect(Curve) method.

AutoParameter

AutoParameter implements batch mode automatic addition of shared or non-shared parameters to one or more family documents. It optionally processes either the currently active family document or all families in a specified folder. It uses the FamilyManager class AddParameter methods and reads its input data from parameter text files in a format similar to the Revit shared parameter files.

CreateAirHandler – RME

CreateAirHandler is a Revit MEP sample to create an air handling unit including MEP pipe and duct connectors. It shows how to check the template family category to verify that a valid starting point is selected. It make use of the FamilyItemFactory class NewExtrusion, NewPipeConnector, and NewDuctConnector methods, sets up the proper connector parameters, and uses Document.CombineElements to join the extrusions to make up the air handler body.

CreateTruss – RST

CreateTruss is a Revit Structure sample that creates a mono truss in a truss family document. The truss curves are created using NewModelCurve, the truss type is set through the ModelCurve TrussCurveType property, and constraints are added to the truss curves with NewAlignment.

DWGFamilyCreation

DWGFamilyCreation shows how to import a DWG file into a family document add two type parameters to the imported instance: DWGFileName specifying the DWG file name, and ImportTime storing the data and time when it was imported.

GenericModelCreation

GenericModelCreation creates a generic model using extrusion, blend, revolution, sweep and swept blend elements. It checks that the open document is indeed a family one or otherwise creates a new family document. It exercises the CreateSketchPlane, NewLineBound, and FamilyItemFactory methods to create profiles and shapes.

TypeRegeneration

The TypeRegeneration sample uses the FamilyManager Types property to determine all types defined in the current family document, and CurrentType to iterate through them. It reports whether all types regenerated successfully, and logs any errors that occurred to a file.

ValidateParameters

ValidateParameters checks whether every type in the current family document has valid values for certain parameters and logs the results to a file. This sample can be run in two modes, either as an external application subscribing to DocumentSaving and DocumentSavingAs events to run the check automatically every time a document is opened, or as an external command to be launched manually when required.

WindowWizard

WindowWizard shows how to create a new window family via a wizard style user interface. It needs to be started in a window family template, e.g. Metric Window.rft. It prompts the user to define input dimensions for various window parameters and materials, and then creates the required geometry, constraints and types using elements including extrusions, alignments, dimensions, reference planes, and family types.

Family API Labs: Creating an Example Family

The Revit Family API Labs is a collection of exercises which introduce you step by step to the creation of a column family. The objective is to learn the basics of the family API. The labs start with the basics and then proceed to more advanced aspects. Full documentation of and instructions for each step are included in separate documents for C# and VB.

Family API Labs
  • Lab1 – define a column with rectangular profile.
  • Lab2 – define a column with L-shape profile.
  • Lab3 – add formula and materials.
  • Lab4 – add visibility control.
Lab 1 – Create Rectangular Column
  • Check the family context.
  • Create a simple solid using extrusion.
  • Set alignments.
  • Add types.

Classes and methods:


doc.IsFamilyDocument()
doc.OwnerFamily.FamilyCategory.Name
doc.FamilyCreate.NewExtrusion()
doc.FamilyCreate.NewAlignment()
familyMgr = doc.FamilyManager
familyMgr.NewType()
familyMgr.Parameter(); familyMgr.Set()
Lab 2 – Create L-Shaped Column
  • Add reference planes.
  • Add parameters.
  • Add dimensions.

Classes and methods:


doc.FamilyCreate.NewReferencePlane()
familyMgr.AddParameter()
doc.FamilyCreate.NewDimension()
Lab 3 – Add Formulas and Materials
  • Add formulae.
  • Add materials.

Classes and methods:


familyMgr.SetFormula()
pSolid.Parameter("Material")
familyMgr.AddParameter("MyColumnFinish", BuiltInParameterGroup.PG_MATERIALS, ParameterType.Material, True)
familyMgr.AssociateElementParameterToFamilyParameter()
Lab 4 – Add Visibility Control
  • Add line representation.
  • Add visibility control.

Classes and methods:


doc.FamilyCreate.NewSymbolicCurve()
doc.FamilyCreate.NewModelCurve()
FamilyElementVisibility(FamilyElementVisibilityType.ViewSpecific/Model)
FamilyElementVisibility.IsShownInFine, etc.
pLine.SetVisibility(pFamilyElementVisibility)
Learning More

Here is an overview of some available resources for further learning:

Family API Webcast and Materials

We held a successful

webcast

on the Revit Family API on Thursday July 23rd 2009.
The supporting material and recording from this webcast is now available.
To access the material from any ADN webcast, you can go to the

ADN training schedule site

and click on the corresponding download link.
You can find this specific webcast by filtering for ‘Revit Family API’.
Here is a direct link to

download the webcast material
, which includes the following items:

  • Presentation: Revit 2010 Family_API.pptx.
  • Source Code for Labs: Revit Family Labs including Visual Studio solution file, Revit.ini information, C# and VB source code, instructions, and a Revit RFT template file.
  • Recording: Revit Family API Webcast recording.
  • Q & A: Revit 2010 Family API Webcast – Questions and Answers Jul 23 2009.docx.

Comments

52 responses to “The Revit Family API”

  1. Hi Jeremy,
    First of all thanks for this wonderful and resourceful blog for all the revit community.
    My Question is not directly related to the new Family API for Revit 2010.
    How can we access geometry object (particularly Geometry.Solid) for Structural Framing, Lighting Fixtures, Railings (stair railing, Hand rail rectangular etc.) and similar Family instances ?
    Please give a solution that works with the Revit 2009 API.

  2. Dear Zorcad,
    Thank you very much for your appreciation, I am really glad that you find it useful!
    One example of accessing the geometry of a family instance is given in
    http://thebuildingcoder.typepad.com/blog/2009/05/nested-instance-geometry.html
    It searches for the first family instance in the current project and iterates over its geometry, extracting and listing all vertices from each of its solids. It then continues to explore the symbol family components using the Symbol.Family.Components property which was available in the Revit 2009 API but has been replaced by the family API in Revit 2010. You don’t need that part. The first part will work unchanged in both Revit 2009 and 2010.
    Cheers, Jeremy.

  3. Hi Jeremy,
    Thanks for the reply,
    Actually I already have gone through all of your previous posts before asking the question.
    In the link you gave:
    if( !Util.GetSelectedElementsOrAll( a, doc,
    typeof( FamilyInstance ) ) )
    this selects the elements of FamilyInstance type and we can get the geometry info., and on another of your posts of selecting all of the model elements in a scene which is;
    http://thebuildingcoder.typepad.com/blog/2009/05/selecting-model-elements.html
    says:
    if( !(e is Symbol)
    && !(e is FamilyBase)
    && (null != e.Category)
    && (_CategoryNameLegendComponents != e.Category.Name)
    && (null != e.get_Geometry(opt)) )
    {
    // . . .
    }
    which selects all the model elements.
    Now the problem I am facing is that a few of these selected model elements I can’t access their geometry info. Example is a Railing.
    So, I was asking if there is way to have geometry information of these type of model elements too.
    Thanks and regards,

  4. Dear Zorcad,
    Thank you for your update and for going through the other posts before asking. I see what you mean now.
    There are a few model elements in Revit that are not exposed in the API. In that case, they are stored in the document elements collection as instances of the generic Element base class, which makes them a bit hard to identify.
    To explore these elements further, you can make use of the Revit element lister implemented in Lab2_1_Elements. Its use is described in
    http://thebuildingcoder.typepad.com/blog/2008/11/exploring-element-parameters.html
    That will show you how to create a railing instance and get a handle on it to explore its parameters and other properties, so you can see what is available and accessible. I would expect the geometry to be provided as normal. The properties and other data may enable you to create a filter to access all railings.
    Cheers, Jeremy.

  5. Hi Jeremy,
    Thanks for details.
    Actually I am able to access all these elements, I was just asking a way (probably code) to access their geometry. Anyways I am working on this as I waiting for your coming reply :-).
    Thanks,

  6. Dear Zorcad,
    Oh, great, if you can access these elements, the hard part is done. The access to geometry is always identical. You use the Geometry property on the Element class, provided in form of the get_Geometry method in C#:
    Autodesk.Revit.Element e;
    Autodesk.Revit.Geometry.Options opt = app.Create.NewGeometryOptions();
    Autodesk.Revit.Geometry.Element ge = e.get_Geometry( opt );
    There are lots of examples of accessing and analysing element geometry in the Geometry category of this blog, e.g. in the latest geometrical post
    http://thebuildingcoder.typepad.com/blog/2009/08/bottom-face-of-a-wall.html
    Cheers, Jeremy.

  7. Prasad Sumanasekara Avatar
    Prasad Sumanasekara

    Hello JEREMY TAMMIK,
    How to set foramula using Family manger
    FamilyParameter ^famiPara = famiManager->AddParameter(“numSize”,BuiltInParameterGroup::PG_GRAPHICS,ParameterType::Integer,false);
    famiPara = famiManager->AddParameter(
    “size1”,BuiltInParameterGroup::PG_GRAPHICS,Parameters::ParameterType::YesNo,false);
    String ^formula =”numSize=”+Convert::ToString(1);
    famiManager->SetFormula(famiPara,formula);
    this is not Work.
    please help me about set formula
    Thank You,
    Prasad.

  8. Dear Prasad,
    I entered SetFormula as a search key in Rod Howarth’s custom Google search for global online Revit API help mentioned in
    http://thebuildingcoder.typepad.com/blog/2009/08/online-revit-api-help.html
    It turned up one single hit:
    http://thebuildingcoder.typepad.com/blog/2009/08/the-revit-family-api.html
    Which takes us right back home again :-)
    The Lab 3 ‘Add Formulas and Materials’ of the sample code of the family API presentation demonstrates adding a formula.
    I hope that solves your issue.
    Cheers, Jeremy.

  9. Pramod R Shinde Avatar
    Pramod R Shinde

    Hi JEREMY TAMMIK,
    We are working on API of Revit Architecture 2010. We want to get all Parameters and their values from the Family document. We are referring AutoParmeter example from SDK. With the help of this example, we are able to get parameters of Family, but didnt get any property or method for getting Value of those parameters.
    So please give any code example for getting values of the Family Parameters.

  10. Dear Pramod,
    Thank you for your interesting query. I picked up the identical question from the case that you submitted to ADN through DevHep Online and answered that.
    Cheers, Jeremy.

  11. Dear Pramod,
    I ended up creating a new blog post to answer your question in depth:
    http://thebuildingcoder.typepad.com/blog/2009/11/family-parameter-value.html
    Cheers, Jeremy.

  12. Lars Rådman Avatar
    Lars Rådman

    Hi Jeremy!
    I’m wondering if you have a good example of the use of the IFamilyLoadOptions callback interface?
    (I’ve searched the API docs and the Family API. It’s mentioned, but I haven’t found it used in any examples.)
    The reason I’m asking is that I am programatically modifying (adding new types to) a set of families containing lighing fixtures, and I need to load the modified families into existing Revit projects already containing the old versions of the families. As far as I understand, this is where the callbacks of IFamilyLoadOptions come into play.
    I’we written some test code (C#) that compiles, but when running it in the debugger I don’t get any callbacks. )-;
    Thanks in advance,
    / Lars

  13. Dear Lasse,
    Yes, I think your understanding is right. I have seen sample code for using IFamilyLoadOptions and heard from colleagues who have tried to use it, but as far as I know this event currently does not work as expected, so I am not surprised that you are not receiving any notification call-backs. The reason is that Revit 2010 simply refuses to reload the family, even if it has been edited. Sorry for the bad news.
    Cheers, Jeremy.

  14. Jeremy,
    I hope everything is going well for you.
    I am trying to use the FamilyItemFactory to create a label inside the family document. I can see all kinds of creation functions like NewDimension, NewSweep, NewTextNote,…
    but I can’t find any function to do NewLabel()
    How do we go about that?
    Regards,
    Nadim

  15. Jeremy,
    Another question.
    I am trying to create an instance of a Generic Annotation Family using
    FamilyInstance instance = xDoc.Create.NewFamilyInstance(new Autodesk.Revit.Geometry.XYZ(0, Y, 0), symbol, Autodesk.Revit.Structural.Enums.StructuralType.NonStructural);
    However, “instance” return null always.
    Any idea why?
    Regards,
    Nadim

  16. Dear Nadim,
    I am fine, thank you, and I hope you are too.
    I’ll try my standard answer first of all, for the umpteenth time: can you do that in the user interface?
    If not, you probably will not have access to it in the API either.
    Cheers, Jeremy

  17. Thanks Jeremy.
    Yes, you can do that in the user interface, inside a family editor. The label might be the most common element used in the Annotation Families.
    Regards,
    Nadim

  18. Dear Nadim,
    If you read carefully in the following post on detail lines, you will notice the phrase ‘They are annotation elements and are visible only in the view in which they are drawn. They can currently only be created in plan views.’
    http://thebuildingcoder.typepad.com/blog/2009/09/detail-lines.html
    Maybe the same is true for the annotation family. Once again, try it in the user interface first.
    Cheers, Jeremy

  19. Dear Nadim,
    On one hand, I found out that there is an open API enhancement request for “Label” support in the family API.
    On the other hand, Harry Mattison very friendlily provided some code to create a new dimension label, which I hope is what you are in fact looking for:
    http://thebuildingcoder.typepad.com/blog/2010/02/creating-a-dimension-label.html
    Cheers, Jeremy.

  20. Thanks Jeremy,
    I was able to complete my extesnion without having to use a Label. But to answer your question, the dimension label is a bit different. In the user interface, any label can be assigned to the dimension as long it has one parameter. But, labels may have an infinite number of parameters.
    Programmatically, API is able to assign the parameter to the dimension directly as you saw in dim.Label = familyParam, but really no actual lable is created.
    What I was trying to do is to create a label that has n-number of parameters. I was going to associate the instances of that family with a Note Block. What I found is that you can create the family, add the parameters to it and then load it into the project. It will do the job without nothing physical is been created in the project.
    I hope this helps in explaining the difference.
    Regards,
    Nadim

  21. Dear Nadim,
    Thank you for the explanation and congratulations on completing your project and working around the missing functionality.
    One very important aspect of the art of programming and any other art as well for that matter is making do with what you have, not fighting windmills.
    Cheers, Jeremy.

  22. Hello Jeremy,
    Thank you for this page on the Family API. Its a good start for me. I have a question regarding instance parameters. I managed to create an instance parameter but it does not show up when the user activates the instance properties window for the selected element. The code I used was:
    FamDoc.FamilyManager.AddParameter(“TESTPARAMETER”, BuiltInParameterGroup.PG_CONSTRUCTION,ParameterType.Text,true);
    Is there a way to set the visibility of this parameter so that the user can work with it in the “Instance Properties” window?
    Thanks again,
    Jeff

  23. My temporary work around for this is to save the family back out and reload it. Not sure if this is my only option, though.

  24. Dear Jeff,
    Thank you for your appreciation, I am glad this page is useful for you!
    I am not quite sure about the whole workflow or the context of the operation you describe. If you say that saving and reloading the document helps, but you would like to avoid that, then I would suggest trying to encapsulate the operation in a transaction and committing it … that might result in a similar update as the save and reload operation. Cf.
    http://thebuildingcoder.typepad.com/blog/2010/01/extra-transaction-required.html
    Cheers, Jeremy.

  25. Dear Lasse,
    Gamal Kira now provided some sample code which actually does show the IFamilyLoadOptions in action:
    http://thebuildingcoder.typepad.com/blog/2010/02/ifamilyloadoptions-and-gemini.html
    Cheers, Jeremy.

  26. Jeremy.
    First of all, thanks for sharing your valued knowledge ! I´m not a programmer, but have a urgent question to a Revit API expert…
    As we all know, Revit has limited modeling tools in the family editor (disregard conceptual mass´s)
    Would it be possible to create complex shapes, using the API ? I´m thinking that it MIGHT be possiple to read 3D Point files from AutoCAD, or maybe even create true Revit geometry form importet .dwg/.sat files ?
    I´m looking to create some complex geometry for chairs, sofas etc, but there´s no way, that I can model it with the current tools, and imported geometry (non parametric) is not really an option… Hope you can point me in the right direction. Thanks.

  27. Dear Klaus,
    I definitely do not know what you are asserting we all know, and do not agree with it either. As far as I know, you can easily build pretty amazing shapes using the Revit Form Creation API:
    http://thebuildingcoder.typepad.com/blog/2009/07/revit-form-creation-api.html
    The form creation labs mentioned at the end of that presentation create free-from surfaces from points, so that should enable what you are asking for. You should also check out Zach’s blog:
    http://thebuildingcoder.typepad.com/blog/2009/07/practical-notes-on-impractical-things.html
    Cheers, Jeremy.

  28. Ha ha – OK, I´ll redraw that statement, and change it to:
    “Most architects/designers (Not programmers), find that Revit (Out Of The Box), has limited modeling tools in the family editor (disregard conceptual mass´s)”
    Besides that :-) Thanks for pointing me to the Revit Form Creation API ! Now I “just” need to learn some programming… Thanks again !

  29. Dear Klaus,
    Oh, well I know next to nothing about actually using Revit, so I cannot comment on that part.
    Good luck learning programming, and watch out for the addictive side effects :-)
    Cheers, Jeremy.

  30. Kees Barnhoorn Avatar
    Kees Barnhoorn

    Jeremy,
    Thank you for writing all the helpful blogs! I use them very often.
    But now I have a little question. Is it not possible to create an in-place family trough the API? I am looking for an answer on the internet. But I can’t find a clear answer or solution. Can you help me?
    Thanks
    Kees

  31. Dear Kees,
    Thank you for your appreciation!
    Here is a very clear and short answer to your question: No.
    It is currently not possible to create an in-place family programmatically.
    You can easily work around this by creating a standard family in the background and inserting an instance of it into the model.
    Cheers, Jeremy.

  32. bhavana Avatar
    bhavana

    Hi Jeremy,
    Thaks for your valuable support.
    I have a requirement where i need to show 3 dimension view of revit families in web application.
    Please suggest how can i crete 3d image of revit families.
    Regards,
    Bhavana

  33. Dear Bhavana,
    Thank you for your appreciation.
    I have actually had similar requests in the past, and created some sample code that solves the problem. I would very much like to publish this, but it still needs a little bit of cleaning up and testing.
    I will send you the sample code as it stands right now if you promise me to clean it up and return the working solution that you create from it.
    Deal?
    Cheers, Jeremy.

  34. sangsen Avatar
    sangsen

    Hi..jeremy..
    I have Revit family mapping issue,because family naming varies from version to version and countrywise also.plz help me to solve it.
    In revit 2012,librarypaths() method return library path as “C:\ProgramData\Autodesk\RST 2012\Libraries\South Asia\”.But i am actually have “C:\ProgramData\Autodesk\RST 2012\Libraries\India\”.Is it problem with installation?.

  35. Dear Sangsen,
    I really don’t know, nor do I have any idea how to find out. I would contact product support on this if I were you.
    By the way, I passed on your other question on library paths to my colleagues but have still not heard back from them:
    http://thebuildingcoder.typepad.com/blog/2011/04/revit-2012-wikihelp-overview.html?cid=6a00e553e168978833014e61196c5b970c#comment-6a00e553e168978833014e61196c5b970c
    I’ll let you know when I find out anything.
    Meanwhile, you can of course always use the API to set the library paths as you wish via the ControlledApplication LibraryPaths property:
    http://thebuildingcoder.typepad.com/blog/2009/08/library-paths.html
    Cheers, Jeremy.

  36. I have setup project parameters from a shared parameter file which contains custom attributes/labels for use with my titlesheet.
    I can access these from project information – can you point me in the right direction on how I can access these via API.
    I want to be able to load these values from the current selected sheet onto a custom form (each label value into a textbox) and export these values to SQL.

  37. Hi Jeremy Tammik,
    I want to create a template family (rft) but without using the exiting family template file. Is there a tool to do it?
    Means that I want to design an unprecedented file. For example, the symbol rebar system.
    Thank a lot.

  38. Dear Du Nguyen Phuoc,
    Sorry, no way.
    Cheers, Jeremy.

  39. Dear Jeremy Tammik,
    The *.rft file, can only Autodesk Create ? I think we can code it.

  40. Dear Du Nguyen Phuoc,
    As far as I know, only Autodesk can create RFT files. The Revit API enables creation of RVT and RFA. If you know of any method to achieve this, please let us know. Thank you.
    Cheers, Jeremy.

  41. Hello Jeremy,
    I think,It is possible to create RFT file
    First create RFA file and rename file extention then It will work as RFT file.Am i wrong?
    Best Regards
    Prasad

  42. Dear Prasad,
    I really have no idea. Have you tried it out? Does it behave well? Can you successfully create new families from the template that you created? What do other people say about this solution? Have you researched on the Internet for observations made by others trying this?
    Cheers, Jeremy.

  43. Dear Jeremy,
    Yes,I have done it few months ago.I havecreated RFT file as following steps.
    First open Generic model template
    then add some Ref plans and needed parameter to template
    then save it as Rfa
    Rename extension
    Best Regards
    Prasad

  44. Dear Prasad,
    Cool. Thank you for the confirmation.
    Cheers, Jeremy.

  45. Thanks to geniuses like you. Software, technology, and engineering can progress! Science is an art thanks to you Germans =D
    I am very fascinated with Revit and I love using it for designing buildings simply because there is no other practical way… You can turn a napkin ‘elevation overlay’ sketch into a virtual building very quickly. I love it!!!
    Recently. One thought that came across. Is it possible to create ‘linked’ network central database that organizes/contains wall types, details, families, materials, regular/shared parameters, company standards (annotation, view templates, those types of things….). This database would be managed by few with admin access. However, there should be a temp dump folder for new developing families/detail during earlier stages that can be accessed and updated the same way, however, this will be less strict and accessible to select people.
    Overall. It would be nice to have a database of components that are created once, organized once, and updated once updating all the projects that depend on this without having to do transfer project standard or copy/load things manually. It is a HUGE hassle trying to organize certain things for multiple projects. There always seems to be things I don’t want in the Revit file. In the end it creates a mess and it just bloats the file with junk and it slows down the performance…
    The interface handling would be the most interesting workaround. How do you know what your database elements are versus everything else… There should be four possible subcategories in order to know which:
    Database elements (used for standards/production).
    Developing database elements (in the works/early design/or user defined)
    Unreconciled elements (elements that are copied from foreign projects that live in the actual file itself/not organized correctly)
    Then system family/element (non editable elements that are defaults by the software).
    Now in order to see what each element is. There should be an automatic description labeled for each element, and an automatic filtering hierarchy once the element exists in the database. For example element would be something like ‘6″Stud-Plaster (Material/Color)_DATABASE ELEMENT‘ This family would only exist inside the linked database, and once updated it will automatically update all instances in all projects. In order to choose and create from the drop down selection window. It will be in a category:
    Basic Wall/
    DATABASE ELEMENT*/(Wall Type)
    This is just a thought. But, if anything like this exists please let me know. If it does not exist I am sure you can create in a day or two, I’ll buy you a few beers =D.
    Thanks,
    Corbin

  46. Dear Corbin,
    Thank you for your idea, enthusiasm and appreciation.
    Sure, something like what you suggest is certainly doable and is being done all over the world today.
    I would just raise your time estimate a teeny weeny little bit…
    Cheers, Jeremy.

  47. I have been trying to place a dwg into a generic annotation, but there is no named view in a generic annotation family, is there a way to import a dwg into this type of family?
    Thanks for any guidance you can give,
    Drew

  48. Dear Drew,
    Same answer as always (well, often): can you place the DWG manually, through the user interface?
    If so, it is probably possible programmatically as well. You can explore the manually generated model using RevitLookup and other tools to determine how and where the DWG was placed, and then reproduce that by coding.
    If not, then it is probably not possible through the API either.
    Cheers, Jeremy.

  49. Thanks Jeremy, I will look into RevitLookup, much appreciated.

  50. Using RevitLookup I found that of the 2 views in the family (“Sheet” and “Project View”) its actually the “Sheet” view that the annotation gets placed into, so I was trying to import into the wrong view when I was trying to import into “Project View”, Thanks again for pointing me to RevitLookup

Leave a Reply to zorcadCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading