Author Topic: Looking for a LayerStates removal tool (ExpressTools variety)  (Read 4228 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Looking for a LayerStates removal tool (ExpressTools variety)
« on: December 28, 2005, 11:18:13 AM »
I am looking for a removal tool for layerstates but can't find one that works.  I am using the LMAN in the express tools to delete the layerstates but I have to do them one by one.  I found some code to delete them using a dictionary but it told me I didn't have any.

Any ideas?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #1 on: December 28, 2005, 12:09:33 PM »
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.

whdjr

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #2 on: December 28, 2005, 12:17:19 PM »
I saw that one earlier but did not run it because it looked similar to the one I already had.  I just ran it know but it came back with none.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #3 on: December 28, 2005, 12:24:48 PM »
This any help?
http://tinyurl.com/cyhhk

Here are some more
http://tinyurl.com/agfga
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.

whdjr

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #4 on: December 28, 2005, 01:48:31 PM »
Sorry CAB but none of those gave any good results.

It might not matter but I am running ADT2006 as AutoCad.

When I do a (namedobjdict) I get the first image below.

The second image is some code I put together that shows 3 dictionaries that are empty.

What gives?

whdjr

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #5 on: December 28, 2005, 02:21:04 PM »
Victor Delgado from WAUN came thru for me.

Code: [Select]
;By Tom Stoeckel
;AutoCAD Express Tools Developer
;tom.stoeckel@autodesk.com
;http://www.autodesk.com/expresstools


(defun c:killstates (/ lyr ent)
  (while (setq lyr (tblnext "layer" (not lyr)))
    (setq
      ent (entget (tblobjname "layer" (cdr (assoc 2 lyr))) '("RAK"))
    )
    (if (and ent (assoc -3 ent))
      (progn
(setq ent (subst '(-3 ("RAK")) (assoc -3 ent) ent))
(entmod ent)
      ) ;progn
    ) ;if
  ) ;while
  (princ)
) ;defun c:killstates

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #6 on: December 28, 2005, 07:48:29 PM »
Quote
'("RAK")

Looks like it's one of those magic number situations :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #7 on: December 28, 2005, 08:47:02 PM »
Looks like it's one of those magic number situations :-)
Those are actually the initials of the programmer that wrote the original LayerStates function.....I used to have the old Bonus Tools that showed this in the code but a quick look on this HDD turned up zilch.  :|

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #8 on: December 28, 2005, 09:03:44 PM »
They're still there Jeff :-)

 
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #9 on: December 28, 2005, 09:14:48 PM »
Those are actually the initials of the programmer that wrote the original LayerStates function.....
Quote

Randy Kintzley // I think....

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #10 on: December 28, 2005, 09:35:22 PM »
Yes Luis,
 I recall a couple of years ago I asked him a couple of questions about ExpressTools <on Lynn Allen's recommendation>. Emails were returned unanswered. I was Very impressed.
« Last Edit: December 28, 2005, 09:39:07 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

whdjr

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #11 on: December 29, 2005, 10:23:02 AM »
I'm sorry you had a bad experience with Randy, Kerry.  I met him and Peter Jamtgaard a few years ago on Bill Kramer's CAD Cruise.  He was a really nice guy and very informative.  I have emailed him a few times after that and he helped me out each time.  He is not on the Express Tools Team now, not sure what he's working on.

hyposmurf

  • Guest
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #12 on: January 01, 2006, 08:04:43 AM »
Did a search for him online and found a mugshot.



Check out the bloke on the next page, his beard! :-) Moses/visualisation master.







Relocated Images to the swamp image storage  - CAB
« Last Edit: January 01, 2006, 09:03:22 AM by CAB »


sourdough

  • Bull Frog
  • Posts: 367
Re: Looking for a LayerStates removal tool (ExpressTools variety)
« Reply #14 on: January 02, 2006, 02:17:08 PM »
Here is a tried and true way to erase layerstates in lman:

the first lisp program is ETLS.lsp
the next one is for acad layerstates : DLS.lsp
NOTE: DLS and ETLS commands


;;; Delete all Layer states
(defun c:dls (/ nme lsList)
(setq ddd "")
(setq ddd (getstring "\nDo you want ERASE ALL LAYERSTATES  (Y)<Y> ? "))
    (if (= ddd "")
      (progn
         (setvar "cmdecho" 0)(graphscr)
         (princ"\n*** Layer State List ***")
         (vlax-for x
         (vla-item
         (vla-GetExtensionDictionary
         (vla-get-layers
         (vlax-get-property
         (vlax-get-acad-object)
         'activedocument)
         )
         )
         "ACAD_LAYERSTATES"
         )
         (princ(strcat "\n Delete all LayerState :" (setq nme(vlax-get x 'name))))
         (command "-layer" "state" "delete" (setq nme(vlax-get x 'name)) "" "")
         (setq lsList (cons nme lsList))
         )
         
      )
   )
(princ)   
);end of defun


(defun c:ETLS ();

(defun ldderr (s)
    (if (not (member s '("console break" "Function cancelled")))
      (princ (strcat "\nFunction ended: " ))
    );end if
    (setvar "cmdecho" 0)
    (setq *error* olderr)
    (princ)
  );end defun

(setq olderr *error*
      *error* ldderr
  );end setq



   (Expr_list_layerstatesfirst)
   
   
   (Expr_c_delete_layerstate)
             
   (princ)
) ; end defun

;delete layer state
 (defun Expr_d_layerstate ( la lstate / lst lst2 lst3 e1 xd a b)
  (if lstate
      (setq lstate (strcase lstate))
  )
  (setq     e1 (entget (tblobjname "layer" la) '("RAK"))
            xd (cdr (assoc -3 e1))
           lst (cdr (assoc "RAK" xd))
             a (cons 1000 (strcat "{" lstate))
             b (cons 1000 (strcat lstate "}"))
  );setq
  (if (member a lst)
      (progn
       (setq lst2 (reverse (cdr (member a (reverse lst))))
             lst3 (cdr (member b lst))
       );setq
       (setq
             lst (append lst2 lst3)
             lst (append (list "RAK") lst)
              xd (subst lst (assoc "RAK" xd) xd)
              xd (append (list -3) xd)
              e1 (subst xd (assoc -3 e1) e1)
       );setq
       (entmod e1)
      );progn then remove it
  );if
  (princ)
 );defun Expr_d_layerstate
 
 
 
 
 ;this is where it starts
 
 
 (defun Expr_c_delete_layerstate ( / lstate lst2 a)
   (Expr_reg_it)
   
   (while (not lstate)
   
    (setq lstate (strcase "?")
   
   
   
   
   
   
   
    );setq
    (if (not (equal lstate ""))
        (progn
         (if (equal (acet-str-space-trim lstate) "?")
             (progn
              (Expr_list_layerstates)
              (setq lstate nil);setq
             );progn then
             (progn
              (if (not lst2)
                  (setq lst2 (Expr_get_layerstates))
              );if
              (if (not (member lstate lst2))
                  (progn
                   (princ (acet-str-format "\nCan't find saved layer state: %1" lstate))
                   (setq lstate nil);setq
                  );progn
                  (progn
                   (initget "Yes No _Yes No")
                   (setq a (getkword "Are you sure? [Yes/No] <Yes>: "))
                   (if (equal a "No")
                       (setq lstate "")
                   );if
                  );progn else
              );if
             );progn else
         );if
        );progn then
    );if
   );while
   (if (and (not (equal a "No"))
            (not (equal lstate ""))
       );and
       (progn
        (Expr_dl lstate)
        (princ (acet-str-format "\nLayer state: %1 deleted." lstate))
       );progn then
   );if
   (princ)
 );defun Expr_c_delete_layerstate
 
 
 (defun Expr_list_layerstates ( / lst a b n )
    
   (setq a (getstring "\nPress [ENTER] to Erase All Express Tools Layer States OR [ESC] <*>:"));setq
   (if (equal a "") (setq a "*"));if
   (setq a (strcase a));setq
   
   (if (setq lst (Expr_get_layerstates));setq
       (progn
        (setq n 0);setq
        (repeat (length lst)
         (setq b (nth n lst));setq
         
         (Expr_dl b)
         
         (if (wcmatch b a)
                (princ (strcat "\nERASED Express Tools Layer State: " b))
         );if
         (setq n (+ n 1));setq
        );repeat
       );progn then
       (princ "\nNo saved layer states found")
   );if
   (princ "\n")
 );defun Expr_list_layerstates
 
 
 
 
 (defun Expr_dl ( lstate / lst n)
   (Expr_reg_it)
 
   (setq lst (acet-table-name-list "layer"));setq
   (setq n 0);setq
   (repeat (length lst)
    (Expr_d_layerstate (nth n lst) lstate)
    ;(spinner)
    (setq n (+ n 1));setq
   );repeat
   (if (acet-str-equal lstate (car #last_restore))
       (setq #last_restore nil)
   );if
  (princ)
 );defun Expr_dl
 
 
 (defun Expr_reg_it ( )
   (if (not (tblsearch "appid" "RAK"))
       (if (=  (regapp "RAK") nil)
          (princ "\nCan't register XDATA for RAK. ")
       );if
   );if
);defun Expr_reg_it


(defun Expr_get_layerstates ( / e1 xd lst lst2 lst3 a b n j)
  (setq lst (acet-table-name-list "layer"))
  (setq b (length lst));setq
  (setq n 0);setq
  (repeat b
  (setq   e1 (entget (tblobjname "layer" (nth n lst)) '("RAK"))
          xd (cdr (assoc -3 e1))
        lst2 (cdr (assoc "RAK" xd))
       
  );setq
  (setq j 0);setq
  (repeat (length lst2)
   (setq a (nth j lst2));setq
   (if (or (not (equal (car a) 1000))
           (not (equal "{" (substr (cdr a) 1 1)))
       );or
       (setq a nil)
       (progn
        (setq a (strcase (substr (cdr a) 2)))
        (if (not (member a lst3))
            (setq lst3 (append lst3 (list a)));setq then
        );if
       );progn else
   );if
   (setq j (+ j 1));setq
  );repeat
 
  (setq n (+ n 1));setq
  );repeat
 
  (if lst3
      (setq lst3 (acad_strlsort lst3));setq then
  );if
  lst3
 );defun Expr_get_layerstates






(defun Expr_list_layerstatesfirst ( / lst a b n )
    
   (setq a (getstring "\nPress [ENTER] to VIEW Express Tools Layer States OR [ESC] < >: "));setq
   
   (if (equal a "") (setq a "*"));if
   (setq a (strcase a));setq
   
   (if (setq lst (Expr_get_layerstates));setq
       (progn
        (setq n 0);setq
        (repeat (length lst)
         (setq b (nth n lst));setq
         
         
         
         (if (wcmatch b a)
                (princ (strcat "\n " b))
         );if
         (setq n (+ n 1));setq
        );repeat
       );progn then
       (princ "\nNo saved layer states found")
   );if
   (princ "\n")
 );defun Expr_list_layerstatesfirst
LDC 2009/C3D 2010/C3D 2011/C3D 2016

Win 10 64bit