ToMaya

This is work in progress. If you have any feedback please mail me at contact@josbalcaen.com

Execute Python code in Maya from Visual Studio

Category: Free work
Downloadable: Yes

Use visual studio to execute python code in Maya. If you haven’t got the Python Tools for Visual Studio installed, get a look at http://pytools.codeplex.com/

Setup

- Download (VS2012 VS2013 VS2015) ToMaya.vsix file and execute it (Microsoft Visual Studio Version Selector). This will install the extension.
- Type the following code in the Maya script editor and drag it to the shelf or use it in a startup script.

import maya.cmds as cmds
try: cmds.commandPort(name="127.0.0.1:6000", close=True, echoOutput=True)
except:    pass
cmds.commandPort(name="127.0.0.1:6000", echoOutput=True)

- If you restart or open Visual studio you should find it under tools.
- Go to Tools -> Options -> Keyboard
- Search for “ToMaya” and create a new shortcut. I use Alt+Space

How it works

- Press the shelve button in Maya
- Creating a file in Visual Studio and type

import maya.cmds as cmds
cmds.polySphere()

- Select the code and press the shortcut or press the menu entry.
- If you see a sphere in Maya everything is setup.

If you see the following error press the shelf button again and check if it gives no error

Download VS2012 VS2013 VS2015

16 thoughts on “ToMaya

  1. Hey I upgraded your “ToMaya” program to work with visual studio 2015 :)

    https://mega.nz/#!8td1gIZZ!YvDC1L9AWZkTGxomDNXjJQIpWHVYoKQP6Zw8OLcdY4E

    • Ionut-Stefan Dinu says:

      Hi!

      Please, could you reupload the file? No link works.. not event the ones for 2012 and 2013…

      Thank you!

      • Jos says:

        Updated all the links. Can’t get the download link for ToMaya.vsix working in the studio gallery, but added a alternative download link.
        Also added the file from Mathijs Roosen (haven’t tested it myself)

  2. Stefanie Nobel says:

    Thanks for the post.

    Are you gonna publish one for VS2015 as well?

    Cheers,
    Stefanie

  3. Kevin says:

    I can’t seem to get this to work.
    Every few times I run the oprn port script in maya I get:
    # Error: RuntimeError: file line 4: Socket error creating command port 127.0.0.1:6000 (10048). #

    And when I run ToMaya (from the menu or command) in VS2013 I get no feedback and there is nothing executed in Maya. Any help appreciated! I’m using maya 2016 and VS2013 Community.

  4. Raymond Stewart says:

    Cant get this to work… Get this error message even though every thing is installed.

    could not find a part of the path ‘c:\Temp\tomaya.py’

  5. […] まず,ToMayaというプラグインを導入し,Visual Studio側からMayaへpythonコードを転送&実行できる環境を整えます.ToMayaのプロジェクトページからプラグインファイル(2015/4/28時点では ToMaya2013.vsix)をダウンロードして実行します.[インストール]ボタンをクリックすると,比較的短い時間で処理が完了します. […]

  6. deepak says:

    thank you!

  7. Luke says:

    looks great, any plan to release a VS2013 version? :)

  8. sm says:

    neat! thanks doing this.

  9. Derrick says:

    False alarm on ToMaya not working… though the commandPort snippet still doesn’t work, it appears port :6000 is open and ToMaya is working… I didn’t realize it only sent the selected text, I assumed it sent the whole document. I’m fairly new to VS addins, I wonder if there’s a way to create a “send document” action by first doing a select all and then using ToMaya.

Leave a Reply to Kevin Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>