Inserting Templates

Discussion in 'AutoCAD' started by rseyda, Jan 6, 2004.

  1. rseyda

    rseyda Guest

    I am going to ask a potentially ignorant question.

    I want to put into custom pulldown menus the ability to start a new drawing using a template. The problem is that I can't insert a .dwt file. I also can't use the New command without a dialog box. How do you start a new drawing using a template without a dialog box?

    Thanks,
     
    rseyda, Jan 6, 2004
    #1
  2. rseyda

    mark Guest

    directly from AutoCAD help...
    "If the system variable, FILEDIA, is set to 0 instead of 1, a prompt on the
    command line is displayed. If you set FILEDIA to 0, this prompt is displayed
    regardless of the Startup setting. "
    HTH
    mark


    drawing using a template. The problem is that I can't insert a .dwt file.
    I also can't use the New command without a dialog box. How do you start a
    new drawing using a template without a dialog box?
     
    mark, Jan 6, 2004
    #2
  3. rseyda

    Tom Smith Guest

    _new

    drawing using a template. The problem is that I can't insert a .dwt file.
    I also can't use the New command without a dialog box. How do you start a
    new drawing using a template without a dialog box?
     
    Tom Smith, Jan 6, 2004
    #3
  4. rseyda

    Tom Smith Guest

    Oops, Mark's right, it's filedia=0 that causes new to run at the command
    line, not the underscore.

    drawing using a template. The problem is that I can't insert a .dwt file.
    I also can't use the New command without a dialog box. How do you start a
    new drawing using a template without a dialog box?
     
    Tom Smith, Jan 6, 2004
    #4
  5. rseyda

    ECCAD Guest

    So, code would look like:
    (defun loaddwt ()
    (setvar "FILEDIA" 0)
    (command "_new")
    (setvar "FILEDIA" 1)
    )

    Remember to turn the Files Dialog back on, or next time you try to open another .dwg, you will have to type it in at the command prompt, including the Formal Path\...\filename.dwg
    Cheers
     
    ECCAD, Jan 6, 2004
    #5
  6. rseyda

    ECCAD Guest

    2nd thought here. Last 'loaddwt' function will stop at _new.
    Why, this is a 'new' drawing session, and the Lisp will not carry across. This method would kinda work in a script, but
    not here.
    Better way ?
    Perhaps the File= on Open ?, specify a .dwg (that is nothing but a 'saved' .dwt - by the same name.
    Bob
     
    ECCAD, Jan 6, 2004
    #6
  7. rseyda

    rseyda Guest

    Ok, so in my pull down menu I have:

    [<-36x48](setvar "users4" "S-3648detail");newtemp;

    This sets the users4 variable to the template name, then I call to run the lisp routine:

    (defun c:newtemp ( / fdia tname)
    (setq fdia (getvar "filedia"))
    (setvar "filedia" 0)
    (setq tname (getvar "users4"))
    (command "new" tname)
    (setvar "filedia" fdia)
    )

    But when I do I get this message:

    Command: newtemp
    new
    Command: S-3648detail Unknown command "S-3648DETAIL". Press F1 for help.

    Command: 0

    I checked and filedia was set to 0, but the new command didn't work. Any ideas?

    Thanks,
     
    rseyda, Jan 6, 2004
    #7
  8. rseyda

    ECCAD Guest

    (command "new" tname)
    is the problem.
    use:
    (command "new")
    new is not expecting a name, so, save the template as a .dwg, and do:
    (command "_open" tname)
    instead.
     
    ECCAD, Jan 6, 2004
    #8
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.