Open version specific files in script
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Open version specific files in script

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
jlspartz
Guest





Posted: Tue Jan 04, 2005 1:12 am    Post subject: Open version specific files in script Reply with quote

I want to make a script to run through hundreds of thousands of drawings but just open the files which are in 2000 format and are not read-only (open by a user). How would I put that in my scripting?

Back to top
mattis
Guest





Posted: Tue Jan 04, 2005 11:28 pm    Post subject: Re: Open version specific files in script Reply with quote

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.
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB