<?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: Automatically create a PDF upon save of a Drawing? in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140353#M3168</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/475927"&gt;@gobluejd&lt;/a&gt;&amp;nbsp;-San.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached here is not a script but an add-in.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M19655" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/fusion-360-api-and-scripts/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M19655&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 373px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1247580iDE7A768FA68F75E5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Aug 2023 06:07:53 GMT</pubDate>
    <dc:creator>kandennti</dc:creator>
    <dc:date>2023-08-01T06:07:53Z</dc:date>
    <item>
      <title>Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12133849#M3161</link>
      <description>&lt;P&gt;Is there anyway to automatically create a PDF of a drawing upon save? &amp;nbsp;Basically I want it to export as a PDF and possibly have the version # in the PDF file name?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is that possible? &amp;nbsp;From what I can see it seems simple via an Add-in or using Python but I am no clue what to do.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2023 15:54:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12133849#M3161</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-07-28T15:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M3162</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/475927"&gt;@gobluejd&lt;/a&gt;&amp;nbsp;-San.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The UserInterface.commandTerminated event is fired when all commands are finished.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E381414E-1CFF-4007-B1DF-C413D7E6841A" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E381414E-1CFF-4007-B1DF-C413D7E6841A&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This event should be used to export PDF files when the following conditions are met&lt;BR /&gt;・When a save command is executed.&lt;BR /&gt;・When the active document is a drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have created a simple add-in.&lt;BR /&gt;When you start the add-in execution, a dialog will appear to select a folder to export the PDF file.&lt;BR /&gt;After that, the PDF file will be exported every time the drawing is saved.&lt;BR /&gt;If you want to stop the function, please exit the add-in.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;#FusionAPI_python addin

import traceback
import adsk.core as core
import adsk.drawing as drawing
import pathlib

_handlers = []
_exportDir = ""
_target_cmd_ids = [
    "PLM360SaveCommand",
]

def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface

        global _exportDir
        _exportDir = get_export_folder_path()
        if len(_exportDir) &amp;lt; 1: return

        global _handlers
        onCommandTerminated = MyCommandTerminatedHandler()
        ui.commandTerminated.add(onCommandTerminated)
        _handlers.append(onCommandTerminated)

        app.log(
            "Start addin(AutoPdfOnSave)"
        )

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


def stop(context):
    try:
        core.Application.get().log(
            "Stop addin(AutoPdfOnSave)"
        )
    except:
        print('Failed:\n{}'.format(traceback.format_exc()))


class MyCommandTerminatedHandler(core.ApplicationCommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args: core.ApplicationCommandEventArgs):

        global _target_cmd_ids
        if args.commandId not in _target_cmd_ids: return

        app: core.Application = core.Application.get()
        doc: drawing.DrawingDocument = drawing.DrawingDocument.cast(app.activeDocument)
        if not doc: return

        dataFile: core.DataFile = doc.dataFile
        filename = f"{dataFile.name} v{dataFile.versionNumber}.pdf"

        global _exportDir
        exportPath = str(
            pathlib.Path(_exportDir) / filename
        )

        drawExpMgr: drawing.DrawingExportManager = doc.drawing.exportManager
        expOpt: drawing.DrawingExportOptions = drawExpMgr.createPDFExportOptions(
            exportPath
        )
        drawExpMgr.execute(expOpt)

        app.log(
            f"Export PDF:{exportPath}"
        )


