Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script throwing up command errors randomly

30 REPLIES 30
SOLVED
Reply
Message 1 of 31
nikkilawsonPLKEN
1934 Views, 30 Replies

Script throwing up command errors randomly

Hi all,

 

I am fairly new to the whole Forum thing and have no idea if this is the right place to ask this? But, I am encountering a very annoying issue that I would immensely appreciate assistance with.

I am currently using AutoCAD LT 2022 and am trying to run a script that I have made. It only works some of the time and the other 80% of attempts end in "Unknown command "o,o". Press F1 for help" I understand where the "0,0" is in my script, I just have no idea why it causes the error. The script up until that point is:

_cutclip
all

_pasteclip
0,0

 

Which as you can, see should be incredibly simple. But, only works every so often. This is driving me mental! I am attempting to automate an amendment on about 1,000+ old drawings and at this rate it would be faster to do it manually!

The only thing I could think is if it is to do with my work PC being slow of late? It runs almost constantly at 100% disk usage and freezes a lot! Maybe that could be throwing the script out of rhythm? Other than that, I have no leads to go from.

 

Thank you in advance for any assistance!

30 REPLIES 30
Message 2 of 31

Can you post a screenshot of your text window so we can see the commands in action. To open it press F2

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 3 of 31

Thank you for assisting me with this!

So, my script to replace a 9mm layout page (Layout1) with a layout of a proper size to rectify distorted PDF's and to place all geometry at the origin point of the drawing. The script is:

_cutclip
all

_pasteclip
0,0
_zoom
e
_stretch
600,350
-100,315

0,334
0,344
_stretch
600,45
-100,-100

0,0
0,-10
_cutclip
all

_pasteclip
0,0
-layout
template
"Drive:\Folder\Sub Folder\Drawing.dwg"
layout1
layout
delete
layout1
_zoom
e
layout
rename

layout1
layout
set
layout1
_.mspace
zoom
e
_.pspace
model
zoom
e
save
close


And the Text Window gets as far as:

nikkilawsonPLKEN_0-1627904484909.png

I have no idea where or why it is going wrong? It works sometimes, that's what I dont understand the most. If it was the script at fault then I would expect it to fail 100% of the time.

Message 4 of 31

It looks like something is going wrong with the _pasteclip command. The commands work as expected on LT2016

 

Is your LT updated to the latest version?

If it is try a repair reinstall to see if that fixes the problem.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 5 of 31

Sorry I think I replied to MYSELF?... But, I did say, I am new to this 'Forum' business. I think my response is below?
Message 6 of 31

OK, Ignore my last message, apparently I dont know what I am talking about! You did get the reply.

I will try a repair install now, hopefully that will help. Thank you again for the assistance. I will report back with my findings.

Message 7 of 31

I dont appear to be able to repair AutoCAD. The Modify button is greyed out. Am I doing something wrong?

nikkilawsonPLKEN_0-1627907054378.png

 

Message 8 of 31

Not too sure what's happening there.

Have you checked that AutoCAD is up to date?

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 9 of 31

It is up to date yes. I wonder if our IT guy will have any idea why I cant repair it. I will report back when he has had chance to look into it.

Message 10 of 31

Make sure that there are no spaces at the end of each line of your script file. They might be throwing the command out of whack.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 11 of 31

Sadly that isn't the case either, that was one of the first things I checked. I feel like if there was an extra space then 100% of my attempts to use the script would fail. Whereas it does work every so often. Also, there are 3 other people in my office using the same script, on the same version of AutoCAD and none of them are encountering the issue.

I think your first suggestion of repairing the install will be what is needed. But, I just cant seem to be able to do it.

Message 12 of 31

Here's a link to help with the repair reinstall

How to repair or reinstall an AutoCAD installation | AutoCAD | Autodesk Knowledge Network

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 13 of 31
pendean
in reply to: nikkilawsonPLKEN

ZIP then share your actual SCR file here with us please: from your posts and screenshots alone there appears to be an errant <enter> after one of your PASTECLIP command entries.
Message 14 of 31
steven-g
in reply to: nikkilawsonPLKEN

True a script should behave 100% the same. But if it is failing and leaving you in an active command then the second time you try the script it will look like it is doing something different. So having said that just a quick look at your script it looks like you are missing a blank line after the very second line it should read

_cutclip
all

<empty line>

_pasteclip
0,0

The empty line above will end the selection of the cutclip object selection otherwise the program sees _pasteclip as an error and it will then try to read 0,0 as the next valid command (which causes the "Unknown command "o,o"). Posting the full script would help us see if there are any other issues further along in the script.

Message 15 of 31

@steven-g @pendean I copied the first few lines of his script exactly from here into a script file and it worked fine in LT2016

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 16 of 31
nikkilawsonPLKEN
in reply to: pendean

There does indeed appear to be an extra 'enter' from the screenshots and if that was the case that would make perfect sense. Unfortunately though, all it is doing for me right now is adding to my confusion. I dont see any obvious errors in the script at all. Like I said earlier, I have 3 other people in my office using the same .scr file without issues. It worked for me without issues also for about the first 10 or so drawings. Then all of a sudden started failing. Now it is failing more often than it is working. Yesterday I was taking not of failed attempts and my current record stands at 34 fails before running the script successfully.

If you do happen to find any error in this script, I wont even be mad, or feel stupid that I hadn't spotted it. I will just be happy that this whole endeavour is over!

 

Thank you again to everybody who is assisting with this.

Message 17 of 31


@h_s_walker wrote:

Here's a link to help with the repair reinstall

How to repair or reinstall an AutoCAD installation | AutoCAD | Autodesk Knowledge Network


This is what I was following. But when it gets to here...

nikkilawsonPLKEN_0-1627979159963.png

I dont have a 'Modify' button available. It is greyed out.

nikkilawsonPLKEN_1-1627979234260.png

 

I asked our IT guy also and he said he will do something with my PC next week. No idea exactly what he is going to be doing, but I assume it will help. Just a shame it will take another week!

Message 18 of 31

Ok so I just downloaded the script and only deleted the layout part and the end and it worked fine for me. Below is a paste of my text window

 

Regenerating layout.
Regenerating model.
Press ENTER to continue: *Cancel*

Command:
Command:
Command:
Command: '_script
Command: _cutclip

Select objects: all
1749 found
25 were on a locked layer.
1665 were not in current space.
1 was the paper space viewport.

Select objects:

Command: _pasteclip
Duplicate definition of block attriba2a ignored.
Duplicate definition of block _Oblique ignored.
Duplicate definition of block scalebar ignored.
Specify insertion point: 0,0
Regenerating model.
Regenerating model.
Regenerating model.
Regenerating model.

Command: _zoom

Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: e
Regenerating layout.

Command: _stretch

Select objects to stretch by crossing-window or crossing-polygon...
Select objects: 600,350
Specify opposite corner: -100,315
11 found

Select objects:

Specify base point or [Displacement]: 0,334

Specify second point or <use first point as displacement>: 0,344

Command: _stretch

Select objects to stretch by crossing-window or crossing-polygon...
Select objects: 600,45
Specify opposite corner: -100,-100
33 found

Select objects:

Specify base point or [Displacement]: 0,0

Specify second point or <use first point as displacement>: 0,-10

Command: _cutclip

Select objects: all
1749 found
25 were on a locked layer.
1665 were not in current space.
1 was the paper space viewport.

Select objects:

Command: _pasteclip
Duplicate definition of block attriba2a ignored.
Duplicate definition of block _Oblique ignored.
Duplicate definition of block scalebar ignored.
Specify insertion point: 0,0
Regenerating model.
Regenerating model.
Regenerating model.
Regenerating model.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 19 of 31

This is what I mean! My AutoCAD is possessed! I really don't understand why it isn't working. It is driving me absolutely insane. My day at work yester day was so painful, it was an entire shift of trying to run this script and watching it fail. If I were to average out my fails, I think what I managed to amend yesterday will have taken me roughly 15x longer to do than it should have! If you think to the old phrase 'its like repeatedly banging your head against a brick wall', I will take the brick wall at this point. That actually sounds pleasant by comparison!

Message 20 of 31

Have you tried it on a completely blank drawing? 

e.g. just draw a rectangle in paper space and then run the script and see what happens.

Then run it on a template drawing and see what happens.

It might be that something in some of your drawings is messing up the script.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report