<?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: Invalid Object Array exception while calling CopyObjects in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4418045#M47782</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Dim myBlock As AcadBlock&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You already binding it early. This is nto what I am looking for. The objective was to use both parameters of CopyObject as Late Binding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all this is required to detect INstalled AutoCad copy on Machine because I don't want to compile code for different versions of AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make a single piece of code working for all versions of AutoCAD?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2013 14:47:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-09-11T14:47:03Z</dc:date>
    <item>
      <title>Invalid Object Array exception while calling CopyObjects</title>
      <link>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4405461#M47780</link>
      <description>&lt;P&gt;I am getting Invalid&lt;STRONG&gt; Object array error&lt;/STRONG&gt; on following line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;oSourceFile.CopyObjects(objCollection, m_oActiveDoc.Blocks);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Code is given below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://pastie.org/8304282"&gt;http://pastie.org/8304282&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2013 21:01:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4405461#M47780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-06T21:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Object Array exception while calling CopyObjects</title>
      <link>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4417689#M47781</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code that worked ok.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        If oAcadApp IsNot Nothing Then
            Dim oActiveDoc As AcadDocument
            oActiveDoc = oAcadApp.ActiveDocument

            Dim oSourceDoc As AcadDocument
            oSourceDoc = Nothing

            For Each oDoc As AcadDocument In oAcadApp.Documents
                If ("C:\Temp\Test.dwg").ToUpper() = oDoc.FullName.ToUpper() Then
                    oSourceDoc = oDoc
                    Exit For
                End If
            Next

            If oSourceDoc IsNot Nothing Then

                ' Get the block to copy
                Dim myBlock As AcadBlock
                myBlock = oSourceDoc.Blocks.Item("Test")

                ' Gather the entities in the block to copy
                Dim objects(0 To myBlock.Count - 1) As AcadEntity
                Dim i As Integer
                i = 0
                For Each obj In myBlock
                    objects(i) = obj
                    i = i + 1
                Next obj

                ' Copy the block from the source to the active drawing
                ' Add a new block
                Dim newBlock As AcadBlock
                newBlock = oActiveDoc.Blocks.Add(myBlock.Origin, myBlock.Name)

                ' Copy the objects to the new block
                oSourceDoc.CopyObjects(objects, newBlock)

            End If
        End If&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that the collection of objects to the "CopyObjects" method is a collection of AcadEntity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2013 12:26:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4417689#M47781</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-09-11T12:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Object Array exception while calling CopyObjects</title>
      <link>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4418045#M47782</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Dim myBlock As AcadBlock&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You already binding it early. This is nto what I am looking for. The objective was to use both parameters of CopyObject as Late Binding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all this is required to detect INstalled AutoCad copy on Machine because I don't want to compile code for different versions of AutoCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I make a single piece of code working for all versions of AutoCAD?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2013 14:47:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4418045#M47782</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-09-11T14:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Object Array exception while calling CopyObjects</title>
      <link>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4419943#M47783</link>
      <description>&lt;P&gt;Sorry, I do not find any way to do that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "CopyObjects" method does not work with an Object array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2013 04:47:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/invalid-object-array-exception-while-calling-copyobjects/m-p/4419943#M47783</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-09-12T04:47:07Z</dc:date>
    </item>
  </channel>
</rss>

