Skip to content

Wing Pro

Jeff Hanna edited this page Mar 25, 2019 · 4 revisions

Wing handles external tools by way of creating custom Python scripts that interact with the Wing API. This limits the ability to utilize external tools to only Wing Pro. The lower priced Wing IDE packages do not contain the extensibility API.

  • Copy the following script, modify it where necessary (e.g. the path to the MXSPyCOM.exe application) and save it to:
  • %APPDATA%\Wing IDE 6\scripts, and then restart Wing.
  • Activate the Edit\Preferences menu command
  • In the Preferences dialog navigate down the left-hand column to the Keyboard option
  • Click the Insert button to create a new keybinding
  • In the New Value dialog that is displayed create a hotkey in the Key box
  • In the Command box type the name of the function in the external command script.

Note: Wing will automatically change any _ characters in the function name to - characters. e.g. execute_script_in_3ds_max -> execute-script-in-3ds-max.
Wing will autocomplete the command name using the list of commands that were registered when it was started.

  • Click the OK button to dismiss the New Value dialog
  • The new command should be visible in the list of commands in the Preferences dialog
  • Click the OK button to dismiss the Preferences dialog.

import os
import subprocess
import wingapi

def execute_script_in_3ds_max():
app = wingapi.gApplication
doc = app.GetActiveDocument()

if doc:
# Save the active doc first
    wingapi.gApplication.ExecuteCommand("save")
    filepath = doc.GetFilename() # This method is misnamed, as it returns the filepath.
    mxspycom_filepath = "C:\\Program Files\\MXSPyCOM\\MXSPyCOM.exe"
    if os.path.exists(mxspycom_filepath) and os.path.exists(filepath):
        subprocess.Popen([mxspycom_filepath, "-s", filepath])

More information on scripting and extending Wing Pro can be found here.

Clone this wiki locally