starting a new file

Discussion in 'AutoCAD' started by liftedaxis, Feb 3, 2004.

  1. liftedaxis

    liftedaxis Guest

    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
     
    liftedaxis, Feb 3, 2004
    #1
  2. 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
     
    R. Robert Bell, Feb 4, 2004
    #2
  3. liftedaxis

    jfrog Guest

    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
     
    jfrog, Feb 4, 2004
    #3
  4. liftedaxis

    liftedaxis Guest

    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
     
    liftedaxis, Feb 4, 2004
    #4
  5. 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
     
    R. Robert Bell, Feb 4, 2004
    #5
  6. liftedaxis

    liftedaxis Guest

    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
     
    liftedaxis, Feb 4, 2004
    #6
  7. liftedaxis

    Thomas Smith Guest

    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...
     
    Thomas Smith, Feb 4, 2004
    #7
  8. liftedaxis

    liftedaxis Guest

    and if in SDI mode, it should also have this:

    (if (> (getvar "DBMOD") 0)
    (command "Y") ; discard all changes
    ) ; if
     
    liftedaxis, Feb 4, 2004
    #8
  9. liftedaxis

    ECCAD Guest

    Jeremiah,
    Try (command ".open" "")

    Bob
     
    ECCAD, Feb 5, 2004
    #9
  10. liftedaxis

    liftedaxis Guest

    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
     
    liftedaxis, Feb 5, 2004
    #10
  11. liftedaxis

    ECCAD Guest

    Thought it was worth a shot.
    Bob
     
    ECCAD, Feb 5, 2004
    #11
  12. liftedaxis

    ECCAD Guest

    You might try making a 'blank' file, place it in support dir.
    then:
    (command ".Open" "n" "blank")
    ??
    Bob
     
    ECCAD, Feb 5, 2004
    #12
  13. liftedaxis

    liftedaxis Guest

    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
     
    liftedaxis, Feb 5, 2004
    #13
  14. 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
     
    R. Robert Bell, Feb 5, 2004
    #14
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.