<?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: Insert Multiple Blocks Within One DWG in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481486#M55299</link>
    <description>&lt;P&gt;Hi Alfred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do schematic drawings that have blocks representing valves / fittings etc.&amp;nbsp; Once the blocks are in position it is useful to create a legend.&amp;nbsp; To create the legend I have to insert one of each block in the schematic and then annotate what the block is (I have a tagging routine for the annotations that works well).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a routine that will grab one instance of each of the blocks in modelspace and reinsert at a new location selected by me.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Jun 2012 15:13:16 GMT</pubDate>
    <dc:creator>Hugh_Compton</dc:creator>
    <dc:date>2012-06-01T15:13:16Z</dc:date>
    <item>
      <title>Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481014#M55294</link>
      <description>&lt;P&gt;I'm trying to get a routine that creates and inserts a copy of all the block entities in a DWG.&amp;nbsp; For some reason the code causes CAD to hang?&amp;nbsp; See attachment for code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 11:55:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481014#M55294</guid>
      <dc:creator>Hugh_Compton</dc:creator>
      <dc:date>2012-06-01T11:55:49Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481090#M55295</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you scan all BlockTableRecords, and within them for all Blockreferences.&lt;/P&gt;&lt;P&gt;Eg. if ModelSpace has a BlockReference included you insert a new BlockReference based on the current one and so you have an endless loop.&lt;/P&gt;&lt;P&gt;With other words:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;we start with ModelSpace having 1 BlockReference&lt;/LI&gt;&lt;LI&gt;You found it and insert this one in ModelSpace&lt;/LI&gt;&lt;LI&gt;Now you have two BlockRefences in Modelspace&lt;/LI&gt;&lt;LI&gt;Next you make as step forward in your loop and find your second BlockReference&lt;/LI&gt;&lt;LI&gt;From that you create a third one&lt;/LI&gt;&lt;LI&gt;and so on .... endless&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Back to the roots, what should this code do?&lt;/P&gt;&lt;P&gt;If you want to make a list of all blockdefinitions then just go through your BlockTable, and each BlockTableRecord, that is not of type layout, create a BlockReference in ModelSpace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 12:32:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481090#M55295</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-06-01T12:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481134#M55296</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the hints.&amp;nbsp; I've tried to get the block obejct IDs first and then do the inserting afterwards (see attached) but CAD still hangs &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 13:05:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481134#M55296</guid>
      <dc:creator>Hugh_Compton</dc:creator>
      <dc:date>2012-06-01T13:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481236#M55297</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've attached another attempt, using someone elses code for a block inserting sub but it still doesn't work...... very confused.....&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 13:44:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481236#M55297</guid>
      <dc:creator>Hugh_Compton</dc:creator>
      <dc:date>2012-06-01T13:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481464#M55298</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you first try to explain what you like to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 15:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481464#M55298</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-06-01T15:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481486#M55299</link>
      <description>&lt;P&gt;Hi Alfred&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do schematic drawings that have blocks representing valves / fittings etc.&amp;nbsp; Once the blocks are in position it is useful to create a legend.&amp;nbsp; To create the legend I have to insert one of each block in the schematic and then annotate what the block is (I have a tagging routine for the annotations that works well).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a routine that will grab one instance of each of the blocks in modelspace and reinsert at a new location selected by me.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 15:13:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481486#M55299</guid>
      <dc:creator>Hugh_Compton</dc:creator>
      <dc:date>2012-06-01T15:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481752#M55300</link>
      <description>&lt;P&gt;In your revision code, you were still adding items to the blockTableRecord while looping through it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Attempt 3, all I see is that the dictionary entries are required to be unique.&amp;nbsp; I am assuming that you have more than one of each block in modelspace, so the second time you find the same block, you are getting a duplicate key exception.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you need to test the dictionary contents before adding each Id/name pair.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if not dict.ContainsKey(id) then dict.add(id,name)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are using 2009 or newer AutoCAD, then you could also benefit from using ObjectID.ObjectClass.Name to type&amp;nbsp;test&amp;nbsp;the objects&amp;nbsp;before opening them, instead of opening everything.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2012 16:57:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/3481752#M55300</guid>
      <dc:creator>chiefbraincloud</dc:creator>
      <dc:date>2012-06-01T16:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Insert Multiple Blocks Within One DWG</title>
      <link>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/8450918#M55301</link>
      <description>&lt;P&gt;Super easy, no lisp required. Xref all blocks in at one time on same coordinates and bind them afterward. I do it frequently.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 19:12:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/insert-multiple-blocks-within-one-dwg/m-p/8450918#M55301</guid>
      <dc:creator>David125</dc:creator>
      <dc:date>2018-12-06T19:12:35Z</dc:date>
    </item>
  </channel>
</rss>

