Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Strange error in layer make code

edited April 2 in LISP Codes

Sorry, This works!

(mk_layer (list "Volume"))

;; mk_layer by CAB at TheSwamp.org   (Optionnal Arguments by ymg)             ;                                                                          ;
;; Routine to ENTAKE a LAYER entity.                                          ;                                                                            ;
;; If the layer already exist, it will be: thawed                             ;
;;                                         set on                             ;
;;                                         unlocked                           ;
;;                                         set as the current layer.          ;
;;  

(defun mk_layer (argl / ent lay Color ltype)
  (setq lay (car argl) color (cadr argl) ltype (caddr argl))
  (if (tblsearch "LAYER" lay)
    (progn
      (if color (setq ent (entget (tblobjname "LAYER" lay))
                      ent (subst (cons 62 color) (assoc 62 ent) ent)
                      ent (entmod ent)
                )
      )
      (if ltype (setq ent (entget (tblobjname "LAYER" lay))
                      ent (subst (cons 6 ltype) (assoc 6 ent) ent)
                      ent (entmod ent)
                )
      )
      (vl-cmdf "._Layer" "_Thaw" lay "_On" lay "_UnLock" lay "_Set" lay "")
    )
    (entmakex
      (list (cons 0 "LAYER")
            (cons 100 "AcDbSymbolTableRecord")
            (cons 100 "AcDbLayerTableRecord")
            (cons 2 lay)
            (cons 70 0)
            (cons 62 (if (or (null color) (= Color "")) 7 Color))
            (cons 6 (if (or (null ltype) (= ltype "")) "Continuous" ltype))
            (cons 290 1)
            (cons 370 -3)
      )
    )
  )
  (setvar 'CLAYER lay)
)
Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam