Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script troubles

17 REPLIES 17
Reply
Message 1 of 18
Anonymous
777 Views, 17 Replies

Script troubles

I have about 200 hundred drawings tha I need to recover, so I figured I would write a script file. It doesn't want to work on more then one drawing. I don't understand since I don't use scripts that often. I have one that works, and one that doesn't.

Here is the one that did.

_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8090-9.dwg"
recoverdwg
_.qsave
_.close
_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8091-7.dwg"
recoverdwg
_.qsave
_.close
_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8092-5.dwg"
recoverdwg
_.qsave
_.close
setvar
filedia
1
setvar
cmddia
0

Here is the one that doesn't.

_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8093-3.dwg"
_.regenall
_.qsave
_.close
_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8094-1.dwg"
_.regenall
_.qsave
_.close
_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8095-8.dwg"
_.regenall
_.qsave
_.close
setvar
filedia
1
setvar
cmddia
0

Any help is greatly appreciated.
Tim
17 REPLIES 17
Message 2 of 18
Anonymous
in reply to: Anonymous

Tim,

Any error messages? Also, what is 'recoverdwg'?

--
Autodesk Discussion Group Facilitator


wrote in message news:4909189@discussion.autodesk.com...
I have about 200 hundred drawings tha I need to recover, so I figured I would write a script file. It doesn't want to work on more
then one drawing. I don't understand since I don't use scripts that often. I have one that works, and one that doesn't.

Here is the one that did.

_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8090-9.dwg"
recoverdwg
_.qsave
_.close
_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8091-7.dwg"
recoverdwg
_.qsave
_.close
_.open
"H:\eMatrix\Mechanical\Chris\12-2697-8092-5.dwg"
recoverdwg
_.qsave
_.close
setvar
filedia
1
setvar
cmddia
0

Here is the one that doesn't.

_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8093-3.dwg"
_.regenall
_.qsave
_.close
_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8094-1.dwg"
_.regenall
_.qsave
_.close
_.recover
"H:\eMatrix\Mechanical\Chris\12-2697-8095-8.dwg"
_.regenall
_.qsave
_.close
setvar
filedia
1
setvar
cmddia
0

Any help is greatly appreciated.
Tim
Message 3 of 18
Anonymous
in reply to: Anonymous

Jason,

No error messages.

