SimplyMaya Forums

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

Home / forum / Lounges / Maya Basics & Newbie Lounge / Straighten imported model (STEP file)
Register FAQ Members List Calendar Mark Forums Read

New Thread
Thread Tools
Old 16-02-2012, 01: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, 09: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, 11:37 AM   #3
ctbram's Avatar
Join Date: Jan 2004
Location: Michigan, USA
Posts: 2,997
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 06:01 PM.
ctbram is offline   Reply With Quote
Old 18-02-2012, 12:42 PM   #4
Lead Modeler - Framestore
Jay's Avatar
Join Date: Feb 2003
Location: UK
Posts: 6,276
Thanks: 41
Thanked 428 Times in 384 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
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
Model all black or new artifacts showing?? Lost all my painting and texuring!!! mayaday Maya Basics & Newbie Lounge 13 06-07-2013 04:37 PM
Urgent help needed Lee Perkins Technical Issues 5 14-10-2011 01:36 PM
Preparing a model before texturing... goggles Members Lounge 7 09-09-2011 09:46 PM
Maya scene files and rendered .iff files disappearing from HDD on file load priimate Technical Issues 3 06-05-2011 09:34 AM
Bump map distortions from an imported model rockit Maya Basics & Newbie Lounge 5 24-12-2010 09:55 AM

1 Month


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

3 months


Billing every 3 months
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


Billing every 12 months
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.