Author Topic: Scr files.  (Read 2957 times)

0 Members and 1 Guest are viewing this topic.

nyah

  • Newt
  • Posts: 25
Scr files.
« on: May 09, 2011, 06: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


Lee Mac

  • Needs a day job
  • Posts: 8924
  • AutoCAD 2013 Windows 7 London, England
Re: Scr files.
« Reply #2 on: May 12, 2011, 06:33:51 am »
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?

Andy Hudson

  • Gator
  • Posts: 2533
Re: Scr files.
« Reply #3 on: May 13, 2011, 09: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.
Revit MEP 2012, AutoCAD MEP 2012, AutoCAD 2011, 2010, 2009

BIGAL

  • Mosquito
  • Posts: 19
Re: Scr files.
« Reply #4 on: July 29, 2011, 11:26:02 pm »
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.

M@yhem

  • Needs a day job
  • Posts: 9928
  • Pain is temporary. Quitting is forever.
Re: Scr files.
« Reply #5 on: August 01, 2011, 06: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.

Jeff H

  • King Gator
  • Posts: 4080
Re: Scr files.
« Reply #6 on: August 01, 2011, 02: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.

BIGAL

  • Mosquito
  • Posts: 19
Re: Scr files.
« Reply #7 on: September 15, 2011, 10: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

Willie

  • Swamp Rat
  • Posts: 858
  • Going nowhere slowly
Re: Scr files.
« Reply #8 on: September 17, 2011, 01:07:22 pm »
I script with excel. I works nice and easy.
Soli Deo Gloria | Qui Audet Adipiscitur
Windows 7 Pro 64bit | Civil 3D 2011 and 2013| ArcGIS 10.1
Yogi Berra : "I'd give my right arm to be ambidextrous."