Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 08-12-2012 , 10:14 PM
Registered User
Join Date: Nov 2012
Posts: 5

get the Name of an imported Object

Hey,
I'm trying to write a script that builds me a house randomly in Python.
For that I am importing a window model, and i have to get the name of that Object and save it in a variable!
I found no way how to do that.
There's no problem getting the name of polyCube for example created in the script editor, so there have to be also a command for imported Objects as well or am I wrong?
I hope someone can tell how I have to do it

thanks in advance user added image

# 2 08-12-2012 , 10:56 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Simple. When you import a file, it (by default) puts the objects into a namespace. You can then look at the new namespace, and you have all the objects that were imported.


Imagination is more important than knowledge.
# 3 09-12-2012 , 12:43 AM
Registered User
Join Date: Nov 2012
Posts: 5
Thank you :-)
I had a lot of trouble with namespaces, when i executed my script twice for example, the given names didn't start over at 0, but did coninue where it left off.
So I had no idea how to select an object in an algorithm, not knowing where the namespace had counted
But I fixed it now with a global variable, not the most beautiful solution i believe, but it works ;-)
Thank you very much for your help :-)

# 4 09-12-2012 , 03:46 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Yes, namespaces can be a pain. Glad you figured it out.


Imagination is more important than knowledge.
# 5 11-12-2012 , 07:14 PM
Registered User
Join Date: Nov 2012
Posts: 5
there is another problem for which I can find no solution.
I want to select a face, than extrude and scale!
I want it to scale to the center, but I think Maya scales it to the center of the hole object, so i have to give it the pivot information of the face, but how do i get it?
Or is there any other solution scaling a face to its center? Any flag or something I miss?
Im using Maya 2011, if this is important.

# 6 11-12-2012 , 07:48 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
When you're in the extrude tool, you can click the small blue circle to switch between global and local. I'm not sure if that helps.

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