<?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: Want to have C# program to modify DWG and save into DWG format in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440985#M6260</link>
    <description>&lt;P&gt;Thanks for the response. It's my bad that i did it in Windows form application. Now I am able to do the same thing in Class library (.NET Framework 4.7), and did the netload in AutoCAD. And then able to do the command in Autocad. I am not receiving any error, as per program it is adding some MText into DWG file and saves it. However, when i open that saved file in Autocad, not able to see that added text. How to check it? It would be good if below questions are clarified as well. 1. How to do the same thing through Windows form Application (.NET Framework). 2. Is it possible to modify and save DWG file withoutAutoCAD installation? I see something like RealDWG, which is subset of Autodesk ObjetARX? Need more clarity on this. Can I use .net core windows application as well to do the same? Please throw some light here to proceed further&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Dec 2023 14:01:20 GMT</pubDate>
    <dc:creator>vsraman85</dc:creator>
    <dc:date>2023-12-14T14:01:20Z</dc:date>
    <item>
      <title>Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438727#M6248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have installed the trail version of AutoCAD and ObjectARX SDK. My objective is to write a C# program to read DWG file, do some modifications, and then save it as another DWG file. I referenced autodesk dll's as per documentation, but program throws a Common Language Runtime error. Can anyone please throw some light on this?I am using Visual Studio 2022. Please suggest what kid of template i need to use for this as well?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 14:12:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438727#M6248</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T14:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438814#M6249</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;It is very difficult (if not impossible) to diagnoze without seeing the code which throws the error.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 14:35:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438814#M6249</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-12-13T14:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438959#M6250</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using Visual studio 2022. tried the same code as Class library, Windows form application (.net framework 4.7).&lt;/P&gt;&lt;P&gt;Here you go with my code in C#.&lt;/P&gt;&lt;P&gt;1. Created winodws form application with C# template in Visual studio.&lt;/P&gt;&lt;P&gt;2. Target framework as .net framework 4.7&lt;/P&gt;&lt;P&gt;3. Added below autodesk reference.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_1-1702481379180.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304368i00558D79BB23AEBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_1-1702481379180.png" alt="vsraman85_1-1702481379180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. Build is succeeded without any error.&lt;/P&gt;&lt;P&gt;5. The moment when i run, it has started throwing below error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_0-1702481239821.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304365i069F9CBBB7958C7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_0-1702481239821.png" alt="vsraman85_0-1702481239821.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note : The same error was throwing in document line, hence i commented those lines but it has started throwing in transaction lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Class Library&lt;/P&gt;&lt;P&gt;1. Same code is tried in Class library.&lt;/P&gt;&lt;P&gt;2. Build is success.&lt;/P&gt;&lt;P&gt;3. Opened the AutoCAD application, in command prompt, entered netload.&lt;/P&gt;&lt;P&gt;4. Selected my class library dll. no error, success till to this point.&lt;/P&gt;&lt;P&gt;5. In my program, i have a command method "ModifyDWG", hence I typed it in command prompt, AutoCAD is not regnoizing that command and nothing is happening.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_2-1702481699519.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304373i78F986DCC9BCE857/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_2-1702481699519.png" alt="vsraman85_2-1702481699519.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:36:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438959#M6250</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T15:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438980#M6251</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using Visual studio 2022. tried the same code as Class library, Windows form application (.net framework 4.7).&lt;/P&gt;&lt;P&gt;Here you go with my code in C#.&lt;/P&gt;&lt;P&gt;1. Created winodws form application with C# template in Visual studio.&lt;/P&gt;&lt;P&gt;2. Target framework as .net framework 4.7&lt;/P&gt;&lt;P&gt;3. Added below autodesk reference.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_1-1702481379180.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304368i00558D79BB23AEBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_1-1702481379180.png" alt="vsraman85_1-1702481379180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;4. Build is succeeded without any error.&lt;/P&gt;&lt;P&gt;5. The moment when i run, it has started throwing below error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_0-1702481239821.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304365i069F9CBBB7958C7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_0-1702481239821.png" alt="vsraman85_0-1702481239821.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Note : The same error was throwing in document line, hence i commented those lines but it has started throwing in transaction lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Class Library&lt;/P&gt;&lt;P&gt;1. Same code is tried in Class library.&lt;/P&gt;&lt;P&gt;2. Build is success.&lt;/P&gt;&lt;P&gt;3. Opened the AutoCAD application, in command prompt, entered netload.&lt;/P&gt;&lt;P&gt;4. Selected my class library dll. no error, success till to this point.&lt;/P&gt;&lt;P&gt;5. In my program, i have a command method "ModifyDWG", hence I typed it in command prompt, AutoCAD is not regnoizing that command and nothing is happening.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_2-1702481699519.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304373i78F986DCC9BCE857/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_2-1702481699519.png" alt="vsraman85_2-1702481699519.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:40:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12438980#M6251</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T15:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439020#M6252</link>
      <description>&lt;P&gt;If you want to be able to use the AutoCAD .NET API, you have to build a DLL (class library) and netload it from a running session of AutoCAD&amp;nbsp; (with a Windows application (exe) you have to use the COM API).&lt;/P&gt;
