<?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: Sketch.referencePlane Property Functionality Changed? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14314592#M23170</link>
    <description>&lt;P&gt;Thanks for the reply &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7262682"&gt;@corbin2&lt;/a&gt;, I ended up in just about the same place. It does shake my confidence in using the API that something like this would suddenly start occurring.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2026 16:52:25 GMT</pubDate>
    <dc:creator>alden_360</dc:creator>
    <dc:date>2026-10-15T16:52:25Z</dc:date>
    <item>
      <title>Sketch.referencePlane Property Functionality Changed?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14274730#M23091</link>
      <description>&lt;P&gt;I have an add-in that has been used successfully for more than a year now and recently started seeing an error within on of my functions when attempting to get the reference plane for a sketch. Below is the error, which indicates that I need to roll back before the sketch is created to get the sketch plane. Is this an intended change and if so is it documented anywhere?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;File "C:\Users/ALDEN/fusion-add-in\commands\modeling\generate_laser_features.py", line 1038, in get_centerpoints
    sketch_plane = centerpoint_sketch.referencePlane  # Get plane sketch was created on to add another sketch to later
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/ALDEN/AppData/Local/Autodesk/webdeploy/production/f0877c667ada77b44502b5b3316b697a2ba18ad4/Api/Python/packages\adsk\fusion.py", line 68638, in _get_referencePlane
    return _fusion.Sketch__get_referencePlane(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
RuntimeError: 3 : referencePlane is a BRefFace - need to roll timeline back before sketch&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2026 17:09:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14274730#M23091</guid>
      <dc:creator>alden_360</dc:creator>
      <dc:date>2026-09-22T17:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sketch.referencePlane Property Functionality Changed?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14311809#M23153</link>
      <description>&lt;P&gt;Hi Alden,&lt;/P&gt;&lt;P&gt;I've encountered this too -- it isn't necessarily new, as I reported it a while back&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;A href="https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-rmatrix-gt/m-p/13829024#M22221" target="_blank"&gt;https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-rmatrix-gt/m-p/13829024#M22221&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Here's the workaround I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def _referencePlaneWithTimelineRolledBack(sketch: Sketch) -&amp;gt; (BRepFace | None):
    # sketch.referencePlane throws "need to roll timeline back to access reference plane" when the
    # sketch's plane is a BRepFace and the timeline is positioned after the sketch (which it normally
    # is, since we're running after the whole design has been built). Roll back to right before the
    # sketch to read it, then restore the timeline position.
    savedTimelineObject = currentTimelineObject()
    try:
        sketch.timelineObject.rollTo(rollBefore=True)
        refPlane = sketch.referencePlane
        return refPlane if isinstance(refPlane, BRepFace) else None
    except:
        return None
    finally:
        savedTimelineObject.rollTo(False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Granted, the face will/may become invalid later in the future if you modify that face. &amp;nbsp;My full code for getting the reference; some of my helper methods are left out, but should be obvious what they do based on the name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def getOrCreateSketchPlane(sketch: Sketch) -&amp;gt; Base:
    # see https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/runtimeerror-2-internalvalidationerror-rmatrix-gt/m-p/13829024#M22221
    try:
        refPlane = sketch.referencePlane # This is what throws (sometimes)
        if isinstance(refPlane, ConstructionPlane):
            return refPlane
        if isinstance(refPlane, BRepFace):
            return refPlane
        if isinstance(refPlane, Profile):
            return refPlane
        # Sketches aren't supposed to work??
        if isinstance(refPlane, Sketch):
            return refPlane
    except:
        # "need to roll timeline back to access reference plane" is the error you get.
        # So, try rolling back first. 
        refPlaneFace: BRepFace | None = _referencePlaneWithTimelineRolledBack(sketch) # catches exceptions
        if refPlaneFace is not None and refPlaneFace.isValid:
            # This works...but the BRepFace reference may be stale, so we check if it is still valid..although we may invalidate it later on if we modify the face that it was generated on
            return refPlaneFace

    return _createConstPlaneAtSketchesLocation(sketch, "Sketch Reference Plane")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2026 15:08:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14311809#M23153</guid>
      <dc:creator>corbin2</dc:creator>
      <dc:date>2026-10-13T15:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sketch.referencePlane Property Functionality Changed?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14314592#M23170</link>
      <description>&lt;P&gt;Thanks for the reply &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7262682"&gt;@corbin2&lt;/a&gt;, I ended up in just about the same place. It does shake my confidence in using the API that something like this would suddenly start occurring.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2026 16:52:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/sketch-referenceplane-property-functionality-changed/m-p/14314592#M23170</guid>
      <dc:creator>alden_360</dc:creator>
      <dc:date>2026-10-15T16:52:25Z</dc:date>
    </item>
  </channel>
</rss>

