CBYLAYER

Discussion in 'AutoCAD' started by cwatson69, Sep 11, 2004.

  1. cwatson69

    cwatson69 Guest

    I am looking for the old lisp routine from Autodesk named CBYLAYER. Does anyone know where I can find this? It's not in 2005 and I can't find it in anything we've kept from the past.
    Thanks,
    Chuck W.
     
    cwatson69, Sep 11, 2004
    #1
  2. cwatson69

    Paul Turvill Guest

    What does (did) it do?
    ___

    anyone know where I can find this? It's not in 2005 and I can't find it in
    anything we've kept from the past.
     
    Paul Turvill, Sep 11, 2004
    #2
  3. I don't know if this still works, but it did when I wrote it:

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; CBLAYR.LSP Change entity color to BYLAYER.
    ;
    ; Copyright (C) 1992 by Autodesk, Inc.
    ;
    ; Permission to use, copy, modify, and distribute this software
    ; for any purpose and without fee is hereby granted, provided
    ; that the above copyright notice appears in all copies and that
    ; both that copyright notice and this permission notice appear in
    ; all supporting documentation.
    ;
    ; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
    ; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
    ; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
    ; ****************************************************************
    ;
    ; This program sorts entities by their color, and places all entities with
    ; the same color on a layer whose name is the color number (e.g., entities
    ; with the color # 3 will be placed on a layer named "3").
    ;
    ; The entity color of all entities are changed to "BYLAYER", and the layer
    ; inherits the color of the entities placed on it.
    ;
    ; Essentially, this program was written to eliminate entities with explicit
    ; color properties, in preperation for exporting via DXF to a post-processor
    ; that does not honor color-by-entity. Use at your own risk.

    (defun C:CBYLAYER ( / ss i hi clayer)
    (initget 7)
    (setq maxcolor (getint "\nHighest color number: "))
    (setq i 0)
    (princ "\nConverting entity colors from by-entity to by-layer...")
    (setq hi (getvar "highlight"))
    (setq clayer (getvar "clayer"))
    (setvar "highlight" 0)
    (setvar "cmdecho" 0)
    (command ".layer")
    (repeat maxcolor (command "make" (itoa (setq i (1+ i))) "c" i ""))
    (command "")
    (setq i 0)
    (repeat maxcolor
    (if (setq ss (ssget "x" (list (cons 62 (setq i (1+ i))))))
    (command ".chprop" ss "" "la" (itoa i) "c" "bylayer" "")))
    (setvar "highlight" hi)
    (command ".layer" "s" clayer "")
    (princ)
    )

    ;;;;;; EOF CBLYER.LSP ;;;;;;;;;;;;
     
    Tony Tanzillo, Sep 12, 2004
    #3
  4. cwatson69

    cwatson69 Guest

    Thanks Tony. It is what I was looking for and it still works.
    Chuck W.
     
    cwatson69, Sep 13, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...