Another SCRIPT befuddlement question

Another SCRIPT befuddlement question

Anonymous
Not applicable
767 Views
5 Replies
Message 1 of 6

Another SCRIPT befuddlement question

Anonymous
Not applicable

I've been writing and using Autocad scripts with no problems for years, I can usually figure out how to get it to do what I want but this time I am stumped. This is what the script in question does.

1. opens a drawing.

2. loads & runs a lisp routine.

3. opens next drawing in script and so on.

After it runs and closes the last drawing it returns to the drawing I launched the script from but then STOPS, it will not do any command after it returns to the original drawing, it makes no sense. At first I thought the original drawing was not active but after the script runs I can type right in the command line of the starting drawing with no mouse clicking, so it is active without a doubt.

Here's the script file:

 

open C:\drawings\drawing1.dwg
(load "stuff.lsp") (stuff) close
open C:\drawings\drawing2.dwg
(load "stuff.lsp") (stuff) close
open C:\drawings\drawing3.dwg
(load "stuff.lsp") (stuff) close
(princ "this will not print in the drawing that launched the script which is active")

 

I really like to know how technically its possible for the script routine ran from 1 drawing to open and do stuff dozens of other drawings and then upon returning the drawing that launched the script, its like NOPE, not going to continue.

 

Thanks for looking, any help would be appreciated.

 

 

0 Likes
768 Views
5 Replies
Replies (5)
Message 2 of 6

cadffm
Consultant
Consultant

When only one document is open in your program, set SDI to 1 (single document interface).

filedia to 0

 

Now you can test your steps by hand in commandline

You don't need (and can not use) CLOSE statement in SDI.

 

open a

changes

qsave

open b

changes

qsave

open c

..

Sebastian

0 Likes
Message 3 of 6

Anonymous
Not applicable

I am well aware of the SDI variable and what it does. That is not what I am am doing. The 'close' statement is there because I am opening several drawings and I have the option to EDIT the drawing before moving on to the next drawing or simply moving on to the next drawing. Like I said, I have analyzed the script process, how it works, what it can do, and what it supposedly can't do. What it can't do is what I try to get it to do. For example to get it allow me to edit a drawing WHILE still running the script is to first throw up a dialogue box upon drawing open, this pauses the script, the dialogue box has 2 options - continue to next drawing in script or edit the current drawing, if I hit the edit drawing button the script will stop via a fake command causing an error, then a  upon a manual drawing close, the script will continue to the next drawing in the script. This is done by undefining the 'close' command then defining a new 'close' command that will in turn redefine the 'close' command THEN issue a script 'resume' command which then will execute the next line in the script which low and behold is 'CLOSE', and that is why the close command is part of the script.

 

I already have a work around for what I need it to do, by closing the drawing that started the script then reopening it as the last drawing to open in the script but I don't like that, I thought maybe there a way to get the script to continue in the drawing that first launched the script. I have already tried the vb-activate method before the last drawing is closed but that the script still doesn't continue. 

0 Likes
Message 4 of 6

ronjonp
Mentor
Mentor

A script is usually run to do a set of common things on a bunch of drawings. Stopping a script to make some manual changes seems a bit backwards of what it is intended to do?

 

A thought is maybe have your script rewrite the script upon open ( not sure if this is possible if it's open )  to remove the current drawing and instructions then define something that calls the script again so it should open the next drawing.. but it feels like we're getting in the weeds with this.

0 Likes
Message 5 of 6

Anonymous
Not applicable

I agree about the stopping of a script but this is what I have created... a real pack or e-transmit.

This is what I do at least a few times a day even more, I complete or revised a set of drawings, I do work for multiple companies, and then send out all the drawings , fonts, and whatnot AND pdf files of each drawing because the persons receiving the files usually are not efficient in Autocad or on the not in the office. My average set is about 8 or 9 sheets, many are 12 and above. 

 

1. FILE MANAGER - open each drawing , change the master date, make sure the layers are set, the drawing is in the entire view, and make a pdf - FILE MANAGER again, only on 1st pdf (which I have coded another program to do with a few mouse clicks), save the drawing, FILE MANAGER again to open next drawing, and so on.

 

2. E-transmit, FILE MANAGER on all the cad files I already just opened, the pdf files are not in the zip file.

 

3. Email, FILE MANAGER yet again on the zip file then all of the pdf files.

 

Say there are 10 sheets, that is a total of 25 or more file pickings plus or minus

This is what my e-transmit does:

1. FILE MANAGER once, choose all the drawing files. My pdf routine will automatically set the directory to my e-transmit directory, I will open all, some, or none of the drawings of my choosing one at a time, so I can make them 'ready' to send, then it will attach the files to an e-mail and launch my email client without ever leaving Autocad.

 

Pretty convenient, right ?

My original question is really was just an annoyance issue. After it opens all the drawings one at a time and returns to the drawing that launched the script, the script stops, so I have to type "pk" (the launch command for my e-transmit lisp) to get the dialogue box back up to hit the "pack button", ha ha.

I was just wondering why it cannot send that last script command to to drawing that launched the lisp, that's all.

0 Likes
Message 6 of 6

maratovich
Advisor
Advisor

You have mixed two different commands - script and lisp.
You only need - batch lisp in several files.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes