Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Conduit Direction

8 REPLIES 8
Reply
Message 1 of 9
kireandreev
1332 Views, 8 Replies

Conduit Direction

kireandreev
Contributor
Contributor

Dear,

I have next situation in picture below:

 

conduits.png

 

 


I would like to connect this conduits with conduits fitting like red line. I am using this function:

doc.Create.NewElbowFitting(cond_connector2, cond_connector1); but appear next error message:

 

failed to insert elbow.

 

I guess that problem is in Directions;

How to solved problem?

 

Best regard.

 

0 Likes

Conduit Direction

Dear,

I have next situation in picture below:

 

conduits.png

 

 


I would like to connect this conduits with conduits fitting like red line. I am using this function:

doc.Create.NewElbowFitting(cond_connector2, cond_connector1); but appear next error message:

 

failed to insert elbow.

 

I guess that problem is in Directions;

How to solved problem?

 

Best regard.

 

8 REPLIES 8
Message 2 of 9
jeremytammik
in reply to: kireandreev

jeremytammik
Autodesk
Autodesk

Yes, that can be rather tricky.

 

I have heard of situations in which Revit is extremely picky about the directions you try to use, and the precision of their orientation.

 

I suggest you work through my series of articles on implementing a rolling offset:

 

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

 

Basically, as far as I can remember, it demonstrates two fundamentally different approaches:

  

  • Insert pipes first, then add fittings
  • Insert fittings first, then add pipes

 

In both cases, Revit can automate and simplify your task significantly, if you let it.

 

If you try to fight the system, you lose.

 

Good luck and have fun!

 

Please do let us know how you end up solving the issue.

 

Thank you!

 

Cheers,

 

Jeremy

   

P.S. I see that this is a continuation of our previous discussion on "offsetting conduit only by Z axis":

  
https://forums.autodesk.com/t5/revit-api-forum/offset-conduit-only-by-z-axis/m-p/9976293

  

Did you end up solving that?

   

If so, would you like to share the solution in that thread?

  

If not, it this new thread an attempt at a new aproach to solving that issue?

   

Thank you!

  



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

Yes, that can be rather tricky.

 

I have heard of situations in which Revit is extremely picky about the directions you try to use, and the precision of their orientation.

 

I suggest you work through my series of articles on implementing a rolling offset:

 

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

 

Basically, as far as I can remember, it demonstrates two fundamentally different approaches:

  

  • Insert pipes first, then add fittings
  • Insert fittings first, then add pipes

 

In both cases, Revit can automate and simplify your task significantly, if you let it.

 

If you try to fight the system, you lose.

 

Good luck and have fun!

 

Please do let us know how you end up solving the issue.

 

Thank you!

 

Cheers,

 

Jeremy

   

P.S. I see that this is a continuation of our previous discussion on "offsetting conduit only by Z axis":

  
https://forums.autodesk.com/t5/revit-api-forum/offset-conduit-only-by-z-axis/m-p/9976293

  

Did you end up solving that?

   

If so, would you like to share the solution in that thread?

  

If not, it this new thread an attempt at a new aproach to solving that issue?

   

Thank you!

  



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

Message 3 of 9
kireandreev
in reply to: jeremytammik

kireandreev
Contributor
Contributor

Dear,

 

I solved creating conduits by Z axis with this code:

var obj = condZ.Location as LocationCurve;
XYZ p2 = new XYZ(obj.Curve.GetEndPoint(0).X, obj.Curve.GetEndPoint(0).Y + distance, obj.Curve.GetEndPoint(0).Z);
XYZ p3 = new XYZ(obj.Curve.GetEndPoint(1).X, obj.Curve.GetEndPoint(1).Y + distance, obj.Curve.GetEndPoint(1).Z);
XYZ p4 = new XYZ(obj.Curve.GetEndPoint(0).X, obj.Curve.GetEndPoint(0).Y - distance, obj.Curve.GetEndPoint(0).Z);
XYZ p5 = new XYZ(obj.Curve.GetEndPoint(1).X, obj.Curve.GetEndPoint(1).Y - distance, obj.Curve.GetEndPoint(1).Z);
XYZ p6 = new XYZ(obj.Curve.GetEndPoint(0).X - (diameter * Math.Sqrt(3) / 2), obj.Curve.GetEndPoint(0).Y, obj.Curve.GetEndPoint(0).Z);
XYZ p7 = new XYZ(obj.Curve.GetEndPoint(1).X - (diameter * Math.Sqrt(3) / 2), obj.Curve.GetEndPoint(1).Y, obj.Curve.GetEndPoint(1).Z);
Transaction trans = new Transaction(doc);
try
{
trans.Start("createConduit");
var conduit3 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p2, p3, condZ.LevelId);
conduit3.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
var conduit4 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p4, p5, condZ.LevelId);
conduit4.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
var conduit5 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p6, p7, condZ.LevelId);
conduit5.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
trans.Commit();
}

