<?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: IntersectionResult parameter getter throws an InvalidOperationException in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391600#M537</link>
    <description>&lt;P&gt;Thank you for creating the macro. I see that the RVT filename ends in R22. Does that stand for Revit 2022? Could you please try it out in a more recent version? I believe that the next major release is being expected soon, and the development team (and all of Autodesk) refuse to support more than three major versions back, so Revit 2022 is out of scope. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Mar 2025 11:09:36 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2025-03-26T11:09:36Z</dc:date>
    <item>
      <title>IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13388951#M534</link>
      <description>&lt;P&gt;Hey everybody! As the title mentions I'm having some surprising difficulties with the IntersectionResult class. Long story short I check the intersection of 2 line elements (i know for a fact that these 2 lines intersect) with (&lt;A href="https://apidocs.co/apps/revit/2024/51961478-fb36-e00b-2d1b-7db27b0a09e6.htm" target="_blank" rel="noopener"&gt;link)&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;SetComparisonResult result = line1.Intersect(line2, out resultArray);&lt;/LI-CODE&gt;&lt;P&gt;It's all nice and fine at this point since the result and resultArray are not null. I can get the IntersectionResult out of the IntersectionResultArray for example by:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;IntersectionResult intResult = resultArray.get_Item(0);&lt;/LI-CODE&gt;&lt;P&gt;But I'm intersected in IntersectionResult.Parameter property (&lt;A href="https://apidocs.co/apps/revit/2024/5ca02b0e-289a-f1ef-7ce2-8b3f175fe402.htm#" target="_blank" rel="noopener"&gt;link&lt;/A&gt;), and when i try to get the value of this parameter an &lt;STRONG&gt;&lt;SPAN class=""&gt;InvalidOperationException&lt;/SPAN&gt;&lt;/STRONG&gt; is thrown. Checking the Parameter property documentation again it claims that it happens when it has not been set yet &lt;EM&gt;"Thrown in the getter when this property has not been set by the method providing the result. "&lt;/EM&gt;.&lt;BR /&gt;Checking this Parameter property in debug reveals that it's not the only one failing. As you can see on the picture the &lt;EM&gt;"Distance"&lt;/EM&gt;, &lt;EM&gt;"EdgeObject"&lt;/EM&gt;, &lt;EM&gt;"EdgeParameter"&lt;/EM&gt; and &lt;EM&gt;"Parameter"&lt;/EM&gt; all fail with &lt;STRONG&gt;InvalidOperationException&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kép.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1481395iFF0366D2D1C3A7EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kép.png" alt="Kép.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This issue occurred to me in a C# addin in all current version versions (22-&amp;gt;25). For testing purposes I've created a python script that you can paste into RevitPytonShell and it results is the same error across all versions.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;results = clr.Reference[DB.IntersectionResultArray]()

t = DB.Transaction(doc, "Line Creation")
t.Start()

lineV = DB.Line.CreateBound(DB.XYZ(0,0,0), DB.XYZ(0,10,0))
lineH = DB.Line.CreateBound(DB.XYZ(-5,5,0), DB.XYZ(5,5,0))

doc.Create.NewDetailCurve(uidoc.ActiveView, lineV)
doc.Create.NewDetailCurve(uidoc.ActiveView, lineH)

result = lineV.Intersect(lineH, results)

intResult = results.get_Item(0)
# For example this works
print("XYZPoint: {}".format(intResult.XYZPoint))
# But the following all fail
print("Distance: {}".format(intResult.Distance))
print("EdgeObject: {}".format(intResult.EdgeObject))
print("EdgeParameter: {}".format(intResult.EdgeParameter))
print("Parameter: {}".format(intResult.Parameter))

t.Commit()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even if it's outside of a Transaction (since Line creation and Line.Intersect does not require that), the results are the same.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;results = clr.Reference[DB.IntersectionResultArray]()

