error on script execution
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
error on script execution
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD

Author Message
Cuma



Joined: 01 Aug 2009
Posts: 2

Posted: Sat Aug 01, 2009 11:20 am    Post subject: error on script execution Reply with quote

Hello

I am going to create the scripts which draw closed plines (the project of photomask). Finale scripts should draw several plines composed of up to several hundreds segments each. However my simple test script is not able to draw correctly two sets, each composed of two triangles one vertex touched, which are encompassed by a polygon.

If I copy each line from script independently to the command line of AutoCad, the plines are drawn correctly. When I execute the script the plines are drawn incorrectly but what is strange to me: looking into the history of the AutoCad command line I found that commands from script are read in proper order and are correct (as in case when one does ctrl-c, ctrl-v from script file ).

I am sure that at the end of each line of script file there are no hidden characters - each line ends with CRLF as should in windows text files. I only found in AutoCad help that varbiale BACKGROUNDPLOT should be set to 0. I checked the operation of the script on AutoCad 2007 and 2008 installed on two different computers. I tested script with and without commentary lines. Please find the script code below (unit: micron):

start
_____

;obiekt num.1 sekcja num.1, znaczniki
pline
53700.0,62350.0
53700.0,62450.0
53800.0,62400.0
close
pline
53800.0,62400.0
53900.0,62450.0
53900.0,62350.0
close
;obiekt num.1 sekcja num.1, znaczniki ramek
pline
53680.0,62320.0
53680.0,62480.0
53800.0,62420.0
53920.0,62480.0
53920.0,62320.0
53800.0,62380.0
close
;obiekt num.1 sekcja num.1, znaczniki
pline
53700.0,62550.0
53700.0,62650.0
53800.0,62600.0
close
pline
53800.0,62600.0
53900.0,62650.0
53900.0,62550.0
close
;obiekt num.1 sekcja num.1, znaczniki ramek
pline
53680.0,62520.0
53680.0,62680.0
53800.0,62620.0
53920.0,62680.0
53920.0,62520.0
53800.0,62580.0
close

________
stop

I will be gratefull for any help beacuse I run out of ideas.

Best regards


_________________
Cuma
Back to top
View user's profile Send private message
CarlB



Joined: 27 Sep 2005
Posts: 121

Posted: Sun Aug 02, 2009 8:33 am    Post subject: Reply with quote

I didn't understand how the script process failed. Was anything drawn? Any clues on the command line?

If vertexes are drawn at wrong location, maybe you need to turn off running object snap (set osmode to 0) before running the script.
Back to top
View user's profile Send private message
Cuma



Joined: 01 Aug 2009
Posts: 2

Posted: Sat Aug 15, 2009 9:30 pm    Post subject: solved Reply with quote

Hello

Finally I have found the error in my script. Each command must be started and closed in a single line of the script; a line is ended with CR LF in Windows OS. I thought that "command" means the name of a given command (ex. _pline), however the command means command including variables. Here is the correct from of the script:

;obiekt num.1 sekcja num.1, znaczniki
_pline 53700.0,62350.0 53700.0,62450.0 53800.0,62400.0 close
_pline 53800.0,62400.0 53900.0,62450.0 53900.0,62350.0 close
;obiekt num.1 sekcja num.1, znaczniki ramek
_pline 53680.0,62320.0 53680.0,62480.0 53800.0,62420.0 53920.0,62480.0 53920.0,62320.0 53800.0,62380.0 close
;obiekt num.1 sekcja num.1, znaczniki
_pline 53700.0,62550.0 53700.0,62650.0 53800.0,62600.0 close
_pline 53800.0,62600.0 53900.0,62650.0 53900.0,62550.0 close
;obiekt num.1 sekcja num.1, znaczniki ramek
pline 53680.0,62520.0 53680.0,62680.0 53800.0,62620.0 53920.0,62680.0 53920.0,62520.0 53800.0,62580.0 close

The last line should be ended with a single blank space not with CR LF.

Best Regards
_________________
Cuma
Back to top
View user's profile Send private message
CarlB



Joined: 27 Sep 2005
Posts: 121

Posted: Mon Aug 17, 2009 8:37 pm    Post subject: Reply with quote

Glad to hear you sorted it...but...
To not leave wrong information for others, there was nothing wrong with your original script format. You can use a space or a line feed (enter) in a script to achieve an "enter" in autocad. it sounded like the problem you had was lines drawin in error, that wouldn't be caused by script format.

In other words, these scripts are equivalent:

_pline 53700.0,62350.0 53700.0,62450.0 53800.0,62400.0 close

and

_pline
53700.0,62350.0
53700.0,62450.0
53800.0,62400.0
close
Back to top
View user's profile Send private message
 
Post new topic   Reply to topic    CADForums.net Forum Index -> AutoCAD All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Access Forum - Microsoft Office Forum - Electronics

Contact Us Powered by phpBB