Placing Pipe accessory

Placing Pipe accessory

ameer.mansourWAK8Y
Advocate Advocate
1,588 Views
4 Replies
Message 1 of 5

Placing Pipe accessory

ameer.mansourWAK8Y
Advocate
Advocate

I have tried to Place Pipe accessory using Revit API 

 

 

 

_mainDoc.Create.NewFamilyInstance(_placmentPt, familySymbol, _refDir, _mepEle, StructuralType.NonStructural);
//_refDir is same direction of pipe
//_mepEle is the host

 

 


but using this method is not rotating the Pipe accessory like in this video. It places the accessory perpendicular to the pipe and no way to rotate it and also it doesn't divide the pipe as shown in this picture.after placmentafter placment

 

So how to do such behaviour using Revit API ?

1,589 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

I am not sure you are using the right NewFamilyInstance overload.

 

I am not sure that a pipe fitting has any host element at all.

 

This article uses a different, and simpler overload:

 

https://thebuildingcoder.typepad.com/blog/2010/08/flex-duct-start-tangent.html

 

Maybe that will let you place the fitting in the proper orientation?

 

You may want to place the fitting first, before adding the pipe elements.

  

Here are some explorations on finding the right overload:

 

https://thebuildingcoder.typepad.com/blog/2011/01/newfamilyinstance-overloads.html

 

Please refer to the series on different ways to implement a rolling offset to see how you can choose between either inserting fittings or pipes first:

 

http://thebuildingcoder.typepad.com/blog/2014/01/final-rolling-offset-using-pipecreate.html

  

 

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

MarryTookMyCoffe
Collaborator
Collaborator

unfortunately, there is no method like this. You need cut pipe, insert instance, rotate and than connect with pipe, there is just no better way.

-------------------------------------------------------------
--------------------------------|\/\/|------------------------
do not worry it only gonna take Autodesk 5 years to fix bug
0 Likes
Message 4 of 5

ameer.mansourWAK8Y
Advocate
Advocate
            if (_refDir.Z != 0)
            {
//this is what i understood from https://thebuildingcoder.typepad.com/blog/2010/08/flex-duct-start-tangent.html
                psfInstance = _mainDoc.Create.NewFamilyInstance(_placmentPt, familySymbol, StructuralType.NonStructural);
                //do rotation
                Line axis2 = Line.CreateBound(_placmentPt, _placmentPt+10*XYZ.BasisY);
                var angle = _refDir.AngleTo(XYZ.BasisY);
                bool success = (psfInstance.Location as LocationPoint).Rotate(axis2, angle);
            }
            else
            {
                psfInstance = _mainDoc.Create.NewFamilyInstance(_placmentPt, familySymbol, _refDir, _mepEle.level, StructuralType.NonStructural); // to overcome rotation in xy plane , this is the only overload that has refdir and it works well. the host here is the level containing Family Instance.
            }

2020-11-03_11-08-58.png

This is what I have done for the rotation, @jeremytammik  can you please take a look as the logic and variables are not clear in the link that you posted.

 

0 Likes
Message 5 of 5

ameer.mansourWAK8Y
Advocate
Advocate

I guess you are right. 


@MarryTookMyCoffe wrote:

unfortunately, there is no method like this. You need cut pipe, insert instance, rotate and than connect with pipe, there is just no better way.


but what do you mean by cut and connect?
cut ==> split ?

0 Likes