<?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: Previous working API Python script now fails at Project Body Projection Link in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11419671#M5392</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6486599"&gt;@info83PHN&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it and saw that the link was indeed broken. I think it is probably a bug.&lt;/P&gt;
&lt;P&gt;The screen moves, but I made a sample using text commands as an alternative.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core


def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface
        des: adsk.fusion.Design = app.activeProduct
        rootComp: adsk.fusion.Component = des.rootComponent

        uTextPlane = rootComp.constructionPlanes.itemByName('TextPlane')
        sketches = rootComp.sketches
        sketch = sketches.add(uTextPlane)
        sketch.name = 'Border'
    
        projectedEntities = projectBodies(sketch, rootComp.bRepBodies)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def projectBodies(
    skt: adsk.fusion.Sketch,
    bodies: list) -&amp;gt; list:

    tokens = [c.entityToken for c in skt.sketchCurves]
    tokens.extend([p.entityToken for p in skt.sketchPoints])

    app: adsk.core.Application = adsk.core.Application.get()
    sels: adsk.core.Selections = app.userInterface.activeSelections

    sels.clear()
    sels.add(skt)
    app.executeTextCommand(u'Commands.Start SketchActivate')

    sels.clear()
    app.executeTextCommand(u'Commands.Start ProjectNewCmd')
    app.executeTextCommand(u'Commands.SetString infoFilterType {}'.format('infoFilterTypeBodies'))
    [sels.add(body) for body in bodies]
    app.executeTextCommand(u'NuCommands.CommitCmd')

    app.executeTextCommand(u'Commands.Start SketchStop')

    projectedEntities = [c for c in skt.sketchCurves if not c.entityToken in tokens]
    projectedEntities.extend([p for p in skt.sketchPoints if not p.entityToken in tokens])

    return projectedEntities&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 14 Sep 2022 01:38:58 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2022-09-14T01:38:58Z</dc:date>
    <item>
      <title>Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11418501#M5391</link>
      <description>&lt;P&gt;I have a python API script I wrote about a year ago ( around 3 or 4 Fusion updates ago ).&lt;/P&gt;&lt;P&gt;It was working perfectly at the time.&lt;/P&gt;&lt;P&gt;Now it fails when I try and Project existing Bodies to a new Sketch.&lt;/P&gt;&lt;P&gt;It appears that the script is executing the Project Body with the 'Projection Link' turned OFF.&lt;/P&gt;&lt;P&gt;If I create the Body Projections manually with 'Projection Link' turned ON, then the result is exactly as I need it to be.&lt;/P&gt;&lt;P&gt;Is it possible to set the 'Projection Link' to ON within a Script ?&lt;/P&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;&lt;LI-CODE lang="python"&gt;                # create a sketch for the border shape
                # create sketch on the 'TextPlane' plane
                uTextPlane = rootComp.constructionPlanes.itemByName('TextPlane')
                sketches = rootComp.sketches
                sketch = sketches.add(uTextPlane)
                sketch.name = 'Border'
            
                projectedSketchEntities = []

                for body in inputColl:
                    projectedEntities = sketch.project(body)
                    projectedSketchEntities.extend([e for e in projectedEntities])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 14:33:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11418501#M5391</guid>
      <dc:creator>info83PHN</dc:creator>
      <dc:date>2022-09-13T14:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11419671#M5392</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6486599"&gt;@info83PHN&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it and saw that the link was indeed broken. I think it is probably a bug.&lt;/P&gt;
&lt;P&gt;The screen moves, but I made a sample using text commands as an alternative.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Fusion360API Python script

import traceback
import adsk.fusion
import adsk.core


def run(context):
    ui = adsk.core.UserInterface.cast(None)
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface
        des: adsk.fusion.Design = app.activeProduct
        rootComp: adsk.fusion.Component = des.rootComponent

        uTextPlane = rootComp.constructionPlanes.itemByName('TextPlane')
        sketches = rootComp.sketches
        sketch = sketches.add(uTextPlane)
        sketch.name = 'Border'
    
        projectedEntities = projectBodies(sketch, rootComp.bRepBodies)

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def projectBodies(
    skt: adsk.fusion.Sketch,
    bodies: list) -&amp;gt; list:

    tokens = [c.entityToken for c in skt.sketchCurves]
    tokens.extend([p.entityToken for p in skt.sketchPoints])

    app: adsk.core.Application = adsk.core.Application.get()
    sels: adsk.core.Selections = app.userInterface.activeSelections

    sels.clear()
    sels.add(skt)
    app.executeTextCommand(u'Commands.Start SketchActivate')

    sels.clear()
    app.executeTextCommand(u'Commands.Start ProjectNewCmd')
    app.executeTextCommand(u'Commands.SetString infoFilterType {}'.format('infoFilterTypeBodies'))
    [sels.add(body) for body in bodies]
    app.executeTextCommand(u'NuCommands.CommitCmd')

    app.executeTextCommand(u'Commands.Start SketchStop')

    projectedEntities = [c for c in skt.sketchCurves if not c.entityToken in tokens]
    projectedEntities.extend([p for p in skt.sketchPoints if not p.entityToken in tokens])

    return projectedEntities&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Sep 2022 01:38:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11419671#M5392</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2022-09-14T01:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11420174#M5393</link>
      <description>&lt;P&gt;I can reproduce this and confirm it is a bug. Hopefully, it can be fixed soon.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 08:37:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11420174#M5393</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2022-09-14T08:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11420281#M5394</link>
      <description>&lt;P&gt;Many Thanks&lt;BR /&gt;Do we need to report this bug somewhere to get it corrected ?&lt;BR /&gt;I am wasting hours with having to manually do the projections manually&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 09:38:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11420281#M5394</guid>
      <dc:creator>info83PHN</dc:creator>
      <dc:date>2022-09-14T09:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11421571#M5395</link>
      <description>&lt;P&gt;Autodesk is aware of the problem, thanks to you reporting it, and are looking into it.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 18:49:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11421571#M5395</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2022-09-14T18:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Previous working API Python script now fails at Project Body Projection Link</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11441645#M5396</link>
      <description>&lt;P&gt;It looks like this has been fixed in the latest update.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 15:55:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/previous-working-api-python-script-now-fails-at-project-body/m-p/11441645#M5396</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2022-09-23T15:55:17Z</dc:date>
    </item>
  </channel>
</rss>

