Combine Pipe Elements Seamlessly

Combine Pipe Elements Seamlessly

Anonymous
Not applicable
2,547 Views
6 Replies
Message 1 of 7

Combine Pipe Elements Seamlessly

Anonymous
Not applicable

I seem to be struggling with combining two pipe elements seamlessly.

 

Let's say I have two pipes that had a coupling between them but are otherwise of uniform pipe type, diameter, etc... I would like to programatically delete the coupling and join the pipes together into a continuous run. Essentially the opposite of PlumbingUtils.BreakCurve

 

In the UI if you delete the coupling then drag one end onto the other it will work as desired and turn the two pipes into one continuous pipe length.

 

I have tried a number of approaches and must be overlooking something simple.

 

If you use Pipe.Create between the two pipe connectors it will create the short segment of pipe and connect them, but you now have three pipes.

 

If you modify the Location.Curve of one pipe to extend it to the end of the second pipe and use Connector.ConnectTo you end up with 2 pipes still.

 

Trying to manual send Document.AutoJoinElements() does not appear to do anything.

 

Attempting to mimic the result from the manual UI input is important to maintain any additional Tap connections etc... so replacing the second pipe by extending the first pipe and remaking all connections is preferably avoidable. When performing the action via the UI the new seamless pipe has the same ID as the dragged extended pipe (expected) and all taps that were previously on the second pipe maintain their original ID implying they were not recreated.

0 Likes
2,548 Views
6 Replies
Replies (6)
Message 2 of 7

Kevin.Lawson.PE
Advocate
Advocate

Delete the coupling, then get the two open connectors and use Connector1.ConnectTo(Connector2) :  https://www.revitapidocs.com/2020/04ee99c9-f411-aabe-7b87-013a6f9adb1d.htm

 

If the routing preferences for the pipe type includes a coupling, it may add a coupling back in.  

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Message 3 of 7

Anonymous
Not applicable

Hello, as mentioned in the OP this does not accomplish the desired effect. This leaves you with two sections of pipe, the goal is to mimic UI behavior.

 

ncAJsfh.png

  1. Before connection
  2. Pipe.Create referencing the two closest connectors
  3. Extending one pipe and Connector.ConnectTo
  4. Connected via UI

The goal is to mimic #4 to turn it into a single length of pipe while maintaining all previous connections such as taps with their old IDs

0 Likes
Message 4 of 7

Kevin.Lawson.PE
Advocate
Advocate

Hmmm.  Are you using doc.Regenerate(); after the ConnectTo() command?  

 

I know pipe transitions won't assume the size of they pipe until you regenerate the document.... 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Message 5 of 7

Anonymous
Not applicable

Yes, I have attempted doc.Regenerate() and doc.AutoJoinElements(). I have played around with trying these in different transaction instances as well, for example different combinations such as the following or in entirely different transactions:

 

t.Start()

c.ConnectTo(c2)

t.Commit()

t.Start()

doc.Regenerate()

t.Commit()

 

They are definitely connected, but the pipe is not combining for me as it does in the UI version. I get the same results in 2018 and 2019. 

0 Likes
Message 6 of 7

Anonymous
Not applicable

Bump - any ideas?

0 Likes
Message 7 of 7

Kevin.Lawson.PE
Advocate
Advocate

Try regenerating the document before committing?

 

t.Start()

c.ConnectTo(c2)

doc.Regenerate()

t.Commit()

 

Other than that I'm out of ideas.  You may have to collect things attached to the 2nd pipe, delete the 2nd pipe and extend the 1st, then reconnect everything to the 1st pipe.  

 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes