circle command in a script in Autocad 2015

circle command in a script in Autocad 2015

egurevich
Explorer Explorer
9,923 Views
16 Replies
Message 1 of 17

circle command in a script in Autocad 2015

egurevich
Explorer
Explorer

Hello.

 

This seems to be a new issue in Autocad 2015 which did not exist in previous versions.

 

Until 2015 if I wanted to write a script (.SCR) that would plot multiple circles it would look like this:

 

circle 0.0350,3.7950 0.01 

circle 0.0350,3.7950 0.01 

circle 0.0350,3.7950 0.01 

 

In 2015 that does not work anymore, because after the first circle gets drawn it prompts for the next circle coordinates, but the script does not pass it to the second circle command. So there is a hanging prompt for coordinates and the script stops.

 

If I write the script as follows:

 

circle
0.0350,3.7950 0.01
0.0750,3.6750 0.01
0.3150,3.0750 0.01 

 

It works, but after the last circle instead of terminating the command and stopping the script, it prompts for another cicle (which is not in the script) and waits for coordinates again. So I don't know how to terminate this script.

 

Is this a bug or the script command functionality has been changed?

 

Please let me know how to get it to work normally.

 

Thanks

Eli

 

 

0 Likes
Accepted solutions (1)
9,924 Views
16 Replies
Replies (16)
Message 2 of 17

Kent1Cooper
Consultant
Consultant

@egurevich wrote:

.... 

Until 2015 if I wanted to write a script (.SCR) that would plot multiple circles it would look like this:

 

circle 0.0350,3.7950 0.01 

circle 0.0350,3.7950 0.01 

circle 0.0350,3.7950 0.01 

 

In 2015 that does not work anymore, because after the first circle gets drawn it prompts for the next circle coordinates, ....

 

If I write the script as follows:

 

circle
0.0350,3.7950 0.01
0.0750,3.6750 0.01
0.3150,3.0750 0.01 

 

It works, but after the last circle instead of terminating the command and stopping the script, it prompts for another cicle... So I don't know how to terminate this script.

.... 


Are you using some overlay program?  My vanilla AutoCAD 2015 does not  behave that way, so I'm guessing you have a redefined command.  Try your first one with a period before the command names, to dig down to the native command definition:

 

.circle 0.0350,3.7950 0.01 

.circle 0.0350,3.7950 0.01 

.circle 0.0350,3.7950 0.01

 

Alternatively, it looks as though the redefined command just needs an Enter to finish it, as do various commands that return to an option prompt, such as LAYER or CHPROP.  Try adding another Enter at the end of the Script in your second version [without the period], so that if you hit Ctrl+End, the cursor is two lines below the last line with content.

Kent Cooper, AIA
0 Likes
Message 3 of 17

egurevich
Explorer
Explorer

I tried both of these options before and it does not change anything. My Autocad is standard so the command is not redefined. The only thing I can think of is that there is some bug somewhere. 

0 Likes
Message 4 of 17

pendean
Community Legend
Community Legend
You ned to finish the command, your script does not most likely:

circle
0.0350,3.7950 0.01
0.0750,3.6750 0.01
0.3150,3.0750 0.01
<<<<THIS HERE NEEDS TO BE A BLACK SPACE AT THE END OF THE SCRIPT OF THE END OF THIS COMMAND RUN).

or
circle 0.0350,3.7950 0.01
<blank space>
circle 0.0350,3.7950 0.01
<blank space>
circle 0.0350,3.7950 0.01
<blank space>

Don't actually type anything where I wrote between < >.
0 Likes
Message 5 of 17

egurevich
Explorer
Explorer

I have a blank space at the end of each line. It still does it. THe problem is only the with CIRCLE. If I do a similar script for PLINE or LINE it works fine.

0 Likes
Message 6 of 17

pendean
Community Legend
Community Legend
Post your actual SCR file then, I'm only copy/pasting from here and they seem to work as I described only.
0 Likes
Message 7 of 17

