Back to the beginning with a quick look at the Revit MEP API, and a great step forward for RevitPythonShell:
Question: I am trying to develop some Revit add-ins.
I would like to know how to enable the user to insert a predefined MEP component in a model and how to detect programmatically whether two components are connected, for example two pipes.
Could you please let me know where I can find the related information?
Do you have any related examples to share with me?
Answer: Welcome to the Revit API!
The Building Coder shares a wealth of information on getting started with the Revit API.
However, before you start even thinking about programming, it is important to gain some fundamental understanding of the BIM, the BIM paradigm and BIM processes.
Furthermore, you should determine in detail exactly how to address your task manually through the end user interface making use of the optimal workflows and respecting best practices, before you start trying to automate the task.
All the questions you raise are addressed by and demonstrated in the Revit SDK samples. The SDK can be downloaded from the official Autodesk Revit developer page.
MEP components are represented by family instances, so you can simply use generic code to insert a family instance.
However, there are also many MEP-specific enhancements that may or may not apply.
To determine whether two pipes are connected, you simply query them for their connectors, represented by
the Connector
class.
It has a ConnectorManager property.
That in turn proves access to the neighbouring parts' connectors.
System traversal is also demonstrated by some of the SDK samples.
In addition to the official sample material from Autodesk, you can also check out The Building Coder blog. My favourite articles from there on connecting pipes is the series exploring how to create a rolling offset.
Here are two other articles from The Building Coder on system traversal:
RevitPythonShell was apparently nearing the end of its active life when its author Daren Thomas moved on to other things.
Now new life has been breathed into the faltering project by Chuong Ho or Hồ Văn Chương, with numerous contributions:
So, now you can snoop your database directly in an interactive REPL command line console, a so-called read–eval–print loop, providing powerful database exploration functionality par excellence, never previously available to such an extent.
Here are some of the pull requests and issues implementing this:
Check out the demo video of RevitLookup snooping from the Python command line online or in this local copy.
The new RevitPythonShell release 1.0.1 includes:
Here is a direct link to the installer:
Ever so many thanks to Chuong Ho for this brilliant work!
Talking about REPL and loops, watch out...