merging specific named objects

Sorry guys - just started MaxScripting...not sure if this is a really easy question or not.

I am trying to merge in a specific named object from another max file...I only want the ojbect named box001.

on btn33 pressed do mergeMaxFile "filepath\box.max" "box001" #useMergedMtlDups

Thanks for the help!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

hi

i hope this example w'd help --

mxf = "..the_path\\box.max" -- the .max file
-- 1st get the list of all objects names in that scene
objs = getMAXFileObjectNames mxs quiet:on
-- and then if the object you looking for exist...
if findItem objs "Box001" > 0 do (
	-- note: even single object should be passed as array
	mergeMAXFile mxf #("Box001") #useMergedMtlDups
)

my recent MAXScripts RSS (archive here)

geardaddy1's picture

Hi Anubis, Thanks for the

Hi Anubis,

Thanks for the reply. I appricate it!

Two things, should mxs be mxf?

Also, I am getting a Syntax error: at = expected name
In Line: objs = #

Anubis's picture

Hmm...

mxf is just a variable and it should pointed to existing .MAX scene file (full path like "C:\\dir\\sub_dir\\box.max"). If for instance your "box.max" is in your '3dsmax\scenes' folder then next w'd get correct path:
mxf = GetDir #Scene + "\\box.max"
...or may use a dialog to locate/select file:

mxf = getMAXOpenFileName ()
if mxf != undefined do (
    -- the code here...
)

[EDIT] Oups... i saw it now :) it was my type error, yes, in the line "objs = ..." it should be mxf :D

my recent MAXScripts RSS (archive here)

geardaddy1's picture

YES!

Got it....Thanks you! That helped me out alot!

Need to do some homework on arrays.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.