Maya Training

Creating characters In Maya and Zbrush

Maya Training

Creating character renders in Maya 2017 and Arnold

Maya Training

Spach-Alspaugh House the complete courseware
You are here > Home > SimplyMaya Community Forums

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 16-02-2012, 02:12 PM   #1
Registered User
Join Date: Jan 2012
Posts: 6
Thanks: 5
Thanked 4 Times in 4 Posts
Default Straighten imported model (STEP file)


I'm receiving STEP files of objects that we're rendering for a client (I don't normally work in Maya), but it seems they end up standing on edge somehow. My suspicion is that the pivot point is not reset angle-wise to 0 degrees. I have been able to get the client to at least get the pivot point to XYZ zeroed, which means that the object (imagine a 1x1x3 box, regardless of unit) is standing at zero XYZ but on its edge basically.

I have still been unable to get the client to "fix" this problem (I believe they're working in Inventor, but they're located in Poland and not fluent in English either, so I can't pay them a visit), so I'm wondering if there is any way or script I can use to "straighten" the model based on a known straight part of the model?

Ideally, if I could select a single nurbshape (a plane) in the model that I know should be aligned along X and Z axis (i.e. flat on the ground) and run a script that either a) straightens the whole model (it's grouped in root) or b) gives me the X, Y and Z rotation to use to straighten it I would be eternally greatful.

Ask away if there's anything else you might need to know.

Oh, it's Maya 2012 on OS X btw.
Bornhall is offline   Reply With Quote
Old 18-02-2012, 10:50 AM   #2
Registered User
Join Date: Jan 2012
Posts: 6
Thanks: 5
Thanked 4 Times in 4 Posts

Alright, seems no one here could be bothered to point me to "Snap Align Object" -> "3 Points to 3 Points", but luckily I found the answer elsewhere...

Anywho, I ended up writing a small script (works for me at least) that may be of help for someone else, here goes:

// this finds the name of the group the selected object belongs to
string $p[] = `listRelatives -fullPath` ;
$p = stringToStringArray( $p[0], "|") ;
$gOriginal = $p[0] ;

// duplicate the selected object and move it to root
duplicate -rr -n refOrig ;
parent -w refOrig ;

// move the object to the root of GROUP the selected object belongs to
parent refOrig $gOriginal ;

// you may or may not want this, I had a subgroup inside the group
// and wanted the duplicated object to be the first object in it
reorder -relative -1 refOrig ;

// create a new reference plane at 0, 0, 0. 100 units wide/deep
nurbsPlane -p 0 0 0 -ax 0 1 0 -w 100 -lr 1 -d 1 -u 1 -v 1 -ch 1 -n refPlan ;

// you may want to change this, I wanted the corner to be at 0, 0
// so X and Y goes -50. for my purpose I also moved it up 75 units.
setAttr "refPlan.translateX" -50 ;
setAttr "refPlan.translateZ" -50 ;
setAttr "refPlan.translateY" 75 ;

// select 3 vertices on the original object
select -r[0][0] ;
select -tgl[0][1] ;
select -tgl[1][1] ;

// select 3 vertices on the reference plane
select -tgl[1][0] ;
select -tgl[1][1] ;
select -tgl[0][1] ;
Basically, what I do is this; I select a single part/plane on the group that needs to be straightened that I know is supposed to be straight (flat on the ground). Then I run the above script which creates a duplicate of the selected object + a reference plane at 0, 0, 0 (I move it in X, Y and Z axis with setAttr above, you may want to get rid of or change those). The script also selects 3 points from the duplicate of the original object and then 3 points on the newly created reference plane. After that I only need to select "3 Points to 3 Points", select "Parent" from the dialog (the script moves the duplicate to the root of the group the original is part of).

Depending on the model, you may have to rotate it anyways, but it should now be a question of 90 degree angles only.

After the straightening is done you should remove the "leftover" refOrig and refPlan objects.

I will not provide any further support for this script, but it may be of help to someone out there
Bornhall is offline   Reply With Quote
Old 18-02-2012, 12:37 PM   #3
ctbram's Avatar
Join Date: Jan 2004
Location: Michigan, USA
Posts: 2,996
Thanks: 42
Thanked 582 Times in 532 Posts

The reason your imported files are rotated by 90 degrees is that inventor, like many true engineering CAD apps, uses the Z-axis as the up axis. Maya uses the Y-axis as the up axis by default.

You can fix this in three ways.

1. change the up axis in maya by going to windows > settings / preferences > settings and making the up axis the Z-axis for your clients files.

2. Have your client set the up axis in Inventor or his CAD surfacing app to be the Y-axis. I cannot recall where this is done in Inventor but I know it can be done.

3. create a mel as you have to rotate all imported objects about the X-axis by 90 degrees and freeze their transforms effectively making the Y-axis the up axis. I am not a mel guy so I cannot really comment on your script.
"If I have seen further it is by standing on the shoulders of giants." Sir Isaac Newton, 1675

Last edited by ctbram : 18-02-2012 at 07:01 PM.
ctbram is offline   Reply With Quote
Old 18-02-2012, 01:42 PM   #4
Lead Modeler - Framestore
Jay's Avatar
Join Date: Feb 2003
Location: UK
Posts: 6,250
Thanks: 40
Thanked 425 Times in 381 Posts


Its not a case of anyone being bothered. People may not actually know hence, no answers.

As CTBram says.......

for the record MAX uses Z up I believe.

If Dave or NextDesign are around they may be able to help with the script

Jay is offline   Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Model all black or new artifacts showing?? Lost all my painting and texuring!!! mayaday Maya Basics & Newbie Lounge 13 06-07-2013 05:37 PM
Urgent help needed Lee Perkins Technical Issues 5 14-10-2011 02:36 PM
Preparing a model before texturing... goggles Members Lounge 7 09-09-2011 10:46 PM
Maya scene files and rendered .iff files disappearing from HDD on file load priimate Technical Issues 3 06-05-2011 10:34 AM
Bump map distortions from an imported model rockit Maya Basics & Newbie Lounge 5 24-12-2010 10:55 AM

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-2017 SimplyMaya - vBulletin® Copyright © 2000-2017, Jelsoft Enterprises Ltd.