<?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: Create Toolbar with C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/9408167#M46219</link>
    <description>&lt;P&gt;&lt;SPAN&gt;could you tell me what dlls you used in that project&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 29 Mar 2020 22:44:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-03-29T22:44:06Z</dc:date>
    <item>
      <title>Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4717009#M46208</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have created quite a few AutoCAD commands, but I think it’s a troublesome thing let users remember the shortcuts, I want to create a toolbar for these commands through C# code, I hope someone can provide a simple and detailed tutorial, step by step is the best..&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sincerely thank&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2013 08:56:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4717009#M46208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-27T08:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4717797#M46209</link>
      <description>&lt;P&gt;Toolbars are a big topic. Took me weeks of search and testing to get the following code down. Make of it what you will. Sorry but I'm not explaining it line by line. I encourage you to search the forums, the dev blog and the Through the Interface blog as well.&lt;/P&gt;&lt;P&gt;P.S. the .bmp's are project resourses.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public void RLCui()
    {
      //Coded by: Lev Villanueva (doucedeux@gm**l.com)
      
      Document newDocument = Application.DocumentManager.MdiActiveDocument;
      Database newDatabase = newDocument.Database;

      bool exists = false;
      String mainCUI = Application.GetSystemVariable("MENUNAME").ToString() + ".cuix";      
      CustomizationSection mainCS = new CustomizationSection(mainCUI, false);
      String baseFolder = mainCUI.Replace(mainCS.CUIFileBaseName + ".cuix", "");
      PartialCuiFileCollection newPCFC = mainCS.PartialCuiFiles;
      String cuiFileToSend = "\"" + baseFolder + "RL.cuix" + "\"";
      String test1 = mainCUI.Replace(mainCS.CUIFileBaseName + ".cuix", "RL.cuix");
      if (newPCFC.Contains(mainCUI.Replace(mainCS.CUIFileBaseName + ".cuix", "RL.cuix")))
      {
        if( Forms.MessageBox.Show("CUI already exist.\nDelete?", "CUI Exists", Forms.MessageBoxButtons.YesNo, Forms.MessageBoxIcon.Information, Forms.MessageBoxDefaultButton.Button1, 0) == Forms.DialogResult.No)
          return;
        exists = true;
      }

      Rebars.Properties.Resources.RLQUAD_16.Save(baseFolder + "RLQUAD16.bmp");
      Rebars.Properties.Resources.RLQUAD_32.Save(baseFolder + "RLQUAD32.bmp");
      Rebars.Properties.Resources.RLXREF_16.Save(baseFolder + "RLXREF16.bmp");
      Rebars.Properties.Resources.RLXREF_32.Save(baseFolder + "RLXREF32.bmp");
      Rebars.Properties.Resources.RLSI_16.Save(baseFolder + "RLSI16.bmp");
      Rebars.Properties.Resources.RLSI_32.Save(baseFolder + "RLSI32.bmp");
      Rebars.Properties.Resources.RLOSA_16.Save(baseFolder + "RLOSA16.bmp");
      Rebars.Properties.Resources.RLFILTRAR_16.Save(baseFolder + "RLFILTRAR16.bmp");
      Rebars.Properties.Resources.RLEXPORTAR_16.Save(baseFolder + "RLEXPORTAR16.bmp");

      CustomizationSection newCS = new CustomizationSection();
      newCS.MenuGroupName = "RL";
      
      MacroGroup newMG = new MacroGroup("RLMacros", newCS.MenuGroup);

      MenuMacro newMM1 = new MenuMacro(newMG, "RL Xref", "^C^CRLXREF", "ID_RL_Xref");
      newMM1.macro.SmallImage = baseFolder + "RLXREF16.bmp";
      newMM1.macro.LargeImage = baseFolder + "RLXREF32.bmp";
      newMM1.macro.HelpString = "Anexar plano original bajo determinadas especificaciones";
      newMM1.macro.CLICommand = "RLXREF";
      
      MenuMacro newMM2 = new MenuMacro(newMG, "RL Quadrant", "^C^CRLQUAD", "ID_RL_Quad");
      newMM2.macro.SmallImage = baseFolder + "RLQUAD16.bmp";
      newMM2.macro.LargeImage = baseFolder + "RLQUAD32.bmp";
      newMM2.macro.HelpString = "Crear cuadrante relacionado a una losa";
      newMM2.macro.CLICommand = "RLQUAD";

      MenuMacro newMM3 = new MenuMacro(newMG, "RL si", "^C^CRLSI", "ID_RL_si");
      newMM3.macro.SmallImage = baseFolder + "RLSI16.bmp";
      newMM3.macro.LargeImage = baseFolder + "RLSI32.bmp";
      newMM3.macro.HelpString = "Dibujar refuerzos tipo s e i de una losa";
      newMM3.macro.CLICommand = "RLSI";

      MenuMacro newMM4 = new MenuMacro(newMG, "RLosa", "^C^CRLOSA", "ID_RLOSA");
      newMM4.macro.SmallImage = baseFolder + "RLOSA16.bmp";
      newMM4.macro.HelpString = "Crear refuerzos de losa";
      newMM4.macro.CLICommand = "RLOSA";

      MenuMacro newMM5 = new MenuMacro(newMG, "RL Filtrar", "^C^CRLFILTRAR", "ID_RLFILTRAR");
      newMM5.macro.SmallImage = baseFolder + "RLFILTRAR16.bmp";
      newMM5.macro.HelpString = "Filtrar de entre los refuerzos de losa para su visualización en el plano";
      newMM5.macro.CLICommand = "RLFILTRAR";

      MenuMacro newMM6 = new MenuMacro(newMG, "RL Exportar", "^C^CRLEXPORTAR", "ID_RLEXPORTAR");
      newMM6.macro.SmallImage = baseFolder + "RLEXPORTAR16.bmp";
      newMM6.macro.HelpString = "Exportar refuerzos a archivos de Excel. Se pedirá un nombre para el archivo.";
      newMM6.macro.CLICommand = "RLEXPORTAR";
      
      Toolbar newT = new Toolbar("RL", newCS.MenuGroup);
      ToolbarButton newButton1 = new ToolbarButton("ID_RL_Xref", "RL Xref", newT, -1);
      ToolbarButton newButton2 = new ToolbarButton("ID_RL_Quad", "RL Quadrant", newT, -1);
      ToolbarButton newButton3 = new ToolbarButton("ID_RL_si", "RL si", newT, -1);
      ToolbarButton newButton4 = new ToolbarButton("ID_RLOSA", "RLosa", newT, -1);
      newButton4.DrawSeparator = true;
      ToolbarButton newButton5 = new ToolbarButton("ID_RLFILTRAR", "RL Filtrar", newT, -1);
      ToolbarButton newButton6 = new ToolbarButton("ID_RLEXPORTAR", "RL Exportar", newT, -1);

      newT.ToolbarItems.Add(newButton2);
      newT.ToolbarItems.Add(newButton1);
      newT.ToolbarItems.Add(newButton3);
      newT.ToolbarItems.Add(newButton4);
      newT.ToolbarItems.Add(newButton5);
      newT.ToolbarItems.Add(newButton6);

      StringCollection newSC = new StringCollection();
      int i = 1;
      for (; i &amp;lt; mainCS.MenuGroup.PopMenus.AllAliases.Count; i++)
      {
        if (!mainCS.MenuGroup.PopMenus.AllAliases.Contains("POP" + i.ToString()))
          break;
      }

      newSC.Add("POP" + i.ToString());
      PopMenu newPopMenu = new PopMenu("RL Menu", newSC, "ID_RLPop"   , newCS.MenuGroup);
      PopMenuItem newPMI1 = new PopMenuItem(newMM1, "RL Xref"    , newPopMenu, -1);
      PopMenuItem newPMI2 = new PopMenuItem(newMM2, "RL Quadrant", newPopMenu, -1);
      PopMenuItem newPMI3 = new PopMenuItem(newMM3, "RL si"      , newPopMenu, -1);
      PopMenuItem newPMI4 = new PopMenuItem(newMM4, "RLosa"      , newPopMenu, -1);      
      PopMenuItem newPMI5 = new PopMenuItem(newMM5, "RL Filtrar" , newPopMenu, -1);
      PopMenuItem newPMI6 = new PopMenuItem(newMM6, "RL Exportar", newPopMenu, -1);
      
      newCS.SaveAs(baseFolder + "RL.cuix");
      


      File.Delete(baseFolder + "RLQUAD16.bmp");
      File.Delete(baseFolder + "RLQUAD32.bmp");
      File.Delete(baseFolder + "RLXREF16.bmp");
      File.Delete(baseFolder + "RLXREF32.bmp");
      File.Delete(baseFolder + "RLSI16.bmp");
      File.Delete(baseFolder + "RLSI32.bmp");
      File.Delete(baseFolder + "RLOSA16.bmp");
      File.Delete(baseFolder + "RLFILTRAR16.bmp");
      File.Delete(baseFolder + "RLEXPORTAR16.bmp");           

      Directory.CreateDirectory(baseFolder + "Extended Help");
      System.IO.File.WriteAllText(baseFolder + @"Extended Help\RLEH.xaml", Rebars.Properties.Resources.RLEH);
      Directory.CreateDirectory(baseFolder + @"Extended Help\Images");
      Rebars.Properties.Resources.EH_RLXREF.Save(baseFolder + @"Extended Help\Images\" + "EH_RLXREF.png");
      Rebars.Properties.Resources.EH_RLQUAD.Save(baseFolder + @"Extended Help\Images\" + "EH_RLQUAD.png");
      Rebars.Properties.Resources.EH_RLSI.Save(baseFolder + @"Extended Help\Images\" + "EH_RLSI.png");

      //File.Copy(baseFolder + "RL.cuix", baseFolder + "RL.zip", true);
      
      //Directory.CreateDirectory(baseFolder + "Temp");

      using (ZipFile newZF = new ZipFile(baseFolder + "RL.cuix"))
      {
        ZipEntry newZE = newZF["MenuGroup.cui"];
        newZE.Extract(baseFolder, ExtractExistingFileAction.OverwriteSilently);


        FileStream oldFS = new FileStream(baseFolder + "MenuGroup.cui", FileMode.Open, FileAccess.Read);
        FileStream newFS = new FileStream(baseFolder + "temp.cui", FileMode.Create, FileAccess.Write);
        StreamReader oldSR = new StreamReader(oldFS);
        StreamWriter newSW = new StreamWriter(newFS);
        String line;

        for (int j = 1; j &amp;lt;= 3; j++)
        {
          do
          {
            line = oldSR.ReadLine();
            if (line == null) break;
            newSW.WriteLine(line);
          } while (!line.Contains(@"&amp;lt;CLICommand"));

          if (line != null)
          {
            newSW.WriteLine(@"&amp;lt;ToolTip&amp;gt;");
            newSW.WriteLine(@"&amp;lt;ExtendedContent UriSource=""" + baseFolder + @"Extended Help\RLEH.xaml"" SourceKey=""RLEH_CMD_00" + j.ToString() + @""" /&amp;gt;""");
            newSW.WriteLine(@"&amp;lt;/ToolTip&amp;gt;");
          }
        }

        while ((line = oldSR.ReadLine()) != null)
          newSW.WriteLine(line);

        newSW.Dispose();
        oldSR.Dispose();
        oldFS.Dispose();
        newFS.Dispose();

        File.Delete(baseFolder + "MenuGroup.cui");
        System.IO.File.Move(baseFolder + "temp.cui", baseFolder + "MenuGroup.cui");
        newZF.RemoveEntry("MenuGroup.cui");
        newZF.AddFile(baseFolder + "MenuGroup.cui", @"\");
        newZF.Save();
        //System.IO.File.Move(baseFolder + "temp.zip", baseFolder + "RL.cuix");
        File.Delete(baseFolder + "MenuGroup.cui");
      }

      object oldCmdEcho = Application.GetSystemVariable("CMDECHO");
      object oldFileDia = Application.GetSystemVariable("FILEDIA");
      Application.SetSystemVariable("CMDECHO", 0);
      Application.SetSystemVariable("FILEDIA", 0);
      if (exists)
        newDocument.SendStringToExecute("_.cuiunload " + "RL" + " ", false, false, false);

      newDocument.SendStringToExecute("_.cuiload " + cuiFileToSend + " ", false, false, false);
      newDocument.SendStringToExecute("(setvar \"FILEDIA\" " + oldFileDia.ToString() + ")(princ) ", false, false, false);
      newDocument.SendStringToExecute("(setvar \"CMDECHO\" " + oldCmdEcho.ToString() + ")(princ) ", false, false, false);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2013 17:40:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4717797#M46209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-27T17:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4718011#M46210</link>
      <description>&lt;P&gt;Read this:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf"&gt;http://forums.autodesk.com/autodesk/attachments/autodesk/152/26712/1/CP205-2_Mike_Tuersley.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can change VB.Net to C# with a conversor:&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://www.developerfusion.com/tools/convert/vb-to-csharp/"&gt;http://www.developerfusion.com/tools/convert/vb-to-csharp/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2013 20:38:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4718011#M46210</guid>
      <dc:creator>joantopo</dc:creator>
      <dc:date>2013-12-27T20:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4718997#M46211</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; I don’t want a Docking Palette, just Toolbar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; For example, draw a line, there is sample code, so I study it will be very convenient&lt;BR /&gt;&amp;nbsp;&amp;nbsp; There also should be sample code for how to creat a very simple Toolbar, and have a button, and the button can execute a esay function, just like output a string.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; I hope to find a such sample code,&amp;nbsp;then I can start easily&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Sincerely thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2013 17:07:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4718997#M46211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-28T17:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719023#M46212</link>
      <description>&lt;P&gt;&lt;IMG align="center" alt="ToolBar.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/75993i20B2A3805F5CA036/image-size/original?v=mpbl-1&amp;amp;px=-1" title="ToolBar.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Just like this Toolbar, First I want to know&amp;nbsp;how&amp;nbsp;to creat a simplest toolbar that just have one button, click this button just output "Hello"&lt;/P&gt;&lt;P&gt;&amp;nbsp;I need more help, clear and easy, thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Dec 2013 17:46:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719023#M46212</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-28T17:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719029#M46213</link>
      <description>Any reason why not creating a Ribbon Panel?&lt;BR /&gt;The Toolbar technology is a relic from the old days.&lt;BR /&gt;You find more samples creating Ribbon style menu's.&lt;BR /&gt;</description>
      <pubDate>Sat, 28 Dec 2013 17:51:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719029#M46213</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2013-12-28T17:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719069#M46214</link>
      <description>&lt;P&gt;Just create a partial CUI and create your commands then you can just drag them on Ribbon Panels, Menus, Toolbars, etc.......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" alt="cui.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/76001i1F43877841A73312/image-size/original?v=mpbl-1&amp;amp;px=-1" title="cui.PNG" /&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;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" alt="acadcui.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/76003i1990283372F5E300/image-size/original?v=mpbl-1&amp;amp;px=-1" title="acadcui.PNG" /&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;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;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;</description>
      <pubDate>Sat, 28 Dec 2013 19:33:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4719069#M46214</guid>
      <dc:creator>jeff</dc:creator>
      <dc:date>2013-12-28T19:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4722521#M46215</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; I hope interface and functionality together, but as I demonstrate below, I only know a way to separate treatment. I want to some friends can help me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Achieve functional&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Below is a very simple command written in C #, Just only need be compiled into dll file, and then enter NETLOAD load the dll file from AutoCAD, and enter HW from a command prompt, it will output “Hello World”&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
[assembly: CommandClass(typeof(MyNameSpace.HelloWorld))]
namespace MyNameSpace
{
class HelloWorld
    {
        [CommandMethod("HW")]
        public void hello()
        {
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;
            acDoc.Editor.WriteMessage("\nHello World");
        }
    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Automatically loaded&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Below method copy from AutoCAD. NET Developer's Guide directly,It let the program to get automatic loading function&lt;/P&gt;&lt;PRE&gt;public void RegisterMyApp()
{
  string sProdKey = HostApplicationServices.Current.RegistryProductRootKey;
  string sAppName = "MyApp";
  RegistryKey regAcadProdKey = Registry.CurrentUser.OpenSubKey(sProdKey);
  RegistryKey regAcadAppKey = regAcadProdKey.OpenSubKey("Applications", true);
  string[] subKeys = regAcadAppKey.GetSubKeyNames();
  foreach (string subKey in subKeys)
  {
      if (subKey.Equals(sAppName))
      {
          regAcadAppKey.Close();
          return;
      }
  }
  string sAssemblyPath = Assembly.GetExecutingAssembly().Location;
  RegistryKey regAppAddInKey = regAcadAppKey.CreateSubKey(sAppName);
  regAppAddInKey.SetValue("DESCRIPTION", sAppName, RegistryValueKind.String);
  regAppAddInKey.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord);
  regAppAddInKey.SetValue("LOADER", sAssemblyPath, RegistryValueKind.String);
  regAppAddInKey.SetValue("MANAGED", 1, RegistryValueKind.DWord);
  regAcadAppKey.Close();
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; Interface Design&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Now I know how to creat commands, how to load, how to load automatically, and finally I intend to design an interface&lt;BR /&gt;&amp;nbsp;&amp;nbsp; But the only way I know is to create . cuix file by Customize User Interface Editor ,add toolbar, buttons, icons, and macros as shown below&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" alt="Customize User Interface Editor.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/76235i71B22DD672A290F9/image-size/original?v=mpbl-1&amp;amp;px=-1" title="Customize User Interface Editor.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I recall myToolbar, then click the only button with mouse, the program is executed HW command as follows&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" alt="nameSpace.PNG" border="0" src="https://forums.autodesk.com/t5/image/serverpage/image-id/76237i5753C9A26091F963/image-size/original?v=mpbl-1&amp;amp;px=-1" title="nameSpace.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; but there is a problem, the interface file. cuix and functional document .dll are two files, the user needs to load separately, do not feel good&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; I'm wondering how I deal with the above problems&lt;BR /&gt;&amp;nbsp;&amp;nbsp; I think there should be a conventional method, possibly, using C # code to achieve the interface and achieve the functional at the same time, and finally compiled into olny one .dll file&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If, as I suspect, and I hope I can find some C # code&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Sincerely thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2013 14:53:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4722521#M46215</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-31T14:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4723671#M46216</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; I think I found a solution,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; If anyone encountered this problem&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Can refer to&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2007/05/creating_a_part.html"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/05/creating_a_part.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2014 12:42:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4723671#M46216</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-01T12:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4723717#M46217</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; Function create by C #, and then compiled into dll files, functions automatically loaded by RegisterMyApp() , it’s referenced from AutoCAD. NET Developer's Guide，then the command will auto load very time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; User interface design by Customize User Interface Editor, and then save as .cuix file, load the user interface using the following code, in fact, equivalent to input CUILOAD in command prompt, but this CUILOAD need only be entered once, it does not need to load very time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Here is the way I take, they can be set simultaneously, only one time, perhaps there is a better way, but now I only know this way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RegisterMyApp()&lt;BR /&gt;{&lt;BR /&gt;_cuiload&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;UnRegisterMyApp()&lt;BR /&gt;{&lt;BR /&gt;_cuiunload&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;the following code is copy form &lt;A target="_blank" href="http://forums.autodesk.com/t5/NET/Accessing-toolbars-and-buttons-programatically/m-p/3182594/highlight/true#M25489"&gt;http://forums.autodesk.com/t5/NET/Accessing-toolbars-and-buttons-programatically/m-p/3182594/highlight/true#M25489&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;string flName = csGavin.CUIFileBaseName;
Application.SetSystemVariable("FILEDIA",0);
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("_cuiunload " + flName + " ",false,false,false);
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("_cuiload " + flName + " filedia 1 ",false,false,false);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jan 2014 15:45:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4723717#M46217</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-01T15:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4725333#M46218</link>
      <description>&lt;P&gt;We&amp;nbsp;use several professionally developed programs, many of which provide separate CUIx files and some of which auto-create user interface elements.&amp;nbsp; There is little to no effort to load a provided CUIx and use them within our system, but the ones which use programmatically created content are very unfriendly to workspaces.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2014 16:06:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/4725333#M46218</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2014-01-02T16:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create Toolbar with C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/9408167#M46219</link>
      <description>&lt;P&gt;&lt;SPAN&gt;could you tell me what dlls you used in that project&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Mar 2020 22:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-toolbar-with-c/m-p/9408167#M46219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-03-29T22:44:06Z</dc:date>
    </item>
  </channel>
</rss>

