noontz
01-25-2009, 12:44 PM
I folks.. Itīs probably very simple, but I just canīt see it.
This script runs fine with one object in the array, but as soon as there is more than one it yields an error that subobjectlevel 2 is out of range?? What is it I canīt see???
objs = $selection
tresV = 0.01 -- vertice treshold
tresE = 45 -- edge treshold
tresF = 15 -- face treshold
for i in 1 to objs.count do
(
max modify mode
obj = objs[i]
subobjectlevel = 1
max select all
verts = getVertSelection obj
meshop.weldVertsByThreshold obj verts tresV
update obj
subobjectlevel = 2
max select all
edges = getEdgeSelection obj
meshop.autoEdge obj edges tresE
update obj
subobjectlevel = 3
max select all
faces = getFaceSelection obj
meshop.autoSmooth obj faces tresF
update obj
subobjectlevel = 2
max select all
edges = getEdgeSelection obj
meshop.autoEdge obj edges tresE
edgeSelSet=#() -- Init. an Array
for face = 1 to obj.numfaces do -- Go through all faces
for edge = 1 to 3 do -- And for every of the 3 edges
if (getedgevis obj face edge) do -- If the visibility is true,
append edgeSelSet (((face-1)*3)+edge) --collect the edge
setedgeselection obj edgeSelSet -- Select all visible edges
update obj
)
This script runs fine with one object in the array, but as soon as there is more than one it yields an error that subobjectlevel 2 is out of range?? What is it I canīt see???
objs = $selection
tresV = 0.01 -- vertice treshold
tresE = 45 -- edge treshold
tresF = 15 -- face treshold
for i in 1 to objs.count do
(
max modify mode
obj = objs[i]
subobjectlevel = 1
max select all
verts = getVertSelection obj
meshop.weldVertsByThreshold obj verts tresV
update obj
subobjectlevel = 2
max select all
edges = getEdgeSelection obj
meshop.autoEdge obj edges tresE
update obj
subobjectlevel = 3
max select all
faces = getFaceSelection obj
meshop.autoSmooth obj faces tresF
update obj
subobjectlevel = 2
max select all
edges = getEdgeSelection obj
meshop.autoEdge obj edges tresE
edgeSelSet=#() -- Init. an Array
for face = 1 to obj.numfaces do -- Go through all faces
for edge = 1 to 3 do -- And for every of the 3 edges
if (getedgevis obj face edge) do -- If the visibility is true,
append edgeSelSet (((face-1)*3)+edge) --collect the edge
setedgeselection obj edgeSelSet -- Select all visible edges
update obj
)
