Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 10-04-2008 , 03:24 AM
ronviers's Avatar
Registered User
Join Date: Nov 2007
Location: US
Posts: 28

Mel systax

spaceLocator -n temp01_r_armFkA01_loc;
spaceLocator -n temp01_r_armFkA02_loc;
float $locWp1[2]=`getAttr temp01_r_armFkA01_locShape.worldPosition[0]`;
float $locWp2[2]=`getAttr temp01_r_armFkA02_locShape.worldPosition[0]`;
distanceDimension -sp $locWp1 -ep $locWp2;

// Error: Error while parsing arguments. //

I get this error on the distanceDimension line - probably because of how I am trying to pass the coordinates to the start and end point arguments. Can someone tell me how I should do it.

Thanks,
Ron

Edit:
Even this,

$t1="-sp 0 0 0";
distanceDimension $t1 -ep 0 0 0;

does not work. I am just not getting it.user added image


Last edited by ronviers; 10-04-2008 at 03:44 AM.
# 2 22-04-2008 , 02:06 AM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
the problem likely stems from the fact that it looks like you're only storing one variable in your array, rather than the set of three you need. The second command is related to this, in that it can't read strings at all. however, if you use seperate variables for each of the location points, the code should work.


Book Wise

https://X4nd5r.deviantart.com
# 3 22-04-2008 , 02:20 AM
ronviers's Avatar
Registered User
Join Date: Nov 2007
Location: US
Posts: 28
Syntactically this is how I got it to work.

spaceLocator -n temp01_r_armFkA01_loc;
spaceLocator -n temp01_r_armFkA02_loc;
float $locWp1[]=`getAttr ("temp01_r_armFkA01_locShape.worldPosition[0]")`;
float $locWp2[]=`getAttr ("temp01_r_armFkA02_locShape.worldPosition[0]")`;
distanceDimension -sp $locWp1[0] $locWp1[1] $locWp1[2] -ep $locWp2[0] $locWp2[1] $locWp2[2];

But this was no better than the way I was doing it before, like this:


distanceDimension -sp 0 0 0 -ep 0 0 0;
rename |distanceDimension1 "tempFkA01_dd";
spaceLocator -n tempFkA01_loc;
spaceLocator -n tempFkA02_loc;
connectAttr -f tempFkA01_locShape.worldPosition[0] tempFkA01_ddShape.endPoint;
connectAttr -f tempFkA02_locShape.worldPosition[0] tempFkA01_ddShape.startPoint;

I am still looking for the correct way to add dd nodes with mel. How do you do it?

Thank you for your reply,
Ron

# 4 22-04-2008 , 02:28 AM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
I'm not entirely sure what you're getting at. What you posted about creating the dd node is good (at least as far as putting in variables). Are you trying to create locators to go along with it? (which it seems to create by default, at least in maya 8.5). or attach one to pre-existing locators/locations? or rename it?


Book Wise

https://X4nd5r.deviantart.com
# 5 22-04-2008 , 02:36 AM
ronviers's Avatar
Registered User
Join Date: Nov 2007
Location: US
Posts: 28
Yes. This is how the distance tool does it. This is the command harvested from the script editor.

distanceDimension -sp 0 0 0 -ep 0 0 0 ;

This results in a dd node with locators attached. Very slick.


Compared to:

distanceDimension -sp $locWp1[0] $locWp1[1] $locWp1[2] -ep $locWp2[0] $locWp2[1] $locWp2[2];

These commands appear to be identical but they do not result in the same dd configuration.
So I have to use one of my clumsy methods.


Last edited by ronviers; 22-04-2008 at 02:39 AM.
# 6 22-04-2008 , 02:48 AM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
*blinks* how are they different? the results seem to be the same to me (could be I'm just dense about this).

Anyways this setup:

Originally posted by ronviers
[distanceDimension -sp $locWp1[0] $locWp1[1] $locWp1[2] -ep $locWp2[0] $locWp2[1] $locWp2[2];

would be the way I would have gone, I think (putting something into the system that way.

If you could be a little more specific about the results you are attempting to get?


Book Wise

https://X4nd5r.deviantart.com
# 7 22-04-2008 , 03:07 AM
ronviers's Avatar
Registered User
Join Date: Nov 2007
Location: US
Posts: 28
Got it!!
Ok, here is what doesn't work:

spaceLocator -n temp01_r_armFkA01_loc;
spaceLocator -n temp01_r_armFkA02_loc;
float $locWp1[]=`getAttr ("temp01_r_armFkA01_locShape.worldPosition[0]")`;
float $locWp2[]=`getAttr ("temp01_r_armFkA02_locShape.worldPosition[0]")`;
distanceDimension -sp $locWp1[0] $locWp1[1] $locWp1[2] -ep $locWp2[0] $locWp2[1] $locWp2[2];

And this is what does:

spaceLocator -n temp01_r_armFkA01_loc -p 0 0 1;
spaceLocator -n temp01_r_armFkA02_loc -p 0 0 0;
float $locWp1[]=`getAttr ("temp01_r_armFkA01_locShape.worldPosition[0]")`;
float $locWp2[]=`getAttr ("temp01_r_armFkA02_locShape.worldPosition[0]")`;
distanceDimension -sp $locWp1[0] $locWp1[1] $locWp1[2] -ep $locWp2[0] $locWp2[1] $locWp2[2];

I guess it needs a non-zero distance. Thanks for bringing be back to this problem Xander-0. I had forgotten all about it. Still, not a whole heck of a lot better than I had but I am very glad to get it worked out.

Thanks for taking a look,
Ron

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