We already presented an analysis of the MEP connectors in Revit 2010, but a general introduction to the MEP-specific API is still missing. Or was, until today.
Question: What can I do with the Revit MEP API? What's new in Revit MEP 2010? Are there any additions or enhancements specifically for the MEP flavour? Any new content?
Answer: The Revit 2010 API has been strongly enhanced with new MEP-specific features. The main feature of the RME API is to provide read and write access to the Revit MEP model, including the following HVAC and piping data aspects and main components:
The classes MechanicalSystem and PipingSystem provide the following top-level system functionality:
The elements contained within a system are not automatically returned in the flow direction, and the TraverseSystem SDK sample demonstrates how to implement traversal in direction of flow for a given system.
The ducts and pipes are represented by the classes Duct, FlexDuct, Pipe and FlexPipe. They provide the following functionality:
The layout functionality can be driven by two points, one point and a connector, or two connectors.
The fittings are represented by family instances, which are created with dedicated Autodesk.Revit.Creation.Document methods New*Fitting, where * can be replaced by any one of Elbow, Tee, Cross, Takeoff, Transition, UnionFitting. The fitting properties can be accessed through the FamilyInstance.MEPModel property.
The MEP connectors are represented by different classes depending on the context. This caused some confusion, which is why this topic has already been discussed in a previous post. In a family document, during the connector definition, we use the specialised classes DuctConnector, PipeConnector and ElectricalConnector. In the project document, the connectors are represented using the Connector class. The connector features include:
For the element creation within a project environment, we have several new methods on the creation document:
To create the connector definitions within the family context, the FamilyItemFactory class accessed through the Document.FamilyCreate property provides the following new methods:
The Revit SDK includes the following new MEP-specific sample applications to demonstrate the use of the new functionality:
The first three demonstrate new RME API features, the fourth is an MEP-specific family API sample.
These samples were also presented in the recent Revit programming webcast.
The MEP contents have also been extended. One important new product feature is the interoperability with Inventor to support the MEP workflow.
Here is a vaguely related question on application compatibility between different flavours of Revit and between the 32 and 64 bit platforms:
Question: Will a Revit plug-in assembly created with the 32-bit Revit MEP 2010 API work on 32-bit Revit Architecture 2010 and in 64-bit Revit MEP or Architecture 2010?
Answer: If the plug-in makes use of MEP-specific functionality through the Revit API in some of its commands, then those commands will only work on Revit MEP. You can query what flavour of Revit your plug-in is currently running on and enable or disable certain functionality accordingly. The vast majority of the Revit API will work unchanged on all flavours.
Because the .NET framework creates assemblies that are not bound to a specific architecture, your application created in a 32-bit environment should also work unmodified in a 64-bit one. You need to test this, though, to ensure that you have not inadvertently bound it to 32 bits in some way.