SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / Vertex Positions in MEL commands
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 06-11-2004, 07:57 PM   #1
Forlax
Subscriber
 
Forlax's Avatar
 
Join Date: Aug 2003
Location: Middlesbrough, UK
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default Vertex Positions in MEL commands

Does anybody know how to get the global position of a vertex on an object using mel scripting.

I tried this:

float $VtxPos[] = `polyMoveVertex -q -t $objName.vtx[0]`;

The script doesn't complete and seems to just hang.

I know this because the script should create a cone at the end of the script.

Come to think of it, I'm actually trying to find the centre of a face. My method is to get the three vertices of the face and average them.

Perhaps somebody knows how to do this and save me a job.

I assume objectCenter is for objects only. (I already tried it without sucess).

Thanks.

Forlax.
Forlax is offline   Reply With Quote
Old 07-11-2004, 02:10 AM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

To get the vertex pos do this:

float $fVtxPos[] = `xform -q -ws -t ($sObjName + ".vtx[0]")`;

I think this would return all vertex positions associated to a face...

float $fVtxPos[] = `xform -q -ws -t ($sObjName + ".f[0]")`;

there might be an easier way for getting the face center. not sure...
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 07-11-2004, 10:37 AM   #3
Forlax
Subscriber
 
Forlax's Avatar
 
Join Date: Aug 2003
Location: Middlesbrough, UK
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This throws up a syntax error.

My $objName is of type string[], so I get the following error message.

// Error: Illegal operation "+" on data of type string[]. //

I assume in your code your objName was of type string.

What is the way around this?

Sorry I am a MEL newbie.
Forlax is offline   Reply With Quote
Old 07-11-2004, 12:19 PM   #4
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

you're dealing with a string array (list of strings) so you need to supply the index as well. eg:

float $fVtxPos[] = `xform -q -ws -t ($sObjName[0] + ".vtx[0]")`;
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 07-11-2004, 12:50 PM   #5
Forlax
Subscriber
 
Forlax's Avatar
 
Join Date: Aug 2003
Location: Middlesbrough, UK
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry.

I figured out my mistake the minute before you replied.

Thanks tho. I appreciate your help.

Thanks.

Forlax.
Forlax is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 08:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 03:41 PM

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.