<?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 How to get the Intersection between a curve and a plane in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584505#M44313</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi all, I have been searching this for a while. How to determine the intersection XYZ point between a curve and a plane? The Revit API provides method to get the intersection point between a face and a curve. But there does not seem exist a way to create a face from a plane. I do not have a solid to extract the face from. All I have is a curve and a plane.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This should be a basic tool for geometry analysis. Am I missing something?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Feb 2019 10:06:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-02-09T10:06:56Z</dc:date>
    <item>
      <title>How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584505#M44313</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi all, I have been searching this for a while. How to determine the intersection XYZ point between a curve and a plane? The Revit API provides method to get the intersection point between a face and a curve. But there does not seem exist a way to create a face from a plane. I do not have a solid to extract the face from. All I have is a curve and a plane.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This should be a basic tool for geometry analysis. Am I missing something?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 10:06:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584505#M44313</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-09T10:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584562#M44314</link>
      <description>&lt;P&gt;Hi! There is no such API, but your task could be solved in various ways.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if you have a Plane object you can create a Transform, using its Origin, XVec, YVec and Normal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using Transform.Inverse you can get line origin and direction in the coordinate system of your plane. The line equation is (x, y, z) = (ox, oy, oz) + t(nx, ny, nz), where ox, oy, oz - plane origin and nx, ny, nz - normal coordinates. An intersection point z coordinate is zero. You can easily find X and Y, just solve this equation system. So, if the equation system has a solution, use Transform.OfPoint(new XYZ(x, y, 0)) to switch back to the model coordinate system&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 10:50:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584562#M44314</guid>
      <dc:creator>aignatovich</dc:creator>
      <dc:date>2019-02-09T10:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584572#M44315</link>
      <description>&lt;P&gt;Oh. The line equation is (x, y, z) = (ox, oy, oz) + t(&lt;STRONG&gt;dx, dy, dz&lt;/STRONG&gt;), where ox, oy, oz - &lt;STRONG&gt;line&lt;/STRONG&gt; origin and &lt;STRONG&gt;dx, dy, dz&lt;/STRONG&gt; - &lt;STRONG&gt;line direction&lt;/STRONG&gt; coordinates of course, sorry&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 10:57:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584572#M44315</guid>
      <dc:creator>aignatovich</dc:creator>
      <dc:date>2019-02-09T10:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584777#M44316</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks for your reply. The algorithm seems a bit complex. I hope Autodesk will add the API in the future. For the time being, I just create a big cubic solid and use the plane to cut the solid to get a face, and then I can get the intersection points.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 15:12:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/8584777#M44316</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-02-09T15:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/9185953#M44317</link>
      <description>&lt;P&gt;If the curve is a line, there is an alternative approach which may be easier to implement with Revit API. For a given line and a plane, let's call the intersection point P. Now if you project the line onto the plane, the result passes through P.&lt;/P&gt;&lt;P&gt;So you can easily project two points of the line onto the plane -Plane.Project() - create another line that passes through those two points - Line.Create(Un)bound() - and the last thing you have to do is to find the intersection of those two lines - Line.Intersect()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;PRE&gt;// Plane plane
// Line line
UV uv1, uv2 = new UV();

plane.Project(line.Origin, out uv1, out double d);
plane.Project(line.Origin + line.Direction, out uv2, out double b);

XYZ xyz1 = plane.Origin + (uv1.U * plane.XVec) + (uv1.V * plane.YVec);
XYZ xyz2 = plane.Origin + (uv2.U * plane.XVec) + (uv2.V * plane.YVec);

Line projectedLine = Line.CreateUnbound(xyz1, xyz2 - xyz1);

IntersectionResultArray iResult = new IntersectionResultArray();
if (line.Intersect(projectedLine, out iResult) != SetComparisonResult.Disjoint) return iResult.get_Item(0).XYZPoint;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Dec 2019 22:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/9185953#M44317</guid>
      <dc:creator>BardiaJahan</dc:creator>
      <dc:date>2019-12-05T22:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/9191045#M44318</link>
      <description>&lt;P&gt;As another possible solution route - can you create a solid from your plane, get the face, find the intersection points, and then delete the solid?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i know it sounds like a lot of extra work, but code wise, it might be pretty simple.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 14:02:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/9191045#M44318</guid>
      <dc:creator>stever66</dc:creator>
      <dc:date>2019-12-09T14:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11274374#M44319</link>
      <description>&lt;P&gt;There is a solution in another thread:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/how-can-we-calculate-the-intersection-between-the-plane-and-the/m-p/9785834" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/how-can-we-calculate-the-intersection-between-the-plane-and-the/m-p/9785834&lt;/A&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2020/10/high-performance-outline-and-line-plane-intersection.html#3" target="_blank" rel="noopener"&gt;https://thebuildingcoder.typepad.com/blog/2020/10/high-performance-outline-and-line-plane-intersection.html#3&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;and a nice geometric explanation + solution here:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://www.parametriczoo.com/index.php/2020/03/07/plane-line-intersection-in-revit-api/&amp;nbsp;" target="_blank" rel="noopener"&gt;https://www.parametriczoo.com/index.php/2020/03/07/plane-line-intersection-in-revit-api/&amp;nbsp;&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sun, 03 Jul 2022 14:04:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11274374#M44319</guid>
      <dc:creator>AmitMetz</dc:creator>
      <dc:date>2022-07-03T14:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11483003#M44320</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;SPAN class=""&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4145125" target="_self"&gt;&lt;SPAN class=""&gt;BardiaJahan!&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;Your method is cool! But I've got an exception, if input projected line is normal to plane. Here is my little change of your code:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;public XYZ GetPlaneAndLineIntersection(Plane plane, Line line)&lt;BR /&gt;{&lt;BR /&gt;UV uv1, uv2 = new UV();&lt;/P&gt;&lt;P&gt;plane.Project(line.Origin, out uv1, out double d);&lt;BR /&gt;plane.Project(line.Origin + line.Direction, out uv2, out double b);&lt;/P&gt;&lt;P&gt;XYZ xyz1 = plane.Origin + (uv1.U * plane.XVec) + (uv1.V * plane.YVec);&lt;BR /&gt;XYZ xyz2 = plane.Origin + (uv2.U * plane.XVec) + (uv2.V * plane.YVec);&lt;/P&gt;&lt;P&gt;if (xyz1.IsAlmostEqualTo(xyz2))&lt;BR /&gt;{&lt;BR /&gt;return xyz1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Line projectedLine = Line.CreateUnbound(xyz1, xyz2 - xyz1);&lt;/P&gt;&lt;P&gt;IntersectionResultArray iResult = new IntersectionResultArray();&lt;BR /&gt;if (line.Intersect(projectedLine, out iResult) != SetComparisonResult.Disjoint)&lt;BR /&gt;{&lt;BR /&gt;return iResult.get_Item(0).XYZPoint;&lt;BR /&gt;}&lt;BR /&gt;return null;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 14:07:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11483003#M44320</guid>
      <dc:creator>Vlastro</dc:creator>
      <dc:date>2022-10-14T14:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the Intersection between a curve and a plane</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11484059#M44321</link>
      <description>&lt;P&gt;Beautiful!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 22:20:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-get-the-intersection-between-a-curve-and-a-plane/m-p/11484059#M44321</guid>
      <dc:creator>BardiaJahan</dc:creator>
      <dc:date>2022-10-14T22:20:29Z</dc:date>
    </item>
  </channel>
</rss>

