TheSwamp
CAD Forums => CAD General => Topic started 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
-
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
-
One more...
http://lee-mac.com/scriptwriting.html (http://lee-mac.com/scriptwriting.html)
-
this will do it.
;;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.
-
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.
-
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.
-
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.
-
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
-
I script with excel. I works nice and easy.