How to create a tee fitting of not 90 degree branch angle for pipe by Revit API?

Anonymous

How to create a tee fitting of not 90 degree branch angle for pipe by Revit API?

Anonymous
Not applicable

Hi,

When I use Revit ribbon drawing function, it is easy to create a tee fitting of any branch angle for pipe. 

QQ截图20181129171929.png

But when using NewTeeFitting method to do it, if the angle of branch is not 90 degree, then an InvalidOperationException throw. How can I create a tee fitting of not 90 degree branch angle for pipe by Revit API?

 

Best Regards,

Zhangzg

0 Likes
Reply
Accepted solutions (1)
6,405 Views
19 Replies
Replies (19)

JimJia
Alumni
Alumni

The failure may be caused by default fitting type after tee fitting creation, you can try to change the default fitting type to appropriate & desired fitting type.  

 

Per my knowledge, the default fitting type is determined by routing preferences setting of pipe/duct/cabletray(you can refer to Revit SDK sample RoutingPreferenceTools on more details.), but I have no idea why it fail. 

 

In order to explore this matter further, we will need to provide a minimal reproducible case for the development team to analyse in depth.


In order to understand exactly what you mean and be able to research possible reasons for the discrepancy between the observed and expected behaviour, they require:
· A short exact description of what you are trying to achieve.
· The behavior you observe versus what you expect, and why this is a problem.
· A complete yet minimal Revit sample model to run a test in.
· A complete yet minimal macro embedded in the sample model or Visual Studio solution with add-in manifest that can be compiled, loaded, run and debugged with a single click to analyse its behavior live in the sample model.
· Detailed step-by-step instructions for reproducing the issue, e.g. which element to pick, what command to launch etc.
· http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

Anonymous
Not applicable

Hi  

 

 

 

 

Best Regards,

0 Likes

JimJia
Alumni
Alumni

Dear Zhigang,

 

Yet another point we have to consider is: please ensure the connector order is correct when calling NewTeeFitting API, you can find the connectors order in the family editing document.

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

Anonymous
Not applicable

Hi  

 

 

Best Regards,

0 Likes

JimJia
Alumni
Alumni

Dear Zhigang,

Can you provide a reproducible case for it? I can help to forward this to engineering team to investigate.

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes

adam.krug
Advocate
Advocate

Maybe it's a problem of units? 90 degree is 1,5707963267949 (0,5 * PI) in Revit internal units.

0 Likes

Anonymous
Not applicable

Hi  

 

 

Best Regards,

0 Likes

Anonymous
Not applicable

Hi adam

 

Thank you for your reply.

 

I am sure I have used the correct angle units. When the angle is 90 degree, it is OK; but When the angle is not 90 degree,  for example 45 degree, it failed.

 

Best Regards,

0 Likes

Shai.Nguyen
Advocate
Advocate

I have same issued. Do you have solution?

0 Likes

jlpgy
Advocate
Advocate
Accepted solution

Hi Zhang:

There is a property named as Angle in the class Connector. It has both get and set accessors.

U can calculate an valid angle value, disconnect the Tee slave element (pipe, etc.), set the Connector.Angle property to a new value, and then connect the Tee connector back to the slave pipe again.

U can use RevitLookup to inspect the Angle property before you get down to writing codes.

 

Notice that:

When you try to re-connect the Tee to the pipe again, you can use Connector.ConnectTo(), but this method sometimes leads to generation error when dealing with Conduit. For my own experience, I suggest using NewTransitionFitting() method. If two connectors are parallel, in opposite directions, with same sizes, and with same self-rotation, the NewTransitionFitting() method doesn't create a real transition fitting, but only connect two connectors.

 

I hope this helps.  🙂

单身狗;代码狗;健身狗;jolinpiggy@hotmail.com

Shai.Nguyen
Advocate
Advocate

Dear Yulong,

Following my understand, I have to take 3 step to create tee fitting with angle.

Step 1: Create tee with valid angle

step1.PNG

Step 2: Modify angle to parallel with slave pipe.step2.PNG

