mattis
Guest
|
Posted:
Tue Jan 04, 2005 11:28 pm Post subject:
Re: Open version specific files in script |
|
|
Here's a routine that will check a drawing before it's opened to find out if it is r2000 or not. If it's not r2000, it will return nil, else it will return T.
(defun vercheck (file / line dwgver ver2000)
(setq line (read-line file))
(setq dwgver (substr rl 1 6))
(close file)
(if (= dwgver "AC1015")
(setq ver2000 T)
(setq ver2000 nil)
)
ver2000
)
(vercheck "c:\\somedwg.dwg")
The read-only thing is a little trickier than that. Here's something that I've done, though not recommended by the programming pros. I created a fake-out routine that would define a command called "yes". Yeah, kind of lame, I know, but waiting for answers on the dicussion groups could take some time and I had to come up with something. Anyway, here's the routine.
(defun c:yes ()
(princ)
)
My script would look like this:
open
c:\drawing1.dwg
yes
(somefunction)
zoom
extents
quit
yes
open
c:\drawing2.dwg
yes
(somefunction)
zoom
extents
quit
yes
open
c:\drawing3.dwg
yes
(somefunction)
zoom
extents
quit
yes
If a 'yes' is needed for the read-only prompt, one will be provided, otherwise, 'yes' is inputted in the command line and nothing happens which will keep the script running. For the script to continue to the next drawing, make sure that SDI mode is set to 1. |
|