def get_export_folder_path(
) -&amp;gt; str:
    app: core.Application = core.Application.get()
    ui: core.UserInterface = app.userInterface

    dialog: core.FolderDialog = ui.createFolderDialog()
    dialog.title = "PDF Export Folder"
    res = dialog.showDialog()
    if res == core.DialogResults.DialogOK:
        return dialog.folder
    else:
        return ""&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each time you save, the exported log is written to a TextCommands window.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 554px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1246735iA34D27E8EA0F95CA/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 14:16:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M3162</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-07-29T14:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12138694#M3163</link>
      <description>&lt;P&gt;Thank you! Going to look at now and try.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 14:41:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12138694#M3163</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-07-31T14:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12138722#M3164</link>
      <description>&lt;P&gt;I do not think it is working. &amp;nbsp;If it matters, I am on MAC. &amp;nbsp;Also the folder will be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Users/jeffreydickerson/Library/CloudStorage/Dropbox/Drawings&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jul 2023 14:49:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12138722#M3164</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-07-31T14:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140016#M3165</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/475927"&gt;@gobluejd&lt;/a&gt;&amp;nbsp;-San.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't use Dropbox, so I tried using OneDrive and was able to export PDFs without any problems.&lt;BR /&gt;I ran it on Win10, but since it doesn't do any OS-dependent processing, it should work on MAC as well, so there may be other problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can I export to another local folder?&lt;BR /&gt;Also, PDF export is not supported by the personal license.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 01:10:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140016#M3165</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-08-01T01:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140036#M3166</link>
      <description>&lt;P&gt;I have never installed a script before. So I may have done wrong. I have a license and not the free one.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;maybe give brief description of how to install? All I did was unzip and put in Dropbox (maybe that’s it and has to be on local drive???)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am at home now and will look at again tomorrow.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;thank you again!!!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 01:29:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140036#M3166</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-08-01T01:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140038#M3167</link>
      <description>&lt;P&gt;I also loaded it via the tools menu (I think) where you can upload scripts and point to directory.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 01:30:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140038#M3167</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-08-01T01:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140353#M3168</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/475927"&gt;@gobluejd&lt;/a&gt;&amp;nbsp;-San.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached here is not a script but an add-in.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M19655" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/fusion-360-api-and-scripts/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12135436#M19655&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 373px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1247580iDE7A768FA68F75E5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 06:07:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12140353#M3168</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-08-01T06:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141184#M3169</link>
      <description>&lt;P&gt;I can not seem to get it to work. &amp;nbsp;I extract to my Documents on MAC. &amp;nbsp;I the open Fusion, go to Utilities, click add ins, then at top of menu select Add-Ins. &amp;nbsp;At the bottom, I select CREATE, made sure Add-In Radial button is selected. &amp;nbsp;Select Python, bane the add-in and select folder location on my MAC (Documents) (select the file folder (&lt;/P&gt;&lt;P&gt;Users/jeffreydickerson/Documents/AutoPdfOnSave) and then hit create. &amp;nbsp;I have tried opening an existing drawing, changing something minor and hit save and it doesn't do anything. &amp;nbsp;I have also tried creating a new part and drawing, I do not get any dialog on where to save.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have the text commands open and do not see anything happening.&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;</description>
      <pubDate>Tue, 01 Aug 2023 13:13:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141184#M3169</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-08-01T13:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141390#M3170</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/475927"&gt;@gobluejd&lt;/a&gt;&amp;nbsp;-San.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The add-in may not be registered properly.&lt;/P&gt;
&lt;P&gt;Extract the zip file. After pressing the green +, specify the following folder&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;└ AutoPdfOnSave/
    └ AutoPdfOnSave/  &amp;lt;--here
        └ AutoPdfOnSave.manifest
        └ AutoPdfOnSave.py&lt;/LI-CODE&gt;
&lt;P&gt;The folders containing "xx.manifest" and "xx.py" must all have the same name, including the folder name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you see the following, registration is complete.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 362px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1247776i1DE306EF243F8E8A/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 14:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141390#M3170</guid>
      <dc:creator>kandennti</dc:creator>
      <dc:date>2023-08-01T14:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically create a PDF upon save of a Drawing?</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141431#M3171</link>
      <description>&lt;P&gt;Got it! Thank you so much.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 14:29:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/automatically-create-a-pdf-upon-save-of-a-drawing/m-p/12141431#M3171</guid>
      <dc:creator>gobluejd</dc:creator>
      <dc:date>2023-08-01T14:29:33Z</dc:date>
    </item>
  </channel>
</rss>

