View Full Version : Scripted Legacy .DWG Importer

10 October 2005, 03:19 PM
I wrote a batch importer script for VIZ a while back, and now that I've upgraded to MAXr7, I've been trying to figure out how to either:

A. get max7 to "Derive objects by: Layer" with its updated DWG import module
B. script the use of the Legacy DWG import filetype

For now, I'm having to go back and forth between viz and max, or manually import, which defeats the purpose of the script altogether. With the Legacy importer, it names all my objects individually with their respective layer names, and leaves all the objects as individual entities, which as far as I can tell, the updated module does not. I'm hoping there's just a flag I've missed in the documentation, but I have looked and looked with no luck. TIA for any suggestions.

here's what it looks like now:

utility uDWG_to_MAX"Convert .DWG to .MAX"
fn replaceChar str oChar rChar =
tStr = ""
for i=1 to str.count do
if str[i] == oChar then tStr += rChar
else tStr += str[i]

button btnTargetDir "Where to save .MAX files"
button btnSourceDir "Where are the .DWG files" enabled:false

on btnTargetDir pressed do
target = getSavePath caption:"Select directory for .MAX files:"
if target == undefined do return false
btnTargetDir.text = ("Target =" + target)
btnSourceDir.enabled = true

on btnSourceDir pressed do
local dir = getSavePath caption:"Select which directory \holds the .DWG files:"
if dir == undefined do return false
files = getFiles ( (replaceChar (dir as string) "\\" "\\\\") + "\\*.DWG" )
for f in files do
resetMaxFile #noPrompt
importFile f #noPrompt
max views redraw
saveMaxFile (getFilenameFile f)

btnSourceDir.text = ("Source =" + dir)

CGTalk Moderation
10 October 2005, 03:19 PM
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.