ScriptSpot

Forum topic · General Scripting

merging specific named objects

By geardaddy1 · 2011-08-17

Description

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 (4)

hi

Anubis · 2011-08-17

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
)

geardaddy1 · 2011-08-17

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 = #

Hmm...

Anubis · 2011-08-17

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

YES!

geardaddy1 · 2011-08-17

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

Need to do some homework on arrays.