I migrated the ADN Revit Structure API training material to Revit 2013, which led me to put together the following summary of the structural API enhancements and some details of the migration steps:
Revit Structure 2013 API Enhancements
I mentioned a few structure specific enhancements in the Revit 2013 API. They are discussed in somewhat more detail in the DevDays Online presentation on What's New in Revit 2013 and the complementary Revit 2013 API webcast, of which the first half provides an introduction to the Revit API in general, and the second covers some new 2013 specific features in more depth.
Actually, it was the webcast preparation that prompted me to start performing the migration described below, which in turn prompted me to publish the result and summarise the changes.
To recap, the structural enhancements include:
Structural Product Related Enhancements
Before we get to the detailed API changes, here are some notes on the main product goals and features:
Reinforcement detailing to help extend the BIM lifecycle from design to construction through detailing and fabrication:
- Area/path reinforcement to host real rebar and set
- Welded wire mesh
- Reinforcement fillets and hooks
- Additional reinforcement units
- Rebar cover
Structural analysis in BIM moving towards delivering structural analysis in the cloud and supporting partner ecosystem growth by
- Results storage, visualization and exploration in RST
- Improved analytical models for surface elements
- Seamless workflow between RST/RSA
- Improved rigid links
Structural analysis web service and visualisation to democratize analysis and make it more accessible, easy to both use and provide. Long term, we would like to deliver structural analysis in the cloud and thus support partner ecosystem growth. Support for modal and deformation analysis, enhanced results visualization.
Enhanced physical properties to centralize analysis workflows around BIM data and improve the efficiency of BIM-based analysis workflows.
- Extended thermal and structural properties of building envelope
- Material authoring and library management workflows
- Foundation for material ecosystem
- Data flow with key Building Performance and Structural Analysis applications
Now let's look at how these changes affect the API:
Reinforcement
The Rebar class provides a number of new methods and properties:
- CreateFromCurvesAndShape
- GetBarPositionTransform
- GetBarExistsAtPosition
- GetHookTypeId/SetHookTypeId
- RebarShapeMatchesCurvesAndHooks
- ScheduleMark
- TotalLength
- Volume
The Rebar.GetCenterlineCurves method takes new arguments to control
- Adjustment for self-intersection
- Inclusion of hooks
- Inclusion of bend radius curves (fillets)
The BarDescription class is now obsolete and replaced by the new RebarInSystem class representing a bar in an AreaReinforcement or PathReinforcement system, providing access to individual rebars in a system and the ability to switch back and forth between system and individual elements.
A new class ReinforcementSettings is provided. When ReinforcementSettings.HostStructuralRebar is true, area and path reinforcement elements create individual rebar elements that participate in views and schedules. The individual RebarInSystem elements have the same graphical representation and parameters as Rebar elements, and have the same API methods for inquiry. Since the RebarInSystem elements are almost entirely controlled by their area or path system element, they lack most of the modification methods of the Rebar class.
These two system classes now have types, and provide new members to retrieve system members, curve boundaries, remove an element and convert its bars into standard rebar via the new methods GetRebarInSystemIds, RemoveAreaReinforcementSystem, and RemovePathReinforcementSystem.
Welded Wire Mesh
- FabricSheet
- Planar sheet of welded wire mesh
- Created and cut by FabricArea
- Option to automatically add symbols and tags
- FabricArea
- Creates and manages a distribution of FabricSheets
- Allows sketched welded wire mesh objects
- Planar hosts only, identical criteria to Area and Path Reinforcement
- Related type classes
- FabricAreaType provides identity data
- FabricSheetType includes uncut dimensions, wire sizes and layouts
- FabricWireType defines wire diameter
Physical Properties
- Structural family instances support additional structural material element
- Structural and thermal material assets can be shared and set on materials
Structural Analytical Model
- New element type AnalyticalLink
- Created between two analytical elements, e.g. a beam and a column
- Two kinds of links: user-defined and automatically generated
- Access link properties like "fixity state"
Analysis Visualization Framework
- Support for deformed shapes as part of AVF display
- AnalysisDisplayStyleDeformedShapeTextLabelType
- AnalysisDisplayDeformedShapeSettings input argument to new CreateAnalysisDisplayStyle override
Revit Structure Labs RstLabs Migration
As said, I migrated the Revit Structure API material from 2012 to 2013, starting with the labs RstLabs. The standard steps are getting to be a habit, after already completing the The Building Coder samples, ADN Revit API training labs, AdnRme Revit MEP API and extensible storage samples:
- Updated the Revit API assembly references.
- Set the target .NET framework version to 4.
- Removed the warnings caused by calls to the Element property in VB, represented as a call to the get_Element method n C#, replacing them by the new Revit 2013 GetElement method, which has the advantage of looking identical in both languages.
After that, no warnings remain.
There are four errors, though, which all are caused by the removal of the LOAD_USE_LOCAL_COORDINATE_SYSTEM_HOSTED built-in parameter.
Since the parameter value retrieved is not used anywhere and the call is just to demonstrate the retrieval of a parameter value in general, I simply commented out the offending statements.
New Revit Structure Labs NewRstLab Migration
Standard stuff, same as before: change the Revit API assembly references, .NET framework version, and replace the use of the Element property by calls to GetElement.
I also replaced the test for a concrete column by new code, since the MaterialConcrete class no longer exists in Revit 2013. Here is the old code I replaced:
MaterialSet materials = column.Materials; MaterialConcrete matConcrete = null; foreach( Material mat in materials ) { // cast it to concrete material matConcrete = mat as MaterialConcrete; break; } if( null == matConcrete ) { messages = "The selected column is not concrete"; trans.RollBack(); return Result.Failed; }
The new code is much clearer and simpler:
if( StructuralMaterialType.Concrete != column.StructuralMaterialType ) { messages = "The selected column is not concrete"; trans.RollBack(); return Result.Failed; }
Revit Structure AVF and DMU Sample RstAvfDmu Migration
RstAvfDmu is a dual sample by Saikat Bhattacharya on using the analysis visualisation framework AVF and the dynamic model update DMU in the context of Revit Structure.
The only significant change required is due to the GetCenterlineCurves method taking some additional arguments in Revit 2013:
// For this we first access // the rebar line geometry //Line rebarLine = rebar.Curves.get_Item( // 0 ) as Line; // 2011 //Line rebarLine = rebar.GetCenterlineCurves( // false )[0] as Line; // 2012 Line rebarLine = rebar.GetCenterlineCurves( false, true, true )[0] as Line; // 2013
Materials
Here is rst_2013_2012-06-12.zip containing the result of my efforts so far, the Revit Structure 2013 versions of RstLabs, NewRstLab and RstAvfDmu.
The Revit Structure link sample RstLink is not yet completed, nor have I yet updated the Revit Structure API slide deck.