Results 1 to 3 of 3

Thread: How to pass global variables between maxscript and python ?

  1. #1
    undefined
    Join Date
    Mar 2017
    Posts
    2

    Question How to pass global variables between maxscript and python ?



    Forixample...

    --python_in_3dsmax-----

    import MaxPlus

    mr = "fusion"
    global mr

    msEval = MaxPlus.Core.EvalMAXScript
    msString ='''
    flux = "capacitor"
    global flux

    print mr
    '''
    msEval(msString)

    print flux

    ----------

    I can't that

  2. #2
    while loop
    Join Date
    Feb 2010
    Posts
    180

    Default

    I have no idea how to do exactly what you want, as I'm completely unfamiliar with the maxscript <--> python bridge.

    But the global keyword in python doesn't really work that way.
    It is basically used to allow nested scopes to access and modify values in the module's global scope.
    So global only impacts the current module that you're in.

    This page has a bunch of examples and explenations:
    http://www.python-course.eu/global_v..._variables.php

  3. #3
    undefined
    Join Date
    Mar 2017
    Posts
    2

    Default I was taught

    -----in_maxscript-----

    __temp__ = "flux"

    -------------------------

    -----in_python(max)--

    msEval = MaxPlus.Core.EvalMAXScript
    msString ='''__temp__'''

    ret = msEval(msString)
    print ret.Get()

    -------------------------




    -----in_python(max)--

    msEval = MaxPlus.Core.EvalMAXScript
    msString ='''__temp__ = "capacitor" '''

    msEval(msString)

    -------------------------


    -----in_maxscript-----

    print __temp__

    -------------------------

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •