<?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 do I &amp;quot;Undo&amp;quot; or delete a failed API operation ?  (aka: Can the API remove/undo/delete the most recent feature from the timeline somehow?) in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10052672#M9544</link>
    <description>&lt;P&gt;*UPDATE* I solved this before posting, but thought I would post anyhow so google-search can help anyone else wondering this stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done something this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    section[ps]['foil']['patch']=patches.add(section[ps]['foil']['patchInput'])
except:
    ps=ps+1 # try again, with the next one along&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;because there are occasions where the section I'm patching is too "twisted" to be patchable - which I can't find any easy way to determine in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works OK, except I end up with an unwanted item on the timeline:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-01 at 10.23.35 pm.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/874996i449E9A602544A829/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-01 at 10.23.35 pm.png" alt="Screen Shot 2021-02-01 at 10.23.35 pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Can anyone think of a way to get rid of the thing that failed (preferably inside my exception handler)?&amp;nbsp; It's throwing the exception, so I don't have a reference to try to delete of course...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively - is there a way to "snapshot and revert" or some other setting to prevent it half-creating that broken feature?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2021 01:32:10 GMT</pubDate>
    <dc:creator>OceanHydroAU</dc:creator>
    <dc:date>2021-02-03T01:32:10Z</dc:date>
    <item>
      <title>How do I "Undo" or delete a failed API operation ?  (aka: Can the API remove/undo/delete the most recent feature from the timeline somehow?)</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10052672#M9544</link>
      <description>&lt;P&gt;*UPDATE* I solved this before posting, but thought I would post anyhow so google-search can help anyone else wondering this stuff.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've done something this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    section[ps]['foil']['patch']=patches.add(section[ps]['foil']['patchInput'])
except:
    ps=ps+1 # try again, with the next one along&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;because there are occasions where the section I'm patching is too "twisted" to be patchable - which I can't find any easy way to determine in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That works OK, except I end up with an unwanted item on the timeline:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-02-01 at 10.23.35 pm.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/874996i449E9A602544A829/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-02-01 at 10.23.35 pm.png" alt="Screen Shot 2021-02-01 at 10.23.35 pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Can anyone think of a way to get rid of the thing that failed (preferably inside my exception handler)?&amp;nbsp; It's throwing the exception, so I don't have a reference to try to delete of course...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively - is there a way to "snapshot and revert" or some other setting to prevent it half-creating that broken feature?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 01:32:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10052672#M9544</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2021-02-03T01:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I "Undo" or delete a failed API operation ?  (aka: Can the API remove/undo/delete the most recent feature from the timeline somehow?)</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10052682#M9545</link>
      <description>&lt;P&gt;The solution that worked for me was to count how many features exist before trying the operation, then after it fails, if there's now more in there, delete the last one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pcount=patchFeats.count # see how many features currently exist
try:
    section[ps]['foil']['patch']=patchFeats.add(section[ps]['foil']['patchInput']) # this might throw an exception
except:
    if pcount &amp;lt; patchFeats.count: # something broken got created
        dudpatch=patchFeats.item(patchFeats.count-1)
        dudpatch.deleteMe()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to be certain that the thing you're about to delete really is bad, you can check&lt;/P&gt;&lt;P&gt;should check:&lt;/P&gt;&lt;P&gt;dudpatch.healthState != 0&lt;/P&gt;&lt;P&gt;-or-&lt;/P&gt;&lt;P&gt;dudpatch.errorOrWarningMessage isn't empty&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2021 01:39:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10052682#M9545</guid>
      <dc:creator>OceanHydroAU</dc:creator>
      <dc:date>2021-02-03T01:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I "Undo" or delete a failed API operation ?  (aka: Can the API remove/undo/delete the most recent feature from the timeline somehow?)</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10062137#M9546</link>
      <description>&lt;P&gt;I'm having the same problem with creating a SplitFaceFeature. Sometimes it doesn't work because the split tool doesn't quite extend all the way to the edge of the face. Totally my issue, but I'd like to just extend the cut line and try again. Unfortunately, SplitFaceFeatures.add does add the feature successfully, but something else within the bowels of the implementation raises a RuntimeError exception, preventing me from ever getting a reference to the unhealthy feature itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I've been able to determine, there is no way to fix this except by poking around in the Timeline as described above. I suppose if you are not in "capture design history" mode, you can just ignore the exception.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Feb 2021 02:19:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/how-do-i-quot-undo-quot-or-delete-a-failed-api-operation-aka-can/m-p/10062137#M9546</guid>
      <dc:creator>GRSnyder</dc:creator>
      <dc:date>2021-02-06T02:19:57Z</dc:date>
    </item>
  </channel>
</rss>

