UNISOLATE XREF LAYER

Discussion in 'AutoCAD' started by om_gc, Oct 15, 2004.

  1. om_gc

    om_gc Guest

    HI
    I WAS WONDERING WHETHER ANYONE HAS A LISP ROUTINE TO UNISOLATE XREF LAYER. I DO HAVE A ROUTINE TO ISOLATE BUT NOT FOR UNISOLATE. SO IT'S ALMOST USLESS.

    THANKS IN ADVANCE
     
    om_gc, Oct 15, 2004
    #1
  2. Do you mean to turn all the other layers on?

    [All Layers On]-LAYER ON * ;
     
    Kent Cooper, AIA, Oct 15, 2004
    #2
  3. not likely, he wants a layerisolate routine that works on nested stuff.
    I would post mine but have not tested it enough.

    "Kent Cooper, AIA" <>
    |>Do you mean to turn all the other layers on?
    |>
    |>[All Layers On]-LAYER ON * ;

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 2004
    #3
  4. om_gc

    om_gc Guest

    I'M TALKING ABOUT THE XREFED LAYERS, NOT THE REGULAR LAYERS IN A DRAWING.

    THANKS
     
    om_gc, Oct 15, 2004
    #4
  5. nested = anything but top level...
    the routine I posted below this post works on anything.
    I would not care about a routine that only worked on active blocks in a drawing...

    om_gc <>
    |>I'M TALKING ABOUT THE XREFED LAYERS, NOT THE REGULAR LAYERS IN A DRAWING.
    |>
    |>THANKS

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 15, 2004
    #5
  6. om_gc

    David Allen Guest

    So is this a newer version. It looks different from your old one.
    Maybe version numbers would be helpful in the future :)


    James Maeding <>
    |>oh, what the heck, try this, you will like it...
    |>the buttons I use have this code:
    |>
    |>commands are:
    |>LAISOLATE
    |>LAUNISOLATE
    |>BLKLAISOLATE
    |>
    |>Dont say I never did nuthin for ya :)
    |>
    |>
    |>om_gc <>
    |>|>HI
    |>|>I WAS WONDERING WHETHER ANYONE HAS A LISP ROUTINE TO UNISOLATE XREF LAYER. I DO HAVE A ROUTINE TO ISOLATE BUT NOT FOR UNISOLATE. SO IT'S ALMOST USLESS.
    |>|>
    |>|>THANKS IN ADVANCE
    |>
    |>James Maeding
    |>jmaeding at hunsaker dot com
    |>Civil Engineer/Programmer


    David
     
    David Allen, Oct 18, 2004
    #6
  7. not a bad idea.
    I have tweaked and tweaked this routine, should be much better now.

    David Allen <*@*.com>
    |>So is this a newer version. It looks different from your old one.
    |>Maybe version numbers would be helpful in the future :)
    |>
    |>
    |>James Maeding <>
    |>|>oh, what the heck, try this, you will like it...
    |>|>the buttons I use have this code:
    |>|>
    |>|>commands are:
    |>|>LAISOLATE
    |>|>LAUNISOLATE
    |>|>BLKLAISOLATE
    |>|>
    |>|>Dont say I never did nuthin for ya :)
    |>|>
    |>|>
    |>|>om_gc <>
    |>|>|>HI
    |>|>|>I WAS WONDERING WHETHER ANYONE HAS A LISP ROUTINE TO UNISOLATE XREF LAYER. I DO HAVE A ROUTINE TO ISOLATE BUT NOT FOR UNISOLATE. SO IT'S ALMOST USLESS.
    |>|>|>
    |>|>|>THANKS IN ADVANCE
    |>|>
    |>|>James Maeding
    |>|>jmaeding at hunsaker dot com
    |>|>Civil Engineer/Programmer
    |>
    |>
    |>David

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Oct 19, 2004
    #7
  8. om_gc

    GaryDF Guest

    Here are some routines that I use by Allen

    Gary

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    ;;;;;;;;;;;;;;;;;;;;;;; Some Xref Layer Command Functions
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;
    ;;; Nested Entity Off by Dan Allen ()
    (Defun c:XNO (/ o1 o2)
    (setq o1 (nentsel "\n* Select nested Layer to turn Off *"))
    (if o1
    (progn
    (setq o2 (cdr (assoc 8 (entget (car o1)))))
    (if (= o2 "0")
    (setq o2 (cdr (assoc 8 (entget (car (cadddr o1))))))
    )
    (command "_.-layer" "off" o2 "")
    (princ o2)
    ) ;end progn
    (princ "\n* No entities selected *")
    ) ;end if
    (princ)
    )
    ;;; Nested Entity Freeze
    (DEFUN c:XNF (/ n1 n2 lan1)
    (SETQ n1 (nentsel "\n* Select Layer to Freeze (including nested) *"))
    (if (/= n1 nil)
    (progn
    (setq n2 (cdr (assoc 8 (entget (car n1)))))
    (if (= n2 "0")
    (setq n2 (cdr (assoc 8 (entget (car (cadddr n1))))))
    )
    (prompt "\n* Layer: ")
    (prompt n2)
    (prompt " was selected *")
    (setq lan1 n2)
    )
    (prompt "\n* No layer selected *")
    )
    (while (/= n1 nil)
    (SETQ n1 (nentsel "\n* Select next Layer *"))
    (if (/= n1 nil)
    (progn
    (setq n2 (cdr (assoc 8 (entget (car n1)))))
    (if (= n2 "0")
    (setq n2 (cdr (assoc 8 (entget (car (cadddr n1))))))
    )
    (prompt "\n* Layer: ")
    (prompt n2)
    (prompt " was selected *")
    (setq lan1 (strcat lan1 "," n2))
    )
    (prompt "\n* Freezing Layers ... please wait *")
    ) ;end if
    ) ;end while
    (command ".layer" "f" lan1 "")
    (princ)
    )
    ;;;
    (Defun c:XNX (/ n1 n2)
    (setq n1 (nentsel "\n* Select nested Layer to turn Off and Freeze (including
    nested) *"))
    (if (/= n1 nil)
    (progn
    (setq n2 (cdr (assoc 8 (entget (car n1)))))
    (if (= n2 "0")
    (setq n2 (cdr (assoc 8 (entget (car (cadddr n1))))))
    )
    (prompt "\n* Layer: ")
    (prompt n2)
    (prompt " was selected *")
    (setq lan1 n2)
    )
    (prompt "\n* No layer selected *")
    )
    (while (/= n1 nil)
    (SETQ n1 (nentsel "\n* Select next Layer:"))
    (if (/= n1 nil)
    (progn
    (setq n2 (cdr (assoc 8 (entget (car n1)))))
    (if (= n2 "0")
    (setq n2 (cdr (assoc 8 (entget (car (cadddr n1))))))
    )
    (prompt "\n* Layer: ")
    (prompt n2)
    (prompt " was selected *")
    (setq lan1 (strcat lan1 "," n2))
    )
    (prompt "\n* Freezing Layers ... please wait *")
    ) ;end if
    ) ;end while
    (command ".layer" "f" lan1 "")
    (command "_.-layer" "off" n2 "")
    (princ)
    )
    ;;; Nested Entity Isolate
    (Defun c:XNI (/ o1 o2)
    (setq o1 (nentsel "\n* Select nested entity to Isolate Layer selected *"))
    (if o1
    (progn
    (setq o2 (cdr (assoc 8 (entget (car o1)))))
    (if (= o2 "0")
    (setq o2 (cdr (assoc 8 (entget (car (cadddr o1))))))
    )
    (SETV "expert" 5)
    (command "_.-layer" "thaw" "0" "Make" "0" "")
    (command "_.-layer" "off" (strcat "~" o2) "")
    (RSETV "expert")
    (princ o2)
    ) ;end progn
    (princ "\n* No entities selected *")
    ) ;end if
    (princ)
    )
    ;;;
    ;;; Xref Isolate
    (Defun c:XISO (/ o1 o2)
    (setq o1 (nentsel "\n* Select xref to Isolate Layer selected *"))
    (if o1
    (progn
    (setq o2 (cdr (assoc 8 (entget (car o1)))))
    (if (= o2 "0")
    (setq o2 (cdr (assoc 8 (entget (car (cadddr o1))))))
    )
    (SETV "expert" 5)
    (setq o2 (bcv_delsuffix o2 "|" T))
    (command "_.-layer" "thaw" "0" "Make" "0" "")
    (command "_.-layer" "off" (strcat "~" o2 "|*") "")
    (RSETV "expert")
    (princ o2)
    ) ;end progn
    (princ "\n* No xref selected *")
    ) ;end if
    (princ)
    )
    ;;; Xref Off
    (Defun c:XOFF (/ o1 o2)
    (setq o1 (nentsel "\n* Select xref to turn Off Layer selected *"))
    (if o1
    (progn
    (setq o2 (cdr (assoc 8 (entget (car o1)))))
    (if (= o2 "0")
    (setq o2 (cdr (assoc 8 (entget (car (cadddr o1))))))
    )
    (SETV "expert" 5)
    (setq o2 (bcv_delsuffix o2 "|" T))
    (command "_.-layer" "off" (strcat o2 "|*") "")
    (RSETV "expert")
    (princ o2)
    ) ;end progn
    (princ "\n* No xref selected *")
    ) ;end if
    (princ)
    )
    ;; SETV function saves setvar settings to be reset at end with RSETV
    ;; (setv "cmdecho" 0) set cmdecho off
    ;; (rsetv "cmdecho") resets cmdecho (see below)
    ;; taken from Essential AutoLISP by Roy Harkow
    (defun SETV (sysvar newval / cmdnam)
    (setq cmdnam (read (strcat sysvar "1"))) ;Create [savevar]1
    (set cmdnam (getvar sysvar)) ;Save [savevar]'s value
    (setvar sysvar newval) ;Then set [savevar] to new value
    )
    ;;;
    (defun RSETV (sysvar / )
    (if (eval (read (strcat sysvar "1"))) ;Only change if exists
    (progn
    (setq cmdnam (read (strcat sysvar "1"))) ;Create [savevar]1
    (setvar sysvar (eval cmdnam)) ;Restore [savevar]'s value
    (set cmdnam nil)
    ) ;end progn
    ) ;end if
    )
    ;;; Trim suffix - up to & including last instance of passed in string
    (defun bcv_delsuffix (str suffixstr all?)
    (if (wcmatch str (strcat "*" suffixstr "*")) ;only trim if suffix
    exists
    (progn
    (While
    (or
    ;; string is not empty
    (and (> (strlen str) 0)
    ;; and suffix can't be found at end
    (not
    (WCmatch ;match
    (substr str
    (1+ (- (strlen str) ; the end of the string
    (strlen suffixstr)
    ) ;_ -
    ) ;_ 1+
    ) ;_ substr
    suffixstr ; against the suffix
    ) ;_ WCmatch
    ) ;_ not
    ) ;_ and
    ;; or if all instances to be trimmed
    ;; and suffix can be found in remainder of string (except end)
    (if all?
    (wcmatch (substr str
    1
    (- (strlen str)
    (strlen suffixstr)
    ) ;_ -
    ) ;_ substr
    (strcat "*" suffixstr "*")
    ) ;_ wcmatch
    ) ;_ if
    ) ;_ or
    (Setq str (Substr str 1 (1- (strlen str))))
    ;trim off the last character
    ) ;_ while
    (Setq
    str (Substr str 1 (- (strlen str) (strlen suffixstr)))
    ) ;trim off suffix
    ) ;_ progn
    ) ;_ if
    str ;return string
    ) ;_ Defun













    HAVE A ROUTINE TO ISOLATE BUT NOT FOR UNISOLATE. SO IT'S ALMOST USLESS.
     
    GaryDF, Oct 19, 2004
    #8
  9. om_gc

    GaryDF Guest

    Good ones, thanks for sharing them.

    Gary


    DO HAVE A ROUTINE TO ISOLATE BUT NOT FOR UNISOLATE. SO IT'S ALMOST USLESS.
     
    GaryDF, Oct 19, 2004
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.