Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 06-11-2004, 08: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, 03: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, 11: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, 01: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, 01: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
Reply


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

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.