<?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: copy block in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482062#M83417</link>
    <description>yah copy and paste using dot net API&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
namrata</description>
    <pubDate>Thu, 10 Nov 2005 04:43:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-11-10T04:43:28Z</dc:date>
    <item>
      <title>copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482060#M83415</link>
      <description>hi,&lt;BR /&gt;
&lt;BR /&gt;
I am unable to copy a block from one ACAD drawing to another can any one help me on this.&lt;BR /&gt;
&lt;BR /&gt;
thanks in advance&lt;BR /&gt;
namrata</description>
      <pubDate>Wed, 09 Nov 2005 12:09:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482060#M83415</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-09T12:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482061#M83416</link>
      <description>cut and paste it?&lt;BR /&gt;
&lt;BR /&gt;
&lt;NAMRATA.NEKKANTI&gt; wrote in message news:5007941@discussion.autodesk.com...&lt;BR /&gt;
hi,&lt;BR /&gt;
&lt;BR /&gt;
I am unable to copy a block from one ACAD drawing to another can any one &lt;BR /&gt;
help me on this.&lt;BR /&gt;
&lt;BR /&gt;
thanks in advance&lt;BR /&gt;
namrata&lt;/NAMRATA.NEKKANTI&gt;</description>
      <pubDate>Wed, 09 Nov 2005 18:42:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482061#M83416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-09T18:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482062#M83417</link>
      <description>yah copy and paste using dot net API&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
regards,&lt;BR /&gt;
namrata</description>
      <pubDate>Thu, 10 Nov 2005 04:43:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482062#M83417</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-10T04:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482063#M83418</link>
      <description>Here's an example to start with.&lt;BR /&gt;
&lt;BR /&gt;
   public void CopyBlock(string sourceFileName, string blockName)&lt;BR /&gt;
   {&lt;BR /&gt;
          try&lt;BR /&gt;
          {&lt;BR /&gt;
                 using(Database sourceDatabase =&lt;BR /&gt;
GetDatabaseFromFile(sourceFileName))&lt;BR /&gt;
                 {&lt;BR /&gt;
&lt;BR /&gt;
HostApplicationServices.WorkingDatabase.Insert(blockName, sourceDatabase,&lt;BR /&gt;
false);&lt;BR /&gt;
                 }&lt;BR /&gt;
          }&lt;BR /&gt;
          catch (Autodesk.AutoCAD.Runtime.Exception e)&lt;BR /&gt;
          {&lt;BR /&gt;
                 //Application.ShowAlertDialog(e.Message);&lt;BR /&gt;
          }&lt;BR /&gt;
   }&lt;BR /&gt;
&lt;BR /&gt;
   public Database GetDatabaseFromFile(string fileName)&lt;BR /&gt;
   {&lt;BR /&gt;
          Database databaseFromFile = new Database(false, true);&lt;BR /&gt;
          databaseFromFile.ReadDwgFile(fileName, System.IO.FileShare.None,&lt;BR /&gt;
false, null);&lt;BR /&gt;
          return databaseFromFile;&lt;BR /&gt;
   }&lt;BR /&gt;
&lt;BR /&gt;
--&lt;BR /&gt;
Bobby C. Jones&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;NAMRATA.NEKKANTI&gt; wrote in message news:5007941@discussion.autodesk.com...&lt;BR /&gt;
hi,&lt;BR /&gt;
&lt;BR /&gt;
I am unable to copy a block from one ACAD drawing to another can any one&lt;BR /&gt;
help me on this.&lt;BR /&gt;
&lt;BR /&gt;
thanks in advance&lt;BR /&gt;
namrata&lt;/NAMRATA.NEKKANTI&gt;</description>
      <pubDate>Fri, 11 Nov 2005 18:38:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482063#M83418</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-11T18:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482064#M83419</link>
      <description>this code snippet is giving an eror &lt;BR /&gt;
it says " self refrenced"</description>
      <pubDate>Mon, 14 Nov 2005 07:54:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482064#M83419</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-14T07:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: copy block</title>
      <link>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482065#M83420</link>
      <description>The example I posted probably isn't what you're looking for and if you used&lt;BR /&gt;
it to try and copy a block from a drawing into another with the same name,&lt;BR /&gt;
then I imagine that is the error you would get &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
This is the overload of the Insert method that I think you are after.&lt;BR /&gt;
&lt;BR /&gt;
currentDatabase.Insert(sourceBlockName, destinationBlockName,&lt;BR /&gt;
sourceDatabase, true);&lt;BR /&gt;
&lt;BR /&gt;
However, this is creating two btr's.  The one with the name provided as the&lt;BR /&gt;
sourceBlockName parameter is good, but the one provided as the&lt;BR /&gt;
destinationBlockName is empty and can be purged.  I did a quick search on&lt;BR /&gt;
the ADN site and this was reported a while back.  Like in the R2004&lt;BR /&gt;
timeframe.&lt;BR /&gt;
--&lt;BR /&gt;
Bobby C. Jones&lt;BR /&gt;
http://www.acadx.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;NAMRATA.NEKKANTI&gt; wrote in message news:5011912@discussion.autodesk.com...&lt;BR /&gt;
this code snippet is giving an eror&lt;BR /&gt;
it says " self refrenced"&lt;/NAMRATA.NEKKANTI&gt;</description>
      <pubDate>Mon, 14 Nov 2005 20:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/copy-block/m-p/1482065#M83420</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-11-14T20:58:41Z</dc:date>
    </item>
  </channel>
</rss>

