<?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 Select Dynamic block and change its visibility state using LISP in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654352#M22</link>
    <description>&lt;P&gt;I am trying to select a specific dynamic block in Layout space and change its visibility state using LISP. Something that I'm doing isn't working because it just states the block is not in layout space, however it clearly is. Basically I need to be able to print the cover sheet for plans twice, once with the standard energy code selections, and a second time with solar energy credit selections.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Block name:&amp;nbsp;WSEC ENERGY SELECTIONS - 2021 - MV4&lt;/P&gt;
&lt;P&gt;Visibility Parameter name: ENERGY CREDITS&lt;/P&gt;
&lt;P&gt;Visibility State (to change to): SOLAR INSTALLATION&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By default the visibility state is typically set to MV4, I want to switch this to SOLAR INSTALLATION so I can print the sheet, then I'll add code to switch it back after printing later.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code sample:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:c2solar ( / blkname visstate ss i ent obj props propname )
  (vl-load-com)

  (setq blkname "WSEC ENERGY SELECTIONS - 2021 - MV4")
  (setq visstate "SOLAR INSTALLATION")

  ;; Select all inserts of the block in paper space (layout space)
  (setq ss (ssget "_X"
            (list
              '(0 . "INSERT")
              (cons 2 blkname)
              (cons 410 "A0.0 Right - Cover")
            )
          )
  )

  (if ss
    (progn
      (setq i 0)
      (while (&amp;lt; i (sslength ss))
        (setq ent (ssname ss i))
        (setq obj (vlax-ename-&amp;gt;vla-object ent))

        ;; Get dynamic block properties
        (if (vlax-property-available-p obj 'EffectiveName)
          (progn
            (setq props (vlax-invoke obj 'GetDynamicBlockProperties))
            (foreach prop props
              (setq propname (strcase (vla-get-PropertyName prop)))
              (if (wcmatch propname "ENERGY CREDITS")
                (vla-put-Value prop visstate)
              )
            )
          )
        )
        (setq i (1+ i))
      )
      (princ (strcat "\nAll matching blocks updated to visibility: " visstate))
    )
    (princ "\nBlock not found in layout space.")
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance to get this functioning would be much appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 May 2025 21:48:58 GMT</pubDate>
    <dc:creator>asleafty</dc:creator>
    <dc:date>2025-05-28T21:48:58Z</dc:date>
    <item>
      <title>Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654352#M22</link>
      <description>&lt;P&gt;I am trying to select a specific dynamic block in Layout space and change its visibility state using LISP. Something that I'm doing isn't working because it just states the block is not in layout space, however it clearly is. Basically I need to be able to print the cover sheet for plans twice, once with the standard energy code selections, and a second time with solar energy credit selections.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Block name:&amp;nbsp;WSEC ENERGY SELECTIONS - 2021 - MV4&lt;/P&gt;
&lt;P&gt;Visibility Parameter name: ENERGY CREDITS&lt;/P&gt;
&lt;P&gt;Visibility State (to change to): SOLAR INSTALLATION&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By default the visibility state is typically set to MV4, I want to switch this to SOLAR INSTALLATION so I can print the sheet, then I'll add code to switch it back after printing later.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code sample:&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:c2solar ( / blkname visstate ss i ent obj props propname )
  (vl-load-com)

  (setq blkname "WSEC ENERGY SELECTIONS - 2021 - MV4")
  (setq visstate "SOLAR INSTALLATION")

  ;; Select all inserts of the block in paper space (layout space)
  (setq ss (ssget "_X"
            (list
              '(0 . "INSERT")
              (cons 2 blkname)
              (cons 410 "A0.0 Right - Cover")
            )
          )
  )

  (if ss
    (progn
      (setq i 0)
      (while (&amp;lt; i (sslength ss))
        (setq ent (ssname ss i))
        (setq obj (vlax-ename-&amp;gt;vla-object ent))

        ;; Get dynamic block properties
        (if (vlax-property-available-p obj 'EffectiveName)
          (progn
            (setq props (vlax-invoke obj 'GetDynamicBlockProperties))
            (foreach prop props
              (setq propname (strcase (vla-get-PropertyName prop)))
              (if (wcmatch propname "ENERGY CREDITS")
                (vla-put-Value prop visstate)
              )
            )
          )
        )
        (setq i (1+ i))
      )
      (princ (strcat "\nAll matching blocks updated to visibility: " visstate))
    )
    (princ "\nBlock not found in layout space.")
  )
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance to get this functioning would be much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 21:48:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654352#M22</guid>
      <dc:creator>asleafty</dc:creator>
      <dc:date>2025-05-28T21:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654380#M23</link>
      <description>&lt;P&gt;Maybe just change&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(cons 2 blkname)&lt;/P&gt;
&lt;P&gt;to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(cons 2 (strcat "`*U*," blkname))&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 15:45:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654380#M23</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2025-05-28T15:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654635#M24</link>
      <description>&lt;P&gt;That's all it needed! Thank you for you speedy assistance, I was at the end of my rope &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2025 18:15:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/13654635#M24</guid>
      <dc:creator>asleafty</dc:creator>
      <dc:date>2025-05-28T18:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060451#M170497</link>
      <description>&lt;P&gt;I'm after something similar but I don't want it tied to a specific layout... I'd like it to do it in all layouts.&lt;/P&gt;&lt;P&gt;In addition to block name, parameter name and desired visibility state, I replaced:&amp;nbsp;&lt;FONT color="#FF0000"&gt; (cons 410 "A0.0 Right - Cover")&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with:&amp;nbsp;&lt;FONT color="#339966"&gt;(setq ctab (getvar "ctab"))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;(foreach obj (layoutlist)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#339966"&gt;(setvar "ctab" obj)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which has worked in the past for me but it's not finding the layout.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2026 16:22:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060451#M170497</guid>
      <dc:creator>rspearYL2SX</dc:creator>
      <dc:date>2026-03-19T16:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060559#M170498</link>
      <description>&lt;P&gt;nevermind, I got it working. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2026 17:13:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060559#M170498</guid>
      <dc:creator>rspearYL2SX</dc:creator>
      <dc:date>2026-03-19T17:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select Dynamic block and change its visibility state using LISP</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060943#M170499</link>
      <description>&lt;P&gt;This does what your asking for and displays the visibility in a dcl to choose. You need to save a lisp file of Lee-mac dynamic block functions. I saved as&amp;nbsp;"Lee-mac Dynamic block get-put.lsp"&amp;nbsp;&lt;A href="https://www.lee-mac.com/dynamicblockfunctions.html" target="_blank"&gt;https://www.lee-mac.com/dynamicblockfunctions.html&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Save the "Multi radio buttons.lsp in a support path" as its a Library function to make a radio button dcl on the fly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2026 22:40:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-dynamic-block-and-change-its-visibility-state-using-lisp/m-p/14060943#M170499</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2026-03-19T22:40:35Z</dc:date>
    </item>
  </channel>
</rss>

