Here is another short and sweet answer to a question that keeps popping up regularly:
Question: How can I change the length of a pipe using the Revit MEP API?
I am actually interested in programmatically splitting the pipe, but I cannot see any support for this in the API.
I tried to change the length of the pipe to indirectly cause a split, but the LocationCurve.Length property is read-only, so I cannot simply modify it.
Answer: I touched briefly on the topic of splitting a duct or pipe a long time ago, back in 2009.
As stated there, there is no built-in ready-made method to split a pipe or duct.
You can however create as many new ducts and pipes as you like using the NewDuct and NewPipe methods.
Also, although the LocationCurve.Length property is read-only, you can still modify it by simply assigning a completely new curve to the element Location property itself. We already discussed samples of doing so for a beam and a wall. The same approach can be used on a pipe as well, and obviously replacing the location curve can also change its length.
Finally, the whole operation of splitting pipes and ducts both by changing their lengths and by creating new elements is demonstrated by the Revit SDK samples, especially the AutoRoute and AvoidObstruction ones:
- AutoRoute: Route a set of ducts and fittings between a base air supply equipment and two terminals.
- AvoidObstruction: Detect and resolve obstructions between ducts, pipes, and beams.
The most common use for duct piping in residential construction is to shorten the amount of flex duct required to connect the duct truck line to the register. Flex duct has a higher rate of friction loss than smooth duct pipe and, therefore, adding round pipe to your duct system increases the efficiency of your system.
Posted by: speedfit pipe | May 13, 2012 at 08:08
Hi Jeremy,
How to split a model line at point?
Regards,
Posted by: Bang | July 19, 2013 at 04:15
Dear Bang,
You can modify the existing line's curve's endpoint to shorten it as desired.
You will have to create a new second model line to replace the missing part, though.
Cheers, Jeremy.
Posted by: Jeremy Tammik | August 13, 2013 at 09:36
I created a flex duct with the API through the Document.Create.NewFlexDuct(Connector1, Connector2, FlexDuctType) method. But now I want to change the flex duct size to match the connector size at my diffuser. This should be simple enough, but MEPCurve.Diameter is read only, I can't edit it. Is it possible to change flex duct size through the API?
Posted by: Ryan | November 08, 2013 at 15:13
Dear Ryan,
I would say yes.
Indeed, the MEPCurve.Diameter is read only, because it is driven by the entire duct system.
You can change the dimensions by editing the connectors, I believe, or by adding a fitting somewhere in between.
Look at the Connector Height, Width and Radius properties, for example. They are all read-write.
I would also expect the duct size to update automatically as soon as you connect it to the diffuser.
Cheers, Jeremy.
Posted by: Jeremy Tammik | November 12, 2013 at 10:42
Jeremy, thanks for the help. We were able to get it to work finally. We created an MEPCurve from the flex duct, a connector set from the MEPCurve, then changed connector radii of the connector set to equal the diffuser connector size. Now we can draw flex duct in a section view.
Posted by: Ryan | November 19, 2013 at 11:02
Dear Ryan,
Thank you for the appreciation and explanation.
I am very glad it helped.
Cheers, Jeremy.
Posted by: Jeremy Tammik | November 19, 2013 at 11:08