Notifications
Clear all

[Closed] Automate autocad file import

Hello, can some one help me with this, my workflow its autocad and 3dsmax.
On autocad i make some polilines and do a wblock to my hard drive, F:\ File.dwg

On 3dsmax i go to file import, select the file them press ok

What i want if its possible its do a script to automate that process, i do it 1000x on every project i made and loose a lot of time.

This its working when i run the script but i want do make a shortcut with it and cant do it

importfile “F:\File.dwg” #noPrompt

Tkx in advanced

9 Replies
1 Reply
(@miauu)
Joined: 10 months ago

Posts: 0

I can’t understnad wyat exactly you want to acheive, but the code below will import the “F:\File.dwg” to the current scene. Save it as .MCR file and install it(drag and drop in 3dsmax viewports). Then you can find the macro in Customize – Customize User Interface – “CarlosPaiva” category


macroscript ImportDWGFile
category:"CarlosPaiva"
tooltip:"Import DWG file"
buttonText:"Import DWG file"
(
	if doesFileExist "F:\File.dwg" do ( importFile "F:\File.dwg" #noPrompt )
	--	"to reset 3dsMax and load the same file: comment the line above and uncomment the lines below"
-- 	resetMaxFile #noPrompt
-- 	if doesFileExist "F:\File.dwg" do ( loadMaxFile "F:\File.dwg" useFileUnits:true quiet:true )
)

look for getfiles and loop (loop) in maxscript help

if doesFileExist “F:\File.dwg” do ( importFile “F:\File.dwg” #noPrompt )
It helps me a lot.
im very happy with your help, thanks miauu

if i change de name, File.dwg to new block.dwg the script not working cant figure why.
Im newbie on maxscript, try to learn but its hard to understand.
tanks in advanced

1 Reply
(@miauu)
Joined: 10 months ago

Posts: 0

Try this and be sure that the blocl.dwg is located in F: drive.


macroscript ImportDWGFile
category:"CarlosPaiva"
tooltip:"Import DWG file"
buttonText:"Import DWG file"
(
	if doesFileExist "F:\block.dwg" then
             ( importFile "F:\block.dwg" #noPrompt )
       else
            messagebox "File not exist or file path is wrong."
)

its working well with files without spaces, the problem its with names with spaces new block.dwg

thanks you Vlad i bougth it is all i want

Blagodarim Vlado!