I have a C# code that allows users to select a pipe or a duct and can retrieve the lenght property from it. Since I am new to Revit API, I was wondering is there a way to spilt a pipe/duct into specified length. For example, if I have a 50" pipe, I need to split it into 5 pipes of 10" each.
I would greatly appreciate any input. Thanks in advance.
As far as I know, there's no single method for doing the split in API. If you are going to do your own split method, you have to consider following steps
1. disconnect pipe/duct (curve) from the other end if connected
2. disconnect possible tap connections (and store them some how)
3. shorten the curve
4. Create new curve and place it correctly plus connect the other end if needed
5. set similar parameter values that was in original curve
6. reconnect the taps to correct curve
Optionally you can delete the old curve totally and create two new.
So as you can see, it's not the worlds simplest task to do and that's why I think it doesn't make sense to start copy-paste code here. So just go ahead and start coding :-) If you face some issues, let see if someone can help you with those.
Thank you for your suggestion. I have started working on the steps you mentioned since it makes complete sense. However, I was wondering if there a way to create new pipe filter, eg. coupling, which is used in Revit to spilt a pipe? If I could somehow create a new pipe coupling then I can place it at a defined lenght on a pipe. If possible, kindly provide a sample code for creating a new coupling.
Please let me know your thoughts on this. Thank you!
I wonder if you mean union? That's a good idea but unfortunatelly doesn't make our life easier. Union is created with Document::NewUnionFitting() method and it takes two connectors. So before you can install union, you have to have two ducts with open ends.
Thanks! I am looking for a flang and union kind of deal. I would appreciate if someone could provide more explanation on union and flages and the best logic to accomplish it.