<?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: Delete Dynamic Block Visibility in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12368037#M21975</link>
    <description>&lt;P&gt;Need a quicker method due to the scale, currently I have a lisp which explodes all dynamic blocks from the drawing, but adds a "_1" to the end,&lt;BR /&gt;&lt;BR /&gt;So I undynamic the blocks then&lt;BR /&gt;Rename the blocks with _1 at the end manually,&lt;BR /&gt;&lt;BR /&gt;Oh, would it be possible for a lisp to remove specific characters from all block names, so if I make the addition at the end of a block name really unique such as "_RemoveThisPart"&lt;BR /&gt;&lt;BR /&gt;That way I could undynamic all blocks and just rename the blocks in bulk&lt;/P&gt;</description>
    <pubDate>Fri, 10 Nov 2023 09:24:08 GMT</pubDate>
    <dc:creator>kieran.leadbetter</dc:creator>
    <dc:date>2023-11-10T09:24:08Z</dc:date>
    <item>
      <title>Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365626#M21969</link>
      <description>&lt;P&gt;Hello, I am currently at the last stages of creating a massive batch lisp/script process and appreciate everyones help so far. I have just one last lisp which is required if anyone would happen to have one already made and happy to share their knowledge.&lt;BR /&gt;&lt;BR /&gt;Currently I have 4 separately named dynamic blocks within each drawing, I am looking to either remove all dynamic blocks and replace them as identically named, I have found multiple lisps which do this, however all rename the blocks which defeats the purpose of my end goal, as keeping the block name allows me to redefine them in future if required.&lt;BR /&gt;&lt;BR /&gt;OR alternatively a lisp which will delete all &lt;EM&gt;&lt;STRONG&gt;unselected&lt;/STRONG&gt;&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;Visibility functions from all dynamic blocks, meaning the block visibility which is currently shown, will remain the blocks default.&lt;BR /&gt;&lt;BR /&gt;If either of these are possible, I would be beyond grateful to anyones help or advice as I have learned so much the past few days.&lt;BR /&gt;&lt;BR /&gt;Kind Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 12:44:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365626#M21969</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-09T12:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365784#M21970</link>
      <description>So you want all the visibility variations of a dynamic block in your DWG file to maintain the exact name? That's not an AutoCAD ability. Sorry. There will need to be some difference in name for each instance.</description>
      <pubDate>Thu, 09 Nov 2023 13:51:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365784#M21970</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2023-11-09T13:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365834#M21971</link>
      <description>Sorry no, I want either any unused visiblities to be deleted, leaving only the shown one, i.e. there could be 3 visibilitys within a block, but after the lisp is run, there would only be 1 visibility in the block, which is the one already shown&lt;BR /&gt;&lt;BR /&gt;OR&lt;BR /&gt;&lt;BR /&gt;Have all dynamic block functionality deleted&lt;BR /&gt;&lt;BR /&gt;Both methods require the block name to remain intact with no renaming occuring</description>
      <pubDate>Thu, 09 Nov 2023 14:13:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12365834#M21971</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-09T14:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12367056#M21972</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12891562"&gt;@kieran.leadbetter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;...&lt;BR /&gt;Have all dynamic block functionality deleted&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Both methods require the block name to remain intact with no renaming occuring&lt;/STRONG&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Blocks don't work like that. If you have a block definition with 3 visibilities and 3 block references with a different visibility shown then you need 3 separate block names. Why are you trying to remove the &lt;EM&gt;smarts&lt;/EM&gt; from your blocks?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 21:38:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12367056#M21972</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-11-09T21:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12367541#M21973</link>
      <description>&lt;P&gt;What about Burst ? Could then make back into a new block.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 02:53:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12367541#M21973</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-11-10T02:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12368033#M21974</link>
      <description>&lt;P&gt;There will only be 1 variation of the block, there are 4 blocks being put into the model, but each block is separately named, there are no blocks within blocks&lt;BR /&gt;- Block Name&lt;BR /&gt;&amp;nbsp;- Visibility 1&lt;BR /&gt;&amp;nbsp;- Visibility 2&lt;BR /&gt;&amp;nbsp;- Visibility 3&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Its a task for a client, they have requested some blocks and due to the scale of the work, about 500 drawings currently, it was much faster and quicker on our end to create dynamic blocks to adjust it if any mistakes are created. However we do not want to send all the visibilities to the client currently as they only paid for one visibility at the current time.&lt;BR /&gt;&lt;BR /&gt;The smarts are more for inoffice use, whereas once the dynamic functions are removed, we can sell them to the client&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 09:20:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12368033#M21974</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-10T09:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12368037#M21975</link>
      <description>&lt;P&gt;Need a quicker method due to the scale, currently I have a lisp which explodes all dynamic blocks from the drawing, but adds a "_1" to the end,&lt;BR /&gt;&lt;BR /&gt;So I undynamic the blocks then&lt;BR /&gt;Rename the blocks with _1 at the end manually,&lt;BR /&gt;&lt;BR /&gt;Oh, would it be possible for a lisp to remove specific characters from all block names, so if I make the addition at the end of a block name really unique such as "_RemoveThisPart"&lt;BR /&gt;&lt;BR /&gt;That way I could undynamic all blocks and just rename the blocks in bulk&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 09:24:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12368037#M21975</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-10T09:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12369451#M21976</link>
      <description>&lt;P&gt;Not sure about the differences in how the different visibility would look. But if it was a door with each visibility being a different directional swing and you not remove all visibility but one then you’ll end up with situations where there would be doors swinging the wrong direction. Make sure your client is aware of the consequences involved with what he’s asking.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Nov 2023 18:56:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12369451#M21976</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-11-10T18:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12370172#M21977</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12891562"&gt;@kieran.leadbetter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Need a quicker method due to the scale, currently I have a lisp which explodes all dynamic blocks from the drawing, but adds a "_1" to the end,&lt;BR /&gt;&lt;BR /&gt;So I undynamic the blocks then&lt;BR /&gt;Rename the blocks with _1 at the end manually,&lt;BR /&gt;&lt;BR /&gt;Oh, would it be possible for a lisp to remove specific characters from all block names, so if I make the addition at the end of a block name really unique such as "_RemoveThisPart"&lt;BR /&gt;&lt;BR /&gt;That way I could undynamic all blocks and just rename the blocks in bulk&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12891562"&gt;@kieran.leadbetter&lt;/a&gt;&amp;nbsp; Your blocks must be fantastic. Renaming, removing parts,&amp;nbsp; bringing back to life. Anything is possible, but there are also better work flows.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2023 04:03:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12370172#M21977</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-11-11T04:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12388799#M21978</link>
      <description>Hello again, sorry for late reply, I was on annual leave for a week, back in office and ready to learn again.&lt;BR /&gt;&lt;BR /&gt;Currently there about a hundred blocks with varying dynamic abilities, each block uses a specific block name, but there are no blocks within each block in order to keep it somewhat simpler when editing blocks.&lt;BR /&gt;&lt;BR /&gt;If there are 3 Visibility States, A B and C, and A is selected, I need B and C to be removed from Visibility Selection, doesn't matter if the unseen lines within the block are deleted or just permanently invisible.&lt;BR /&gt;&lt;BR /&gt;One block name is:&lt;BR /&gt;&lt;BR /&gt;NCR 6629 Collar_ADV 15'' 4_High&lt;BR /&gt;&lt;BR /&gt;I need to retain this block name in order to redefine the block on a large scale across aprox 450 Information Sheets, possibly more in future. The bulk redefine lisp you created the other week works brilliant, alongside it I am also using a UnDynamic_AllBlocks Lisp, however this in turn renames the block to:&lt;BR /&gt;&lt;BR /&gt;NCR Collar_ADV 15'' 4_High_1.&lt;BR /&gt;&lt;BR /&gt;So my 2 options are:&lt;BR /&gt;&lt;BR /&gt;1: Ideal Goal&lt;BR /&gt;- Redefine All Blocks&lt;BR /&gt;- Delete unrequired visibility types&lt;BR /&gt;- Purge All&lt;BR /&gt;- Rename All Blocks Lisp (Remove the _1 at the end of block names)&lt;BR /&gt;- Save and Quit, ready for next redefine when required&lt;BR /&gt;&lt;BR /&gt;2:&lt;BR /&gt;- Redefine All Blocks&lt;BR /&gt;- Make all blocks UnDynamic (This creates the issue of if the block is redefined, I will have to manually select the correct visibility each time)&lt;BR /&gt;- Purge All&lt;BR /&gt;- Rename All Blocks Lisp (Remove the _1 at the end of block names)&lt;BR /&gt;- Save and Quit, ready for next redefine when required</description>
      <pubDate>Mon, 20 Nov 2023 14:45:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12388799#M21978</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-20T14:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12388812#M21979</link>
      <description>This shouldn't be an issue for the purpose of my task, the Blocks I am creating will only appear once within a drawing, meaning as long as the correct visibility state is selected and retained, while only deleting/removing the ones not selected, it will allow us to redefine blocks in a mass bulk method saving weeks of work</description>
      <pubDate>Mon, 20 Nov 2023 14:50:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12388812#M21979</guid>
      <dc:creator>kieran.leadbetter</dc:creator>
      <dc:date>2023-11-20T14:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12390305#M21980</link>
      <description>&lt;P&gt;A Google barely tested seems to work.&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dynamic-block-to-static-block-renamed-after-visibility-state/td-p/7254339" target="_blank" rel="noopener"&gt;Dynamic Block to Static Block - Renamed after Visibility State - Autodesk Community - AutoCAD&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once ran you need to purge dynamic block out then can rename removing the item number on end, "WINDOW 2",&amp;nbsp; ran twice 2 visibilty states, 3rd go "WINDOW 3"&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 05:16:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12390305#M21980</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-11-21T05:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12390466#M21981</link>
      <description>&lt;P&gt;Try this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:UnDynamic
    (   /
        _get_item
        _right
        _make_key
        _dynamic-&amp;gt;static_block
        _get_locked
        _get_dynamic_inserts
        _main
     	bn_lst
    	adoc
    )
    (defun _get_item ( collection key / item )
        (vl-catch-all-apply
           '(lambda ( ) (setq item (vla-item collection key)))
        )
        item
    )
    (defun _right ( str n / len )
        (if (&amp;lt; n (setq len (strlen str)))
            (substr str (1+ (- len n)))
            str
        )
    )
    (defun _make_key ( collection prefix len / key )
        (   (lambda ( i pad )
                (while
                    (_get_item collection
                        (setq key
                            (strcat prefix
                                (_right
                                    (strcat pad (itoa (setq i (1+ i))))
                                    len
                                )
                            )
                        )
                    )
                )
                key
            )
            0
            (   (lambda ( pad )
                    (while (&amp;lt; (strlen pad) len)
                        (setq pad (strcat "0" pad))
                    )
                    pad
                )
                ""
            )
        )
    )


