Python script print multiple looped object while scaling

import rhinoscriptsyntax as rs
#x = input mesh
for i in range(0,1000000):
E = rs.ScaleObject(x,rs.MeshVolumeCentroid(x),(i/100,i/100,i/100),True)
if rs.MeshVolume(E)[1]*(0.87) >= 100:
break
print(E)

why this print ONE guid of E scaled mesh, but the loop prints me out in rhino n(loops)-objects??
thank you
Nicolas

E = rs.ScaleObject(x,rs.MeshVolumeCentroid(x),(i/100,i/100,i/100),True)

The last “True” argument means that it will create a copy of the scaled mesh and add it to the document on every loop. When you print E at the end, it is just the last object added, as you are replacing the reference in in E with the new object ID in every loop.

What are you trying to do here? This looks like a very inefficient way to size down a mesh, and has the potential to run you out of memory…

–Mitch

thank for the reply.
to be honest is part of a script i am developing.
if i can i would like to post it all so you could maybe help me with the debug.
if i change TRUE to False, this will quit working. It does not comes with any error, but it seems to run out of memory like you said…

i attached the complete.py file.
hope you could help me, i am quite a newbie in py programming, this is my first script :smiley:CALNIC_SCALE_MATERIAL.py (3.0 KB)