<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dialog box to turn on/off certain layer in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440653#M20494</link>
    <description>&lt;P&gt;Another way to consider this is to use a layer filter. It creates SEAL filter if needed, then launches the layer dialog with this filter current.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:SealLayers (/ :LayerFilterList n)
  
  (defun :LayerFilterList (/ :SubFilterList)
    (defun :SubFilterList (dict / ent lst)
      (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
	(setq lst (append lst (cons ent (if (assoc 360 (entget ent)) (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent))))))))))))) lst)
    (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
	    (:SubFilterList (dictsearch (vlax-vla-object-&amp;gt;ename (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))) "ACLYDICTIONARY"))))
  
  (setq n "SEAL")
  (setvar 'cmdecho 0)
  (if (not (member n (:LayerFilterList)))
    (command "_.-LAYER" "_Filter" "_New" "_P" "All" "NAME==\"0-SEAL*\" OR NAME==\"Layer*\"" n ""))
  (command "_.-LAYER" "_Filter" "_Set" n "")
  (command "_.-LAYER" "_Filter" "_Set" n "") ; for some reason
  (initdia) (command "_.LAYER")
  (setvar 'cmdecho 1)
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 09:11:56 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2023-12-14T09:11:56Z</dc:date>
    <item>
      <title>Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439591#M20489</link>
      <description>&lt;P&gt;I am very limited in my lsp and dcl coding and have only done very basic things so far.&amp;nbsp; I have tried to put together a way for our users to turn on/off (and freeze/thaw) certain layers by selecting a checkbox instead of going through the layers dropdown all the time.&amp;nbsp; I have attached what I have, it pulls up the dialog box and I can check the 1 I am trying to test (0-Seal, just trying to test 1 to start) but it doesn't thaw/turn on that layer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have any advice?&amp;nbsp; I saw a few posts about something along the lines but they looked different but will continue to search as well.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 19:56:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439591#M20489</guid>
      <dc:creator>Thomasbatson</dc:creator>
      <dc:date>2023-12-13T19:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439612#M20490</link>
      <description>Q: why not implement and use LAYERSTATEs? One easy pulldown for users to use is right there on the Ribbon, you can even move it around if needed&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-5312A8BD-DD94-47D6-B1BA-5E0AF5E0CED8#:~:text=Have%20You%20Tried%3A%20Layer%20States" target="_blank"&gt;https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-5312A8BD-DD94-47D6-B1BA-5E0AF5E0CED8#:~:text=Have%20You%20Tried%3A%20Layer%20States&lt;/A&gt;</description>
      <pubDate>Wed, 13 Dec 2023 20:05:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439612#M20490</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2023-12-13T20:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439616#M20491</link>
      <description>&lt;P&gt;Editing reply, I will have to look at the layer states.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 20:09:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439616#M20491</guid>
      <dc:creator>Thomasbatson</dc:creator>
      <dc:date>2023-12-13T20:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439934#M20492</link>
      <description>&lt;P&gt;If the layers are known can do a lisp&amp;nbsp; defun for each group of layers, say use command L1, L2 or ground, floor etc. There is code that turns off a layer if on and if ran again the layer is off will turn on. Can be modifed to look at a list of layers. That code has been posted many times but I don't have it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 22:45:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12439934#M20492</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-12-13T22:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440543#M20493</link>
      <description>&lt;P&gt;just for starter&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:SealLayers ()
	(setq lay_state_nam_num_list '(
								  	("0" "0-SEAL" 1) ("0" "0-SEAL_AREAWRK" 2) ("0" "0-SEAL_BIDPRUPOSE" 3) 
									("0" "0-SEAL_DOCUTXT" 4) ("0" "0-SEAL_E-COPY" 5) ("0" "0-SEAL_CLIENT USE" 6) 
									("0" "0-SEAL_PRELIMTXT" 7) ("0" "0-SEAL_E-PROF INFO" &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; 
									("0" "0-SEAL_REFTXT" 9) ("0" "0-SEAL_REVIEW" 10)
								  )
		  dialog (load_dialog "SealLayers.dcl")
	)
	(if (not (new_dialog "SealLayers" dialog))
		(exit)
		(progn
			(action_tile "OK" "(progn (change_state (get_state lay_state_nam_num_list)) (done_dialog))") 
  			(start_dialog)
  			(unload_dialog dialog)
		)
	)
)

(defun Get_State (lay_state_nam_num_list)
	(setq index 0)
	(repeat (length lay_state_nam_num_list)
		(setq lay_state_nam_num_list (subst (append (list (get_tile (strcat "checkbox" (itoa (last (nth index lay_state_nam_num_list))))))
													(cdr (nth index lay_state_nam_num_list))
											)
											(nth index lay_state_nam_num_list)
											lay_state_nam_num_list
									 )
			  index (1+ index)
		)
	)
	lay_state_nam_num_list
)
(defun change_state (lay_state_nam_num_list)
	(mapcar '(lambda (layer) (progn (set-layer-visibility (cadr layer) (atoi (car layer)))
;									(thaw-turn-on-thaw-all-viewports...)
							 )
			 )
			 lay_state_nam_num_list
	)
)

(defun set-layer-visibility (layer-name status)
  	(if (tblsearch "layer" layer-name) (vlax-put layer-name 'LayerOn status))
)

;(defun thaw-turn-on-thaw-all-viewports (layer-name status)
;  (vlax-for layout (vla-get-layouts (vla-get-activeDocument (vlax-get-acad-object)))
;  	(vlax-for object (vla-get-block layout)
;    	(if (= "AcDbViewport" (vla-get-objectname object))
;    	  (progn
;		  		should define here what you are going to do with vp's layers or else
;    	  )
;    	)
;  )
;)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 14 Dec 2023 07:55:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440543#M20493</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2023-12-14T07:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440653#M20494</link>
      <description>&lt;P&gt;Another way to consider this is to use a layer filter. It creates SEAL filter if needed, then launches the layer dialog with this filter current.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:SealLayers (/ :LayerFilterList n)
  
  (defun :LayerFilterList (/ :SubFilterList)
    (defun :SubFilterList (dict / ent lst)
      (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
	(setq lst (append lst (cons ent (if (assoc 360 (entget ent)) (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent))))))))))))) lst)
    (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
	    (:SubFilterList (dictsearch (vlax-vla-object-&amp;gt;ename (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))) "ACLYDICTIONARY"))))
  
  (setq n "SEAL")
  (setvar 'cmdecho 0)
  (if (not (member n (:LayerFilterList)))
    (command "_.-LAYER" "_Filter" "_New" "_P" "All" "NAME==\"0-SEAL*\" OR NAME==\"Layer*\"" n ""))
  (command "_.-LAYER" "_Filter" "_Set" n "")
  (command "_.-LAYER" "_Filter" "_Set" n "") ; for some reason
  (initdia) (command "_.LAYER")
  (setvar 'cmdecho 1)
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 09:11:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440653#M20494</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2023-12-14T09:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dialog box to turn on/off certain layer</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440977#M20495</link>
      <description>&lt;P&gt;Thank you I will look for it.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 12:24:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dialog-box-to-turn-on-off-certain-layer/m-p/12440977#M20495</guid>
      <dc:creator>Thomasbatson</dc:creator>
      <dc:date>2023-12-14T12:24:18Z</dc:date>
    </item>
  </channel>
</rss>