lineV = DB.Line.CreateBound(DB.XYZ(0,0,0), DB.XYZ(0,10,0))
lineH = DB.Line.CreateBound(DB.XYZ(-5,5,0), DB.XYZ(5,5,0))
result = lineV.Intersect(lineH, results)

intResult = results.get_Item(0)
# For example this works
print("XYZPoint: {}".format(intResult.XYZPoint))
# But the following all fail
print("Distance: {}".format(intResult.Distance))
print("EdgeObject: {}".format(intResult.EdgeObject))
print("EdgeParameter: {}".format(intResult.EdgeParameter))
print("Parameter: {}".format(intResult.Parameter))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Would appreciate any help with this problem!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 09:33:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13388951#M534</guid>
      <dc:creator>matyas.csanady3GW48</dc:creator>
      <dc:date>2025-03-25T09:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13389731#M535</link>
      <description>&lt;P&gt;I would like to pass this on to the development team for analysis, including a complete minimal sample in order for them to be able to reproduce the issue with a single click, if possible. Could you create a simple RVT (that can be empty) including a C# macro to execute to reproduce the problem, please? Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:03:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13389731#M535</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2025-03-25T15:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391498#M536</link>
      <description>&lt;P&gt;Hi Jeremy!&lt;BR /&gt;&lt;BR /&gt;Thank you for your quick reply and for the fact that you forward this issue to the DEV team. As you asked for I've created a macro that is able reproduce the same exception with a single click. I've attached an empty Revit project file that contains this macro, as expected running the macro throws the same exception.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 10:16:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391498#M536</guid>
      <dc:creator>matyas.csanady3GW48</dc:creator>
      <dc:date>2025-03-26T10:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391600#M537</link>
      <description>&lt;P&gt;Thank you for creating the macro. I see that the RVT filename ends in R22. Does that stand for Revit 2022? Could you please try it out in a more recent version? I believe that the next major release is being expected soon, and the development team (and all of Autodesk) refuse to support more than three major versions back, so Revit 2022 is out of scope. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 11:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391600#M537</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2025-03-26T11:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391636#M538</link>
      <description>&lt;P&gt;I've updated it to Revit2025 and attached it.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 11:27:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13391636#M538</guid>
      <dc:creator>matyas.csanady3GW48</dc:creator>
      <dc:date>2025-03-26T11:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13396926#M539</link>
      <description>&lt;P&gt;The Curve.Intersect method does not set the IntersectionResult's Parameter property. Look at the documentation for &lt;A href="https://apidocs.co/apps/revit/2025.3/51961478-fb36-e00b-2d1b-7db27b0a09e6.htm" target="_blank" rel="noopener"&gt;Curve.Intersect&lt;/A&gt; to see which properties are set and what they mean.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2025 19:13:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13396926#M539</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2025-03-28T19:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13399413#M540</link>
      <description>&lt;P&gt;Whoever designed this part of the API deserves a raise. /s&lt;/P&gt;&lt;P&gt;It seems that the Parameter and Distance properties of the IntersectResult object will never get set by any of the methods creating it. So what was the intent?&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 10:04:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13399413#M540</guid>
      <dc:creator>tamas.deri</dc:creator>
      <dc:date>2025-03-31T10:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13400449#M541</link>
      <description>&lt;P&gt;&lt;SPAN&gt;IntersectionResult's Parameter and Distance properties are both set by the Curve.Project method. The problem with&amp;nbsp;IntersectionResult is that it is used to return results for several different geometric methods.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2025 20:07:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13400449#M541</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2025-03-31T20:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: IntersectionResult parameter getter throws an InvalidOperationException</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13426899#M542</link>
      <description>&lt;P&gt;Thank you for the clear clarification. I shared it on the blog to avoid future similar confusion:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2025/04/intersection-result-llm-for-ifc-and-more-ai.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2025/04/intersection-result-llm-for-ifc-and-more-ai.html#2&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Apr 2025 11:57:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/intersectionresult-parameter-getter-throws-an/m-p/13426899#M542</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2025-04-15T11:57:12Z</dc:date>
    </item>
  </channel>
</rss>