(defun c:RecoverDwg ()

;(while (/= (getvar "lastprompt") "3M AutoCAD Configuration Loaded.")
; (command pause)
;)
(command "_.layer" "_m" "Defpoints" "")
(command "_.change" (ssget "x" '((0 . "VIEWPORT"))) "" "_properties" "_layer" "Defpoints" "")
(command "_.mspace")
(command "_.zoom" "_extents")
(command "_.zoom" "1xp")
(command "_.pspace")
(command "_.qsave")
)

It works one the first one no problem, then it just stops, like it finished the script. I'm lost.

Tim
Message 4 of 18
Anonymous
in reply to: Anonymous

Sorry for the delay, wrapped up in some other code
and some tunes this weekend. Haven't given this a
great amount of thought, but is SDI and issue?

--
Autodesk Discussion Group Facilitator


wrote in message news:4909284@discussion.autodesk.com...
Jason,

No error messages.

(defun c:RecoverDwg ()

;(while (/= (getvar "lastprompt") "3M AutoCAD Configuration Loaded.")
; (command pause)
;)
(command "_.layer" "_m" "Defpoints" "")
(command "_.change" (ssget "x" '((0 . "VIEWPORT"))) "" "_properties" "_layer" "Defpoints" "")
(command "_.mspace")
(command "_.zoom" "_extents")
(command "_.zoom" "1xp")
(command "_.pspace")
(command "_.qsave")
)

It works one the first one no problem, then it just stops, like it finished the script. I'm lost.

Tim
Message 5 of 18
Anonymous
in reply to: Anonymous

It isn't in the one where I use open, but I can run a check on it later today and get back to you.

Thanks.
Tim
Message 6 of 18
Anonymous
in reply to: Anonymous

Thanks Jason, that seemed to do it. Do you have any idea why it is like that? If not cool, I just like to know why something works.

Tim
Message 7 of 18
Anonymous
in reply to: Anonymous

Glad it worked for ya. I'm no script expert
(if there is such a thing) but I think scripts are
simply designed with work with SDI = 1.


--
Autodesk Discussion Group Facilitator



wrote in message news:4910115@discussion.autodesk.com...
Thanks Jason, that seemed to do it. Do you have any idea why it is like
that? If not cool, I just like to know why something works.

Tim
Message 8 of 18
Anonymous
in reply to: Anonymous

Cool, and Thanks again.

Tim
Message 9 of 18
Anonymous
in reply to: Anonymous

Jason Piercey wrote:
> Glad it worked for ya. I'm no script expert
> (if there is such a thing) but I think scripts are
> simply designed with work with SDI = 1.
>
>
I use scripts a LOT with SDI = 0. Never a problem.
Dave
DDP
Message 10 of 18
Anonymous
in reply to: Anonymous

Any ideas on what Tim's problem might be with SDI = 0 ?

--
Autodesk Discussion Group Facilitator



"ddpcad" wrote in message
news:4911903@discussion.autodesk.com...

>
I use scripts a LOT with SDI = 0. Never a problem.
Dave
DDP
Message 11 of 18
Anonymous
in reply to: Anonymous

When I ran the script that has the "open" as the opening feature for the drawings, it will work with SDI equaling 0, but when I use "recover" as the opening feature for the drawings, it doesn't seem to work. I still don't understand why, but if I have to run it with SDI = 1, then that is what I have to do.

Thanks again for all the info, and help.
Tim
Message 12 of 18
Anonymous
in reply to: Anonymous

Jason Piercey wrote:
> Any ideas on what Tim's problem might be with SDI = 0 ?
>

I didn't look at his original script to closely and have never used a
script to recover drawings but would think that it would have something
to do with the various dialogs or prompts that come up depending on
whether a drawing needs to be recovered or not. If a drawing doesn't
need recovery you get one dialog with an OK button. If a drawing does
need recovery there are sometimes the need to hit Enter several times to
get to the drawing. Tough for a script to know what to do with that
Dave
DDP
Message 13 of 18
Anonymous
in reply to: Anonymous

When with SDI = 0, and running the recover script, it doesn't prompt for anything, weather it need recovering or not. It does work, but only on the first drawing in the script file, then it just stops without any error or any message.

If no one can tell me why, then that is cool because it worked with SDI set to 1. I have no idea at all what is going one with scripts, so I can't even fathom a guess, so any insight is appreciated.

Thanks.
Tim
Message 14 of 18
Anonymous
in reply to: Anonymous

T.Willey wrote:
> When with SDI = 0, and running the recover script, it doesn't prompt for anything, weather it need recovering or not. It does work, but only on the first drawing in the script file, then it just stops without any error or any message.
>
> If no one can tell me why, then that is cool because it worked with SDI set to 1. I have no idea at all what is going one with scripts, so I can't even fathom a guess, so any insight is appreciated.
>
> Thanks.
> Tim

OK, now that I look back at your original two posts I see that you are
not really Recovering drawings using the RECOVER command. Your code
works fine here as:

(defun c:RecoverDwg ()

;(while (/= (getvar "lastprompt") "3M AutoCAD Configuration Loaded.")
; (command pause)
😉
(command "_.layer" "_m" "Defpoints" "")
(command "_.change" (ssget "x" '((0 . "VIEWPORT"))) "" "_properties"
"_layer" "Defpoints" "")
(command "_.mspace")
(command "_.zoom" "_extents")
(command "_.zoom" "1xp")
(command "_.pspace")
(command "_.qsave")
)

which I saved to a folder in my search path and added to my Startup
Suite. I then created the following script:

open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\001.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\002.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\101.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\102.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\301.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\302.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\303.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\304.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\305.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\401.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\402.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\403.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\404.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\405.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\406.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\407.dwg"
recoverdwg qsave close
open "C:\Documents and Settings\Jones\My
Documents\DDPJob\testing\Main\408.dwg"
recoverdwg qsave close

and it ran on all drawings without a hitch. SDI = 0
Dave
DDP
ps: the QSave in your code is redundant
Message 15 of 18
Anonymous
in reply to: Anonymous

In my original post I was trying to use the recover command to open the drawings because I had to. I did a little lisp where I had to push the ok button while I waited for an answer, which Jason made about turning SDI to 1 and running the script then. And that worked.

In your post you use the open command to open the drawings, and that worked for me also, but I wanted to use the recover command to open the drawings, but that didn't work in the script.

My conslusion is: If you want to use the recover command to open drawings in a script file, then you have to have SDI = 1.

Thanks for all the points of view, and help.
Tim
Message 16 of 18
Anonymous
in reply to: Anonymous

T.Willey wrote:
> In my original post I was trying to use the recover command to open the drawings because I had to. I did a little lisp where I had to push the ok button while I waited for an answer, which Jason made about turning SDI to 1 and running the script then. And that worked.
>
> In your post you use the open command to open the drawings, and that worked for me also, but I wanted to use the recover command to open the drawings, but that didn't work in the script.
>
> My conslusion is: If you want to use the recover command to open drawings in a script file, then you have to have SDI = 1.
>
> Thanks for all the points of view, and help.
> Tim

I don't think SDI should have anything to do with runnings scripts or
the Recover command. I've run scripts on 1000's of drawings doing
everything from printing to XRef reloading to adding viewports and I
have never had SDI = 1. I have never tried to script Recover multiple
drawings though and would like to figure this out for my own education
if you don't mind.

Please post the code that doesn't work for you with SDI = 0 and I'll
give it a try here.
Dave
Message 17 of 18
Anonymous
in reply to: Anonymous

I think this is all you need. All you need to do really is change "open" to "recover" in you script.

Please post if you learn anything new, as I like to learn also.
Thanks.
Tim
Message 18 of 18
Anonymous
in reply to: Anonymous

T.Willey wrote:
> I think this is all you need. All you need to do really is change "open" to "recover" in you script.
>
> Please post if you learn anything new, as I like to learn also.
> Thanks.
> Tim

will do...it'll probably be this weekend before I can play with it to my
hearts content...golf tomorrow and work Fri ya know 🙂
Dave

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report