<?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: Bulk Processing via Python Script in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553430#M6698</link>
    <description>&lt;P&gt;Sounds like you may have introduced an inconsistency in the white space that you use for code indentation.&lt;/P&gt;
&lt;P&gt;Turn on "show whitespace" in your editor (in 3ds Max's editor, it's Ctrl+Shift+8, or View menu &amp;gt; Whitespace) and look for the problem.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jun 2020 20:43:53 GMT</pubDate>
    <dc:creator>attilaszabo</dc:creator>
    <dc:date>2020-06-01T20:43:53Z</dc:date>
    <item>
      <title>Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553337#M6695</link>
      <description>&lt;P&gt;For the record, I am more artist than I am technical so I am still learning and open minded to my code. But basically I have a situation that I have been trying to solve for weeks.... and I am stumped like no other.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This script works in Max 2019 but does not work in Max 2020... I don't have the slightest clue, could someone help guide me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#
#import modules
#
import MaxPlus as max
import pymxs
import os

#
#define a master folder and suffix name
#

folder = r"C:\Users\me\Desktop\test2"

convertedEndingName = "_BUILD"


# Find any .max files in the folder specified, if max exist, open, export # entire scene to fbx.
for root, dirs, files in os.walk(folder):
    for item in files:
      if item.endswith((".max", ".MAX")):
		  filePath = os.path.join(root, item)
		  filePath = filePath.replace('\\', '\\\\')
		  
		  filePath1 = r'"' + filePath + '"'
		  
		  print(filePath1)
		  
		  
		  filePathExported = filePath.replace('.max', '').replace('.MAX', '')
		  
		  sm = r'loadMaxFile ' + filePath1 + ' quiet:true prompt:false useFileUnits:false'
		  
		  max.Core.EvalMAXScript(sm)
		  
		  filePathExported = r'"' + filePathExported + '_MAX' + convertedEndingName +'.fbx"'
		  
		  print(filePathExported)
		  
		  efbx = r'exportFile ' + filePathExported  + '#noPrompt ' + ' selectedOnly:false'
		  
		  max.Core.EvalMAXScript(efbx)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 19:45:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553337#M6695</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-01T19:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553345#M6696</link>
      <description>&lt;P&gt;What is the error you are encountering?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 19:52:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553345#M6696</guid>
      <dc:creator>attilaszabo</dc:creator>
      <dc:date>2020-06-01T19:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553386#M6697</link>
      <description>&lt;P&gt;Whoops, I am sorry, I got my versions mixed up,&amp;nbsp;It works in Max 2020 but not 2021.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error I am getting looks like this:&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="maxError.png" style="width: 711px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/778436iC21B69C5C30A6738/image-size/large?v=v2&amp;amp;px=999" role="button" title="maxError.png" alt="maxError.png" /&gt;&lt;/span&gt;&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>Mon, 01 Jun 2020 20:21:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553386#M6697</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-01T20:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553430#M6698</link>
      <description>&lt;P&gt;Sounds like you may have introduced an inconsistency in the white space that you use for code indentation.&lt;/P&gt;
&lt;P&gt;Turn on "show whitespace" in your editor (in 3ds Max's editor, it's Ctrl+Shift+8, or View menu &amp;gt; Whitespace) and look for the problem.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 20:43:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553430#M6698</guid>
      <dc:creator>attilaszabo</dc:creator>
      <dc:date>2020-06-01T20:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553449#M6699</link>
      <description>&lt;P&gt;Thanks! That helped me get to the real problem....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there is no MaxPlus Module... then how do I rewrite the two functions that use MaxPlus on line&amp;nbsp;&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="unknown.png" style="width: 464px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/778441i90D7B81E440EE89B/image-size/large?v=v2&amp;amp;px=999" role="button" title="unknown.png" alt="unknown.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The lines I am referring to are&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;			sm = r'loadMaxFile ' + filePath1 + ' quiet:true prompt:false useFileUnits:false'&lt;/LI-CODE&gt;&lt;P&gt;and&lt;/P&gt;&lt;LI-CODE lang="python"&gt;			efbx = r'exportFile ' + filePathExported  + '#noPrompt ' + ' selectedOnly:false'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2020 20:59:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553449#M6699</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-01T20:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553775#M6700</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;The script already uses a MAXScript way of loading and exporting a file. You simply need to use the 'pymxs' module to achieve the same. The module is a Python wrapper over MAXScript. Your script would now read like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;#
#import modules
#
from pymxs import runtime as mxs
import os

#
#define a master folder and suffix name
#

folder = r"C:\Users\me\Desktop\test2"

convertedEndingName = "_BUILD"

# Find any .max files in the folder specified, if max exist, open, export # entire scene to fbx.
for root, dirs, files in os.walk(folder):
    for item in files:
        if item.endswith((".max", ".MAX")):
            filePath = os.path.join(root, item)
            filePath = filePath.replace('\\', '\\\\')
            print(filePath)

            filePathExported = filePath.replace('.max', '').replace('.MAX', '')
            mxs.loadMaxFile(filePath, quiet=True, prompt=False, useFileUnits=False)

            filePathExported = filePathExported + '_MAX' + convertedEndingName + '.fbx'
            print(filePathExported)

            mxs.exportFile(filePathExported, mxs.Name('noPrompt'), selectedOnly=False)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can read more on translating MAXScript to Python on &lt;A href="https://help.autodesk.com/view/MAXDEV/2021/ENU/?guid=__developer_using_pymxs_html" target="_blank" rel="noopener"&gt;this help page&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 02:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9553775#M6700</guid>
      <dc:creator>eric.brosseau</dc:creator>
      <dc:date>2020-06-02T02:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk Processing via Python Script</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9555537#M6701</link>
      <description>&lt;P&gt;THANK YOU SO MUCH!&amp;nbsp; IT WORKS!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The resources you linked are really helpful, especially seeing it used in example.. You rock for correcting this for me. Thanks again.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2020 17:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/bulk-processing-via-python-script/m-p/9555537#M6701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-06-02T17:53:16Z</dc:date>
    </item>
  </channel>
</rss>

