<?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: Paid gig - Fusion API Python Script in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740962#M7671</link>
    <description>&lt;P&gt;Thank You Makoto.&lt;/P&gt;&lt;P&gt;At first glance it looks like your script will almost do what I need. As I am a novice with python, I will need some time to work through this and try and understand the code ( last coded in VB5 about 15 years ago ).&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;</description>
    <pubDate>Sun, 07 Nov 2021 14:50:58 GMT</pubDate>
    <dc:creator>info83PHN</dc:creator>
    <dc:date>2021-11-07T14:50:58Z</dc:date>
    <item>
      <title>Paid gig - Fusion API Python Script</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740563#M7668</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I really don't know how to get started, so looking for someone to make a script which I can later expand on to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Script needs :&lt;/P&gt;&lt;P&gt;Input Dialog with 7 line text area, OK, Cancel.&lt;BR /&gt;On 'Cancel', close dialog, do nothing.&lt;/P&gt;&lt;P&gt;On 'OK', close dialog and then ...&lt;/P&gt;&lt;P&gt;Convert the 7 lines of text from the text input area to Uppercase.&lt;/P&gt;&lt;P&gt;Split the 7 lines of text in to variables ( userVarName, userVar1, userVar2, userVar3 .... , userVar6 ) and trim off and blank spaces either end of each variable.&lt;/P&gt;&lt;P&gt;'Save As' the opened design as 'userVarName'.&lt;/P&gt;&lt;P&gt;Change view to 'Home' ( to center the model )&lt;/P&gt;&lt;P&gt;Change view to 'Front'&lt;/P&gt;&lt;P&gt;Edit 'Sketch1'&lt;/P&gt;&lt;P&gt;Sketch1 contains 6 text items. Change the text in the text items to userVar1 ... userVar6&lt;/P&gt;&lt;P&gt;If the userVar = the text "SMALLER" then set the text size to 6.75mm&lt;/P&gt;&lt;P&gt;If the userVar = the text "LARGE" then set the text size to 9mm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note - the above 6 text items in the sketch could be moved to different sketches is it is easier to process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leave the Sketch open in Edit mode and end the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 07:37:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740563#M7668</guid>
      <dc:creator>info83PHN</dc:creator>
      <dc:date>2021-11-07T07:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Paid gig - Fusion API Python Script</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740883#M7669</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I made a script which does the job more similar to what you want. I am happy to help you out. Reach out to me via email.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="savetodoc.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/986726i7774DA447D672B68/image-size/large?v=v2&amp;amp;px=999" role="button" title="savetodoc.gif" alt="savetodoc.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 13:34:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740883#M7669</guid>
      <dc:creator>cam.tech</dc:creator>
      <dc:date>2021-11-07T13:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Paid gig - Fusion API Python Script</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740941#M7670</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;There were multiple parts I didn't understand, but I tried to create a script with my interpretation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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 = None
    try:
        app: adsk.core.Application = adsk.core.Application.get()
        ui = app.userInterface
        des: adsk.fusion.Design = app.activeProduct
        root: adsk.fusion.Component = des.rootComponent

        # input values
        msg1: str = 'Please enter the following values.\n'
        msg2: str = 'userVarName,userVar1,userVar2,userVar3,userVar4,userVar5,userVar6'
        resValues, cancelled = ui.inputBox(msg1 + msg2, '', msg2)
        if cancelled:
            return

        # split
        values = resValues.split(',')
        if len(values) != 7:
            ui.messageBox('The characters you entered are incorrect.')
            return
        
        # convert &amp;amp; trim
        values = [s.strip().upper() for s in values]

        # saveAs - activeProject.rootFolder
        rootFolder: adsk.core.DataFolder = app.data.activeProject.rootFolder
        doc: adsk.fusion.FusionDocument = app.activeDocument
        doc.saveAs(values[0], rootFolder, '', '')

        # view
        vp: adsk.core.Viewport = app.activeViewport
        vp.fit()
        cam: adsk.core.Camera = vp.camera
        cam.viewOrientation = adsk.core.ViewOrientations.FrontViewOrientation
        vp.camera = cam
        vp.refresh()

        # get sketch1 - from root component
        skt1: adsk.fusion.Sketch = root.sketches.itemByName('sketch1')
        if not skt1:
            ui.messageBox('"sketch1" is not found.')
            return

        if skt1.sketchTexts.count &amp;lt; 6:
            ui.messageBox('"sketch1" has less than 6 texts.')
            return

        # Rewriting sketch text
        # The combination of the text in sketch1 and the input text is unknown.
        # For now, I'll assume the order in which they were found.
        unitMgr: adsk.core.UnitsManager = des.unitsManager
        txt: adsk.fusion.SketchText
        for txt, value in zip(skt1.sketchTexts, values[1:]):
            txt.text = value
            if value == 'SMALLER':
                txt.height = unitMgr.convert(6.75, 'mm', unitMgr.internalUnits)
            if value == 'LARGE':
                txt.height = unitMgr.convert(9., 'mm', unitMgr.internalUnits)

        # Edit mode for sketches
        sels: adsk.core.Selections = ui.activeSelections
        sels.clear()
        sels.add(skt1)
        app.executeTextCommand(u'Commands.Start SketchActivate')

        # finish
        ui.messageBox('Done')
        
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't visualize what you are thinking, just in words.&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 14:38:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740941#M7670</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2021-11-07T14:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Paid gig - Fusion API Python Script</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740962#M7671</link>
      <description>&lt;P&gt;Thank You Makoto.&lt;/P&gt;&lt;P&gt;At first glance it looks like your script will almost do what I need. As I am a novice with python, I will need some time to work through this and try and understand the code ( last coded in VB5 about 15 years ago ).&lt;/P&gt;&lt;P&gt;Thank You&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 14:50:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10740962#M7671</guid>
      <dc:creator>info83PHN</dc:creator>
      <dc:date>2021-11-07T14:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Paid gig - Fusion API Python Script</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10741273#M7672</link>
      <description>&lt;P&gt;Thank You&lt;SPAN class=""&gt; &lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3787950" target="_self"&gt;&lt;SPAN class=""&gt;kandennti&lt;/SPAN&gt;&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Your code certainly put me on the right track and I was able to reach my goal from there.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Nov 2021 21:12:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/paid-gig-fusion-api-python-script/m-p/10741273#M7672</guid>
      <dc:creator>info83PHN</dc:creator>
      <dc:date>2021-11-07T21:12:55Z</dc:date>
    </item>
  </channel>
</rss>

