Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 24-07-2004 , 12:58 AM
DukerX's Avatar
Subscriber
Join Date: Nov 2002
Location: Sandnes, Norway
Posts: 99

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]


-DX-

Last edited by DukerX; 24-07-2004 at 01:04 AM.
# 2 24-07-2004 , 01:29 AM
dannyngan's Avatar
Registered User
Join Date: Dec 2002
Location: Seattle, WA
Posts: 1,154
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);


Danny Ngan
Animator | Amaze Entertainment
my website | my blog | my job
# 3 24-07-2004 , 01:39 AM
DukerX's Avatar
Subscriber
Join Date: Nov 2002
Location: Sandnes, Norway
Posts: 99
Yeeha!
Thanks alot man. It works!
(I'm using the script to create spirals..)


-DX-
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads