davesec Posted October 2, 2013 Posted October 2, 2013 i would like to put together a script that does the following: 1. double-clicks on all viewports 2. sets the VP color of all layers to black (so everything in the viewport looks black and white) 3. sets layer 'SITE' to green 4. sets layer 'PATH' to blue is this possible? basically i have about a million drawings, each with a couple of layouts containing one or two viewports each, and i need to make everything in the viewports look black and white, with the exception of the SITE and PATH layers, which are to be set to green and blue respectively. thanks! Quote
mwade93 Posted October 2, 2013 Posted October 2, 2013 (edited) Try the command vplayer. You can make a batch file to edit the files as well if someone else can show how to use lisp to select all the tabs in a drawing. If you only have one tab on a drawing I can help you with that part. Here is a macro I use regularly to turn layers on and off: ^C^C^Cvplayer;f;4400,3300,300,400;s;c;\\;;vplayer;t;2208,2209;s;p;;; As a script it would be: vplayer f 4400,3300,300,400 s all (c stands for crossing window; you want all here ignore \\ ) vplayer t 2208,2209 s p (previous w/3 return keys after) Edited October 2, 2013 by mwade93 Quote
Tuns Posted October 2, 2013 Posted October 2, 2013 That macro wont help him here. He needs a LISP. A macro is impractical because he has a million drawings so I'm 100% sure he wouldn't want to click a million times over. That would take 8 hours of nothing but clicking a button. Quote
mwade93 Posted October 2, 2013 Posted October 2, 2013 Well, a batch file will accomplish that, he would need lisp if he had multiple layouts in a dwg, if he did not it could be done without. Batch file uses a script file to execute commands on each drawing in a location. He would put the drawings in a file folder, refrencence the script and tell the batch to run the script on each of the drawings in that location. Quote
Tuns Posted October 2, 2013 Posted October 2, 2013 At any rate, the macro you posted doesn't work. ^C^C^C-layer;f;4400,3300,300,400;s;c;\\;;-layer;t;2208,2209;s;p;;; That will work for freezing and thawing those layers. VPLAYER doesn't even have a (F)reeze or (T)haw option nor can it edit the color of the layer in a viewport. -layer;c;t;0,255,0;SITE;c;t;0,0,255;PATH;; This should change both layers to the correct color. I didn't test it though so I don't know if it works. How does a batch file work? I would like to know how to make one. Would make a lot of my work much easier. Quote
mwade93 Posted October 2, 2013 Posted October 2, 2013 I was giving an example of how to write that code. Let me write something up on how to use the batch and I send it. Quote
SLW210 Posted October 2, 2013 Posted October 2, 2013 (edited) You might look into ScriptPro, AutoScript or Scriptwriter Edited October 2, 2013 by SLW210 Quote
mwade93 Posted October 2, 2013 Posted October 2, 2013 You might look into ScriptPro, AutoScriptor Scriptwriter Lee Mac's is quite nice I must say. Just as easy for me to use a .bat file but for others that's a great resource. However, you did need full AutoCAD for it to run because of LT with a .bat the manual way you do not. Quote
SLW210 Posted October 2, 2013 Posted October 2, 2013 Lee Mac's is quite nice I must say. Just as easy for me to use a .bat file but for others that's a great resource. However, you did need full AutoCAD for it to run because of LT with a .bat the manual way you do not. The OP is not using LT. The site for AutoScript did mention a version for LT should be forthcoming. AutoScript for AutoCAD LT is coming soon Quote
mwade93 Posted October 2, 2013 Posted October 2, 2013 I did not see that part. I am not surprised that Lee Mac had a solution to this Quote
SLW210 Posted October 2, 2013 Posted October 2, 2013 I did not see that part. I am not surprised that Lee Mac had a solution to this No not Lee Mac's, the one from Cadig, AutoScript. Quote
MBSupport Posted October 6, 2013 Posted October 6, 2013 For this problem lisp is not required a script routine will complete the task. ;Start of routine vplayer c 7 * a layer c 3 SITE c 5 PATH Qsave ;End of Routine This routine can be used in our batch program Multi-Batch, which works with AutoCAD LT and full. It has plenty of standard routines plus 5 wizards to get you started. Patrick http://www.multi-batch.com/ Quote
davesec Posted October 9, 2013 Author Posted October 9, 2013 thanks, i will give this a shot and see if i can make it work. Quote
davesec Posted February 11, 2014 Author Posted February 11, 2014 hi again! is it possible to do this for a layer on an xref? my situation: drawing a references drawing A drawing b references drawing B drawing c references drawing C so in the layer manager, for drawing a, i see the following in layer manager: A|SITE and A|PATH and in drawing b, i see: B|SITE and B|PATH is there a way to ignore the A| and B| prefix that changes with each drawing? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.