<?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 Re: Curve intersect in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103686#M19648</link>
    <description>&lt;P&gt;Thanks...&lt;/P&gt;&lt;P&gt;thanks for your solution...&lt;BR /&gt;I have another question..&lt;BR /&gt;Is there a way to read the curveloop coordinates at a specific lenght from the first point of the curve?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2022 14:11:54 GMT</pubDate>
    <dc:creator>stefano.cartaKGT96</dc:creator>
    <dc:date>2022-04-13T14:11:54Z</dc:date>
    <item>
      <title>Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11102939#M19644</link>
      <description>&lt;P&gt;Hi Guys..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a list of xyz point by a txt file.&lt;/P&gt;&lt;P&gt;I import it and I create a CurveLoop&lt;/P&gt;&lt;P&gt;Then I have to check the intersection of this curve with a Line and find intersection point coordinates.&lt;/P&gt;&lt;P&gt;i use this code, but I receive an exception:&lt;/P&gt;&lt;P&gt;System.InvalidCastException: 'unable to casttype&amp;nbsp; 'Autodesk.Revit.DB.Line' on type 'System.Collections.Generic.IEnumerable`1[Autodesk.Revit.DB.Curve]'.' on the intersect line code&lt;/P&gt;&lt;P&gt;where am i wrong?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Stefano&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; Dim CurvaAsse3D As New CurveLoop
 Dim CurvaAsse2D As New CurveLoop
            For xx = 0 To listaPuntiAsse.Count - 1
                If xx &amp;lt;&amp;gt; listaPuntiAsse.Count - 1 Then
                    Dim Linea As Line = Line.CreateBound(listaPuntiAsse(xx), listaPuntiAsse(xx + 1))
                    Dim Linea2d As Line = Line.CreateBound(listaPuntiAsse2D(xx), listaPuntiAsse2D(xx + 1))
                    CurvaAsse3D.Append(Linea)
                    CurvaAsse2D.Append(Linea2d)
                End If
            Next
Dim lineaprova As Line = Line.CreateBound(InternalPoint4, InternalPoint1)
Dim ptinter As XYZ = CurvaAsse3D.Intersect(lineaprova)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 09:05:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11102939#M19644</guid>
      <dc:creator>stefano.cartaKGT96</dc:creator>
      <dc:date>2022-04-13T09:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103067#M19645</link>
      <description>&lt;P&gt;The 'Intersect' method is a LINQ extension because CurveLoop implements IEnumerable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So not the 'Intersect' method you thought it was. The 'Intersect' method you are using above takes another IEnumerable of same type as an argument to list items that occur in both lists according to a comparison operator.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is why it is looking for&amp;nbsp;&lt;SPAN&gt;IEnumerable(of Curve) not Line.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You need to call Curve.Intersect on each Line and compile the results i.e. no need to use CurveLoop.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 10:19:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103067#M19645</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-04-13T10:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103119#M19646</link>
      <description>&lt;P&gt;Thanks for your reply..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a 3d curve created from 3d points, then I create a second curve like the first but with Z=0&lt;/P&gt;&lt;P&gt;I create a vertical line in a specific point of the second curve and I have to find the intersection point of the line with the first curve.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 10:25:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103119#M19646</guid>
      <dc:creator>stefano.cartaKGT96</dc:creator>
      <dc:date>2022-04-13T10:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103236#M19647</link>
      <description>&lt;P&gt;If I understand correctly you have a line in the 0,0,1 direction to find the same point on the 3D curve as is on the 2D?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since these are all line segments could it not be solved by using similar triangles for Z?&lt;/P&gt;&lt;P&gt;Z1/L1 = Z2/L2&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;Z2 is the overall change in Z for the line segment (difference in Z between two ends could be +ve or -ve)&lt;/P&gt;&lt;P&gt;L2 is the 2D length of the line segment&lt;/P&gt;&lt;P&gt;Z1 is the unknown Z value at a point along the 2D length&lt;/P&gt;&lt;P&gt;L1 is the 2D length associated with Z1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;L2 = Length 2d = ((End0.X - End1.X)^2 + (End0.Y.End1.Y)^2)^0.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Z1 = L1 * (Z2/L2)&lt;/P&gt;&lt;P&gt;The final Z would be the Z at the end used for start of the measurement + Z1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then X and Y are the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 11:25:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103236#M19647</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-04-13T11:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103686#M19648</link>
      <description>&lt;P&gt;Thanks...&lt;/P&gt;&lt;P&gt;thanks for your solution...&lt;BR /&gt;I have another question..&lt;BR /&gt;Is there a way to read the curveloop coordinates at a specific lenght from the first point of the curve?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 14:11:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11103686#M19648</guid>
      <dc:creator>stefano.cartaKGT96</dc:creator>
      <dc:date>2022-04-13T14:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11104561#M19649</link>
      <description>&lt;P&gt;CurveLoop is just a collection of joined curves it has no direct way of evaluating a point along it's length but you can probably write a function. You have to ensure that the curves are continuously joined and are joined end to start but you can reverse curves to correct those that don't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you then iterate the curves in the loop adding the length to a sum value then you get to an iteration where the sum value is greater than or equal to your target length at which you want to find the point. If you deduct the previous lengths from your target length then you get the &lt;U&gt;remainder&lt;/U&gt; to evaluate along the current iterated curve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a CurveLoop has more than one curve then such curves would be bound and all would have a length value. If you divide 1 by the length and multiply it by the &lt;U&gt;remainder&lt;/U&gt; then you have a normalised value to input into Curve.Evaluate for the current iterated curve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Refer to RevitAPI.chm CurveLoop class for definitions regarding what is considered continuous.&lt;/P&gt;&lt;P&gt;Note also that for some complex curves (splines etc.) the parameter value changes are not uniform along the curve length.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 21:09:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11104561#M19649</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2022-04-13T21:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Curve intersect</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11105353#M19650</link>
      <description>&lt;P&gt;Thanks..&lt;/P&gt;&lt;P&gt;it's the same procedure I had in mind ...&lt;/P&gt;&lt;P&gt;I convert in code...&lt;/P&gt;&lt;P&gt;Stefano&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2022 07:14:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/curve-intersect/m-p/11105353#M19650</guid>
      <dc:creator>stefano.cartaKGT96</dc:creator>
      <dc:date>2022-04-14T07:14:02Z</dc:date>
    </item>
  </channel>
</rss>

