<?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 add a new menu in the main toolbar? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400225#M56472</link>
    <description>&lt;P&gt;Following C# (VS 2008) code is what I tried with ObjectARX 2011 SDK &amp;amp; AutoCAD 2011.&lt;/P&gt;&lt;P&gt;When I debug the code it seems it runs fine. It passes throught the if statement without any error.&lt;/P&gt;&lt;P&gt;But I can't find the newly added menu.&lt;/P&gt;&lt;P&gt;Is the code wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("MyGroup", "My", "MyCommandLocal", CommandFlags.Modal)]
        public void MyCommand() // This method can have any name
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            CustomizationSection cs;
            string mainCuiFile = (string)Application.GetSystemVariable("MENUNAME");
            mainCuiFile += ".cuix";
            ed.WriteMessage(mainCuiFile);
            cs = new CustomizationSection(mainCuiFile);

            if (cs.MenuGroup.PopMenus.IsNameFree("Custom Menu"))
            {
                System.Collections.Specialized.StringCollection pmAliases = new System.Collections.Specialized.StringCollection();
                PopMenu pm = new PopMenu("Custom Menu", pmAliases, "Custom Menu Tag", cs.MenuGroup);

                PopMenuItem pmi = new PopMenuItem(pm, -1);
                pmi.MacroID = "ID_AUGI";
                pmi.Name = "Autodesk User Group International";
                pmi = new PopMenuItem(pm, -1);
                pmi = new PopMenuItem(pm, -1);
                pmi.MacroID = "ID_CustomSafe";
                pmi.Name = "Online Developer Center";

                foreach (Workspace wk in cs.Workspaces)
                {
                    WorkspacePopMenu wkpm = new WorkspacePopMenu(wk, pm);
                    wkpm.Display = 1;
                }
            }
            else
                ed.WriteMessage("Custom Menu already Exists\n");
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2012 01:03:33 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-04-05T01:03:33Z</dc:date>
    <item>
      <title>How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398397#M56468</link>
      <description>&lt;P&gt;Hello to all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to ObjectARX (.NET).&lt;/P&gt;&lt;P&gt;I would like to add a customized menu in the main toolbar.&lt;/P&gt;&lt;P&gt;Can't find any sample in ObjectARX 2011 samples. And it's really hard to find references.&lt;/P&gt;&lt;P&gt;Could I get some help, please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 07:27:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398397#M56468</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-04T07:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398577#M56469</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;...I would like to add a customized menu in the main toolbar...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is "main toolbar"?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 10:29:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398577#M56469</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-04-04T10:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398607#M56470</link>
      <description>&lt;P&gt;Oh. I'm sorry. I meant the menubar where "File" "Edit" "View"... sutff placed.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:02:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398607#M56470</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-04T11:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398639#M56471</link>
      <description>&lt;P&gt;OK.&lt;/P&gt;
&lt;P&gt;1. ObjectARX SDK: samples\dotNet\CuiSamp (but only ObjectARX SDK 2008 and 2009)&lt;/P&gt;
&lt;P&gt;2. ActiveX-interface&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:37:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3398639#M56471</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-04-04T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400225#M56472</link>
      <description>&lt;P&gt;Following C# (VS 2008) code is what I tried with ObjectARX 2011 SDK &amp;amp; AutoCAD 2011.&lt;/P&gt;&lt;P&gt;When I debug the code it seems it runs fine. It passes throught the if statement without any error.&lt;/P&gt;&lt;P&gt;But I can't find the newly added menu.&lt;/P&gt;&lt;P&gt;Is the code wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        [CommandMethod("MyGroup", "My", "MyCommandLocal", CommandFlags.Modal)]
        public void MyCommand() // This method can have any name
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            CustomizationSection cs;
            string mainCuiFile = (string)Application.GetSystemVariable("MENUNAME");
            mainCuiFile += ".cuix";
            ed.WriteMessage(mainCuiFile);
            cs = new CustomizationSection(mainCuiFile);

            if (cs.MenuGroup.PopMenus.IsNameFree("Custom Menu"))
            {
                System.Collections.Specialized.StringCollection pmAliases = new System.Collections.Specialized.StringCollection();
                PopMenu pm = new PopMenu("Custom Menu", pmAliases, "Custom Menu Tag", cs.MenuGroup);

                PopMenuItem pmi = new PopMenuItem(pm, -1);
                pmi.MacroID = "ID_AUGI";
                pmi.Name = "Autodesk User Group International";
                pmi = new PopMenuItem(pm, -1);
                pmi = new PopMenuItem(pm, -1);
                pmi.MacroID = "ID_CustomSafe";
                pmi.Name = "Online Developer Center";

                foreach (Workspace wk in cs.Workspaces)
                {
                    WorkspacePopMenu wkpm = new WorkspacePopMenu(wk, pm);
                    wkpm.Display = 1;
                }
            }
            else
                ed.WriteMessage("Custom Menu already Exists\n");
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 01:03:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400225#M56472</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-05T01:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400377#M56473</link>
      <description>&lt;PRE&gt;cs.Save();
string flName = cs.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>Thu, 05 Apr 2012 05:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400377#M56473</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-04-05T05:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400679#M56474</link>
      <description>&lt;P&gt;If I add the following code, I see my newly added menu "Custom Menu" at the very end of list.&lt;/P&gt;&lt;P&gt;But still can't find it in the GUI menubar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            foreach (Workspace wk in cs.Workspaces)
            {
                ed.WriteMessage(wk.Name);
                foreach (WorkspacePopMenu wsPM in wk.WorkspacePopMenus)
                {
                    PopMenu pm = cs.getPopMenu(wsPM.PopMenuID);
                    if (pm != null)
                    {
                        ed.WriteMessage(string.Format("\n{0}", pm.Name));
                    }
                }
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for assisting me.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 09:30:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3400679#M56474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-05T09:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3406233#M56475</link>
      <description>&lt;P&gt;Still doesn't show up. =(&lt;/P&gt;&lt;P&gt;Would there be any other approach?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 09:44:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3406233#M56475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-10T09:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3416415#M56476</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;Application.DocumentManager.MdiActiveDocument.&lt;BR /&gt;SendStringToExecute("(menucmd \"Gacad.Help=+MyGroupName.MyPopUpMenuName\") ",false,false,false);&lt;/PRE&gt;
&lt;P&gt;MyGroupName is a name of your's menugroup&lt;BR /&gt;MyPopUpMenuName is a name of your's popup-menu.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2012 05:23:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3416415#M56476</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2012-04-17T05:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new menu in the main toolbar?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3418837#M56477</link>
      <description>&lt;P&gt;Unfortunately, the code didn't work for me. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, I found the following link working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://through-the-interface.typepad.com/through_the_interface/2010/04/adding-to-autocads-application-menu-and-quick-access-toolbar-using-net.html#comment-6a00d83452464869e2016303c22b63970d"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/04/adding-to-autocads-application-menu-and-quick-access-toolbar-using-net.html#comment-6a00d83452464869e2016303c22b63970d&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code block looks very similar to the one you taught me.&lt;/P&gt;&lt;P&gt;But I am not sure why only the code from the link works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I think my problem is finally solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you a lot for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2012 09:05:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-add-a-new-menu-in-the-main-toolbar/m-p/3418837#M56477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-04-18T09:05:26Z</dc:date>
    </item>
  </channel>
</rss>

