<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Changing pipe direction in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8956690#M40559</link>
    <description>&lt;P&gt;I am trying to place a pipe precisely between two points: intersectionPoint and intersectionPoint + perpendicularDirection. I am using the following statement to move the pipe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Pipe dummyPipe = doc.GetElement(ElementTransformUtils.CopyElement(doc, branchPipe.Id, XYZ.Zero).First()) as Pipe;
(dummyPipe.Location as LocationCurve).Curve = Line.CreateBound(intersectionPoint, intersectionPoint + 1.0 * perpendicularDirection);&lt;/PRE&gt;&lt;P&gt;With the above placement, I would expect the pipe's curve's direction to be exactly equal to perpendicularDirection. But that's not the case. As an example, if perpendicularDirection is set to&amp;nbsp;{(-0.016831296, 0.968685013, -0.052781984)}, the direction of the pipe comes out to be&amp;nbsp;{(-0.017347059, 0.998368562, -0.054399389)}. Note that there is a slight difference in the direction and as a result, I am not able to connect this pipe to a Tee fitting as per&amp;nbsp;&lt;A title="Insert T-connection" href="https://forums.autodesk.com/t5/revit-api-forum/how-to-create-a-tee-fitting-of-not-90-degree-branch-angle-for/td-p/8433556" target="_blank" rel="noopener"&gt;Insert T-connection&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW the same issue happens even if I create a new pipe between two points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to fix this issue?&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 22:59:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-08T22:59:18Z</dc:date>
    <item>
      <title>Changing pipe direction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8956690#M40559</link>
      <description>&lt;P&gt;I am trying to place a pipe precisely between two points: intersectionPoint and intersectionPoint + perpendicularDirection. I am using the following statement to move the pipe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Pipe dummyPipe = doc.GetElement(ElementTransformUtils.CopyElement(doc, branchPipe.Id, XYZ.Zero).First()) as Pipe;
(dummyPipe.Location as LocationCurve).Curve = Line.CreateBound(intersectionPoint, intersectionPoint + 1.0 * perpendicularDirection);&lt;/PRE&gt;&lt;P&gt;With the above placement, I would expect the pipe's curve's direction to be exactly equal to perpendicularDirection. But that's not the case. As an example, if perpendicularDirection is set to&amp;nbsp;{(-0.016831296, 0.968685013, -0.052781984)}, the direction of the pipe comes out to be&amp;nbsp;{(-0.017347059, 0.998368562, -0.054399389)}. Note that there is a slight difference in the direction and as a result, I am not able to connect this pipe to a Tee fitting as per&amp;nbsp;&lt;A title="Insert T-connection" href="https://forums.autodesk.com/t5/revit-api-forum/how-to-create-a-tee-fitting-of-not-90-degree-branch-angle-for/td-p/8433556" target="_blank" rel="noopener"&gt;Insert T-connection&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW the same issue happens even if I create a new pipe between two points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how to fix this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 22:59:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8956690#M40559</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-08T22:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pipe direction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8959271#M40560</link>
      <description>&lt;P&gt;In most cases, you do not need to specify an exact pipe direction to create a pipe between fittings, not an exact fitting location to insert a fitting between existing pipes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Revit will automatically adjust the newly created element appropriately to connect with the existing elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I discovered this and explored it in some detail in my research series on creating a rolling offset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2014/01/final-rolling-offset-using-pipecreate.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2014/01/final-rolling-offset-using-pipecreate.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please study the different approaches presented in that research series.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Aug 2019 18:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8959271#M40560</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-08-10T18:19:49Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pipe direction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8966993#M40561</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/413917"&gt;@jeremytammik&lt;/a&gt;&amp;nbsp;The problem was because of inaccuracy in the cross product. I was deriving the pipe direction by doing two cross-products of unit-norm vectors. In other words, pipeDirection = X.CrossProduct(Y).CrossProduct(X). If X and Y are of unit-norm, I would expect pipeDirection to be unit-norm, but that wasn't the case. I was getting about 0.971 instead of 1.000. I thought that Revit uses doubles and not floats, but may be that's not the case. Once I normalize pipeDirection, it worked fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW Your rolling offset post only deals with inserting elbows, which works pretty well. In my case, I am inserting T connection and that API is a horrible mess. Here are the issues:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;CreateTeeFitting() works only when the connection is 90 degrees so you have to use the workaround mentioned in&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/tee-fitting-with-no-right-angle/m-p/8954339#M40512" target="_blank" rel="noopener"&gt;Tee Fitting with no right-angle.&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;The above workaround works only when the base pipe is placed in a way that's acceptable to Revit. As an example, adding a Tee connection works if the two pipes are placed along X axis and the branch pipe is along the Y-axis. But if I rotate the three pipes slightly, for e.g. by 0.1 degrees, the CreateTeeFitting() function fails.&lt;/LI&gt;&lt;LI&gt;So now I have to do another workaround, i.e. create dummy pipes in a position that the Revit likes and create a 90 degree T connection. Then delete all the dummy pipes and the fittings that were automatically created except the T connection. Now rotate the T fitting to what I want, for e.g. by 0.1 degrees. Then change the angle of the branch connector to something other than 90 degrees.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This issue along with&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/tee-fitting-with-no-right-angle/m-p/8954339#M40512" target="_blank" rel="noopener"&gt;Line based family location don't update Origin after change&lt;/A&gt;&amp;nbsp;has taken me about a week to create a T connection at the right place and orientation instead of probably an hour if the API had worked in the first place.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 00:34:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8966993#M40561</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-15T00:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Changing pipe direction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8967235#M40562</link>
      <description>&lt;P&gt;Thank you very much for your research, solution, and pointers to the other issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry to hear that it cost you so much time to resolve these issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am glad to hear that you succeeded in the end. Congratulations!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This all seems very useful to me, so I'll summarise it on The Building Coder for future reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One little clarification:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If X and Y are both unit length, their cross product will still NOT be unit length unless they are exactly perpendicular.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:55:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/changing-pipe-direction/m-p/8967235#M40562</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2019-08-15T06:55:08Z</dc:date>
    </item>
  </channel>
</rss>

