Jump to content

Recommended Posts

Posted

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!

Posted (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 by mwade93
Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted
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.

Posted
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
Posted

I did not see that part. I am not surprised that Lee Mac had a solution to this :notworthy:

Posted
I did not see that part. I am not surprised that Lee Mac had a solution to this :notworthy:

 

No not Lee Mac's, the one from Cadig, AutoScript.

Posted

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/

Posted

thanks, i will give this a shot and see if i can make it work.

  • 4 months later...
Posted

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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...