[Closed] How Can i merge objects by pattern?
Hi guys, im trying to merge a specific objects into a scene , but i would like merge by pattern.
I dont know how can i list the objects of the file and select a pattern to be merged.
Any help will be apreciated , thank you very much !!
You can use ‘getMAXFileObjectNames’ to get an array of object names in the file.
Then collect only the names that match your pattern in a loop like this:
objsIWant = for o in objNames where matchPattern o pattern:myPattern collect o
Now simply use ‘mergeMAXFile’ with this ‘objsIWant’ as your name_array argument.
See maxscript help on these functions: ‘getMAXFileObjectNames’, ‘mergeMAXFile’.
Ey man , Thank you for your response , I’ll try and tell you how I’ve done. thanks again man !! :applause:
this is i try it but i have some errors
objetos = getmaxfileobjectnames “c:\project\ep002_background_02.max”
Objsiwant = for o in objNames where matchPattern o pattern:“mesa” collect o
mergeMAXFile “c:\project\ep002_background_02.max” Objsiwant
and this is the error:
– Error occurred in anonymous codeblock; filename: c:\project\prueba_merge_pattern.ms; position: 203; line: 3
– No “map” function for undefined
what can i do ? thanks !!
Looks like objNames is undefined, try changing it to objetos
so…
objetos = getmaxfileobjectnames "c:\\project\\ep002_background_02.max"
Objsiwant = for o in objetos where matchPattern o pattern:"*mesa*" collect o
mergeMAXFile "c:\\project\\ep002_background_02.max" Objsiwant