I can't draw using my script file

I can't draw using my script file

lee02258
Explorer Explorer
1,308 Views
14 Replies
Message 1 of 15

I can't draw using my script file

lee02258
Explorer
Explorer

Hello,

 

I am trying to draw multiple lines and circles using my script file (please see attached. I converted it to .txt b/c the forum does not support .scr format attachment).

However, whenever I try to load the script using the "script" command it will not generate the correct features.

If I input a few lines in the script file directly in the command terminal, the features are correctly drawn but when I copy and paste more than a certain number of lines into the command terminal, AutoCAD will not draw. 

 

Can anyone help me with this?

 

0 Likes
Accepted solutions (1)
1,309 Views
14 Replies
Replies (14)
Message 2 of 15

Pointdump
Consultant
Consultant

Hi Sang,
Thanks for posting your SCR file.
I'm having a hard time wrapping my head around it, but I think it would be best to simplify it. Each line should do just one thing. That way you'll know at what point the wheels are falling off.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 3 of 15

paullimapa
Mentor
Mentor

For the Line command after the last coordinate entry add an additional space to finish the command before you start C for the Circle command 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 15

tramber
Advisor
Advisor
Accepted solution

Turn the osnap OFF !

Put the OSMODE variable to 0 😁


EESignature

Message 5 of 15

Pointdump
Consultant
Consultant

Hi Paul,
I think the "C" is for CLOSE. Sang uses CIRCLE for Circle Command.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 6 of 15

tramber
Advisor
Advisor

Anyway, the PGP file is not used by Autocad to execute a script file.... It is necessary to write the original and complete command name.


EESignature

0 Likes
Message 7 of 15

paullimapa
Mentor
Mentor

yes, you are correct. I ran the script file and works perfectly for me...see attached dwg...I wonder why OP has issues?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 8 of 15

Kent1Cooper
Consultant
Consultant

@paullimapa wrote:

.... I ran the script file and works perfectly for me...see attached dwg...I wonder why OP has issues?


It worked for me, too, though [ensuring Osnap is off first] my result is different:

Kent1Cooper_0-1679584721301.png

rather than @paullimapa 's result that has multi hundreds of Circles coinciding at a limited number of locations -- maybe there was some Osnap on there [including CENter mode, I suspect].

 

The weirdest part is that it's all one line!  But it seems to work anyway [for me].

 

[By the way, those 50.000 Circle radii don't need the decimal part -- just plain 50 would do in all cases.  Any trailing zeroes in any of the coordinates are pointless.]

Kent Cooper, AIA
Message 9 of 15

lee02258
Explorer
Explorer

Thank you Bertrand! It works now!!

0 Likes
Message 10 of 15

Kent1Cooper
Consultant
Consultant

@lee02258 wrote:

.... will not generate the correct features.

.... will not draw. 


That combination raises the question:  Does "will not generate the correct features" mean not drawing at all [as the second quoted line sort of suggests], or does it draw something, but just not what you expect?  If running Osnap is on, depending on Osnap mode and aperture size settings and Zoom level, it could have various kinds of unexpected results.

Kent Cooper, AIA
0 Likes
Message 11 of 15

tramber
Advisor
Advisor

You are welcome.

You may use OSNAPCOORD variable and set it to 1 as an other solution so it won't be a necessity to act on OSMODE 😉

It is in tab n°6 in the options dialog box.


EESignature

Message 12 of 15

lee02258
Explorer
Explorer

Hi Paul,

 

Thanks for testing my script!

When I view your file the circles are overlapping together (see attached) which was happening to me before.

But the script works if I turn off the osnap and run the script.

 

Sang

 

0 Likes
Message 13 of 15

lee02258
Explorer
Explorer

Hi Kent,

 

 

Sorry about being vague about my wording.

Using the script generated a drawing but it was not what I intended.

After turning off the osnap, the script started to generate the drawing I expected.

Thank you for your help!

 

 

Sang

0 Likes
Message 14 of 15

paullimapa
Mentor
Mentor

Perhaps a wishlist item for AutoCAD to ignore running osnaps while running scripts 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 15 of 15

cadffm
Consultant
Consultant

No need, there is a setting: OSNAPCOORD.

Default 2 for Keyboard only 

Value 1 is for automation too.

 

So setup your program to 1,

easy to write this line to your script first

Sebastian