• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Contributor
    david.rock
    Posts: 21
    Registered: ‎02-09-2011

    AcadMenuGroup Menu group edit not saving

    362 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

     

    Please use plain text.
    Active Member
    david.rock
    Posts: 6
    Registered: ‎09-15-2011

    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

     

    Please use plain text.
    Moderator
    Alexander.Rivilis
    Posts: 1,168
    Registered: ‎04-09-2008

    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

    Please use plain text.
    Active Member
    david.rock
    Posts: 6
    Registered: ‎09-15-2011

    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

    Please use plain text.