Jump to content

color to layer lisp routine


rpict
 Share

Recommended Posts

does anybody know about a lisp routine, that puts entities with a particular color on a particular layer?

e.g. all entities with color yellow on layer 0 are put on layer wall, all entities with color white on layer 0 are put on layer windows etc.

all that should go in one run at once.

 

-rpict

Link to comment
Share on other sites

what version of Acad, and how many drawings do you have to convert? if it is only a couple, I would just filter the selections out.

 

I just relized that Multi-batch has that routine already built into it.. its called "Change Items of a color to a layer" www.multi-batch.com if your someone like me who doesn't have the time or all the skills to program yet.

 

Hope that helps,

 

Mike

Link to comment
Share on other sites

  • 1 year later...

Hi there,

 

I tried the Multi-batch, and allthough I will keep it 'cause of the many functions, it does not work for the color to layer in my case. I use AutoCAD 2000LT and the function is not selectable then.

 

Does anyone know of a separate LISP that I can use? I have about 2700 .dwgs (Bolt & Nut library) I need to convert. Multi-batching would be the best, but I would gladly settle for a LISP per drawing, which still saves me a lot of time.

 

-kobuzz

Link to comment
Share on other sites

I created a simple lisp for you. If you are using LT I don't think you can run lisp files unless you have an addon. If you have any problems let me know

 

Mike

 

(defun c:colortolayer ()

(setq orgcolor (ssget "x" '((62 . 1))));; . 1 is the color

(command "change" orgcolor "" "p" "la" "lay1" "");; place layer name here where lay1 is

(setq orgcolor (ssget "x" '((62 . 2))));; . 2 is the color

(command "change" orgcolor "" "p" "la" "lay2" "");; place layer name here where lay2 is

(setq orgcolor (ssget "x" '((62 . 3))));; . 3 is the color

(command "change" orgcolor "" "p" "la" "lay3" "");; place layer name here where lay3 is

(setq orgcolor (ssget "x" '((62 . 4))));; . 4 is the color

(command "change" orgcolor "" "p" "la" "lay4" "");; place layer name here where lay4 is

(setq orgcolor (ssget "x" '((62 . 5))));; . 5 is the color

(command "change" orgcolor "" "p" "la" "lay5" "");; place layer name here where lay5 is

(setq orgcolor (ssget "x" '((62 . 6))));; . 6 is the color

(command "change" orgcolor "" "p" "la" "lay6" "");; place layer name here where lay6 is

(setq orgcolor (ssget "x" '((62 . 7))));; . 7 is the color

(command "change" orgcolor "" "p" "la" "lay7" "");; place layer name here where lay7 is

(setq orgcolor (ssget "x" '((62 . 8))));; . 8 is the color

(command "change" orgcolor "" "p" "la" "lay8" "");; place layer name here where lay8 is

(princ)

)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...