Create mass from rooms

Hi

I am trying to create masses from rooms, similar to some of the plug-ins that are commercially available. I am using Lunchbox’s room element collector and then extruding the curves to create a solid. But what type of element does it need to be for it to get into a Revit project environment? Presumably it needs to be a mass but I can’t see any nodes to create a mass, only solid. And solids aren’t appearing in the project.

Thanks

Dynamo_Mass

You can use ImportInstance.ByGeometry or ImportInstance.ByGeometries to import your Dynamo geometry into a project. However, if you want to create real (parametric) mass families you would have to take a different route. From the top of my head, I can think of two scenarios.

  1. Creating mass families in the project: Since the rooms are located in a project you cannot create masses there directly (the Revit API does not allow access to inplace families). You can circumvent this limitation by placing instances of parametrized mass families and changing their parameters upon placement. The obvious limitation to this is that you would need different mass families for different room shapes (square, L-shaped etc.).

  2. Creating masses in a conceptual mass family: You could store the vertices of all room boundaries in a spreadsheet (first Dynamo definition). Next, you could open a conceptual mass family and create masses based on the data in the spreadsheet (second Dynamo definition). This workflow has several limitations: a) the use of two separate definitions, b) there’s only one method for creating masses (Form.ByLoftCross Sections - there used to be alot more options in Dynamo 0.6.3 - let’s hope they make a comeback…) and c) you lose the ability to move the individual room volumes around independently in your project file.

In my opinion, none of these are ideal. :slight_smile:

Maybe someone else has a better idea…

room1) i fully agree with andreas’s post.

  1. to simplify your workflow see the picture.

prior to dynamo you have to do an area and volume computation in revit.

  1. another easy way (assuming that it is not important of what type is your mass) i 'd create a floor type with given height of roomheight. (here rooms have to be planar)

  2. everything else needs extra computation because you will have to distinquish shapes in floorplan like rectangular, combined, circular… and in section …

Revit API does not allow access to In-Place Families but it does allow access to Revit Family Templates.

Why can’t we create a custom Dynamo Node to do the following:

 

  1. Begin a Revit Transaction

2.Open The Revit Mass Template File from Path and Name it with a String

3.Place the Room Boundary Curves From Room Collector into the New Revit Mass File according to 0,0,0

  1. Extrude the Room Boundary Curves Based on the Height From the Room Instances and the Sketch Plane From the Room Level

  2. Apply Room Color to Extrusions Based on Department Color

  3. Insert the New Mass Family Into the Revit Project Revit Project

Basically, most of the commercial plugins are doing something along those lines. Why cant a Node be created using C# or Design Script do the same steps.

How about grabbing the Room Boundary Curves from the Revit Database and then putting them into family document via the API.

Can this level of code be put into a Dynamo Node (http://forums.autodesk.com/t5/revit-api/create-mass-from-room/td-p/3674458):


// Create family doc from template
Autodesk.Revit.DB.Document familyDoc = app.NewFamilyDocument(@“C:\ProgramData\Autodesk\RV​T 2013\Family Templates\English\Metric Generic Model.rft”);

// Save the new Family - room is Room Element not defined in this sample code
string fileName = @“C:\Temp” + room.UniqueId.ToString() + “.rfa”;
familyDoc.SaveAs(fileName);

Transaction transaction = new Transaction(familyDoc, “RoomToMass”);
transaction.Start();

// Get the room boundary
SpatialElementBoundaryOptions opt = new SpatialElementBoundaryOptions();

IList<IList<Autodesk.Revit.DB.BoundarySegment>> segArray = room.GetBoundarySegments(opt);

CurveArray curveArray = new CurveArray();

// Iterate to gather the curve objects
foreach (IList<Autodesk.Revit.DB.BoundarySegment> bSegments in segArray)
{
foreach (Autodesk.Revit.DB.BoundarySegment bSegment in bSegments)
{
curveArray.Append(bSegment.Curve);
}
}

// Origin point and normal point that gives the extrusion direction
XYZ ptOrigin = new XYZ(0, 0, 0);
XYZ ptNormal = new XYZ(0, 0, 1);

// The plane to extrude the mass from
Plane plane = app.Create.NewPlane(ptNormal, ptOrigin);
SketchPlane sketchPlane = familyDoc.FamilyCreate.NewSketchPlane(plane);

// Add the CurveArray to a CurveArrArray
CurveArrArray curveArrArray = new CurveArrArray();
curveArrArray.Append(curveArray);

// Extrude the form 10 feet as test
Extrusion extrusion = familyDoc.FamilyCreate.NewExtrusion(true, curveArrArray, sketchPlane, 10);

transaction.Commit();

familyDoc.Save();

// now need to place the family…


Why isn’t that possible? Because afaik switching between documents is currently not possible in Dynamo. So you can either perform your operation in the project file directly or divide your workflow into several graphs - one for each file you’re working in.

The fact that the Revit API does not allow access to in-place families seems pretty dumb to me. Creating a family with the room masses in it is a good workaround but it would really restrict the control you have on manipulating the geometry. It would be really interesting to hear from CASE on how they got around these issues in their plug-in. (http://apps.case-inc.com/content/subscription-extrude-rooms-3d-mass)

In the end I used Peter’s methodology of import instances. The geometry is completely unusable in Revit but I just exported to *dwg for analysis in Grasshopper.

Another annoying issue is that although it’s possible to extract a room’s correct bounding curves according to the room area computation setting, room volumes are always computed to the wall finish (http://knowledge.autodesk.com/support/revit-lt/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/RevitLT-Model/files/GUID-06B6BB18-C968-4A7E-9147-65C294288F64-htm.html) More workarounds for what you would think would be a pretty simple task…

Its good to know upfront that Dynamo can not switch between Documents. It would have been neat to be able to take all of this Dynamo Geometry and automatically place them in Family Docs with a Node.

 

Is there a way to set the type name of an ImportInstance. They are currently coming is as a bunch of random numbers - ‘ea72aa33-a27…’. I’m trying to get them to be named the same as the room number the import instance was created from. Both ‘Element.SetName’ and ‘Element,SetParameterByName’ are failing. Thanks

 

Rooms to mass

Try this sequence: ImportInstance.ByGeometry > Element.Type > Element.SetName

1 Like

That was it. Thanks for your help Andreas

 
Room to mass working

Is it possible to create masses from areas using Dynamo?

Hi David

Yes it is possible to create masses from areas. I have updated the BVN package (0.1.10) to include two new nodes:

  • Area.ElementCollector - This is based on Nat Miller's LunchBox Room collector. I just changed which element it is collecting. Can't really take credit for that.
  • Area.ImportInstance - This will place important instances from areas. I believe that only 'Spaces' have a volume (assuming 'area and volume' is selected under area and volume computations). If we are talking about areas (GFA, GBA, etc) then it is 2D. This custom node extrudes the polycurve of the area to the next level above. It also uses mm, so if you are using feet, you'll have to adjust. Please note that the custom node is not currently working properly when used as a custom node. I need to dig deeper to find out why. I'll let you know. But if you edit it and then cut and paste it into a new workspace, it will work.
1 Like

hi Paul, is it still working now? seems no more Element.Type and Element.SetName in current OOTB Dynamo

Element.Type and Element.SetName are from the Clockwork package.