Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

help with fn using execute

help with fn using execute

Anonymous
Not applicable
267 Views
2 Replies
Message 1 of 3

help with fn using execute

Anonymous
Not applicable
hi there
i have done a script to get back the modifiers for all objects selected & assign values to the properties of it so i just have a problem with this fn the fn should return array with all modifiers properties & another array with the index of the bool values properties


fn Modname sel =
(
if (sel == undefined) then (messagebox "plz select objects & press again"
)
else(
global allmod = #()
global modprops = #()
global bool_index = #()
for obje in sel do
(
for m in obje.modifiers do
(
allmodbefore = allmod.count
if ((findstring m.name " " )!= undefined ) do
(
b = filterString m.name " "
nametmp = ""
for i = 1 to b.count do nametmp += b
m.name = nametmp
)
appendIfUnique allmod m.name
if allmod.count != allmodbefore do(
modprop = getPropNames obje.modifiers
modpropf = #()
indv_boolindex = #()
for pro in modprop do
(
a = obje.modifiers
st = "a."+(pro as string)
pr_val = execute (st )

try(
if (pr_val == true or pr_val == false)do(
append modpropf pro
append indv_boolindex modpropf.count
)
(pr_val as float )
append modpropf pro
)catch ()
)
append modprops modpropf
append bool_index indv_boolindex
))
))
return bool_index
return modprops
return allmod
)



when i run the fn frist time when i open the max i get an error in
-- Frame:
-- pr_val: undefined
-- st: "a.BendAngle"
-- a: Bend:Bend
but run the fn again it works fine
why ?
0 Likes
268 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
--change this...
st = "a."+(pro as string)

--to...
st = "$"+obje.name+"."+a.name+"."+(pro as string)
0 Likes
Message 3 of 3

Anonymous
Not applicable
thank u
worked very fine
thanx
0 Likes