SDI Problem

Discussion in 'AutoCAD' started by justindavidwerner, Mar 28, 2005.

  1. This is a continuation of:

    http://discussion.autodesk.com/thread.jspa?messageID=4770472&#4770472

    I think everyone thought all problems were solved but they are not, so now I start a new thread.

    Why does (command "_new" "D-JOBNO-0G1.1.DWT") work fine with SDI set to 1 (with a "Y" in between to discard changes in a new unchanged drawing), but once you set SDI to 0 AutoCAD says "Unknown command
    "D-JOBNO-0G1.1.DWT". Press F1 for help."?????

    p.s.

    If you do it on the command line in AutoCAD:

    _NEW (Enter)
    D-JOBNO-0G1.1.DWT (Enter)

    it works fine

    Please see link above for more info.
     
    justindavidwerner, Mar 28, 2005
    #1
  2. justindavidwerner

    ECCAD Guest

    Justin,
    Send me an E-Mail with your 'latest' attempt.

    (remove the nospam + the ".")
    I think you need a combination Lisp, and Script to
    handle both SDI 0 and SDI 1 conditions.
    Maybe I can come up with a solution.

    Bob Shaw
     
    ECCAD, Mar 28, 2005
    #2
  3. justindavidwerner

    Tom Smith Guest

    Bob, I haven't experimented with those scenarios, but I wonder if the cmdactive trick wouldn't work in a lisp. Or maybe just a check of the dbmod and sdi variables. Apparently the "new" command will have different prompt sequences depending on the circumstances.
     
    Tom Smith, Mar 28, 2005
    #3
  4. justindavidwerner

    ECCAD Guest

    Justin,
    Attached files / method seem to work. You might want to
    include some local settings in the scripts.

    Menu should load 'new-g1-1.lsp'
    Lisp:
    ;; new-g1-1.lsp
    (setvar "CMDECHO" 0)
    (setvar "LISPINIT" 1)
    (setvar "ACADLSPASDOC" 1)
    (if (not (= (strcase (substr (getvar "dwgname") 1 7)) "DRAWING"))
    (progn
    (setvar "FILEDIA" 0)
    (command ".qsave")
    (setvar "FILEDIA" 1)
    )
    )
    (setvar "FILEDIA" 0)
    (if (= (getvar "SDI") 1)
    (command "script" "/acad/justin/sdi1-d-g1.scr")
    (command "script" "/acad/justin/sdi0-d-g1.scr")
    ); if
    (princ)
    ---------
    Scripts:
    ;; SDI1-D-G1.scr
    ;;
    (setvar "FILEDIA" 0)
    NEW
    Y
    D-JOBNO-0G1.1.DWT
    (setvar "CMDECHO" 0)
    (alert "SAVEAS this drawing to your project directory, then update it")
    (setvar "LISPINIT" 1)
    (setvar "ACADLSPASDOC" 1)
    (setvar "FILEDIA" 1)
    (princ)
    -----------------
    And,
    -----------------
    ;; SDI0-D-G1.scr
    ;;
    (setvar "FILEDIA" 0)
    NEW
    D-JOBNO-0G1.1.DWT
    (setvar "CMDECHO" 0)
    (alert "SAVEAS this drawing to your project directory, then update it")
    (setvar "LISPINIT" 1)
    (setvar "ACADLSPASDOC" 1)
    (setvar "FILEDIA" 1)
    (princ)
     
    ECCAD, Mar 28, 2005
    #4
  5. Everything works except for one thing:

    With SDI set to 1 and you have a previously saved drawing open, if you make changes and then run the lisp (from the menu) without saving the open drawing it does save the file and pop up the alert, but doesn't load the template file.
     
    justindavidwerner, Mar 28, 2005
    #5
  6. justindavidwerner

    ECCAD Guest

    In that case, make SDI1 script same as
    SDI0 script..

    ;; SDI1-D-G1.scr
    ;;
    (setvar "FILEDIA" 0)
    NEW
    D-JOBNO-0G1.1.DWT
    (setvar "CMDECHO" 0)
    (alert "SAVEAS this drawing to your project directory, then update it")
    (setvar "LISPINIT" 1)
    (setvar "ACADLSPASDOC" 1)
    (setvar "FILEDIA" 1)
    (princ)
     
    ECCAD, Mar 28, 2005
    #6
  7. nope,

    now it says:

    Command: NEW
    Really want to discard all changes to drawing? <N> D-JOBNO-0G1.1.DWT

    Yes or No, please.
    Really want to discard all changes to drawing? <N>

    with SDI set to 1 with a blank drawing.
     
    justindavidwerner, Mar 28, 2005
    #7
  8. OK I give up, I've spent way too much time on this. What I'm going to do is, add the lisp and scripts you wrote to the computers with SDI set to 0 (with a few modifications, i.e. not needing the SDI1.scr) and to the computer(s) with SDI set to 1 I'll add the lisp I wrote.
     
    justindavidwerner, Mar 28, 2005
    #8
  9. justindavidwerner

    Tom Smith Guest

    This all seems so complicated.

    In the one place you talked about what you were trying to accomplish, the goal was a menu item to start a new drawing according to one of four templates.

    What I do is set the default template folder to a custom folder containing nothing but our few standard templates. None of our users need to be using any of the Acad-supplied templates. So to start a new drawing, they type "new" or hit use the standard pulldown, then pick from among our templates. No programming involved, standard interface, and it works regardless of SDI setting.

    I do not force a "save as" upon creating a drawing. That's a training issues and is covered in our written procedural outline.
     
    Tom Smith, Mar 28, 2005
    #9
  10. I have noted that work with sdi = 0 is very slower than
    sdi = 1

    I use this method:

    ; before script:
    (cond
    ( (= 1 (getvar "SDI")) )
    ( (= (vl-catch-all-apply 'setvar '("SDI" 1)) 1)
    (setcfg "AppData/Asso/CSdiMode" "0")
    )
    ( T
    (alert (strcat
    "To make faster the elaboration and the opening of the files,"
    "\nthis command requires that there is only an opened drawing."
    "\nClose the other opened drawings and relaunch the command."
    ) )
    (quit)
    )
    )


    ; at the end of the script
    ; EndDwt is a template with only a big text "Scrip terminated"
    (cond
    ( (= "0" (getcfg "AppData/Asso/CSdiMode"))
    (setvar "SDI" 0) (setcfg "AppData/Asso/CSdiMode" "")
    (vl-load-com)
    (vla-add (vla-get-documents (vlax-get-acad-object)) EndDwt)
    (command "_.VBASTMT" "ThisDrawing.Close False")
    )
    ( T
    (command "_.NEW")
    (if (= (getvar "DBMOD") 0)
    (command EndDwt)
    (command "_Y" EndDwt)
    )
    )
    )
    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --
     
    Marc'Antonio Alessi, Mar 29, 2005
    #10
  11. I tried this route but it didn't fly with my co-workers. They don't think they should have to close all their other open drawings.
     
    justindavidwerner, Mar 29, 2005
    #11
  12. If you have many files to compute with the script
    the performance is VERY different...

    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --
     
    Marc'Antonio Alessi, Mar 29, 2005
    #12
  13. justindavidwerner

    jlspartz Guest

    I wouldn't want to close my drawings either. Why is anyone working with SDI on? It doesn't really speed anything up, it just uses less memory with less drawings open. In batch scripts, I still leave SDI off and just put a _CLOSE at the end, so there is still only one drawing open all the time.

    But if you must, then use the if statement that ECCAD wrote up above and eliminate the use of two scripts and make it one.
     
    jlspartz, Mar 29, 2005
    #13
  14. clip
    clip

    hummm...

    Save a drawing with name Test and try to run the scripts below,
    my tests with one dwg opened are:

    SDI=1 SDI=0
    ---------------------------------
    - empty DWG > 6 sec. 24 sec.
    - 600Kb DWG > 16 sec. 38 sec.
    ---------------------------------

    If you have thousand files (middly less 1 Mb)
    maybe the time is very different.

    Greater is the file and smaller is the difference.


    --

    Marc'Antonio Alessi
    http://xoomer.virgilio.it/alessi
    (strcat "NOT a " (substr (ver) 8 4) " guru.")

    --

    Test0.SCR (SDI = 0)
    -------------------------------------
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE
    _OPEN Test.DWG _ZOOM E _QSAVE _CLOSE


    Test1.SCR (SDI = 1)
    -------------------------------------
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
    _OPEN Test.DWG _ZOOM E _QSAVE
     
    Marc'Antonio Alessi, Mar 30, 2005
    #14
  15. Apparently you've never had multiple drawings open without having saved more than one. If/when AutoCAD chooses to crash you don't have to recover just one file but all of them. If you have SDI set to 1 you can open many drawings in many different sessions and if AutoCAD chooses to crash you only have to recover one file.
     
    justindavidwerner, Mar 30, 2005
    #15
  16. These aren't drawing template so to speak, they are more like a way to start creating a general sheet (cover sheets and ADA sheets). We have a G1 for Dsize, a G2 for Dsize, a G1 for Esize, and a G2 for Esize. The problem is my co-workers don't always erase the Esize drawings if their only using Dsize (we copy a drawing setup folder with every folder set up with generic drawings in it to make a new project folder) so the server is getting filled up with unnecessary drawings. So if people have to create the General drawings from the menu they will only make the size they need. Get it?
     
    justindavidwerner, Mar 30, 2005
    #16
  17. ....and if you read my code, if SDI is 0 it set temporarily
    SDI 1, when the script is terminated set back SDI 0.

    Cheers.
     
    Marc'Antonio Alessi, Mar 31, 2005
    #17
  18. justindavidwerner

    Tom Smith Guest

    No, sorry, I don't get it. Apparently I'm missing something. I suppose this method of creating a project evolved for a reason, but I've never seen an approach like that, where unwanted drawing files are created at the outset.

    When I've had to do projects with inexperienced help, sometimes I've created a whole folder of nearly empty files just to get them started, but I didn't create files that didn't apply to the job.

    I don't see the distinction between a template and "a way to start creating a general sheet" -- that's how I'd define a drawing template. At my present job, we have templates for several purposes, such as a cover sheet template, a general purpose drawing sheet template with title block, and so forth. Most of these are D size since that's what we mostly need, but there's also an E size template. There's also a "blank" template which contains all our layers, linetypes, text styles, etc. but no graphic material. I've also done templates specific to a project, though at this job that hasn't been needed beacuse the project sets are so small.

    All the lisps/script/macros posted so far have done what I suggested -- run the NEW command with a designated DWT template file. And all the complexity results from the SDI issue. All I'm suggesting is, instead of creating a menu-driven interface to automate the NEW command with a selected DWT, it would seem simpler to simply run the plain old built-in NEW, and let the user pick the appropriate template from the standard interface. If you make your own template folder and point the path to it, the user won't see anything but the limited range of template choices you give him, and it will work the same regardless of SDI setting, without any programming required. If there's a prompt to save, due to SDI setting, then the user will deal with it.
     
    Tom Smith, Mar 31, 2005
    #18
  19. justindavidwerner

    jlspartz Guest

    I use docbar, that displays all the drawings that are open and I can right-click and do a save all or close all. If you've worked on 100 million dollar hospital projects that have 300-500 sheets, you'd understand that there is no possible way to work with SDI on.

    And then a year ago with Architectural Desktop 3.3, the architectural detailer would not run unless you only had one drawing open. So, if you wanted more than one drawing, you had to open a new session of AutoCAD each time, which took all your available RAM away. So, sorry, I'm quite partial after that to not having SDI on.
     
    jlspartz, Apr 1, 2005
    #19
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.