egurevich
Explorer
Explorer

attached. Had to change extension to TXT to post.

0 Likes
Message 8 of 17

egurevich
Explorer
Explorer

one more thing. I ran REDEFINE command on CIRCLE and it did not fix anything. Also installed SP2 and that did not fix anything either. Any other ideas?

0 Likes
Message 9 of 17

pendean
Community Legend
Community Legend

You have too many blank spaces and even more blank lines to keep track of, that's the problem.

 

Both scripts work fine, I've re-written them to aid in troubleshooting in the future (this is how I like to write script files): I avoid adding blank spaces on the same line as other words, there is no way to keep track of them. Consider changing your script writing methods.

Message 10 of 17

Kent1Cooper
Consultant
Consultant

@egurevich wrote:

attached. ....


In Scripts, unlike in AutoLISP, spaces matter.  Try the coordinates-on-each-line version without the spaces at the ends of each line other than the first, and with an additional Enter at the end so that [as I suggested earlier] when you press Ctrl+End, the cursor is two lines below the last line with content.  [I'm not currently where I have 2015 to test it.]

Kent Cooper, AIA
0 Likes
Message 11 of 17

egurevich
Explorer
Explorer

Thanks. This worked. Is there some kind of documentation for proper script wrting?

 

I use Excel to generate the scripts using the CONCATENATE excel formula. So it's easier if the whole command comes out in one line. The way you have it would make the Excel spreadsheet a lot more complicated. 

 

Any suggestions on how to generate this script in Excel so that one CIRCLE command uses up only one line?

 

 

 

0 Likes
Message 12 of 17

pendean
Community Legend
Community Legend
There is no 'proper', just do what is easiest to circumvent having to count blank spaces you cannot see,

See these for your second question: http://thecadgeek.com/blog/2007/09/creating-script-files-with-excel/
http://www.cadforum.cz/cadforum_en/qaID.asp?tip=6606


And I have never tried it but this looks interesting http://www.scriptsheets.com/
0 Likes
Message 13 of 17

egurevich
Explorer
Explorer
Accepted solution

Thanks.

I played around with it and what I see is that I was missing an enter on the last line that it apparently wanted. Without the enter on the last line it gets stuck inside the CIRCLE command. But for some reason the space at the end of the line does not work here. It does no interpret the space as an enter.

 

0 Likes
Message 14 of 17

Kent1Cooper
Consultant
Consultant

@egurevich wrote:

... I was missing an enter on the last line that it apparently wanted. .... But for some reason the space at the end of the line does not work here. It does no interpret the space as an enter.


The Customization Guide says about Scripts that the last line of a Script file must be blank.  [That's also true of certain other file types, such as hatch pattern and linetype definitions.]  I don't see anything there about the last character in a line, but I do recall that in menu [.mnu] files, the end of a line of code is read as Enter unless it is one of certain control characters [such as a backslash for User input, or ^H for backspace -- I don't remember all the possibilities without some digging].  It could be that similarly, a space at the end of a line in a Script doesn't register in the same way as it does within the line, but I'm not positive.

Kent Cooper, AIA
0 Likes
Message 15 of 17

egurevich
Explorer
Explorer
Thanks
0 Likes
Message 16 of 17

Anonymous
Not applicable
Hi, I am having the same problem with circle command within my script - my script works in other CAD software such as Draftsight however, now using AutoCAD 2016 and my script terminates at the last circle command and awaits input for a new circle that is not in the script.

Like you, my script file is generated from an Excel spreadsheet and, no matter what I try to change ie no spaces at end of last line, two spaces at end of last line or one blank line or two blank lines after last command none of these makes any difference.

Would it be possible for you to post your solution please?

Kind regards

Dave.
0 Likes
Message 17 of 17

cdnrfguy
Observer
Observer

Very helpful!

 

Thank you.

 

Dan

0 Likes