Jump to content

Recommended Posts

Posted

I have a script that I need to run in a bunch of drawings. In the past I have always used a batch file to run these and it always worked. Since I got 2010, it isn't working anymore. Here is one line in my batch (I have a line for each matching drawing and script):

 

"C:\apps\AutoCAD 2010\acad.exe" (drawing_path)\mt200090s0570e0.dwg /b (script_path)\mt200090s0570e0.scr

 

I tried reversing the order too (suggested by a programmer):

 

"C:\apps\AutoCAD 2010\acad.exe" /b (script_path)\mt200090s0570e0.scr (drawing_path)\mt200090s0570e0.dwg

 

Neither one works. It opens the drawing, kicks off the script, then it decides to load VBA (which ends the script before it begins).

 

Any ideas? I have hundreds of drawings I have to run this script on. In case you are wondering, the script attaches an image:

filedia 0

-layer s IMAGE

 

-image

 

(image_path)\mt200090s0570e0.tif

3171090.963,304537.340

7.1790

0 draworder

l

 

b filedia 1

qsave

quit

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • ChrisCMU

    16

  • Lee Mac

    14

  • dbroada

    4

Top Posters In This Topic

Posted

It doesn't even run now, so it never gets to the end. If I did close, wouldn't it have a bunch of acad windows open?

Posted

just guessing here (I don't have 2010) but is the (image_path) causing VBA to launch?

Posted
It doesn't even run now, so it never gets to the end. If I did close, wouldn't it have a bunch of acad windows open?

 

No, 'close' should close the active drawing window, and then the next line in the script will open a new window in its place.

Posted
just guessing here (I don't have 2010) but is the (image_path) causing VBA to launch?

 

Here is what it does in the drawing:

 

klsif.jpg

Posted
Here is what it does in the drawing:

 

klsif.jpg

it puts a red cross through it?

 

sorry, we don't get access to photo hosting sites so I can't see that :)

Posted

Well, I figured out two things.

 

1) close does not work. It just hangs there until you click the close "x" then continues. I put quit back in.

2) I took the "-vbarun" poriton out of the startup and it works fine. We had that in there to load our custom application. Without that, it goes right into the script. I will have to run this from a machine without that application I guess.

 

I just wish there was a fix that doesn't involve disabling that add on application.

Posted
1) close does not work. It just hangs there until you click the close "x" then continues. I put quit back in.

 

Are you running the script with close or still using the batch? "Close" will work for a script.

Posted

It's a batch file, but the "close" or "quit" is inside the script that is run in each drawing. When it gets to the "close" in the ACAD command line it exits the drawing fine. But, it won't resume running the batch file until ACAD is closed.

Posted

The drawback of using a batch file to run the script I suppose - 'close' definitely is the way to go - why would you want to close and open the Application for every drawing.. that would take forever!

 

As I say in my previous post - is it mandatory that you use a batch?

Posted

It's mandatory to run the script in 50 drawings or more at a time. Is batch the only way to accomplish that? I don't know. That's the only way I know how to run individual scripts in corresponding drawings. I'm open to alternatives if there are any.

Posted

I read through that entire thread. Unless I'm missing something I don't see how anyone in there described how to run different scripts in a batch format. All of their ideas pertained to running one script in many drawings. I need to run many scripts in specific drawings:

 

script1 in drawing 1

script2 in drawing 2

etc

 

Each script contains coordinates that the image needs to be inserted at and a unique scale. No script can be run in a different drawing or the image would not line up with the line work in that drawing.

Posted

Lee & I disagree on the use of scripts :) usually but I'm inclined to agree with him here. I still think AutoCAD is interpreting the (image_path) as a instruction and is loading VBA to look for it. The fact that you get the script name without the prefix is why I think that.

Posted

Why not just create a script for drawing set 1, and a script for drawing set 2 using the program I linked you to?

 

Alternatively, code the script operations in a LISP and then call the LISP from the script - which is much more versatile.

 

Lee

Posted
Lee & I disagree on the use of scripts :)

 

:) I was actually waiting for you to disagree with one of my posts... I know that our opinions differ on this subject :)

Posted
Why not just create a script for drawing set 1, and a script for drawing set 2 using the program I linked you to?

 

Alternatively, code the script operations in a LISP and then call the LISP from the script - which is much more versatile.

 

Lee

 

Believe me, I hate scripts. Lisps (where hard returns and spaces mean nothing) are much better. The only reason we used scripts was to batch it. How would I kick off the lisp within the batch file though? do I still use the "/b" and then the lisp name? also, how would I make sure the lisp is loaded when the drawing is open? Normally in my startup I have frequently used lisps all loaded. These would all be differently named lisps.

Posted

Using a LISP is better IMO yes, but can a batch file process drawings without opening and closing AutoCAD every time?

 

If it were me, I would create a LISP to do the "business", and call it from within a script - I would not use a batch file at all.

Posted
Using a LISP is better IMO yes, but can a batch file process drawings without opening and closing AutoCAD every time?

 

If it were me, I would create a LISP to do the "business", and call it from within a script - I would not use a batch file at all.

 

I don't follow. How do you run multiple scripts without using a batch file? I still haven't seen anything explain that to me. I don't have any issues with script/lisp creation...but how do I run them all in the corresponding drawing?

 

I have 50 drawings, lets call them drawing1, drawing2, etc.

I have 50 images that need to be attached (same name as drawing).

 

How do you attach them (script or lisp) without using a batch file? I'm not going to open each drawing and kick off the lisp/script manually.

 

I actually have 1500 of these, but we do them in batches of 50 at a time.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...