This is the conduits in picture above.

 

Problem is on Direction between conduit which must to connect each other with familyInstance  (conduit fitting).

My questions is how to detect that Directions between conduits(connectors) is not OK, and how to change Direction (only one conduits(connectors)) to be Directions synchronized.

 

Best regard.

0 Likes

Dear,

 

I solved creating conduits by Z axis with this code:

var obj = condZ.Location as LocationCurve;
XYZ p2 = new XYZ(obj.Curve.GetEndPoint(0).X, obj.Curve.GetEndPoint(0).Y + distance, obj.Curve.GetEndPoint(0).Z);
XYZ p3 = new XYZ(obj.Curve.GetEndPoint(1).X, obj.Curve.GetEndPoint(1).Y + distance, obj.Curve.GetEndPoint(1).Z);
XYZ p4 = new XYZ(obj.Curve.GetEndPoint(0).X, obj.Curve.GetEndPoint(0).Y - distance, obj.Curve.GetEndPoint(0).Z);
XYZ p5 = new XYZ(obj.Curve.GetEndPoint(1).X, obj.Curve.GetEndPoint(1).Y - distance, obj.Curve.GetEndPoint(1).Z);
XYZ p6 = new XYZ(obj.Curve.GetEndPoint(0).X - (diameter * Math.Sqrt(3) / 2), obj.Curve.GetEndPoint(0).Y, obj.Curve.GetEndPoint(0).Z);
XYZ p7 = new XYZ(obj.Curve.GetEndPoint(1).X - (diameter * Math.Sqrt(3) / 2), obj.Curve.GetEndPoint(1).Y, obj.Curve.GetEndPoint(1).Z);
Transaction trans = new Transaction(doc);
try
{
trans.Start("createConduit");
var conduit3 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p2, p3, condZ.LevelId);
conduit3.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
var conduit4 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p4, p5, condZ.LevelId);
conduit4.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
var conduit5 = Autodesk.Revit.DB.Electrical.Conduit.Create(doc, condZ.GetTypeId(), p6, p7, condZ.LevelId);
conduit5.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).Set(diameter);
trans.Commit();
}

This is the conduits in picture above.

 

Problem is on Direction between conduit which must to connect each other with familyInstance  (conduit fitting).

My questions is how to detect that Directions between conduits(connectors) is not OK, and how to change Direction (only one conduits(connectors)) to be Directions synchronized.

 

Best regard.

Message 4 of 9
jeremy_tammik
in reply to: kireandreev

jeremy_tammik
Autodesk
Autodesk

Thank you for the clarification. 

 

What do you think about my experiences exploring how to create the rolling offset? You say nothing about that.

 

It shows how to work with pipes and ducts and their fittings.

 

One easy approach for conduits, I believe, is to create placeholder elements for them. They are just model curves, I think. Then, you can convert all the placeholders into real conduit elements with one single call:

 

https://thebuildingcoder.typepad.com/blog/2011/07/mep-placeholders.html

 

As always, you should check out the functionality in the end user interface first to see whether it does what you need.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

Thank you for the clarification. 

 

What do you think about my experiences exploring how to create the rolling offset? You say nothing about that.

 

It shows how to work with pipes and ducts and their fittings.

 

One easy approach for conduits, I believe, is to create placeholder elements for them. They are just model curves, I think. Then, you can convert all the placeholders into real conduit elements with one single call:

 

https://thebuildingcoder.typepad.com/blog/2011/07/mep-placeholders.html

 

As always, you should check out the functionality in the end user interface first to see whether it does what you need.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 5 of 9
kireandreev
in reply to: jeremy_tammik

kireandreev
Contributor
Contributor

Dear Jeremy Tammik,

 

the link:

https://thebuildingcoder.typepad.com/blog/2011/07/mep-placeholders.html

is very good, but my questions is:

  1. When create Conduit Fitting how to check conditions for direction of connectors?
  2. If condition for Direction is not good, how to change direction of connectors or position of conduits(rotate, move...)?
  3. I like to know all initial conditional for creating Conduit Fitting.

Best regard.

0 Likes

Dear Jeremy Tammik,

 

the link:

https://thebuildingcoder.typepad.com/blog/2011/07/mep-placeholders.html

is very good, but my questions is:

  1. When create Conduit Fitting how to check conditions for direction of connectors?
  2. If condition for Direction is not good, how to change direction of connectors or position of conduits(rotate, move...)?
  3. I like to know all initial conditional for creating Conduit Fitting.

Best regard.

Message 6 of 9
jeremy_tammik
in reply to: kireandreev

jeremy_tammik
Autodesk
Autodesk

I would simply constrain all directions to be exactly vertical or horizontal.

 

Does that not satisfy all your needs, as well as the real-world constraints?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

I would simply constrain all directions to be exactly vertical or horizontal.

 

