Author Topic: Using Hard pointers to manage layers  (Read 7711 times)

0 Members and 1 Guest are viewing this topic.

lamarn

  • Swamp Rat
  • Posts: 636
Re: Using Hard pointers to manage layers
« Reply #30 on: July 08, 2016, 10:05:35 AM »
Very happy with the code mr. Roy_43 provided
Works like a charm!
 
Using AutoCAD

Code: [Select]
(defun c:Unpurg (/ enm lst ptrs)
  (setq lst '("1" "2" "3")) ; Laagnamen.
  (foreach nme lst
    (if (setq enm (tblobjname "LAYER" nme))
      (setq ptrs (cons (cons 340 enm) ptrs))
    )
  )
  (gc:SetXrecData
    (gc:GetOrCreateExtDict (cdr (assoc 330 (entget (tblobjname "LAYER" "0")))))
    "LAYER_UNPURGE"
    ptrs
  )
  (princ)
)

Using BricsCAD
Code: [Select]
(defun gc:GetOrCreateExtDict (ent / dict)
  (cond
    ((cdadr (member '(102 . "{ACAD_XDICTIONARY") (entget ent))))
    ((setq dict (entmakex
                  '((0 . "DICTIONARY") (100 . "AcDbDictionary"))
                )
     )
     (entmod (append (list '(102 . "{ACAD_XDICTIONARY")
                           (cons 360 dict)
                           '(102 . "}")
                     )
                     (entget ent)
             )
     )
     dict
    )
  )
)
Design is something you should do with both hands. My 2d hand , my 3d hand ..