Jump to content

Script Issues: Not performing correct command or skipping command.


asad112

Recommended Posts

I have searched around for a similar problem, but did not seem to find it. If anyone can point me to where this has been discussed, this thread can be closed.

 

Anyways, I am about to pull my hair out. I have used a program called Script Maker v. 1.0.4 to create simple batch scripts to update attributes in my title blocks that exist in multiple drawings.

 

This is the essence of the command:

 

PSPACE

GATTE

0,0

APPROVALDATE

[here I enter the new text]

Y

_QSAVE

CLOSE

 

When those commands are generated on with a script containing the desired files, for some reason the script malfunctions around the 7th drawing.

 

Today, I downloaded a demo of Hurricane for AutoCAD, which is a more user friendly program that does just about the same thing.

 

This is the script it generates:

 

(LOAD "C:/PROGRAM FILES (X86)/HURRICANE/LISP/TB_WIZ1.LSP")

;-------------

TB_WIZ1

"title-sheet"

approvaldate

09/19/12

REGEN

;-------------

 

Again, it works first few drawings (in this case the first three drawings), but malfunctions on the fourth drawing.

 

This is very frustrating because I had no problems with this on my previous computer. Now, on a new faster computer, I having these problems. I am even having them on the exact same drawing files that had no issues on the previous computer.

 

I have attached the text as it is executed in both versions.

 

Thanks!

 

Script1.txt

Script2.txt

Link to comment
Share on other sites

I have tried entering a 3 second delay after each set of related commands, it didn't seem to fix the issue. As a matter of fact, it just push off the problem to drawings later on in the sequence. It is so bizarre.

Link to comment
Share on other sites

Yeah, they all have the attribute. I confirmed this by going in manually and performing the commands and it worked fine.

 

I am trying it now with Autodesk Script pro, and I am having better luck because it uses a timeout feature when a drawing is not responding. From the 16 drawings in this set, #7 through #10 do not update. Oddly enough, script pro shows a status of "failed" for the successful updates, and a status of "done" for the unsuccessful updates. Therefore, I think I have been able to narrow the problem down to this hookup:

 

Command: _.SCRIPT

Enter script file name : C:\Users\Adam\Desktop\TEST.SCR

 

Command: PSPACE

 

Already in paper space.

 

Command: GATTE

 

Initializing...

Select block or attribute [block name]: 0,0

 

 

Command: 0,0

Unknown command "0,0". Press F1 for help.

I am certain that there is a block located at 0,0. Because when I going in manually and perform GATTE, and enter 0,0, it shows me all the attributes available for modification.
Link to comment
Share on other sites

After a lot of guess work, it appears the problem was that the script was not finding the coordinates I was providing. I had a few drawings where "0,0" (as "0,0" were the coordinates I was providing to gatte) was obscured by the bottom of the workspace screen. The simple fix was to add a ZOOM and then EXTENTS command before GATTE.

 

I swear, sometimes AutoCAD presents us with the most trivial and aggravating of issues. Anyways, thanks you guys for your input.

Link to comment
Share on other sites

I think you answered your own question earlier: after adding a three second delay more files got processed and only later files started to fail.So try 4-5-6-7-8-9-10 second delays until the set is complete.

Link to comment
Share on other sites

I have posted elsewhere the problem of zooming sometimes, in some lisps you do the same manually and it works because you have zoomed in, this has been a problem with Autocad for say 20+ years. Its a hidden bug its like if you can not see it I will not work, simple work around is use Z C 0,0 scale this way you control how much you can see, using Z E can bring other problems that wrong objects will be picked.

 

You should not need any time delays. I have processed multi drawings and never needed time delay.

 

I would use a bit of lisp to get entries this stops any problems of autocad using and continuing on rather than asking.

 

PSPACE
(setq ans (getstring "\n[here I enter the new text]'))
GATTE
0,0
APPROVALDATE
ans
Y
_QSAVE
CLOSE

Link to comment
Share on other sites

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...