I thought this worked in previous versions, maybe I'm losing my mind. I'm in 2004, and need to create a new drawing. (command "new") (command ".new") (command "_new") (command "-new"), nothing works. i must be missing something right? --Jeremiah
Jeremiah, Please use google to search this ng. This question has been asked many times before. -- R. Robert Bell, MCSE www.AcadX.com I thought this worked in previous versions, maybe I'm losing my mind. I'm in 2004, and need to create a new drawing. (command "new") (command ".new") (command "_new") (command "-new"), nothing works. i must be missing something right? --Jeremiah
It's not your imagination...(command "new") doesn't work with release 2002 and similarly caused me me stress when my lisp routine that depend on (command "new") and (command "open") no longer worked. That doesn't mean that you're NOT losing your mind though...especially if you're working with lisp. Somebody on this forum sent me a workaround for the "open", but I haven't yet figured out how to get the "new" to work. Sorry...wish I could be more help
well, i'm looking, and not finding much.... i found i can do this: (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "new\n") ...but that seems to pause on template selection. the much more code-heavy: (defun AE_NEWDWG ( template status / ae-acad-object newdwg ) (vl-load-com) (setq ae-acad-object (vlax-get-acad-object)) (if (not template) (setq newdwg (vla-add (vla-get-documents ae-acad-object))) (setq newdwg (vla-add (vla-get-documents ae-acad-object) template)) ) (if (not status) (princ "\nNew drawing created\n") (vla-put-activedocument ae-acad-object newdwg) ) (princ) ) ...alas doesn't work in SDI mode. any other suggestions? --Jeremiah
Seemed to be a bit of a bum-rush, eh? Does this get me back in your good graces? (defun NewDwg (fqnName / oldCmdEcho) (setq oldCmdEcho (getvar "CmdEcho")) (setvar "CmdEcho" 0) (cond ((= (getvar "SDI") 0) (command "._VBAStmt" (strcat "AcadApplication.Documents.Add \"" fqnName "\""))) ((command "._VBAStmt" (strcat "ThisDrawing.New \"" fqnName "\"")))) (setvar "CmdEcho" oldCmdEcho) (princ)) Usage: (NewDwg (findfile "acad.dwt")) -- R. Robert Bell, MCSE www.AcadX.com well, i'm looking, and not finding much.... i found i can do this: (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "new\n") ...but that seems to pause on template selection. the much more code-heavy: (defun AE_NEWDWG ( template status / ae-acad-object newdwg ) (vl-load-com) (setq ae-acad-object (vlax-get-acad-object)) (if (not template) (setq newdwg (vla-add (vla-get-documents ae-acad-object))) (setq newdwg (vla-add (vla-get-documents ae-acad-object) template)) ) (if (not status) (princ "\nNew drawing created\n") (vla-put-activedocument ae-acad-object newdwg) ) (princ) ) ...alas doesn't work in SDI mode. any other suggestions? --Jeremiah
ah, maybe i couldn't find it because the previous examples were in the VBA ng? anyhoo, does this mean there's *no* way to do this in Lisp??? isn't that a little spooky? I forget if VBA is still an install option in 2004... what if the user didn't install VBA? and even though you've always been in my good graces, now you are at the top of the list again. but don't let it go to your head. thanks. --Jeremiah
I typically create a script file new.scr in AutoCAD's Temp folder and run it... In it is just the following: ############## new.scr between Pound Signs ############ new ################################################# Works great... If you're in SDI mode, you may need to modify it appropriately to account for "Do you want to save" prompts, etc...
and if in SDI mode, it should also have this: (if (> (getvar "DBMOD") 0) (command "Y") ; discard all changes ) ; if
nope, doesn't work. the second prompt I get is "Really want to discard all changes?", so modifying that to (command ".open" "Y" ""), in SDI mode it just reopens the current drawing. --Jeremiah
You might try making a 'blank' file, place it in support dir. then: (command ".Open" "n" "blank") ?? Bob
hehehehe.... you know the funny thing? i *HAVE* a "blank.dwg" sitting there, it's used to initialize the VoloView ActiveX. thanks for the brainstorming help. a novel solution! --Jeremiah
I don't know if it possible to install A2k2 or higher w/o VBA. -- R. Robert Bell, MCSE www.AcadX.com ah, maybe i couldn't find it because the previous examples were in the VBA ng? anyhoo, does this mean there's *no* way to do this in Lisp??? isn't that a little spooky? I forget if VBA is still an install option in 2004... what if the user didn't install VBA? and even though you've always been in my good graces, now you are at the top of the list again. but don't let it go to your head. thanks. --Jeremiah