Author Topic: Non-removable Layer  (Read 5142 times)

0 Members and 1 Guest are viewing this topic.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Non-removable Layer
« Reply #15 on: September 20, 2011, 01:01:45 PM »
I didn't realise with attmode. Thank you. :)

Sorry for the wasted time.

My pleasure and it's not a waste of time.
It was not a waste of my time because  I learn something.   :| ^-^
But man will my brain hurt in the morning for it!
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Non-removable Layer
« Reply #16 on: September 20, 2011, 01:03:52 PM »
I didn't realise with attmode. Thank you. :)

Sorry for the wasted time.

My pleasure and it's not a waste of time.
But man will my butt hurt in the morning for it!
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Non-removable Layer
« Reply #17 on: September 20, 2011, 02:38:34 PM »
I didn't realise with attmode. Thank you. :)

Sorry for the wasted time.

My pleasure and it's not a waste of time.
But man will my butt hurt in the morning for it!
:-D :-D :-D
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

bilançikur

  • Newt
  • Posts: 82
Re: Non-removable Layer
« Reply #18 on: September 21, 2011, 01:37:38 AM »
for somehow,..the Laydel do not seem to work with my 2011 version....but did the job on 2010.

Also, in 2011 version x64, the command "LAYMCUR" does not work.
I seem to be the only one however...

Yarik

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Non-removable Layer
« Reply #19 on: September 21, 2011, 08:27:42 AM »
for somehow,..the Laydel do not seem to work with my 2011 version....but did the job on 2010.

Also, in 2011 version x64, the command "LAYMCUR" does not work.
I seem to be the only one however...

Yarik
Try the old ai_molc command - same thing.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

VVA

  • Newt
  • Posts: 166
Re: Non-removable Layer
« Reply #20 on: September 21, 2011, 08:42:01 AM »

I also was once interested in this question. I got to make a layer of non-removable only Created permanent reactor layer, which can be removed only by software. Of the minuses - you need to constantly download the rector.
command will KEEP_LAY in drawing two layers: "DELME_PLIZ1" "DELME_PLIZ2" and reactors to them.
At least Laydel and Purge they are not removed.
Code: [Select]
(defun C:KEEP_LAY ( / layer ID keep_list reac lay)
  (foreach lay '("DELME_PLIZ1" "DELME_PLIZ2")
    (or (tblobjname "layer" lay)
        (vla-add (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) lay)
        )
   (setq layer (vlax-ename->vla-object(tblobjname "layer" lay)))
  (setq ID (vla-get-ObjectID layer))
  ;;;Dictionary KEEP_LAYER '((ID_1 NAME_1) ... (ID_N NAME_N))
  ;;;where  ID_xxx - object ID, returned  vla-get-ObjectID
  ;;; NAME_xxx   - Layer Name
  (if (null (assoc ID (setq keep_list (vlax-ldata-get "KEEP_LAYER" "DONT_ERASE")))) ;_Íåò â ñïèñêå âå÷íûõ
    (progn
      (setq reac (VLR-Object-Reactor (list layer) "Delete layer" '((:vlr-erased . dellay))))
      (setq keep_list (append keep_list (list (list ID (vla-get-name layer)))))
      (princ (strcat "\nLayer " (vla-get-name layer) " protected from deletion"))
      (vlax-ldata-put "KEEP_LAYER" "DONT_ERASE" keep_list)
 ;;;     (if (not (vlr-pers-p reac))(vlr-pers reac))
      )
    )
  )
  (princ)
)
(defun dellay (vlao reac args / name ID keep_list layer reac)
  (setq ID (vla-get-ObjectID vlao))
  (if (setq name (assoc ID (setq keep_list (vlax-ldata-get "KEEP_LAYER" "DONT_ERASE"))))  ;_â ñïèñêå âå÷íûõ
    (progn
      (setq name (cadr name))
      (setq keep_list (vl-remove (assoc ID keep_list) keep_list))
      (setq layer (vla-add (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object))) name))
      (setq ID (vla-get-ObjectID layer))
      (setq keep_list (append keep_list (list (list ID (vla-get-name layer)))))
      (setq reac (VLR-Object-Reactor (list layer) "Delete layer" '((:vlr-erased . dellay))))
      (princ (strcat "\nYou can not delete layer " name))
      (vlax-ldata-put "KEEP_LAYER" "DONT_ERASE" keep_list)
;;;      (if (not (vlr-pers-p reac))(vlr-pers reac))
      )
    )
  )
(princ "\nType KEEP_LAY to protect layer DELME_PLIZ1 and  DELME_PLIZ2")(princ)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Non-removable Layer
« Reply #21 on: September 21, 2011, 11:01:59 AM »
Hey bilançikur !!

Welcome to theswamp !  :)


Thank you VVA I keep the code !  :)
Keep smile...

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Non-removable Layer
« Reply #22 on: September 21, 2011, 11:10:53 AM »
Wow (@ Vlad) ICQ is still around.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox