Initial commit

This commit is contained in:
2018-11-26 22:23:22 +01:00
parent 317403389d
commit 86753f6ca0
50 changed files with 4573 additions and 1 deletions

71
layerFromColor.lsp Normal file
View File

@@ -0,0 +1,71 @@
(defun C:LFC (/ i imax il ss currElem color colorNum allColors newLayer currLayer newElem)
(graphscr)
;variables:
(setq i 0);counter to zero
(setq imax 1);while variable
(prompt "\nselect entities to change layer (all): ")
(setq ss (ssget));asks for selection
(setq il (sslength ss));length of selection
(setq allColors nil)
(while imax
(print i)
(setq currElem (entget (ssname ss i) ))
(setq color (assoc 62 currElem))
(setq colorNum (cdr color))
(print colorNum)
(if (and (not (= colorNum 0)) colorNum)
(progn
(if (not (type allColors))( setq allColors (list colorNum)))
(if (not (member colorNum allColors)) (setq allColors (append allColors (list colorNum))))
)
)
;while specific:
(setq i (1+ i));increments i
(if (= i il) (setq imax nil));finish function if i equals il
)
(setq i 0);counter to zero
(setq imax 1);while variable
(while imax
(print i)
(setq color (nth i allColors))
(command "._layer" "_M" color "")
;while specific:
(setq i (1+ i));increments i
(if (= i (length allColors)) (setq imax nil));finish function if i equals il
)
(setq i 0);counter to zero
(setq imax 1);while variable
(while imax
(print i)
(setq currElem (entget (ssname ss i) ))
(setq color (assoc 62 currElem))
(setq colorNum (cdr color))
(if (and (not (= colorNum 0)) colorNum)
(progn
(setq currLayer (assoc 8 currElem))
(setq newLayer (cons 8 (itoa colorNum)))
(print newLayer)
(setq newElem(subst newLayer currLayer currElem))
(entmod newElem)
)
)
;while specific:
(setq i (1+ i));increments i
(if (= i il) (setq imax nil));finish function if i equals il
)
(terpri)
(setq ss nil)
)