help on script
Hello
I do a little script and it worked. I forgot to save last changes and now it didn't work anymore..
If anybody can help.
It clone selected object and if i'm not happy with result I can delete these objects.
It is when I press DEL button I get an error...
-----------------
nl = $
PP = nl.pos
try destroyDialog rlslice catch()
global rlslice = rollout rlslice "copy exponL"
(
spinner NB "NB " width:60 range:[2,1000,10] type:#integer
spinner DISTX "DISTz " width:60 range:[.0001,100000,1] type:#float
spinner spX "corr " width:60 range:[.0001,100000,1] type:#float
button GO "GO"
button DEL "DEL"
on GO pressed do
(
newObj=#()
repX = DISTX.value + spX.value
for i=1 to NB.value do
(
newObj[i] = instance nl
nl.pos = nl.pos + [0,0,repX]
repX = repX + spX.value
)
)
on DEL pressed do
(
for a in newObj do ( delete a )
nl.pos = PP
)
)
createDialog rlslice 160 200
-----------------------------------------
Comments
Thanks you very much for your
Thanks you very much for your help and tips.
Merry chrismas and happy holidays (if any) :-)
.
Thank you.
Happy Holidays to you too. :)
Tools and Scripts for Autodesk 3dsMax
.
Some advices:
- when you write code and you see that a word is colored with different color than the rest of your words, this means that this word is a "specia" word. For example, in your code you give the name "GO" to one of your buttons. As you can se this word is colored with different color than the "DEL" word.
- as you wrote the script the "nl" and "PP" variables becomes global. This may causes problems, because other scripts may use the same variables and when they are global, the scripts will overwrites those variables.
- when you works with arrays ia a good practice first to check if those arrays are not empty.
Tools and Scripts for Autodesk 3dsMax