Author Topic: Layer Merge  (Read 8417 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Layer Merge
« Reply #15 on: April 25, 2005, 04:50:57 PM »
These should look like this.
Code: [Select]

       ("BLOCK" <==========================================================================================purge
       ("BLOCKTEXT" <==========================================================================================purge
       ("BRNOTE" <==========================================================================================purge
       ("BRTITLES" <==========================================================================================purge
       ("CONSTRUCTION" "A-Cons-Nplt" yellow "hidden2")  ; yellow & hidden2 set in dwg


Code: [Select]
      ("BLOCK")
       ("BLOCKTEXT")
       ("BRNOTE")
       ("BRTITLES")
       ("CONSTRUCTION" "A-Cons-Nplt" yellow "hidden2")  ; yellow & hidden2 set in dwg
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Layer Merge
« Reply #16 on: April 25, 2005, 04:56:41 PM »
Quote from: CAB
These should look like this.
Code: [Select]

       ("BLOCK" <==========================================================================================purge
       ("BLOCKTEXT" <==========================================================================================purge
       ("BRNOTE" <==========================================================================================purge
       ("BRTITLES" <==========================================================================================purge
       ("CONSTRUCTION" "A-Cons-Nplt" yellow "hidden2")  ; yellow & hidden2 set in dwg


Code: [Select]
      ("BLOCK")
       ("BLOCKTEXT")
       ("BRNOTE")
       ("BRTITLES")
       ("CONSTRUCTION" "A-Cons-Nplt" yellow "hidden2")  ; yellow & hidden2 set in dwg


I corrected that and it still will not run.



Cab,

I am planning to go shark fishing sometime over the summer!  That should be fun!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Layer Merge
« Reply #17 on: April 25, 2005, 06:59:37 PM »
There are many errors, missing quotes.
Like this
Code: [Select]
      ("ARHEADER" "S-Beam" white Phamton2)  ; use white & Phamton2
should be this
Code: [Select]
      ("ARHEADER" "S-Beam" "white" "Phamton2")  ; use white & Phamton2
       
and incomplete code like this:
Code: [Select]
("ARINTELEV" ;<==== purpe

when in VLIDE you will not be allowed to load the code until you fix these incomplete code errors.
The missing quotes will cause errors when you try to run the code.

These items must be cleaned up.
If you don't have a new layer defined yet comment out the line
Code: [Select]
;; ("ARINTELEV" ;<==== purpe

Your function (defun MergeLayerP  has a P in the name but you call it with (MergeLayer LayList)
this will never work, the programming languages are very particular about such things.

Try again!


Yes shark fishing is a lot of fun. If you are not going to eat them put them back.
I have a few shark stories but I usually wait till I have a few rum & cokes before I
tell them. The fish always get bigger in proportion to the alcohol consumed. :)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Layer Merge
« Reply #18 on: April 25, 2005, 07:18:42 PM »
Cab,

I have fixed the error that you mentioned in your post.    Here is the last update of the lisp:  But I am getting - too few arguments - now.

Code: [Select]

(defun c:MergeLayer (laylist / OldLay NewLay SelSet Index EntName EntDxf)
  (if (and laylist
           (listp laylist)
      )
    (foreach Lyr_data laylist

      (setq OldLay (car Lyr_data))
      (setq NewLay (cadr Lyr_data))
      (if (not (tblsearch "LAYER" NewLay))
        (CreateLayer Lyr_data)
        (progn
          (setq SelSet (ssget "_X" (list (cons 8 OldLay))))
          (if (and Selset (>= (sslength SelSet) 1))
            (progn
              (setq Index 0)
              (while (setq EntName (ssname SelSet Index))
                (setq EntDxf (entget EntName))
                (if (= (cdr (assoc 8 EntDxf)) OldLay)
                  (progn
                    (setq
                      EntDxf (subst (cons 8 NewLay) (assoc 8 EntDxf) EntDxf)
                    )
                    (entmod EntDxf)
                    (entupd EntName)
                  )
                  (setq Index (1+ Index))
                )
              )
            )
            (princ (strcat "No objects on layer " OldLay " found !"))
          )
        )
      )
    )
  )
)

(defun Createlayer (Lyr_data / lyr clr ltyp)
  (setq lyr  (cadr Lyr_data))
  (command "._Layer" "_Make" lyr "")
  (if (setq clr (nth 2 Lyr_data))
    (command "._Layer" "_Color" (if (= clr "") "_White" Clr) lyr "")
  )
  (if (setq ltyp (nth 3 Lyr_data))
    (command "._Layer" "LT" (if (= ltyp "") "Continuous" ltyp) lyr "")
  )
)



;;  Start here with a list of layer names
(defun c:fixlayers1 (/ LayList)
  ;;  Create a list of layer name Lyr_datas. ((oldlayer newlayer)....)
  ;;  Optional Color & Line Type, If included it will be used or "" will
  ;;  default to preset values, nil will use values in drawing
  ;;  Default Color  "" = White
  ;;  Default linetype "" = "Continuous"
  (setq LayList '(("3DAREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("3DARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("A_Notes" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("AN_DIMS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("AN_NOTES" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("AN_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
  ("AN_RM_NAMES" "A-Anno-Rnam" "magenta" "Continuous")  ; magenta & linetype set in dwg
("AR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
("ARAPPLIANCE" "A-Flor-Appl" "red" "Continuous")  ; use Red & "Continuous"
("ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
("ARDCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
("ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("ARDOOR-BR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("ARDOOR-SILL" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("AREA"  "A-Area-Nplt" "11" "Continuous") ; Use 11 & cont
("AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("AREWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("AREWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARFIREPLACE" "A-Flor-Appl" "red" "Continuous")  ; use color & linetype set in dwg
("ARGLAZE" "A-Glas" "green" "Continuous") ; Use White & cont
("ARHEADER" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("ARINTELEV")
("ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-1_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARKWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARKWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARSCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
("ARSOFFIT")
("ARSTAIR" "A-Flor-Strs" "green" "Continuous") ; Use green & cont
("ARTRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
("ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
("BA_FL1_ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("B_FL1_AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARGLAZE" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("BA_FL1_LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
("BA_FL1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("BA_FN1_GENNOTE" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("BA_FN1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("BEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("BLOCK")
        ("BLOCKTEXT")
        ("BRNOTE")
        ("BRTITLES")
("CONSTRUCTION" "A-Cons-Nplt" "yellow" "hidden2")  ; yellow & hidden2 set in dwg
("DASH1" "A-Misc" "green" "Continuous") ; Use green & cont
("DASH2L" "A-Misc" "green" "Continuous") ; Use green & cont
("DASH3L" "A-Misc" "green" "Continuous") ; Use green & cont
("DETAIL" "A-Detl" "41" "Continuous")  ; use 41 & cont
("DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("DTL-3" "A-Detl" "41" "Continuous")  ; use 41 & cont
("DWGTEXTURE" "A-Flor-Patt" "54" "Continuous")  ; use color & linetype set in dwg
("LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
("MEDIUM" "A-Misc" "magenta" "Continuous") ; Use magenta & cont
("MPFIXTURE" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
("OILHEAT" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
("OPTION" "A-Misc" "green" "Continuous") ; Use green & cont
("PR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
("REVISION" "A-Anno-Revs" "cyan" "Continuous")  ; use cyan & cont
("S-DTL" "A-Detl" "41" "Continuous")  ; use 41 & cont
("S-NOTES" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("ST_NOTESMS" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("ST_WBEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("Stdtl" "A-Detl" "41" "Continuous")  ; use 41 & cont
("STFND" "S-Wall" "White" "Continuous") ; Use White & cont
("STFTG" "S-Foot" "green" "Hidden")  ; use green & Hidden
("STNOTE" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("STSTEEL" "S-Beam" "white" "Phanton2")  ; use white & Phanton2
("STWOOD" "S-Cols" "white" "Phanton2")  ; use white & Phanton2
("S-WALLS" "S-Wall" "White" "Continuous") ; Use White & cont
("TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("TRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
           )
  )
  (MergeLayer LayList)
  (princ)
)

(defun c:fixlayers2 (/ LayList)
  ;;  Create a list of layer name Lyr_datas. ((oldlayer newlayer)....)
  (setq LayList '(("3DAREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("3DARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("A_Notes" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("AN_DIMS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("AN_NOTES" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("AN_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
  ("AN_RM_NAMES" "A-Anno-Rnam" "magenta" "Continuous")  ; magenta & linetype set in dwg
("AR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
("ARAPPLIANCE" "A-Flor-Appl" "red" "Continuous")  ; use Red & "Continuous"
("ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
("ARDCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
("ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("ARDOOR-BR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("ARDOOR-SILL" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("AREA"  "A-Area-Nplt" "11" "Continuous") ; Use 11 & cont
("AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("AREWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("AREWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARFIREPLACE" "A-Flor-Appl" "red" "Continuous")  ; use color & linetype set in dwg
("ARGLAZE" "A-Glas" "green" "Continuous") ; Use White & cont
("ARHEADER" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("ARINTELEV")
("ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-1_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARIWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARKWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARKWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARSCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
("ARSOFFIT")
("ARSTAIR" "A-Flor-Strs" "green" "Continuous") ; Use green & cont
("ARTRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
("ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
("ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
("BA_FL1_ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
("B_FL1_AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARGLAZE" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
("BA_FL1_ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
("BA_FL1_DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("BA_FL1_LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
("BA_FL1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("BA_FN1_GENNOTE" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("BA_FN1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("BEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("BLOCK")
        ("BLOCKTEXT")
        ("BRNOTE")
        ("BRTITLES")
("CONSTRUCTION" "A-Cons-Nplt" "yellow" "hidden2")  ; yellow & hidden2 set in dwg
("DASH1" "A-Misc" "green" "Continuous") ; Use green & cont
("DASH2L" "A-Misc" "green" "Continuous") ; Use green & cont
("DASH3L" "A-Misc" "green" "Continuous") ; Use green & cont
("DETAIL" "A-Detl" "41" "Continuous")  ; use 41 & cont
("DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
("DTL-3" "A-Detl" "41" "Continuous")  ; use 41 & cont
("DWGTEXTURE" "A-Flor-Patt" "54" "Continuous")  ; use color & linetype set in dwg
("LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
("MEDIUM" "A-Misc" "magenta" "Continuous") ; Use magenta & cont
("MPFIXTURE" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
("OILHEAT" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
("OPTION" "A-Misc" "green" "Continuous") ; Use green & cont
("PR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
("REVISION" "A-Anno-Revs" "cyan" "Continuous")  ; use cyan & cont
("S-DTL" "A-Detl" "41" "Continuous")  ; use 41 & cont
("S-NOTES" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("ST_NOTESMS" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("ST_WBEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
("Stdtl" "A-Detl" "41" "Continuous")  ; use 41 & cont
("STFND" "S-Wall" "White" "Continuous") ; Use White & cont
("STFTG" "S-Foot" "green" "Hidden")  ; use green & Hidden
("STNOTE" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
("STSTEEL" "S-Beam" "white" "Phanton2")  ; use white & Phanton2
("STWOOD" "S-Cols" "white" "Phanton2")  ; use white & Phanton2
("S-WALLS" "S-Wall" "White" "Continuous") ; Use White & cont
("TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
("TRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
  )
  (MergeLayer LayList)
  (princ)


If I catch a shark, I will be keeping it.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Layer Merge
« Reply #19 on: April 25, 2005, 07:36:28 PM »
These lines are incomplete
Code: [Select]
("BLOCK")
("BLOCKTEXT")
("BRNOTE")
("BRTITLES")

try this new routine, it has a few more error traps.
Code: [Select]
(defun MergeLayer (laylist / OldLay NewLay SelSet Index EntName EntDxf)
  (if (and laylist ; not nil
           (listp laylist) ; and is a list
      )
    (foreach Lyr_data laylist
      ;; got new layer data and not in drawing already
      (if (and (setq NewLay (cadr Lyr_data))
               (not (tblsearch "LAYER" NewLay))
          )
        (CreateLayer Lyr_data)
      )
      (setq Index 0)
      (cond
        ((null NewLay)
         (princ "\n***  No new layer in data !")
        )
        ((null OldLay)
         (princ "\n***  No old layer in data !")
        )
        ;;  if old layer name and items on that layer
        ((and (setq OldLay (car Lyr_data))
              (setq SelSet (ssget "_X" (list (cons 8 OldLay))))
         )
         (while (setq EntName (ssname SelSet Index))
           (setq EntDxf (entget EntName))
           (if (= (cdr (assoc 8 EntDxf)) OldLay)
             (progn
               (setq
                 EntDxf (subst (cons 8 NewLay) (assoc 8 EntDxf) EntDxf)
               )
               (entmod EntDxf)
               (entupd EntName)
             )
             (setq Index (1+ Index))
           )
         )
        )
        ((prompt (strcat "\n***  No objects on layer " OldLay " found !")))
      ) ; end cond stmt
    ) ; foreach
  ) ; endif
) ; defun
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Layer Merge
« Reply #20 on: April 25, 2005, 07:40:57 PM »
I have to search our company Layering Standard to see what layer to put them on.

Thank you for your help.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Layer Merge
« Reply #21 on: April 25, 2005, 07:44:18 PM »
Just looked at your new code. The data list creator code looks ok with the exceptions
noted in my previous post. The new routine will catch those tough.
In your new code you named the subroutine c:MergeLayer
You can only call this by using (c:MergeLayer LayList)
Usually you only prefix a functions name with c: if you are going to call it from the command line
in ACAD and those type calls will not except passed variables.
I know there is a lot to learn but you are doing well in a short time, keep it up.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

One Shot

  • Guest
Layer Merge
« Reply #22 on: April 25, 2005, 07:50:09 PM »
Quote from: CAB
Just looked at your new code. The data list creator code looks ok with the exceptions
noted in my previous post. The new routine will catch those tough.
In your new code you named the subroutine c:MergeLayer
You can only call this by using (c:MergeLayer LayList)
Usually you only prefix a functions name with c: if you are going to call it from the command line
in ACAD and those type calls will not except passed variables.
I know there is a lot to learn but you are doing well in a short time, keep it up.


What does this mean:

bad argument type: consp nil
Command:
Command:
Command: MergeLayer
Unknown command "MERGELAYER"


Thank you,

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Layer Merge
« Reply #23 on: April 25, 2005, 08:14:54 PM »
Lets try one more time. :)
Note that there is no error trap for line types if not found, routine will crash.

Code: [Select]
(defun MergeLayer (laylist / OldLay NewLay SelSet Index EntName EntDxf)
  (if (and laylist ; not nil
           (listp laylist) ; and is a list
      )
    (foreach Lyr_data laylist
      ;; got new layer data and not in drawing already
      (if (and (setq NewLay (cadr Lyr_data))
               (not (tblsearch "LAYER" NewLay))
          )
        (CreateLayer Lyr_data)
      )
      (setq Index 0)
      (cond
        ((null NewLay)
         (princ "\n***  No new layer in data !")
        )
        ((null (setq OldLay (car Lyr_data)))
         (princ "\n***  No old layer in data !")
        )
        ;;  if old layer name and items on that layer
        ((and OldLay
              (setq SelSet (ssget "_X" (list (cons 8 OldLay))))
         )
         (while (setq EntName (ssname SelSet Index))
           (setq EntDxf (entget EntName))
           (if (= (cdr (assoc 8 EntDxf)) OldLay)
             (progn
               (setq
                 EntDxf (subst (cons 8 NewLay) (assoc 8 EntDxf) EntDxf)
               )
               (entmod EntDxf)
               (entupd EntName)
             )
             (setq Index (1+ Index))
           )
         )
        )
        ((prompt (strcat "\n***  No objects on layer " OldLay " found !")))
      ) ; end cond stmt
    ) ; foreach
  ) ; endif
) ; defun


(defun Createlayer (Lyr_data / lyr clr ltyp)
  (setq lyr  (cadr Lyr_data))
  (command "._Layer" "_Make" lyr "")
  (if (setq clr (nth 2 Lyr_data))
    (command "._Layer" "_Color" (if (= clr "") "_White" Clr) lyr "")
  )
  (if (setq ltyp (nth 3 Lyr_data))
    (command "._Layer" "LT" (if (= ltyp "") "Continuous" ltyp) lyr "")
  )
)



;;  Start here with a list of layer names
(defun c:fixlayers1 (/ LayList)
  ;;  Create a list of layer name Lyr_datas. ((oldlayer newlayer)....)
  ;;  Optional Color & Line Type, If included it will be used or "" will
  ;;  default to preset values, nil will use values in drawing
  ;;  Default Color  "" = White
  ;;  Default linetype "" = "Continuous"
  (setq LayList '(("3DAREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("3DARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("A_Notes" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("AN_DIMS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("AN_NOTES" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("AN_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
         ("AN_RM_NAMES" "A-Anno-Rnam" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("AR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
       ("ARAPPLIANCE" "A-Flor-Appl" "red" "Continuous")  ; use Red & "Continuous"
       ("ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
       ("ARDCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
       ("ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("ARDOOR-BR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("ARDOOR-SILL" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("AREA"  "A-Area-Nplt" "11" "Continuous") ; Use 11 & cont
       ("AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("AREWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("AREWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARFIREPLACE" "A-Flor-Appl" "red" "Continuous")  ; use color & linetype set in dwg
       ("ARGLAZE" "A-Glas" "green" "Continuous") ; Use White & cont
       ("ARHEADER" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("ARINTELEV")
       ("ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-1_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARKWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARKWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARSCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
       ("ARSOFFIT")
       ("ARSTAIR" "A-Flor-Strs" "green" "Continuous") ; Use green & cont
       ("ARTRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
       ("ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("B_FL1_AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARGLAZE" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("BA_FL1_LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
       ("BA_FL1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("BA_FN1_GENNOTE" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("BA_FN1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("BEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("BLOCK")
       ("BLOCKTEXT")
       ("BRNOTE")
       ("BRTITLES")
       ("CONSTRUCTION" "A-Cons-Nplt" "yellow" "hidden2")  ; yellow & hidden2 set in dwg
       ("DASH1" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DASH2L" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DASH3L" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DETAIL" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("DTL-3" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("DWGTEXTURE" "A-Flor-Patt" "54" "Continuous")  ; use color & linetype set in dwg
       ("LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
       ("MEDIUM" "A-Misc" "magenta" "Continuous") ; Use magenta & cont
       ("MPFIXTURE" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
       ("OILHEAT" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
       ("OPTION" "A-Misc" "green" "Continuous") ; Use green & cont
       ("PR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
       ("REVISION" "A-Anno-Revs" "cyan" "Continuous")  ; use cyan & cont
       ("S-DTL" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("S-NOTES" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("ST_NOTESMS" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("ST_WBEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("Stdtl" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("STFND" "S-Wall" "White" "Continuous") ; Use White & cont
       ("STFTG" "S-Foot" "green" "Hidden")  ; use green & Hidden
       ("STNOTE" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("STSTEEL" "S-Beam" "white" "Phanton2")  ; use white & Phanton2
       ("STWOOD" "S-Cols" "white" "Phanton2")  ; use white & Phanton2
       ("S-WALLS" "S-Wall" "White" "Continuous") ; Use White & cont
       ("TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("TRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
     )
  )
  (MergeLayer LayList)
  (princ)
)

(defun c:fixlayers2 (/ LayList)
  ;;  Create a list of layer name Lyr_datas. ((oldlayer newlayer)....)
  (setq LayList '(("3DAREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("3DARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("A_Notes" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("AN_DIMS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("AN_NOTES" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("AN_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
       ("AN_RM_NAMES" "A-Anno-Rnam" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("AR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
       ("ARAPPLIANCE" "A-Flor-Appl" "red" "Continuous")  ; use Red & "Continuous"
       ("ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
       ("ARDCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
       ("ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("ARDOOR-BR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("ARDOOR-SILL" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("AREA"  "A-Area-Nplt" "11" "Continuous") ; Use 11 & cont
       ("AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("AREWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("AREWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARFIREPLACE" "A-Flor-Appl" "red" "Continuous")  ; use color & linetype set in dwg
       ("ARGLAZE" "A-Glas" "green" "Continuous") ; Use White & cont
       ("ARHEADER" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("ARINTELEV")
       ("ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-1_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARIWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARKWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARKWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARSCABINET" "A-Flor-Case-Ovhd" "41" "Hidden") ; Use 41 & hidden
       ("ARSOFFIT")
       ("ARSTAIR" "A-Flor-Strs" "green" "Continuous") ; Use green & cont
       ("ARTRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
       ("ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWALL-3_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWALL-5_50" "A-Wall" "White" "Continuous") ; Use White & cont
       ("ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARBRKWALL" "A-Wall" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARDOOR" "A-Door" "yellow" "Continuous") ; Use yellow & cont
       ("B_FL1_AREWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARGLAZE" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_ARIWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARWALL" "A-Wall" "White" "Continuous") ; Use White & cont
       ("BA_FL1_ARWINDOW" "A-Glas" "green" "Continuous") ; Use green & cont
       ("BA_FL1_DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("BA_FL1_LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
       ("BA_FL1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("BA_FN1_GENNOTE" "A-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("BA_FN1_TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("BEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("BLOCK")
       ("BLOCKTEXT")
       ("BRNOTE")
       ("BRTITLES")
       ("CONSTRUCTION" "A-Cons-Nplt" "yellow" "hidden2")  ; yellow & hidden2 set in dwg
       ("DASH1" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DASH2L" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DASH3L" "A-Misc" "green" "Continuous") ; Use green & cont
       ("DETAIL" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("DIMENSIONS" "A-Anno-Dims" "yellow" "Continuous")  ; use yellow & cont
       ("DTL-3" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("DWGTEXTURE" "A-Flor-Patt" "54" "Continuous")  ; use color & linetype set in dwg
       ("LIGHT" "A-Misc" "green" "Continuous") ; Use green & cont
       ("MEDIUM" "A-Misc" "magenta" "Continuous") ; Use magenta & cont
       ("MPFIXTURE" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
       ("OILHEAT" "M-HVAC-Symb" "magenta" "Continuous")  ; use magenta & cont
       ("OPTION" "A-Misc" "green" "Continuous") ; Use green & cont
       ("PR_POCHE" "A-Flor-Patt" "54" "Continuous")  ; use 54 & linetype set in dwg
       ("REVISION" "A-Anno-Revs" "cyan" "Continuous")  ; use cyan & cont
       ("S-DTL" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("S-NOTES" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("ST_NOTESMS" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("ST_WBEAM" "S-Beam" "white" "Phanton2")  ; use white & "Phanton2"
       ("Stdtl" "A-Detl" "41" "Continuous")  ; use 41 & cont
       ("STFND" "S-Wall" "White" "Continuous") ; Use White & cont
       ("STFTG" "S-Foot" "green" "Hidden")  ; use green & Hidden
       ("STNOTE" "S-Anno-Note" "cyan" "Continuous")  ; use color & linetype set in dwg
       ("STSTEEL" "S-Beam" "white" "Phanton2")  ; use white & Phanton2
       ("STWOOD" "S-Cols" "white" "Phanton2")  ; use white & Phanton2
       ("S-WALLS" "S-Wall" "White" "Continuous") ; Use White & cont
       ("TITLES" "A-Anno-Dtit" "magenta" "Continuous")  ; magenta & linetype set in dwg
       ("TRAP" "P-Fixt-Symb" "red" "Continuous") ; Use red & cont
  ))
  (MergeLayer LayList)
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.