Introduction to Maya - Modeling Fundamentals Vol 1
This course will look at the fundamentals of modeling in Maya with an emphasis on creating good topology. We'll look at what makes a good model in Maya and why objects are modeled in the way they are.
# 1 22-02-2013 , 12:03 PM
Registered User
Join Date: Nov 2012
Posts: 5

Loop slows down

Hey,

I'm writing a short script in python that extrudes twice every face on a plane.
With the following code it works but when i'm executing the script, it slows down if the loop runs over 30 or 40 times. It starts real quick but slows down more and more. I don't understand why it's happening, it shouldnt worry if the variable x is 10 or 100


class Plane():

def Creator(self, building):

for x in range(building):

for i in range(2):
cmds.polyExtrudeFacet( 'pPlane1.f[' + str(x) + ']' , ls=(0.7, 0.7, 0) )
cmds.polyExtrudeFacet( 'pPlane1.f[' + str(x) + ']' , ltz=0.4 )


def Ground(self, XScale, YScale):
cmds.polyPlane( w=XScale, h=YScale, sw=XScale, sh=YScale)
building = XScale * YScale
place.Creator(building)

place = Plane()
place.Ground(15, 15)


I hope somebody can explain it to me and have some advice in case my program is bad^^

thanks :-)


Last edited by McDee; 24-02-2013 at 11:16 AM.
# 2 26-02-2013 , 07:14 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
One of the problems could be that there is simply more geometry than there was before. Another problem could be that the construction history is beginning to build up. Take a look at the constructionHistory command. Turn it off at the beginning of your script, and then back on at the end. (You don't need to toggle it on each command)


Imagination is more important than knowledge.
# 3 26-02-2013 , 11:10 PM
Registered User
Join Date: Nov 2012
Posts: 5
Thank you so much :-) i never could thought of that!!
I turned off the construction History and now it runs real fast!

thanks a lot :-)

# 4 27-02-2013 , 03:53 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
No problem. Don't worry though, if you work with this stuff a lot, you'll be able to spot the problems pretty quickly.


Imagination is more important than knowledge.
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