Loop more fast...
Hello everyone :)
I have write a little script which allows me to detach and make an object the faces of a poly. The main part of Whole script is a string recovery from 3dsMaxScript:
obj = selection[1] for p = polyop.getNumFaces obj to 1 by -1 do (polyop.detachFaces obj #{p} asNode:true)
Ok, the script works well, but...
If I start the script and I 500/800 faces, it is fast, but if I have more of 1000 faces, max crash or freezes... Do you know a way to make it more stable and faster the code above? I tried, but no appreciable result ...
Thank for any reply
Michele
Comments
Thanks miauu and barigazy :)
Thanks miauu and barigazy :)
Today I'll try both codes but they are certainly better than the original! it's always nice to discover new forms of programming. A good start to continue my studying :)
Thanks again
Branko provided a good
Branko provided a good example to see the differences between the FOR and the WHILE loop. :) They do the same, but with different speed.
Tools and Scripts for Autodesk 3dsMax
It's true! I have always
It's true! I have always asked how to use FOR or WHILE loop :D
...
Yup. It's fester because I use predefined variables.
But it's not memory efficient solution as Kostadin method.
Do you see why? .... I tell you anyway :)
This cause memory leaking
number-=1
bga
.
On object with 1250 polygons this:
tooks less than 3 sec.
Tools and Scripts for Autodesk 3dsMax
...
I tested this on Sphere with 64 segs
#1 miauu code
#2 my code
#1 -> time:5.472 memory:545648L
#2 -> time:4.752 memory:640712L
bga
I tried the two loops on my
I tried the two loops on my notebook (not performing) with a Sphere with 64 segs:
#1 -> time:19.456 memory:86400L
#2 -> time:16.68 memory:107384L
Original string: time:16.624 memory:109400L
Seems be fast as the example of barigazy... Is possible? You can do a test ??