&lt;P&gt;You can start from &lt;A href="https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-BA686431-C8BF-49F2-946E-9CEB2F7AE4FA" target="_blank" rel="noopener"&gt;this topic&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 15:56:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439020#M6252</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-12-13T15:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439039#M6253</link>
      <description>&lt;P&gt;Thanks. But class library netload is also not working with same code. Can I get any sample code for reading, modifying and saving as new DWG in C#?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 16:03:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439039#M6253</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T16:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439167#M6254</link>
      <description>&lt;P&gt;Here's a generic example which takes a delegate (Action&amp;lt;Database&amp;gt;) as argument.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;public static void ProcessDwg(string fileName, Action&amp;lt;Database&amp;gt; action)
{
    try
    {
        using (var db = new Database(false, true))
        {
            db.ReadDwgFile(fileName, FileOpenMode.OpenForReadAndAllShare, false, null);
            action(db);
            db.SaveAs(fileName, DwgVersion.Current);
        }
    }
    catch (System.Exception ex)
    {
        var ed = Application.DocumentManager.MdiActiveDocument.Editor;
        ed.WriteMessage($"\nError with '{fileName}': {ex.Message}");
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your example:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;private static void AddMText(Database db)
{
    using (var tr = db.TransactionManager.StartTransaction())
    {
        var modelSpace = (BlockTableRecord)tr.GetObject(
            SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForWrite);
        var mtext = new MText()
        {
            Location = new Point3d(2, 2, 0),
            Contents = "added text in a closed .dwg file!"
        };
        modelSpace.AppendEntity(mtext);
        tr.AddNewlyCreatedDBObject(mtext, true);
        tr.Commit();
    }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doing so, you can test the AddMtext method in the current database and/or pass it to ProcessDwg.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;ProcesDwg(filename, AddMtext);&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Dec 2023 16:49:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439167#M6254</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-12-13T16:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439905#M6255</link>
      <description>&lt;P&gt;A minor embellishment to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;'s example, which may be necessary in certain circumstances:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public static class Unnamed
{
   public static void ProcessDwg(string fileName, Action&amp;lt;Database&amp;gt; action)
   {
      try
      {
         using(var db = new Database(false, true))
         {
            db.ReadDwgFile(fileName, FileOpenMode.OpenForReadAndAllShare, false, null);
            using(new WorkingDatabase(db))
            {
               action(db);
               db.SaveAs(fileName, DwgVersion.Current);
            }
         }
      }
      catch(System.Exception ex)
      {
         var ed = Application.DocumentManager.MdiActiveDocument.Editor;
         ed.WriteMessage($"\nError with '{fileName}': {ex.Message}");
      }
   }
}

public class WorkingDatabase : IDisposable
{
   Database previous;

   public WorkingDatabase(Database newWorkingDb)
   {
      if(newWorkingDb == null)
         throw new ArgumentNullException(nameof(newWorkingDb));
      Database current = HostApplicationServices.WorkingDatabase;
      if(newWorkingDb != current)
      {
         previous = current;
         HostApplicationServices.WorkingDatabase = newWorkingDb;
      }
   }

   public void Dispose()
   {
      if(previous != null)
      {
         HostApplicationServices.WorkingDatabase = previous;
         previous = null;
      }
   }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 22:28:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12439905#M6255</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2023-12-13T22:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440029#M6256</link>
      <description>&lt;P&gt;I have tried the above said coding, ended up with the same error again.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_0-1702511472727.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304567i7F136134C6E3537B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_0-1702511472727.png" alt="vsraman85_0-1702511472727.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 23:51:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440029#M6256</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T23:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440031#M6257</link>
      <description>&lt;P&gt;I have tried the same, ended with same existing error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vsraman85_0-1702511522562.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1304568iBBA462D0DFBD5839/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vsraman85_0-1702511522562.png" alt="vsraman85_0-1702511522562.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Dec 2023 23:52:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440031#M6257</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-13T23:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440271#M6258</link>
      <description>&lt;P&gt;You show a screenshot but it does not show the exception message or stacktrace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 03:33:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440271#M6258</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2023-12-14T03:33:35Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440293#M6259</link>
      <description>&lt;P&gt;If "...with the same existing error" means the "common Language runtime error" described in your original post, it means:&lt;BR /&gt;You write/run the code in wrong project type. Is it .NET Framework 4.x class library? if yes, do you run AutoCAD and "netload" the DLL into AutoCAD, then enter the command declared by [CommandMethod("XXX")] attribute? Or, have you set the "Copy Local" to False for the 3 AutoCAD .NET API DLLs? Or, your project is .NET Core (.NET 5, 6, 7, or 8 class library. Of course, if you still try to run do an EXE app, it will not work, as &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt; has pointed out earlier.&lt;BR /&gt;&lt;BR /&gt;You probably need to show/describe how you start the class library project.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 04:04:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440293#M6259</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-12-14T04:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440985#M6260</link>
      <description>&lt;P&gt;Thanks for the response. It's my bad that i did it in Windows form application. Now I am able to do the same thing in Class library (.NET Framework 4.7), and did the netload in AutoCAD. And then able to do the command in Autocad. I am not receiving any error, as per program it is adding some MText into DWG file and saves it. However, when i open that saved file in Autocad, not able to see that added text. How to check it? It would be good if below questions are clarified as well. 1. How to do the same thing through Windows form Application (.NET Framework). 2. Is it possible to modify and save DWG file withoutAutoCAD installation? I see something like RealDWG, which is subset of Autodesk ObjetARX? Need more clarity on this. Can I use .net core windows application as well to do the same? Please throw some light here to proceed further&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 14:01:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12440985#M6260</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-14T14:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12441760#M6261</link>
      <description>&lt;P&gt;I am able to doexecute the code in class library. But how should i do the same with windows form application? Can i use .net core or .net framework only allowed?&amp;nbsp; Where can i get sample code and steps to do this? If i am using .net windows application, should autocad to be installed in that machine? what is RealDWG? how can i use it?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 17:35:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12441760#M6261</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-14T17:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12441814#M6262</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;has already answered you (message 4 of this thread): AutoCAD .NET API assemblies CANNOT be used outside AutoCAD process (e.g. not in an EXE app). You cannot manipulate DWG File without using AutoCAD (except for using RealDwg SDK. However, judging by your questions, you seems do not know much in depth about AutoCAD/AutoCAD drawing, so, I'd say do not bother RealDwg).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use an EXE (.NET Framework, or .NET Core, not much difference) to automate AutoCAD application (desktop) via AutoCAD COM API, but it is a bad solution in most cases, because the user has to face/deal with 2 desktop apps, while the task can most likely be done by just run AutoCAD with properly designed .NET API plugins.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your objectives is to prepare a drawing file before handling it for user to work with in AutoCAD and want to do the preparation at backend, you still need AutoCAD of some forms: either AutoCAD console, or AutoCAD online (Autodesk's Platform Cloud Services, which is basically AutoCAD console in the cloud). However, you still need to learn how to program AutoCAD .NET API plugin, before you can use AutoCAD console/Platform Services meaningfully. Once you can do .NET API plugin well, thus know how to manipulate drawing database/file well, you may one day look into the possibility of using RealDwg SDK (quite expensive) for your solution, because the code to deal with drawing database/file are mostly the same. Again, in the "everything is online" era, using cloud services would much simple/easier, and cheaper solution than licensing RealDwg to try build your own "mini AutoCAD" to deal with DWG file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 17:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12441814#M6262</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-12-14T17:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12443642#M6263</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the clarification. Where can I download and how can i use Autodesk COM API for windows application EXE?&lt;/P&gt;&lt;P&gt;And also I don't see any separate downloadable of RealDWG. Is it part of ObjectARX? How to use it? There is no clear documentations avaialble.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 14:29:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12443642#M6263</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-15T14:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12444155#M6264</link>
      <description>&lt;P&gt;There is nothing to download for using AutoCAD COM API, as long as AutoCAD is installed. If you ever did MS Office App automation (Word, Excel...), automating AutoCAD would be quite similar, but you DO NEED TO know AutoCAD well enough. You can install AutoCAD VBA module and use the Object Browser in AutoCAD VBA IDE to browse/learn AutoCAD COM API object model.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to pay to license RealDwg SDK (quite expensive). Search Autodesk's website for information of how to buy it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not knowing what your objectives are/what you want to do, and feel that you do not know AutoCAD programming well enough, I can only say, trying to build EXE (desktop?) to automate another heavy desktop app (AutoCAD) would be one of the worst solutions among all possible ones, if not the worst one, in most cases. I'd also think it is waste time to look into RealDwg before you have deep understanding on AutoCAD programming, IMO.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Dec 2023 17:42:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12444155#M6264</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-12-15T17:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448713#M6265</link>
      <description>&lt;P&gt;Thanks for your response. Yes. I am completely new to this AutoCAD programming, exploring all possible options.&lt;/P&gt;&lt;P&gt;Below is my objective of my POC.&lt;/P&gt;&lt;P&gt;1. I would like to open a DWG file without the help of AutoCAD and wanted to do&amp;nbsp; it programmatically.&lt;/P&gt;&lt;P&gt;2. Do some modifications to the opened DWG file. ( Connecting lines, circles, etc)&lt;/P&gt;&lt;P&gt;3. Save the corrections and create them as a new DWG file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Venkat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 17:37:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448713#M6265</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-18T17:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448845#M6266</link>
      <description>&lt;P&gt;You did not provide the business case/context of why you want to&amp;nbsp; do it "without the help of AutoCAD". So, the simple answer is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, without AutoCAD, you cannot manipulate DWG file, unless you use RealDwg SDK (again, I'd say forget using RealDwg until you are actually programming AutoCAD fluently with either AutoCAD .NET API or ObjectARC C++).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use Autodesk cloud services or host Acad console at your backend services, you could have a solution looking like "without the help of AutoCAD" to the users, but you actually use a remote AutoCAD without UI. Again, you need to be good at AutoCAD programming for choosing this route.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is, if you want to manipulate DWG file, you ALWAYS start from &lt;STRONG&gt;USING&lt;/STRONG&gt; AutoCAD and programming &lt;STRONG&gt;WITH&lt;/STRONG&gt; AutoCAD.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 18:58:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448845#M6266</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-12-18T18:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Want to have C# program to modify DWG and save into DWG format</title>
      <link>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448908#M6267</link>
      <description>&lt;P&gt;Based on some business requirements, we wanted to draw lines, connect objects, add text through programmatically through back services, and save it as DWG.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2023 19:32:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/want-to-have-c-program-to-modify-dwg-and-save-into-dwg-format/m-p/12448908#M6267</guid>
      <dc:creator>vsraman85</dc:creator>
      <dc:date>2023-12-18T19:32:56Z</dc:date>
    </item>
  </channel>
</rss>