Step 3: Extend the pipe by NewTransitionFitting()

step3.PNG

But I'm stuck at step 1, how to create tee fitting with 2 connectors?

0 Likes

Revitalizer
Advisor
Advisor

Hi,

 

you could create a dummy pipe which provides a valid third connector.

After creating your tee, delete this dummy pipe.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Shai.Nguyen
Advocate
Advocate

wonderful idea! I will try thanks so much!

0 Likes

jlpgy
Advocate
Advocate

Hi:

Yep! As @Revitalizer has already explained.

In our solution, we also create a perpendicular MEPCurve element with the same qualifications as the main Tee element. This temp element provide the third connector.

Be aware that you should calculate the cross point ahead to meke sure the Tee fitting will be located at the correct location.

单身狗;代码狗;健身狗;jolinpiggy@hotmail.com
0 Likes

Shai.Nguyen
Advocate
Advocate

@Revitalizer@jlpgy

Hi both,

After calculate the side of dummy and create NewTeeFitting, I've met 2 situations, that I don't know what's the correct Angle I have to set to connector.angle:

Case 1: set 45 degree to Angle

th1.PNG

Case 2: or 135?

th2.PNGBoth 2 case are correct. But I dont know how to find correct one.

Please advise. Thank you.

0 Likes

jlpgy
Advocate
Advocate

Hi:

It depends on the implementation of the Tee fitting family.

Suggest you double click the Tee fitting to open it's family document, and then check the angle parameter and inspect how it is bound to other parameters.

If you are using the default Revit libraries, and the default pipe fittings, I think it should be the angle between the connector3 and connector1. But I'm not quite sure. It totally depends on how the Tee fitting family is implemented, especially its parameter binding.

单身狗;代码狗;健身狗;jolinpiggy@hotmail.com
0 Likes

fawzimasri7137
Advocate
Advocate

Hi,

I am having similar issues dealing with the angle of a Wye that i would like to insert in place of a Tee.

For my test i simply used the out of the box TEE and renamed it as a Wye, and tried to replace it using NewTeeFitting, but first i set my preferences to pick up the Wye family as default and not the Tee family.

i posted this here : https://forums.autodesk.com/t5/revit-api-forum/replace-a-family-instance-with-another-family-based-o...

 

Do you mind commenting on my code in the link above and give me some pointer on how you ended up dealing with it?

 

thanks

 

 

0 Likes

tom.zhengGNS4G
Contributor
Contributor

Have any of you tried connecting pipes with slopes to TeeFittings with angles? I have successfully implemented TeeFittings with angles using the aforementioned method. However, when attempting to connect pipes with slopes, I encountered a slight issue. The pipes connect successfully, and the slopes are correct. However, visually on the drawing, the pipe appears to be broken (it automatically connects when moving the TeeFitting). I have tried various methods and found that changing the pipe slope seems to cause this issue. I would like to understand why this problem is occurring. Below is my connection method: I use "PlumbingUtils.BreakCurve" to cut the main pipe -> generate a pipe perpendicular to the main pipe -> use "NewTeeFitting" to connect the main pipe with the previous pipe -> delete the perpendicular pipe -> change the angle of the TeeFitting -> connect the branch pipe.

Pink represents pipes with slopes, while gray represents pipes without slopes.
Pink represents pipes with slopes, while gray represents pipes without slopes.Pink represents pipes with slopes, while gray represents pipes without slopes.

0 Likes

steven_mKQLB6
Community Visitor
Community Visitor

This is a shocking discovery that the default API does not allow for non-90-degree tees.

 

@tom.zhengGNS4G , were you able to resolve the issue? Maybe you could intentionally move the newly inserted fitting by a tiny fraction to prompt it to generate itself, as you mentioned that moving it will connect it properly.

 

I'm also curious - what happens if the branch also comes in at a 45-degree angle vertically? Meaning it has a large Z vector. Instead of changing just the angle property of the tee, is there a way to match the connector to the connector of the branch instead?

0 Likes