<?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 : how to work in differet Autocad version? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6229798#M36678</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To overcome the COM / ActiveX API versions dependency, a simple way is to use late binding with the 'dynamic' type (requires .NET Framework 4.0 or later).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you think your app is ready to be deployed, make a bakup by copying the whole solution.&lt;/P&gt;
&lt;P&gt;In the deployment solution, remove all references to the COM / ActiveX libraries, all using directive to Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common.&lt;/P&gt;
&lt;P&gt;Then correct all unknown type errors by replacing COM types with dynamic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. replace:&lt;/P&gt;
&lt;PRE&gt;AcadApplication acadApp = (AcadApplication)Application.AcadApplication;
AcadDocument acDoc = acadApp.ActiveDocument;
AcadModelSpace modelSpace = acDoc.ModelSpace;&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;dynamic acadApp = Application.AcadApplication;
dynamic acDoc = acadApp.ActiveDocument;
dynamic modelSpace = acDoc.ModelSpace;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2016 07:20:52 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2016-03-23T07:20:52Z</dc:date>
    <item>
      <title>how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6229641#M36677</link>
      <description>&lt;P&gt;hi everybody. i used C#&amp;nbsp;with activex in autocad2016. how to depeloy to different autocad version?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 02:54:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6229641#M36677</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-23T02:54:22Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6229798#M36678</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To overcome the COM / ActiveX API versions dependency, a simple way is to use late binding with the 'dynamic' type (requires .NET Framework 4.0 or later).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you think your app is ready to be deployed, make a bakup by copying the whole solution.&lt;/P&gt;
&lt;P&gt;In the deployment solution, remove all references to the COM / ActiveX libraries, all using directive to Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common.&lt;/P&gt;
&lt;P&gt;Then correct all unknown type errors by replacing COM types with dynamic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;e.g. replace:&lt;/P&gt;
&lt;PRE&gt;AcadApplication acadApp = (AcadApplication)Application.AcadApplication;
AcadDocument acDoc = acadApp.ActiveDocument;
AcadModelSpace modelSpace = acDoc.ModelSpace;&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;dynamic acadApp = Application.AcadApplication;
dynamic acDoc = acadApp.ActiveDocument;
dynamic modelSpace = acDoc.ModelSpace;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 07:20:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6229798#M36678</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-23T07:20:52Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231676#M36679</link>
      <description>&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;like this one how to replace?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AcadMLeader myMLeader;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myMLeader.TextRightAttachmentType = AcTextAttachmentType.acAttachmentBottomOfBottom;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i replace them like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dynamic myMLeader;&lt;/P&gt;&lt;P&gt;myMLeader.TextRightAttachmentType = AcTextAttachmentType.acAttachmentBottomOfBottom;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but AcTextAttachmentType.acAttachmentBottomOfBottom&amp;nbsp;is error.&amp;nbsp;how to replace by dynamic?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 01:08:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231676#M36679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-24T01:08:04Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231898#M36680</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As you certainly know each item in a enumeration (AcTextAttachmentType is a n enum) has an integer value. You can use this integer value instead of the enum item name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get the enum integer values (and replace them) before removing COM references with the inellisense (or the object browser):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/226829i11403D5B31A928F0/image-size/original?v=lz-1&amp;amp;px=-1" alt="AcTextAttchmentType.png" title="AcTextAttchmentType.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;so, replace:&lt;/P&gt;
&lt;PRE&gt;AcadMLeader yourMLeader;

yourMLeader.TextRightAttachmentType = 
    AcTextAttachmentType.acAttachmentBottomOfBottom;&lt;/PRE&gt;
&lt;P&gt;with:&lt;/P&gt;
&lt;PRE&gt;dynamic yourMLeader;

yourMLeader.TextRightAttachmentType = 6;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Mar 2016 07:16:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231898#M36680</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-24T07:16:25Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231912#M36681</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;it is good! i want to use yourMLeader.TextRightAttachmentType = 6; in early binding, because it is easy to transeform to late binding. but it is error. how to do except of yourMLeader.TextRightAttachmentType =AcTextAttachmentType.acAttachmentBottomOfBottom; in early binding?</description>
      <pubDate>Thu, 24 Mar 2016 07:30:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231912#M36681</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-24T07:30:55Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231915#M36682</link>
      <description>&lt;P&gt;Try with an explicit cast:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;yourMLeader.TextRightAttachmentType = (AcTextAttachmentType)6;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Mar 2016 07:36:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6231915#M36682</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-03-24T07:36:46Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6233801#M36683</link>
      <description>It is ok. Thank you very much!!</description>
      <pubDate>Fri, 25 Mar 2016 01:39:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6233801#M36683</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-25T01:39:49Z</dc:date>
    </item>
    <item>
      <title>Re : how to work in differet Autocad version?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6233870#M36684</link>
      <description>&lt;P&gt;Hi,there are another problem when i create region. this work well in early binding.&lt;/P&gt;&lt;P&gt;AcadCircle[] circleObj = new AcadCircle[1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;double[] calpt = new double[3];&lt;/P&gt;&lt;P&gt;calpt[0] = 0; calpt[1] = 0; calpt[2] = 0;&lt;/P&gt;&lt;P&gt;circleObj[0] = AcadDoc.ModelSpace.AddCircle(calpt, 5);&lt;/P&gt;&lt;P&gt;// create region&lt;/P&gt;&lt;P&gt;object[] regionObject;&lt;/P&gt;&lt;P&gt;regionObject = (object[])AcadDoc.ModelSpace.AddRegion(circleObj);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when i transfer to late binding like this, it is show "&amp;nbsp;&lt;SPAN&gt;Invalid Object Array"&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dynamic[] circleObj = new dynamic[1];&lt;/P&gt;&lt;P&gt;double[] calpt = new double[3];&lt;/P&gt;&lt;P&gt;calpt[0] = 0; calpt[1] = 0; calpt[2] = 0;&lt;/P&gt;&lt;P&gt;circleObj[0] = AcadDoc.ModelSpace.AddCircle(calpt, 5);&lt;/P&gt;&lt;P&gt;// create region&lt;/P&gt;&lt;P&gt;object[] regionObject;&lt;/P&gt;&lt;P&gt;regionObject = (object[])AcadDoc.ModelSpace.AddRegion(circleObj); //this can't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to do it?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2016 04:06:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-work-in-differet-autocad-version/m-p/6233870#M36684</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-25T04:06:55Z</dc:date>
    </item>
  </channel>
</rss>

