maya-command-port
v1.0.0
Published
Connect to an Autodesk Maya CommandPort via a TCP socket, and execute Python/MEL commands
Downloads
99
Maintainers
Readme
Maya CommandPort (Node)
NodeJS library to interact with an Autodesk Maya commandPort by sending Python/MEL commands.
Installation
npm install maya-command-portExample Usage
import { MayaCommandPort } from 'maya-command-port';
const PORT = 7001;
const HOST = 'localhost';
const commandPort = new MayaCommandPort();
commandPort.connect(PORT, HOST).then(async () => {
// Send a Python command to Maya
let command = 'print("Hello from Node!")';
let response = await commandPort.sendCommandPython(command);
// Or send a MEL command
command = 'polySphere -name "Test";';
response = await commandPort.sendCommandMEL(command);
// Disconnect from Maya once done
await commandPort.disconnect();
}).catch((err) => {
console.error('Failed to connect to Maya CommandPort:', err);
});Maya Setup
Use the maya command commandPort to open a command port in Maya. Refer to the official command documentation for configuration options.
Example Python
from maya import cmds
cmds.commandPort(name=":7001", sourceType="python", echoOutput=True)Example MEL
commandPort -name ":7001" -sourceType "mel" -echoOutput;Changelog
For a list of changes, see releases
