I have a problem in starting a script that is developed with python there is someone who can help me

I have a problem in starting a script that is developed with python there is someone who can help me

originalthinkingstudio
Explorer Explorer
652 Views
5 Replies
Message 1 of 6

I have a problem in starting a script that is developed with python there is someone who can help me

originalthinkingstudio
Explorer
Explorer

please can anyone help me to solve this problem , "this script is for renaming bitmaps and materials"

thank you

you can download Script in attached file 

 

originalthinkingstudio_0-1667234757335.png

 

0 Likes
Accepted solutions (1)
653 Views
5 Replies
Replies (5)
Message 2 of 6

eric.brosseau
Autodesk
Autodesk

Hi @originalthinkingstudio,

The Python script you are trying to run seems to rely on 'MaxPlus', a Python module that was deprecated with the introduction of Python 3. The last release Python 2.7 was still present in the product was for 3ds Max 2021. Starting with 3ds Max 2022, Python 3 was the only Python interpreter and 'MaxPlus' was then not present anymore.

 

On which version of 3ds Max are you trying to use your script?

 

Eric Brosseau
Senior Software Developer, 3ds Max, Autodesk
Message 3 of 6

originalthinkingstudio
Explorer
Explorer
Thanks for the reply
I'm working on the 2023 version
0 Likes
Message 4 of 6

originalthinkingstudio
Explorer
Explorer
Is there a solution to run it on version 2023
Or do I have to install the 2021 version?
0 Likes
Message 5 of 6

eric.brosseau
Autodesk
Autodesk
Accepted solution

There are two options. you either:

  • run your script on a 3ds Max 2021 with the command-line option '-pythonver 2' (or set the environment ADSK_3DSMAX_PYTHON_VERSION=2) - detailed here; or
  • the vast majority of MaxPlus functionalities can be converted to use the 'pymxs' Python module, our MAXScript exposure to Python.

 

I have taken a look (really rapidly) at the 'main.py' file in the archive you provided in the original post. It seems MaxPlus is used for only two trivial cases:

  1. executing a MAXScript script from within Python
     MaxPlus.Core.EvalMAXScript(
    'filein @"{}"'.format(os.path.join(ROOT_DIRECTORY, cls.ValidatorFileName)))
    This can be converted to the pymxs.runtime 
    rt.filein(os.path.join(ROOT_DIRECTORY, cls.ValidatorFileName))
  2. The other call wants to get the main Qt widget of the 3ds Max by making this call
    MaxPlus.GetQMaxMainWindow()

    We introduced a new Python helper module directly dealing with PySide2 (Qt) objects called qtmax. The call would be simply this (once you import qtmax into your script)

    qtmax.GetQMaxMainWindow()

     

I hope this help. As a free gift, I have included a working main.py file (this only file in the zip archive attached to this message) with the changes required and described here.

 

Eric Brosseau
Senior Software Developer, 3ds Max, Autodesk
0 Likes
Message 6 of 6

originalthinkingstudio
Explorer
Explorer

the problem is solved thank you very much eric.brosseau
0 Likes