Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   putting strings into expressions? (https://simplymaya.com/forum/showthread.php?t=12733)

DukerX 24-07-2004 12:58 AM

putting strings into expressions?
 
I'm currently playing with some MEL-scripting, but there is something I just can't figure out..

Is there a way to insert an "arglist" after a "curve" command?

For instance: "curve $arglist;" where $arglist is a string containing as an example "-p 1 0 0 -p 1 1 0 -p 2 1 0 -p 1 1 1"

The $arglist string is created dynamically in the script, one "-p x y z" sequence at the time.

I think I could calculate the first four points and then execute "curve -p $x1 $y1 $z1 -p ......." and then use the "-a" flag to append points to the curve, but it's not very neat, and I haven't tried it yet. Not sure if it would work anyway...

[Edit]
By the way... I've tested the arglist by using the "print ($arglist);" command and then copying the result and paste it after a "curve" command in the command line.
[/Edit]

dannyngan 24-07-2004 01:29 AM

You'll need to use an eval command to combine multiple strings into a command like this:

Code:

$points = "-p 1 0 0 -p 1 1 0 -p 2 1 0 -p 1 1 1";
eval("curve " + $points);


DukerX 24-07-2004 01:39 AM

Yeeha!
Thanks alot man. It works!
(I'm using the script to create spirals..)


All times are GMT. The time now is 08:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018