igor333
01-04-2005, 07:40 PM
Hi,
I have two max files :
1) few groups with lots of objects in each group.
2) One object with material and texture on it.
I need to open each group, then to replace each object with the object in the second
file (object without material ---> object with material)
This is what I have done for now:
group_name = #()
Obj_name = #()
count = 0
group_arr = #()
fobj_names = #()
objs_in_group_arr = #(#())
for i= 1 to selection.count do
(
group_flag = true
if classof(selection[i].baseobject) == Dummy then
(
append group_arr selection[i]
group_flag = false
count = count + 1
group_name = filterString selection[i].name "."
objs_in_group_arr[count] = #()
)
if (group_flag == true) then
(
Obj_name = filterString selection[i].name "."
if(Obj_name[1] == group_name[1]) then
(
append objs_in_group_arr[count] selection[i]
)
)
)
fobj_names = getmaxfileobjectnames "second.max"
mergemaxfile "first.max" fobj_names #select
for i = 1 to group_arr.count do
(
-- It doesn't work from here,I need to replace it in a different way
new_mesh = meshop.cloneFaces selection[1] selection[1].faces
setGroupOpen group_arr[1] true
for j = 1 to objs_in_group_arr[i].count do
(
new_mesh.position = objs_in_group_arr[i][j].position
delete objs_in_group_arr[i][j]
)
)
I have problems with the replace code.
1) Should i use the cloneFaces command to copy the object?
2) Is it true to just replace the objects positions and then delete the old one?
3) Is it a shortest way to select the objects from each group?
Thanks:-)
I have two max files :
1) few groups with lots of objects in each group.
2) One object with material and texture on it.
I need to open each group, then to replace each object with the object in the second
file (object without material ---> object with material)
This is what I have done for now:
group_name = #()
Obj_name = #()
count = 0
group_arr = #()
fobj_names = #()
objs_in_group_arr = #(#())
for i= 1 to selection.count do
(
group_flag = true
if classof(selection[i].baseobject) == Dummy then
(
append group_arr selection[i]
group_flag = false
count = count + 1
group_name = filterString selection[i].name "."
objs_in_group_arr[count] = #()
)
if (group_flag == true) then
(
Obj_name = filterString selection[i].name "."
if(Obj_name[1] == group_name[1]) then
(
append objs_in_group_arr[count] selection[i]
)
)
)
fobj_names = getmaxfileobjectnames "second.max"
mergemaxfile "first.max" fobj_names #select
for i = 1 to group_arr.count do
(
-- It doesn't work from here,I need to replace it in a different way
new_mesh = meshop.cloneFaces selection[1] selection[1].faces
setGroupOpen group_arr[1] true
for j = 1 to objs_in_group_arr[i].count do
(
new_mesh.position = objs_in_group_arr[i][j].position
delete objs_in_group_arr[i][j]
)
)
I have problems with the replace code.
1) Should i use the cloneFaces command to copy the object?
2) Is it true to just replace the objects positions and then delete the old one?
3) Is it a shortest way to select the objects from each group?
Thanks:-)
