| Author |
Message |
justindavidwerner
Guest
|
Posted:
Mon Mar 28, 2005 7:00 pm Post subject:
SDI Problem |
|
|
This is a continuation of:
http://discussion.autodesk.com/thread.jspa?messageID=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.
|
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Mon Mar 28, 2005 7:02 pm Post subject:
Re: SDI Problem |
|
|
Justin,
Send me an E-Mail with your 'latest' attempt.
nospam.ec-cad@centurytel.net
(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 |
|
| Back to top |
|
 |
Tom Smith
Guest
|
Posted:
Mon Mar 28, 2005 7:40 pm Post subject:
Re: SDI Problem |
|
|
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.
|
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Mon Mar 28, 2005 9:47 pm Post subject:
Re: SDI Problem |
|
|
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)
------------
:)
Bob |
|
| Back to top |
|
 |
justindavidwerner
Guest
|
Posted:
Mon Mar 28, 2005 11:05 pm Post subject:
Re: SDI Problem |
|
|
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. |
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Mon Mar 28, 2005 11:34 pm Post subject:
Re: SDI Problem |
|
|
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)
------------------
or call same script..for both
Bob |
|
| Back to top |
|
 |
justindavidwerner
Guest
|
Posted:
Tue Mar 29, 2005 12:08 am Post subject:
Re: SDI Problem |
|
|
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. |
|
| Back to top |
|
 |
justindavidwerner
Guest
|
Posted:
Tue Mar 29, 2005 12:40 am Post subject:
Re: SDI Problem |
|
|
| 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. |
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Tue Mar 29, 2005 12:43 am Post subject:
Re: SDI Problem |
|
|
I give up. You can't have it both ways.
Sorry.
Bob |
|
| Back to top |
|
 |
justindavidwerner
Guest
|
Posted:
Tue Mar 29, 2005 12:47 am Post subject:
Re: SDI Problem |
|
|
It's OK.
I appreciate your help.
Thank you very much for getting it to work with computers with SDI set to 0. |
|
| Back to top |
|
 |
Tom Smith
Guest
|
Posted:
Tue Mar 29, 2005 1:05 am Post subject:
Re: SDI Problem |
|
|
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. |
|
| Back to top |
|
 |
jlspartz
Guest
|
Posted:
Tue Mar 29, 2005 4:20 am Post subject:
Re: SDI Problem |
|
|
It works perfectly fine. I tested it over here. It saves the drawing you are in, opens the template, then pops up the alert. You cannot get the alert to come up if it didn't create a new file, since it pops open the alert after the new file is created. I tried SDI 0 and SDI 1.
The only thing I would suggest is instead of an alert do _SAVEAS instead and then it pops open the save drawing dialog. |
|
| Back to top |
|
 |
Marc'Antonio Alessi
Guest
|
Posted:
Tue Mar 29, 2005 10:03 am Post subject:
Re: SDI Problem |
|
|
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.")
-- |
|
| Back to top |
|
 |
ECCAD
Guest
|
Posted:
Tue Mar 29, 2005 7:00 pm Post subject:
Re: SDI Problem |
|
|
For SDI 1, something like this might work..
(if (> dbmod 0)(command "_new" "Y" "dwtfile"))
(if (= dbmod 0)(command "_new" "dwtfile"))
Bob |
|
| Back to top |
|
 |
justindavidwerner
Guest
|
Posted:
Tue Mar 29, 2005 7:04 pm Post subject:
Re: SDI Problem |
|
|
| 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. |
|
| Back to top |
|
 |
|
|
|
|