TheSwamp

CAD Forums => CAD General => Topic started by: nyah on May 09, 2011, 07:59:43 AM

Title: Scr files.
Post by: nyah on May 09, 2011, 07:59:43 AM
Hi Everyone

Big yellow thing in the sky we are all hiding here in Scotland, someone told us its called "Sun"
That said.

Is there a resource or book I can bu that teaches me how to write script files?
I have 200 drawings that have the same lines and text on the same layers and wouyld love to be able to change the layers automatically ideally from outside the drawing failing that a universal command that changes the old layers to the corresponding new layers, which too dont change

Grateful for anyones help

Thanks

Nyah
Title: Re: Scr files.
Post by: Matt__W on May 09, 2011, 08:18:30 AM
Have a look....

http://www.theswamp.org/index.php?topic=18781.msg230055#msg230055

http://www.theswamp.org/index.php?topic=26572.0

http://thecadgeek.com/blog/2008/03/introduction-to-autocad-script-files/

http://www.upfrontezine.com/tailor/tailor19.htm
Title: Re: Scr files.
Post by: Lee Mac on May 12, 2011, 07:33:51 AM
One more...

http://lee-mac.com/scriptwriting.html (http://lee-mac.com/scriptwriting.html)
Title: Re: Scr files.
Post by: hudster on May 13, 2011, 10:32:49 AM
this will do it.

Code: [Select]
;;rename layers;;
-layer
rename
old-layer-name
new-layer-name

;;end of script;;

Scripts are easy, just write down the commands you'd use in Autocad to do the job, then add them to a text file, save it as a scr file and your off and running.
Title: Re: Scr files.
Post by: BIGAL on July 30, 2011, 12:26:02 AM
Some more help stuff that is definately not documented

1st Start Run CMD got to directory with drawings do dir *.dwg >dirlist /b
this makes a txt file of all your drawings names.

2nd open txt in word and simply make your script, a real smart feature is you can search/replace end of line its ^p
you add 1 blank line at top for changes at start of  lines eg ^p open, for ends just put in commands and then add ^p eg close N ^p

2nd-2 use excel paste txt file then add text columns use the contactenate command to make new single line scripts and cut and paste out.
Title: Re: Scr files.
Post by: Matt__W on August 01, 2011, 07:55:34 AM
Some more help stuff that is definately not documented

1st Start Run CMD got to directory with drawings do dir *.dwg >dirlist /b
this makes a txt file of all your drawings names.


2nd open txt in word and simply make your script, a real smart feature is you can search/replace end of line its ^p
you add 1 blank line at top for changes at start of  lines eg ^p open, for ends just put in commands and then add ^p eg close N ^p

2nd-2 use excel paste txt file then add text columns use the contactenate command to make new single line scripts and cut and paste out.
#1 is VERY WELL documented.  That's old-school DOS stuff right there, which is why you won't find it in the AutoCAD help files.
Title: Re: Scr files.
Post by: Jeff H on August 01, 2011, 03:48:43 PM
Do not know if any of the links mentioned this, but a easy way is to do what you want in AutoCAD hit F2 and copy and paste in notepad clean up lines not needed and save with .scr

Then from window explorer drag and drop the file onto AutoCAd and it will run it.
Title: Re: Scr files.
Post by: BIGAL on September 15, 2011, 11:02:24 PM
You can cut and paste from lots of programs to autocad command line including lots of lines

eg xyz point creation just Point then paste x,y,z all in one go same for scripts.

When testing lisp can paste just one or more lines
Title: Re: Scr files.
Post by: Willie on September 17, 2011, 02:07:22 PM
I script with excel. I works nice and easy.