<?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 How to create a dwg file in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9413066#M19940</link>
    <description>&lt;P&gt;I am brand new to AutoCAD programming and am struggling to even get out of the gate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a custom program written in C# that our project engineers can use to graphically build an electrical panel and basic attached utilities (lights, receptacles, etc.). I have the program generating an excel breakdown of the components for purchasing, and a pdf schematic for the PMs to send to the customer. What I would like to do next is auto-generate a dwg file of the schematic for our electrical drafters to open and modify/add to as the specifics of the job require.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, this would happen with a silent instance of AutoCAD instead of a visible instance of the app. I do not want this to be a plug-in for AutoCAD. From my understanding, I am looking for an out-of-process stand alone .exe that will create a new .dwg, insert pre-existing blocks, and newly created objects into the new file, then save the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have dug through dozens of articles on this site, watched dozens of videos, etc. And I am confused as to how I am even supposed to start on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Visual Studio and have already used NuGet to install AutoCAD.Net (and AutoCAD.NET.Core and AutoCAD.NET.Model) which automatically placed references for AcCoreMgd, AcDbMgd, and AcMgd into the project. However, these are stored in the project, and neither referencing the same from the AutoCAD installation location nor the ObjectARX installation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I haven't been able to even get a reference to a running instance of AutoCAD nor create a new instance. The tutorials all seem to be very basic and assume that a plug-in is being created, or a new command is being created to be ran inside of AutoCAD; or they are very complex and don't bother with basic things like properly setting up references for non-plugins or dlls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that I have a decent enough grasp on the object model to build the drawing once I can figure out how to get the app/db/whatever running and linked to?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help with this.&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
    <pubDate>Tue, 31 Mar 2020 19:26:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-03-31T19:26:10Z</dc:date>
    <item>
      <title>How to create a dwg file</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9413066#M19940</link>
      <description>&lt;P&gt;I am brand new to AutoCAD programming and am struggling to even get out of the gate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a custom program written in C# that our project engineers can use to graphically build an electrical panel and basic attached utilities (lights, receptacles, etc.). I have the program generating an excel breakdown of the components for purchasing, and a pdf schematic for the PMs to send to the customer. What I would like to do next is auto-generate a dwg file of the schematic for our electrical drafters to open and modify/add to as the specifics of the job require.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, this would happen with a silent instance of AutoCAD instead of a visible instance of the app. I do not want this to be a plug-in for AutoCAD. From my understanding, I am looking for an out-of-process stand alone .exe that will create a new .dwg, insert pre-existing blocks, and newly created objects into the new file, then save the file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have dug through dozens of articles on this site, watched dozens of videos, etc. And I am confused as to how I am even supposed to start on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Visual Studio and have already used NuGet to install AutoCAD.Net (and AutoCAD.NET.Core and AutoCAD.NET.Model) which automatically placed references for AcCoreMgd, AcDbMgd, and AcMgd into the project. However, these are stored in the project, and neither referencing the same from the AutoCAD installation location nor the ObjectARX installation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I haven't been able to even get a reference to a running instance of AutoCAD nor create a new instance. The tutorials all seem to be very basic and assume that a plug-in is being created, or a new command is being created to be ran inside of AutoCAD; or they are very complex and don't bother with basic things like properly setting up references for non-plugins or dlls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that I have a decent enough grasp on the object model to build the drawing once I can figure out how to get the app/db/whatever running and linked to?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help with this.&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 19:26:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9413066#M19940</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-31T19:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dwg file</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9413254#M19941</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According you need to buil an out of process, you cannot use the AcCoreMgd, AcDbMgd, and AcMgd libraries. You have to use the AutoCAD &lt;A href="https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-36BF58F3-537D-4B59-BEFE-2D0FEF5A4443" target="_blank" rel="noopener"&gt;ActiveX/COM API&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 20:32:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9413254#M19941</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-03-31T20:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dwg file</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415458#M19942</link>
      <description>&lt;P&gt;Gilles,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have looked into what you said, and see that I need to use the ActiveX/Com for my standalone program and then write custom plugins for AutoCAD which I call. There is a help article on this called "Out-of-Process Versus In-Process (.NET)".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This leads me to my next issue. I cannot get the tutorial's includes to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Specifically, the tutorial states to include&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.AutoCAD.Interop;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None of these appear to be in my Visual Studio project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have done the following as suggested in the developer documentation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p"&gt;&lt;FONT color="#808000"&gt;To fully access AutoCAD automation objects from Microsoft Visual Studio® .NET, create references to the following files:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#808000"&gt;The AutoCAD 2019 type library,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;acax23enu.tlb&lt;/EM&gt;, located at C:\Program Files\Common Files\Autodesk Shared.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#808000"&gt;The AutoCAD/ObjectDBX Common 23.0 type library,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;axdb23enu.tlb&lt;/EM&gt;, located at C:\Program Files\Common Files\Autodesk Shared&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have looked on this forum and found TONS of problems with interop includes. I have tried most of the suggested solutions.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have referenced the COM type Libraries (AutoCAD 2019 Type Library and AutoCAD/ObjectDBX Common 23.0 Type Library).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have downloaded the ObjectArX and linked to their .tlb files.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;I have verified that Copy Local is set to false.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Nothing allows me to include Autodesk.AutoCAD.Interop.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;What is really confusing is that when I click on the AutoCAD reference the path is given as "C:\Users\mknopp\source\repos\AutoCADAutomationActiveX\obj\Debug\Interop.AutoCAD.dll". So, the dll is seemingly there.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Any help with how I need to go about getting the includes would be greatly appreciated.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Thank you,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Michael&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 17:18:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415458#M19942</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-01T17:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dwg file</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415709#M19943</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;First, you probably do not need create a .NET plugin as shown in the "Out-of-Process Versus In-Process (.NET)" article, and can do all your stuff using the AutoCAD ActiveX/COM API.&lt;/P&gt;
&lt;P&gt;To reference the AutoCAD.Interop libraries browse to ObjectARX 2019\inc-x64 and select Autodesk.AutoCAD.Interop.dll and Autodesk.AutoCAD.Interop.Common.dll.&lt;/P&gt;
&lt;P&gt;This done, you should be able to use ActiveX\COM API.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 18:51:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415709#M19943</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-04-01T18:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a dwg file</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415769#M19944</link>
      <description>&lt;P&gt;Gilles,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That worked perfectly. Thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2020 19:18:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-create-a-dwg-file/m-p/9415769#M19944</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-01T19:18:56Z</dc:date>
    </item>
  </channel>
</rss>

