.NET

Reply
Contributor
david.rock
Posts: 21
Registered: ‎02-09-2011
Message 1 of 4 (559 Views)

AcadMenuGroup Menu group edit not saving

559 Views, 3 Replies
07-17-2011 05:01 PM

 Hello,

 

Does anybody know why my menu group is not saving in the following code.

 

The following code adds a menu item to the Toolbar Test in a menu group named TEST. However when I exit and re-enter AutoCAD the menu is not saved. I have also tried saveas with no luck.

 

I am compiling the code **** a .net dll and then running it via lisp.

 

Any ideas?

 

 

  '
    '(TestAddToolbarItem_dotNet)
    '
    <LispFunction("TestAddToolbarItem_dotNet")> _
    Public Function TestAddToolbarItem_dotNet(Optional ByVal myLispArgs As ResultBuffer = Nothing) As ResultBuffer

        Dim acadApp As AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
        Dim objMenuGroup As AcadMenuGroup = acadApp.Application.MenuGroups.Item("TEST")
        Dim objToolbar As AcadToolbar = objMenuGroup.Toolbars.Item("Test")
        objToolbar.Visible = True
        Dim objNewToolbrItem As AcadToolbarItem = objToolbar.AddToolbarButton(objToolbar.Count, "Test", "", "Macro")
        'objMenuGroup.Save(Autodesk.AutoCAD.Interop.Common.AcMenuFileType.acMenuFileSource)
        objMenuGroup.Save(Autodesk.AutoCAD.Interop.Common.AcMenuFileType.acMenuFileCompiled)
        MsgBox("'" & objMenuGroup.MenuFileName & "' Attempt Menu Group save. But it does not seem to be saving..")

        Return myLispArgs
    End Function

 

 

Kind Regards

David Rock

 

Active Member
david.rock
Posts: 8
Registered: ‎09-15-2011
Message 2 of 4 (464 Views)

Re: AcadMenuGroup Menu group edit not saving

03-03-2012 08:30 PM in reply to: david.rock

It seems that a CustomizationSection is able to be saved.

 

However I cannot find a way of getting to the CustomizationSection of an existing menugroup. The only way I can find is to create a new CustomizationSection.

 

Does anybody know ho to get to the CustomizationSection of an existing menugroup?

 

There does not seem any point to having the object 'Autodesk.AutoCAD.Interop.IAcadMenuGroup.Save' if it does not work or throw an exception when is does not work.

 

Any help really appretiated.

Thanks

David

 

Moderator
Alexander.Rivilis
Posts: 1,406
Registered: ‎04-09-2008
Message 3 of 4 (458 Views)

Re: AcadMenuGroup Menu group edit not saving

03-04-2012 02:01 AM in reply to: david.rock

david.rock wrote:

There does not seem any point to having the object 'Autodesk.AutoCAD.Interop.IAcadMenuGroup.Save' if it does not work or throw an exception when is does not work.


Last version of AutoCAD which allow to save  menugroup with COM interface was 2005.

Autodesk.AutoCAD.Customization help you customize menugroup for AutoCAD 2007+

ObjectARX SDK: samples\dotNet\CuiSamp (ObjectARX SDK 2008 and 2009)


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
david.rock
Posts: 8
Registered: ‎09-15-2011
Message 4 of 4 (443 Views)

Re: AcadMenuGroup Menu group edit not saving

03-05-2012 04:37 AM in reply to: Alexander.Rivilis

There must be some way of editing a cuix menu and saving it? I am trying both lisp and .net methods and both do not save the changes to the menu. Attached is the lisp.



The 2008 class sample is very helpful. However the class is biased towards creating new toolbars and toolbar items. I am having trouble seeing how to iterate through an existing menu, do a find and replace opperation and save the menu.



Regards

David

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.