Help with merge script...easy fix I'm sure...lost
What I want to do it type "box" or "cone", specify a directory and search through max scene files in the directory for items named "box" or "cone". Then merge those items into the current scene.
This is what I got so far, but I'm getting a --No "map" function for undefined on line 30 "append objToMergeArr n"
rollout merRoll "Merge"
(
edittext prefix_txt "Item:" fieldWidth:150 labelOnTop:false
on prefix_txt entered txt do
(
if txt != "*cone*" then
searchForString = #("*cone*")
if txt != "*box*" then
searchForString = #("*box*")
)
label lab1 " "style_sunkenedge:true width:265 height:40 pos:[0,60]
label lab2 "Search for and merge in items from max scene files" pos:[12,35]
label lab3 "Author: Scott Parris" pos:[80,65]
label lab4 "Date: 6/13/14" pos:[94,80]
button but1 "Browse" pos:[200,2]
on but1 pressed do
(
maxFilesDir = getSavePath caption:"Select the directory" initialDir:"C:/Users/3D/Desktop"
maxFilesArr = getFiles (maxFilesDir + "\\*.max")
for mf in maxFilesArr do
(
objInFile = getMaxFileObjectNames mF
objToMergeArr = #()
for n in objInFile do
(
for str in searchForString where (matchpattern n pattern:str) do
(
append objToMergeArr n
)
)
if objToMergeArr.count != 0 do
(
-- #AutoRenameDups -- max2011+
mergeMAXFile mF objToMergeArr /* #select */#noRedraw #mergeDups #renameMtlDups #alwaysReparent quiet:true
)
)
)
)
Attachment | Size |
---|---|
merge_ui_4.ms | 1.19 KB |
Comments
Thank you so much!!!
Thank you so much!!! Everything works great.
I'm new to Maxscript so I was piecing this together looking at other scripts. I didn't really understand why it wasn't working.
Thank you again.
.
Glad to help. :)
Tools and Scripts for Autodesk 3dsMax
.
The problem is that the searchForString variable is not defiend as local for the script.
What is the logic behind this part of the code:
Even if you type CONE in the edit text field the script will load only boxes.
I think that you have to use something like this:
Tools and Scripts for Autodesk 3dsMax