Jump to content

Isolating blocks or objects with nested layers


Recommended Posts

Posted

Does anyone have a method to isolate blocks or objects, that have nested layers within the blocks? 

 

I have blocks that have [for example (Layer A, Layer C, Layer 1, Layer 10)] contained in the block. The block resides on master layer (Layer Blocks).

 

I was hoping to isolate the (Layers Block) by selecting the object and it would also isolate the other layers with it.

 

Is that possible by any chance?

 

Hopefully if it can do that, it would be easily to unisolate it as well. 

Posted (edited)

Try this:

(defun c:foo (/ e k l n)
  ;; RJP » 2021-11-22
  (layerstate-restore (setq k "RJP-NLAYISO") nil 2)
  (while (setq e (nentsel "\nSelect objects to isolate: "))
    (foreach x (append (list (car e)) (cadddr e))
      (or (vl-position (setq n (cdr (assoc 8 (entget x)))) l) (setq l (cons n l)))
    )
  )
  (if l
    (progn (setvar 'cmdecho 0)
	   (layerstate-save k 2 nil)
	   (command "_.layer" "_Freeze" "*" "")
	   (command "_.layer" "_Thaw" (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) l)) "")
	   (setvar 'cmdecho 1)
    )
  )
  (princ)
)

 

Edited by ronjonp
Posted

Works Great Ronjon! Hate to ask this, anyway to "unfoo"? If not, I can still make this work. thank you again.

Posted
2 hours ago, rcb007 said:

Works Great Ronjon! Hate to ask this, anyway to "unfoo"? If not, I can still make this work. thank you again.

(defun c:unfoo nil (layerstate-restore "RJP-NLAYISO" nil 2))

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...