Message 1 of 5
How to send python lists to a custom command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'd like to be able to create a command that will accept from python a large list, or even better a list of tuples, as an argument. Just like the curve command for instance: cmds.curve( d=1, p= [ (x,y,z), (x,y,z), (x,y,z), ... ] ). And then translate it into a multidimensional array.
I can use the addFlag and flagArgument functions to pass data through, but the data types seem limited.
Here is what I have:
MSyntax MyCommand::newSyntax() { MSyntax syntax; syntax.addFlag( "-arg", "-argument", MSyntax::kDouble); return syntax; } MStatus MyCommand::doIt(const MArgList &argList) { MStatus status; MArgDatabase argData(syntax(), argList, &status ); CHECK_MSTATUS_AND_RETURN_IT(status); double arg1; arg1 = argData.flagArgumentDouble("-arg", 0); }
How can I make a command that accepts lists as arguments?