System Family Creation

Here is a frequent query that came in once again today:

Question: I would like to create new system families in the Revit project, specifically wall families, to represent my stored database values including data such as material, thickness and other required properties.

I would like to use the API to create a new wall and assign the structural layers their function and material.
I would appreciate some advice how to achieve the creation of these system family types.

Answer: System families are built into Revit itself and cannot be modified, so the short answer to your question is simply ‘No, you cannot create new system families’.

On the other hand, just like standard families, the purpose of system families is to provide types or symbols for use in the building model.
The types are represented by the ElementType base class, and it provides a Duplicate method which allows you to create new types of the same family.

Some system families are exposed as classes to the API, such as Wall.
In that case, the Wall class and its properties and methods define what you can do with it, and the wall types are represented by the WallType derived from ElementType.

Here is some VB code taken from the discussion on

creating a new type
which
creates a new wall type using the Duplicate method, modifies it, and then assigns it to an existing wall:


  Dim wallType As WallType = wall.WallType
 
  Dim newWallType As WallType _
    = TryCast(wallType.Duplicate( _
      newWallTypeName), WallType)
 
  Dim layers As CompoundStructureLayerArray _
    = newWallType.CompoundStructure.Layers
 
  For Each layer As CompoundStructureLayer _
    In layers
 
    ' double each layer thickness:
 
    layer.Thickness *= 2.0R
  Next
 
  ' assign the new wall type back to the wall:
 
  wall.WallType = newWallType

For completeness sake, here is the same code in C#:


  WallType wallType = wall.WallType;
 
  WallType newWallType = wallType.Duplicate(
    newWallTypeName ) as WallType;
 
  CompoundStructureLayerArray layers
    = newWallType.CompoundStructure.Layers;
 
  foreach( CompoundStructureLayer layer in layers )
  {
    // double each layer thickness:
 
    layer.Thickness *= 2.0;
  }
  // assign the new wall type back to the wall:
 
  wall.WallType = newWallType;

In the current Revit API, you cannot create new layers in a wall type’s compound layer structure.

The work-around for this is to create the required number of layers manually and save separate wall types for each number of layers in the template file used to create your project.
Then, when your application needs a new wall type with a specific number of layers, it can use a suitable one of the manually created predefined wall types and duplicate and modify that.


Comments

21 responses to “System Family Creation”

  1. How to convert wall to my CurtainWallPanel?

  2. Dear Ismail,
    First find out how to achieve it manually in the user interface. Then explore the resulting model using RevitLookup. Then automate the process step by step.
    Cheers, Jeremy.

  3. Hi Jeremy,
    Is editing the structure of the wall possible yet in Revit 2014 API?

  4. Dear Chris,
    It has been possible since Revit 2012.
    Look for in CompoundStructure in
    http://thebuildingcoder.typepad.com/blog/2013/02/whats-new-in-the-revit-2012-api.html
    For further information, you can search for it globally:
    http://lmgtfy.com/?q=revit+api+CompoundStructure
    Cheers, Jeremy.

  5. myrevitbim@gmail.com Avatar
    myrevitbim@gmail.com

    Dear Jeremy,
    Is it possible to create a system families for products
    like raceways?
    If so could you guide me
    Thanks
    Ramesh

  6. Dear Ramesh,
    It is not possible to create any system families at all.
    Read the text above, please.
    Cheers, Jeremy.

  7. I’m trying to create a command that would turn off the level heads in specific views. Level lines were to remain, but heads were to be shut off. This will facilitate in creating “pretty drawings” without the effort of clicking off individual level heads in each view,which can sometimes be up to 10 additional clicks in multiple views.
    Here’s the problem: I’ve found the BuiltinParameter.Datum_Bubble_End_1 and 2, which allow me to globally turn off and on ALL the level heads, but this doesn’t allow me to do it per view. So I would be able to turn them all off and then in certain views I’d have to go back and turn them back on. I’ve found the visibility graphics controls which allow me to work per view, but since the lines are to remain I can’t use that.
    With Levels being a system family is there any way that I can toggle the visibility of the level head tag from within the API?

  8. RevitArkitek Avatar
    RevitArkitek

    It doesn’t appear to be exposed in the API yet. Just like Section “Gaps in Segments” and “Cycle Section Head” which are view specific.

  9. HOW TO CREATE SYSTEM FAMILY FOR MEP PIPE

  10. Dear Xiqx,
    Thank you for sharing this.
    Looks super cool to me.
    I wonder whether step 7 can be driven programmatically:
    “Go to the ‘R’ button (Application Menu) – Save As – Library – Group.”
    Cheers, Jeremy.

  11. This is very interesting, think it could be used to create new arrowhead type with code and predefine the lineweight? As sort of a way to get around the fact that the lineweight option is locked when you try and create some new arrowheads?

  12. Dear James,
    Yes, sure. If the arrowhead is a normal type, it should be possible to duplicate it and modify all properties that are not marked as read-only.
    Cheers, Jeremy.

  13. Hi Jeremy,
    can I remove WallTypes from Revit database throught .NET API?
    Cheers
    Veli

  14. Dear Veli,
    Yes, sure.
    You can actually remove most elements from the Revit database, if you wish.
    This is generally achieved by calling the Document.Delete method:
    http://thebuildingcoder.typepad.com/blog/deletion
    Cheers, Jeremy.

  15. Debdutta Nag Avatar
    Debdutta Nag

    Hi Jeremy,
    I actually want to create a schedule where I can get total length of a piping system including fittings.
    In order to do this I have created a Multi-Category Schedule, but the length field is not coming within this. I can add a shared parameter to calculate the length of fittings but the same is not possible to pipe properties.
    Kindly guide me to solve the issue.
    Thanks,
    Debdutta

  16. Dear Debdutta,
    I am not an expert on schedules, but I would imagine that if all else fails, you can simply create a shared parameter for all pipes and populate that on each pipe element programmatically with the pipe length obtained from the distance between its start and end point.
    There are very probably other and better ways as well, though.
    Cheers, Jeremy.

  17. Dear Jeremy,
    I trying to get this to work but I am missing a reference or something.
    CompoundStructureLayerArray is unknown. What dll do I have to reference to get this class?
    Thanks for any help
    Christian

  18. Dear Christian,
    The Revit API used to include lots of custom collection classes such as CompoundStructureLayerArray.
    We have been working for years now on removing them and replacing them by generic collection classes instead.
    Here is an example of some commented out obsolete code and the new replacement for this specific case:

    //CompoundStructureLayerArray floorlayers
    //  = floor.FloorType.CompoundStructure.Layers; // 2011
    //
    //foreach (CompoundStructureLayer layer in floorlayers)
    //{
    //  thickness = layer.Thickness;
    //}
    CompoundStructure floorlayers
    = floor.FloorType.GetCompoundStructure();
    thickness = floorlayers.GetWidth();
    

    You can mostly find hints about these replacements in the What’s New sections for each release:
    http://thebuildingcoder.typepad.com/blog/2014/04/whats-new-in-the-revit-2015-api.html
    Cheers, Jeremy.

  19. Dear Christian,
    Cool, congratulations, I’m glad, and thank you for the appreciation!
    Cheers, Jeremy.

Leave a Reply