<?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 Block Deletion using Script in AutoCAD LT Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7836149#M37220</link>
    <description>&lt;P&gt;Is there a way to delete a specific block from within a drawing using a script? I've looked through many forums and can't find an exact answer but I do have a script working as below and so long as I insert the block as the last operation it will do exactly what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The objective is to delete an existing title block, purge the drawing, save it and then close the sheet and repeat the cycle until all sheets have been updated. I then run another script that replaces the title block and this works great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An even better solution would be to delete the old title block, purge and replace it with the new one all from within a single script but again is this possible as both blocks would have the same name albeit I could have the replacement block in a different file location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of our projects can have up to 150 sheets so to change the drawing revision etc. manually can be very tedious.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current script is as follows: -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_.open "C:\SteveW\P01.dwg"&lt;BR /&gt;Erase&lt;BR /&gt;L&lt;BR /&gt;_PURGE&lt;BR /&gt;_A&lt;BR /&gt;*&lt;BR /&gt;_N&lt;BR /&gt;_.qsave&lt;BR /&gt;_.close&lt;/P&gt;&lt;P&gt;_.open "C:\SteveW\P02.dwg"&lt;BR /&gt;Erase&lt;BR /&gt;L&lt;BR /&gt;_PURGE&lt;BR /&gt;_A&lt;BR /&gt;*&lt;BR /&gt;_N&lt;BR /&gt;_.qsave&lt;BR /&gt;_.close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 20:58:52 GMT</pubDate>
    <dc:creator>IsisControls</dc:creator>
    <dc:date>2018-03-07T20:58:52Z</dc:date>
    <item>
      <title>Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7836149#M37220</link>
      <description>&lt;P&gt;Is there a way to delete a specific block from within a drawing using a script? I've looked through many forums and can't find an exact answer but I do have a script working as below and so long as I insert the block as the last operation it will do exactly what I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The objective is to delete an existing title block, purge the drawing, save it and then close the sheet and repeat the cycle until all sheets have been updated. I then run another script that replaces the title block and this works great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An even better solution would be to delete the old title block, purge and replace it with the new one all from within a single script but again is this possible as both blocks would have the same name albeit I could have the replacement block in a different file location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some of our projects can have up to 150 sheets so to change the drawing revision etc. manually can be very tedious.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current script is as follows: -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_.open "C:\SteveW\P01.dwg"&lt;BR /&gt;Erase&lt;BR /&gt;L&lt;BR /&gt;_PURGE&lt;BR /&gt;_A&lt;BR /&gt;*&lt;BR /&gt;_N&lt;BR /&gt;_.qsave&lt;BR /&gt;_.close&lt;/P&gt;&lt;P&gt;_.open "C:\SteveW\P02.dwg"&lt;BR /&gt;Erase&lt;BR /&gt;L&lt;BR /&gt;_PURGE&lt;BR /&gt;_A&lt;BR /&gt;*&lt;BR /&gt;_N&lt;BR /&gt;_.qsave&lt;BR /&gt;_.close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 20:58:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7836149#M37220</guid>
      <dc:creator>IsisControls</dc:creator>
      <dc:date>2018-03-07T20:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7836382#M37221</link>
      <description>Scripts can't do all of that in LT.&lt;BR /&gt;&lt;BR /&gt;Read the INSERT method in this second half of the tutorial &lt;A href="https://www.ellenfinkelstein.com/acadblog/replace-one-block-with-another/" target="_blank"&gt;https://www.ellenfinkelstein.com/acadblog/replace-one-block-with-another/&lt;/A&gt;</description>
      <pubDate>Wed, 07 Mar 2018 22:28:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7836382#M37221</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2018-03-07T22:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7843016#M37222</link>
      <description>&lt;P&gt;Hi Pendean,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply. I've had a look at that and it works fine when not used in a script, so I must be doing something wrong. I have used the script as below:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;_.open "C:\SteveW\P01.dwg"&lt;/P&gt;&lt;P&gt;_.insert&lt;/P&gt;&lt;P&gt;TitleBlock2=C:\SteveW\TitleBlock2&lt;/P&gt;&lt;P&gt;Y&lt;/P&gt;&lt;P&gt;_.qsave&lt;/P&gt;&lt;P&gt;_.close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Ellen's example after the Yes command to redefine the block you escape to quit otherwise you copy the new block over the old one and this is where my script fails as it asks for the insertion point etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I assume I need to add something after the Yes to escape from the insert command and continue running through the rest of the script, looking through other posts and forums i have seen that some people say (command), (script-cancel) or simple carriage returns achieves this but this doesn't work so I'm stumped.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Mar 2018 10:00:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7843016#M37222</guid>
      <dc:creator>IsisControls</dc:creator>
      <dc:date>2018-03-10T10:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7843189#M37223</link>
      <description>(command) is for lisp equipped versions of AutoCAD (aka not LT).&lt;BR /&gt;&lt;BR /&gt;Finish the INSERT then just DELETE LAST.</description>
      <pubDate>Sat, 10 Mar 2018 14:24:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7843189#M37223</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2018-03-10T14:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7844910#M37224</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4847986"&gt;@IsisControls&lt;/a&gt;&amp;nbsp; A script file is nothing more than what you type on the command line. So yes &lt;SPAN&gt;there is a way to delete a specific block from within a drawing using a script. Just select it with an absolute coordinate point (X,Y,Z). The first sentence in the below link should say "You can use absolute or relative Cartesian (rectangular) coordinates to locate points when creating &lt;FONT color="#ff0000"&gt;or selecting&lt;/FONT&gt; objects.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-F64F8008-E1C0-49CC-A268-A6B8C6E9B566" target="_blank"&gt;http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-F64F8008-E1C0-49CC-A268-A6B8C6E9B566&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If you do not know where an absolute coordinate point is on your title block use the ID command to find one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;ID command help link&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-F258AC00-5E9F-4B6B-A670-33F7708E3FB6" target="_blank"&gt;http://help.autodesk.com/view/ACD/2018/ENU/?guid=GUID-F258AC00-5E9F-4B6B-A670-33F7708E3FB6&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To select your title block find a point somewhere on your title block (ID command if you do not know one) and use those X,Y,Z numbers in place of the "L". (a lot of people insert their title block with the lower left corner at 0,0,0 so I will use that in the example below) To finish the select object portion of the ERASE command you will need a blank line between the L and -purge&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;Erase&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0,0,0&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#ff0000"&gt;-purge&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;the purge portion of your script is OK&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;To put in the insert portion of the script in you will just enter what you would type on the command line. You will need to know the following information.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;block &lt;SPAN&gt;to insert&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;insertion point&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;X scale factor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Y scale factor&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;rotation angle&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So assuming you are inserting your new title block at 0,0,0 at full size with 0 rotation, the insert new block portion of your script should look like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;-insert&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;C:\SteveW\TITLEBLOCK.dwg&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0,0,0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;Your save and close portions are OK&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;See the attached script file for an example of how it will look when all put together. Feel free to rename and modify it to suit your needs.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/37212"&gt;@pendean&lt;/a&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;wrote:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;Scripts can't do all of that in LT.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WHY NOT? Did I miss something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;open a drawing file&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;_.open "C:\SteveW\P01.dwg"&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;delete a&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt; specific block&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;Erase&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0,0,0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;purge the drawing&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;_PURGE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;_A&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;_N&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;insert a new title block&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;-insert&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;C:\SteveW\TITLEBLOCK.dwg&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0,0,0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;FONT color="#000000"&gt;save and close&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&lt;SPAN&gt;_.qsave&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;_.close&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 05:16:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7844910#M37224</guid>
      <dc:creator>Johneng</dc:creator>
      <dc:date>2018-03-12T05:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7845638#M37225</link>
      <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/535625"&gt;@Johneng&lt;/a&gt; as long as you assume a block is always installed and can be selected from 0,0,0, but there is no guarantee.&lt;BR /&gt;&lt;BR /&gt;Your solution, while valid, makes too many assumptions. I believe the OP already solved the issue with the less-assumptive method of replacing the block, a more useful tip that can be applied to any block needing redefinition.</description>
      <pubDate>Mon, 12 Mar 2018 12:11:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7845638#M37225</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2018-03-12T12:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Block Deletion using Script</title>
      <link>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7863339#M37226</link>
      <description>&lt;P&gt;Thank you both for your responses, I have played around with the scripts and now got the solution I was looking for and it works great.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Mar 2018 21:07:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-lt-forum/block-deletion-using-script/m-p/7863339#M37226</guid>
      <dc:creator>IsisControls</dc:creator>
      <dc:date>2018-03-18T21:07:25Z</dc:date>
    </item>
  </channel>
</rss>

