<?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: Retrieving file name using python in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/retrieving-file-name-using-python/m-p/9113102#M13357</link>
    <description>&lt;P&gt;I think what you might be looking for can be found at the document object; document.name. Note that the name returns including the version of the document. You could remove that by splitting on the last space that was used in the string. (Assuming python, see &lt;A href="https://docs.python.org/3/library/stdtypes.html#str.rsplit" target="_blank" rel="noopener"&gt;.rsplit()&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could also look into document.datafile.name but for some reason my code does not execute when using that. (Should probably be reported) I'm not sure what the result would normally be, might very well not be equal to the document name at all! I say that because I've noticed that you can save multiple files with the same name. But this might not be what you are looking for anyway. (You could also look into document.datafile.copy() to make a copy to a different folder in a360)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;app = adsk.core.Application.get()&lt;BR /&gt;&lt;BR /&gt;# Document name
docNameWithVersion = app.activeDocument.name
docName = docNameWithVersion.rsplit(' ',1)[0]&lt;BR /&gt;&lt;BR /&gt;# Data-file name __ Does not work&lt;BR /&gt;# app.activeDocument.dataFile.name&lt;/PRE&gt;&lt;P&gt;For export to your local drive you might want to look at design.exportManager. There is some example code &lt;A href="http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-B801DDA8-9A0C-42AD-AC06-F8244CA08D65" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2019 19:12:46 GMT</pubDate>
    <dc:creator>PinRudolf</dc:creator>
    <dc:date>2019-10-28T19:12:46Z</dc:date>
    <item>
      <title>Retrieving file name using python</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/retrieving-file-name-using-python/m-p/9110335#M13356</link>
      <description>&lt;P&gt;Does anyone know of a way to retrieve the file name for the active part in Fusion? And if possible, would I be able to move the file to a different folder on my computer using code?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2019 16:17:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/retrieving-file-name-using-python/m-p/9110335#M13356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-26T16:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving file name using python</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/retrieving-file-name-using-python/m-p/9113102#M13357</link>
      <description>&lt;P&gt;I think what you might be looking for can be found at the document object; document.name. Note that the name returns including the version of the document. You could remove that by splitting on the last space that was used in the string. (Assuming python, see &lt;A href="https://docs.python.org/3/library/stdtypes.html#str.rsplit" target="_blank" rel="noopener"&gt;.rsplit()&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could also look into document.datafile.name but for some reason my code does not execute when using that. (Should probably be reported) I'm not sure what the result would normally be, might very well not be equal to the document name at all! I say that because I've noticed that you can save multiple files with the same name. But this might not be what you are looking for anyway. (You could also look into document.datafile.copy() to make a copy to a different folder in a360)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;app = adsk.core.Application.get()&lt;BR /&gt;&lt;BR /&gt;# Document name
docNameWithVersion = app.activeDocument.name
docName = docNameWithVersion.rsplit(' ',1)[0]&lt;BR /&gt;&lt;BR /&gt;# Data-file name __ Does not work&lt;BR /&gt;# app.activeDocument.dataFile.name&lt;/PRE&gt;&lt;P&gt;For export to your local drive you might want to look at design.exportManager. There is some example code &lt;A href="http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-B801DDA8-9A0C-42AD-AC06-F8244CA08D65" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2019 19:12:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/retrieving-file-name-using-python/m-p/9113102#M13357</guid>
      <dc:creator>PinRudolf</dc:creator>
      <dc:date>2019-10-28T19:12:46Z</dc:date>
    </item>
  </channel>
</rss>

