<?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 convert Plugin to Windows Form in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858222#M14246</link>
    <description>&lt;P&gt;But isn't this still an AutoCAD plug in?&amp;nbsp;&amp;nbsp;When I originally converted the VB6 code to C#, the only using statement I had for AutoCAD was "using AutoCAD;"&amp;nbsp; and I was then able to run my program and it would find the AutoCAD app that was running and I was getting info from the document I had opened.&amp;nbsp; I'm trying to upgrade to the newer method, but maybe it's only for plug ins?&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 21:20:41 GMT</pubDate>
    <dc:creator>gary_kohout</dc:creator>
    <dc:date>2022-01-04T21:20:41Z</dc:date>
    <item>
      <title>How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10851976#M14239</link>
      <description>&lt;P&gt;Hello, kind of a newbie here.&amp;nbsp; I have an old VB6 program that we use to fill out title blocks and print drawings etc. that I'm converting to C#.&amp;nbsp; All of the current examples that I can find are plug ins to type commands on the command line.&amp;nbsp; What I want is a windows form where I can click buttons on the form to interact with AutoCAD.&amp;nbsp; I have played with the plug in code and it works, but how can I convert it to a windows form rather than a program?&amp;nbsp; Are there some samples out there showing this using "ObjectARX"?&amp;nbsp; All of the samples using a Windows Form that I have found are old where they only have one using statement for AutoCAD "using AutoCAD;"&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 19:43:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10851976#M14239</guid>
      <dc:creator>gary_kohout</dc:creator>
      <dc:date>2021-12-31T19:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10852081#M14240</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you might start here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://through-the-interface.typepad.com/through_the_interface/2015/09/creating-an-autocad-palette-dynamically-to-launch-commands-and-methods-tagged-using-net.html" target="_blank"&gt;https://through-the-interface.typepad.com/through_the_interface/2015/09/creating-an-autocad-palette-dynamically-to-launch-commands-and-methods-tagged-using-net.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This shows a user-control used inside an AutoCAD palette.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 22:32:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10852081#M14240</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2021-12-31T22:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10852094#M14241</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You can have a look at &lt;A href="https://gilecad.azurewebsites.net/UserInterfaces_en.aspx" target="_blank" rel="noopener"&gt;this little tutorial&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 22:54:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10852094#M14241</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2021-12-31T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857527#M14242</link>
      <description>&lt;P&gt;Thanks guys, still can't get it going.&amp;nbsp; I'm sure it' a very simple issue I'm missing.&amp;nbsp; Here's the code I have right now.&amp;nbsp; Just trying to get to the items in the "Block table" so I can get to the title blocks in model space.&amp;nbsp; Can't figure out how to grab the active document that I have opened in AutoCAD.&amp;nbsp; Keeps telling me it detected an invalid program...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="garykohout_0-1641310620777.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1007325iBC7B76CA7EFD0D13/image-size/medium?v=v2&amp;amp;px=400" role="button" title="garykohout_0-1641310620777.png" alt="garykohout_0-1641310620777.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcApp = Autodesk.AutoCAD.ApplicationServices.Application;

namespace ACADTest2
{
    public partial class Form1 : Form
    {
     
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Document acDoc;
            acDoc = AcApp.DocumentManager.MdiActiveDocument;
            Database db = HostApplicationServices.WorkingDatabase;
            Transaction trans = db.TransactionManager.StartTransaction();

            BlockTable blkTbl = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
            BlockTableRecord msBlkRec = trans.GetObject(blkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 15:38:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857527#M14242</guid>
      <dc:creator>gary_kohout</dc:creator>
      <dc:date>2022-01-04T15:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857707#M14243</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Your issue does not seem to be related to the Windows Form API.&lt;/P&gt;
&lt;P&gt;Did you start from a working AutoCAD plug-in with a simple CommandMethod?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 16:48:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857707#M14243</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2022-01-04T16:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857888#M14244</link>
      <description>&lt;P&gt;Yes, I started with some training I found online.&amp;nbsp; This code works.&amp;nbsp; When I run it, AutoCAD starts, then I type "netload" then have to select a dll name "AU.dll".&amp;nbsp; The I type in "myfirstline" and it draws the line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

namespace AU.MySoftware
{
    public class Initialization : IExtensionApplication
    {
        #region Commands

        [CommandMethod("MyFirstLine")]
        public void cmdMyFirst()
        {
            Database db = HostApplicationServices.WorkingDatabase;
            Transaction trans = db.TransactionManager.StartTransaction();

            BlockTable blkTbl = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
            BlockTableRecord msBlkRec = trans.GetObject(blkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

            Point3d pnt1 = new Point3d(0, 0, 0);
            Point3d pnt2 = new Point3d(10, 10, 0);

            Line lineObj = new Line(pnt1, pnt2);
            msBlkRec.AppendEntity(lineObj);
            trans.AddNewlyCreatedDBObject(lineObj, true);
            trans.Commit();
        }

        #endregion


        #region Initialization

        void IExtensionApplication.Initialize()
        {

        }

        void IExtensionApplication.Terminate()
        {

        }
        #endregion

    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:07:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10857888#M14244</guid>
      <dc:creator>gary_kohout</dc:creator>
      <dc:date>2022-01-04T18:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858040#M14245</link>
      <description>&lt;P&gt;So, then you can add a new item to your project (a Windows Form) and make interaction within the dialog&amp;nbsp; box (Windows form) and the command class (AutoCAD plugin as shown &lt;A href="https://gilecad.azurewebsites.net/UserInterfaces_en.aspx#modalWinForm" target="_blank" rel="noopener"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS: you should not have CommandMethod in a class implementing IExtensionApplication overall if the Initialize and Terminate methods are empty.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 19:36:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858040#M14245</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2022-01-04T19:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858222#M14246</link>
      <description>&lt;P&gt;But isn't this still an AutoCAD plug in?&amp;nbsp;&amp;nbsp;When I originally converted the VB6 code to C#, the only using statement I had for AutoCAD was "using AutoCAD;"&amp;nbsp; and I was then able to run my program and it would find the AutoCAD app that was running and I was getting info from the document I had opened.&amp;nbsp; I'm trying to upgrade to the newer method, but maybe it's only for plug ins?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 21:20:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858222#M14246</guid>
      <dc:creator>gary_kohout</dc:creator>
      <dc:date>2022-01-04T21:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858256#M14247</link>
      <description>&lt;P&gt;The AutoCAD .NET API only runs "in-process" (i.e. a netloaded plugin).&lt;BR /&gt;Read &lt;A href="https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-C8C65D7A-EC3A-42D8-BF02-4B13C2EA1A4B" target="_blank" rel="noopener"&gt;this topic&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 21:47:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10858256#M14247</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2022-01-04T21:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert Plugin to Windows Form</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10859494#M14248</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; That clears up a lot of my confusion.&amp;nbsp; Really appreciate your help!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 13:36:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-convert-plugin-to-windows-form/m-p/10859494#M14248</guid>
      <dc:creator>gary_kohout</dc:creator>
      <dc:date>2022-01-05T13:36:14Z</dc:date>
    </item>
  </channel>
</rss>