Does that not satisfy all your needs, as well as the real-world constraints?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 7 of 9
kireandreev
in reply to: jeremy_tammik

kireandreev
Contributor
Contributor

Dear Jeremy,

 

For conduits which start and end point is X1!=X2, Y1!=Y2, Z1!=Z2 I use next directions:

XYZ vx = end - start;

XYZ vz = XYZ.BasisZ;
XYZ vy = vz.CrossProduct(vx);

For conduits which start and end point is X1==X2, Y1==Y2, Z1!=Z2 I use next directions:

XYZ vx = end - start;

vy = XYZ.BasisY;
vz = XYZ.BasisX;

 

Conduits created:

Curve CurveLeft = obj.Curve.CreateOffset(distance, vz);

Conduit conduitLeft = Conduit.Create(doc, e.GetTypeId(), CurveLeft.GetEndPoint(0), CurveLeft.GetEndPoint(1), e.LevelId);

Curve CurveRight = obj.Curve.CreateOffset(distance, vz);

Conduit conduitRight = Conduit.Create(doc, e.GetTypeId(), CurveRight.GetEndPoint(0), CurveRight.GetEndPoint(1), e.LevelId);

Curve CurveTop = obj.Curve.CreateOffset(diameter * Math.Sqrt(3) / 2, vy);

Conduit conduitTop = Conduit.Create(doc, e.GetTypeId(), CurveTop.GetEndPoint(0), CurveTop.GetEndPoint(1), e.LevelId);

 

Conduits with X1!=X2, Y1!=Y2, Z1!=Z2 is connected OK each other with fitting, but conduits with X1!=X2, Y1!=Y2, Z1!=Z2 and conduits with X1==X2, Y1==Y2, Z1!=Z2(by Z axis) in some situations can NOT connect each other with fittings.

How to creating direction for X,Y and Z axis to may conduits connect each other with fittings in all situations?

How to solved this problem?

 

Best Regard

 

 

0 Likes

Dear Jeremy,

 

For conduits which start and end point is X1!=X2, Y1!=Y2, Z1!=Z2 I use next directions:

XYZ vx = end - start;

XYZ vz = XYZ.BasisZ;
XYZ vy = vz.CrossProduct(vx);

For conduits which start and end point is X1==X2, Y1==Y2, Z1!=Z2 I use next directions:

XYZ vx = end - start;

vy = XYZ.BasisY;
vz = XYZ.BasisX;

 

Conduits created:

Curve CurveLeft = obj.Curve.CreateOffset(distance, vz);

Conduit conduitLeft = Conduit.Create(doc, e.GetTypeId(), CurveLeft.GetEndPoint(0), CurveLeft.GetEndPoint(1), e.LevelId);

Curve CurveRight = obj.Curve.CreateOffset(distance, vz);

Conduit conduitRight = Conduit.Create(doc, e.GetTypeId(), CurveRight.GetEndPoint(0), CurveRight.GetEndPoint(1), e.LevelId);

Curve CurveTop = obj.Curve.CreateOffset(diameter * Math.Sqrt(3) / 2, vy);

Conduit conduitTop = Conduit.Create(doc, e.GetTypeId(), CurveTop.GetEndPoint(0), CurveTop.GetEndPoint(1), e.LevelId);

 

Conduits with X1!=X2, Y1!=Y2, Z1!=Z2 is connected OK each other with fitting, but conduits with X1!=X2, Y1!=Y2, Z1!=Z2 and conduits with X1==X2, Y1==Y2, Z1!=Z2(by Z axis) in some situations can NOT connect each other with fittings.

How to creating direction for X,Y and Z axis to may conduits connect each other with fittings in all situations?

How to solved this problem?

 

Best Regard

 

 

Message 8 of 9
jeremy_tammik
in reply to: kireandreev

jeremy_tammik
Autodesk
Autodesk

I would suggest trying to create and place the fittings in the exact required locations first, with no piping whatsoever added.

 

Once the fittings are all placed, you can call their connector's ConnectTo method to hook them up with each other. When you do so, Revit will create the piping automatically.

 

This has all been researched and explained in my rolling offset series:

 

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

  

At least I believe so...  seven years is way over my maximum memory   span...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes

I would suggest trying to create and place the fittings in the exact required locations first, with no piping whatsoever added.

 

Once the fittings are all placed, you can call their connector's ConnectTo method to hook them up with each other. When you do so, Revit will create the piping automatically.

 

This has all been researched and explained in my rolling offset series:

 

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

  

At least I believe so...  seven years is way over my maximum memory   span...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 9 of 9
kireandreev
in reply to: jeremy_tammik

kireandreev
Contributor
Contributor

Dear Jeremy,

 

I solved this problem, thanks to your guidance.

 

Best regard.

0 Likes

Dear Jeremy,

 

I solved this problem, thanks to your guidance.

 

Best regard.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report