<?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 LISP Delete Block If Exists Not Working in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-delete-block-if-exists-not-working/m-p/7743154#M109289</link>
    <description>&lt;P&gt;I'm trying to first check to see if the block exists, then delete it. I'm getting a "error: bad SSGET list value" when I try to delete a KNOWN block that I know exists on the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong? Can someone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;;Erases a block name if it exists
;Example:   (m:eraseBlock  "PLC1FIRE")
(defun m:eraseBlock (blk / ss )
       (if (setq ss (ssget "X" (list '(0 . "INSERT") (cons 2 blk)))) )
		(progn		
			(command "_erase" ss "")
			(command "_purge" "B" blk "N")
		)		
	)
  )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Feb 2018 14:17:13 GMT</pubDate>
    <dc:creator>david.faunce</dc:creator>
    <dc:date>2018-02-01T14:17:13Z</dc:date>
    <item>
      <title>LISP Delete Block If Exists Not Working</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-delete-block-if-exists-not-working/m-p/7743154#M109289</link>
      <description>&lt;P&gt;I'm trying to first check to see if the block exists, then delete it. I'm getting a "error: bad SSGET list value" when I try to delete a KNOWN block that I know exists on the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong? Can someone help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;;Erases a block name if it exists
;Example:   (m:eraseBlock  "PLC1FIRE")
(defun m:eraseBlock (blk / ss )
       (if (setq ss (ssget "X" (list '(0 . "INSERT") (cons 2 blk)))) )
		(progn		
			(command "_erase" ss "")
			(command "_purge" "B" blk "N")
		)		
	)
  )&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:17:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-delete-block-if-exists-not-working/m-p/7743154#M109289</guid>
      <dc:creator>david.faunce</dc:creator>
      <dc:date>2018-02-01T14:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: LISP Delete Block If Exists Not Working</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-delete-block-if-exists-not-working/m-p/7743252#M109290</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4523925"&gt;@david.faunce&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to first check to see if the block exists, then delete it. I'm getting a "error: bad SSGET list value" when I try to delete a KNOWN block that I know exists on the drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I doing wrong? Can someone help?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;Erases a block name if it exists
;Example:   (m:eraseBlock  "PLC1FIRE")
(defun m:eraseBlock (blk / ss )
       (if (setq ss (ssget "X" (list '(0 . "INSERT") (cons 2 blk)))) &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;
		(progn		
			(command "_erase" ss "")
			(command "_purge" "B" blk "N")
		)		
	)
  )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Too many parenthesis, but what if the block is in other layout then current?&lt;/P&gt;
&lt;P&gt;(ssget) selects all the blocks across drawing, but the erase command will remove just the ones in current layout (or model)&lt;/P&gt;</description>
      <pubDate>Thu, 01 Feb 2018 14:40:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-delete-block-if-exists-not-working/m-p/7743252#M109290</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2018-02-01T14:40:22Z</dc:date>
    </item>
  </channel>
</rss>

