How Can i merge objects by pattern?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2013
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 !!
 
  02 February 2013
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'.
 
  03 March 2013
Ey man , Thank you for your response , I'll try and tell you how I've done. thanks again man !!
 
  03 March 2013
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 !!
 
  03 March 2013
Originally Posted by AlexMateo: 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
 
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 12:28 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.