Is it the "rigid()" function that is crashing Maya? I suppose you could try adding a sleep to see if it at least prevents the crash, and go from there.
import time time.sleep(0.1) # 1/10 of a second That aside, there are some things you can probably do to make it more efficient. Some of the commands take a list of objects, so that you don't have to loop over each one and call it individually: # operate on the whole selection instead of doing a # for x in y: select, operate, deselect cmds.connectDynamic(selection, f='gravityField1') cmds.rigidBody(selecton, active=True,iv=[0.0,-10.0,0]) cmds.rigidBody(floorSel , active=False,passive=True) Also, you can make your callback connections a bit more tightly bound by using the callable object: floorBut=cmds.button(label="Load Floor",c=getFloor) freezeBut=cmds.button(label="Freeze transforms",c=freeze) Hope that helps. On Mon, Jul 23, 2012 at 1:00 PM, Ricardo Viana <[email protected]> wrote: > Hi all. i ve been assigned a task where i need to simulate a large number > of > rigid bodies. i developed a script to aid me in the process but the thing > is > that it works ok with few objects, but when gets to more than 200 objects > it immediately crashes maya. Sorry for my newbieness but is there a way > i can make the for loop process to slow down so that it slowly creates rbd > one at a time, maybe that can work. i have the script here > http://pastebin.com/5gDiG9y6 if you > want to have a look. > > cheers > Ricardo Viana > > -- > view archives: > http://groups.google.com/**group/python_inside_maya<http://groups.google.com/group/python_inside_maya> > change your subscription settings: http://groups.google.com/** > group/python_inside_maya/**subscribe<http://groups.google.com/group/python_inside_maya/subscribe> > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