;;;				Autodesk Lisp Forum            			;;;

      
      (defun _dynamic-&amp;gt;static_block ( blocks insert len blst / f bn  bnr)
       (setq bn  (vla-get-effectivename insert))    
        (vla-ConvertToStaticBlock
            insert
            (setq bnr (_make_key blocks (strcat bn " ") len))
        )
        (setq bnr (list bn (vl-string-left-trim (strcat bn " ") bnr) insert))   
        (if (setq f (assoc bn blst))
			 (subst bnr f blst)(cons bnr blst))
	)

;;;				Autodesk Lisp Forum            			;;;

      
    (defun _get_locked ( layers / locked )
        (vlax-for layer layers
            (if (eq :vlax-true (vla-get-lock layer))
                (setq locked (cons layer locked))
            )
        )
        locked
    )
    (defun _get_dynamic_inserts ( blocks / inserts )
        (vlax-for block blocks
            (vlax-for object block
                (if (eq "AcDbBlockReference" (vla-get-objectname object))
                    (if (eq :vlax-true (vla-get-isdynamicblock object))
                        (setq inserts (cons object inserts))
                    )
                )
            )
        )
        inserts
    )
    (defun _main ( document / blocks inserts locked len )
        (if
            (setq inserts
                (_get_dynamic_inserts
                    (setq blocks (vla-get-blocks document))
                )
            )
            (progn
                (foreach layer (setq locked (_get_locked (vla-get-layers document)))
                    (vla-put-lock layer :vlax-false)
                )
                (setq len (strlen (itoa (length inserts))))
                (foreach insert inserts
		(Setq bn_lst
                    (_dynamic-&amp;gt;static_block blocks insert len bn_lst))
                      
                )
                (foreach layer locked
                    (vla-put-lock layer :vlax-true)
                )
            )
        )
        (princ)
    )


;;;				Autodesk Lisp Forum            			;;;

	(repeat 4 (vla-purgeall (setq adoc (vla-get-activedocument (vlax-get-acad-object)))))
      
	(_main adoc)
      
	(repeat 4 (vla-purgeall adoc))
	(setq blocks (vla-get-blocks adoc))
	(foreach itm bn_lst
		(vl-catch-all-error-p (vl-catch-all-apply 'vla-put-name 
		          (list (vla-item blocks (Strcat (Car itm)" "(cadr itm))) (Car itm))))
	   )

;;;				Autodesk Lisp Forum            			;;;
          
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 07:01:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12390466#M21981</guid>
      <dc:creator>smallƑish</dc:creator>
      <dc:date>2023-11-21T07:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Dynamic Block Visibility</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12391584#M21982</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10577275"&gt;@smallƑish&lt;/a&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.theswamp.org/index.php?topic=32681.msg382548#msg382548" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;Credit&lt;/STRONG&gt;&lt;/A&gt; to the late author Michael Puckett. There are also a few more examples in that thread.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 15:22:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/delete-dynamic-block-visibility/m-p/12391584#M21982</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2023-11-21T15:22:29Z</dc:date>
    </item>
  </channel>
</rss>

