menuload problem

Since v10 i use the same method to load (using menuload) several custom partial menu's (cui files) using a lisp setup function. However in v15.1.17 only the last loaded partial menu remains in the menu pull down list. It looks like the previous is overwritten (allthough they have different names and i worked fine for years). Looking in the Customize dialog the partial cui are loaded, but not displayed. What is wrong ?

ty !

Comments

  • Dear Dirk,

    please send us a support request ... as far as I see, you will need (menucmd ...) to show the popups.
    Many greetings !
  • Hi Dirk,

    With BricsCAD V15 menu items will not show up if they do not have a valid ID tags. Older versions of BricsCAD converted MNU -> CUI without generating these tags. Perhaps this is the cause of your issue? Solution is to re-load the original MNU, assuming it hasn't changed, or manually add the necessary ID tags.

    Regards,

    Jason Bourhill

    CAD Concepts 


  • i wrote in another thread that i use MNU files but that is not the case, it is CUI actually and this has worked fine, also the install procedure:

    As you can see i excluded the menucmd for BricsCAD, don't remember why but it has always worked flawlessly.

     (command "_menuload" menu$)
     (if (not (vl-string-search "Bricscad" (getvar "acadver")))
             (menucmd (strcat "p40=+" m ".pop1"))
     )

    I changed it into

     (command "_menuload" menu$)
     (menucmd (strcat "p40=+" m ".pop1"))

    This is looped for every menu i have (my app is modular and not every user has all menu's installed)

    However still only the last menu is shown in the pull-down

    But when i add them manually typing in the command line

    (menucmd (strcat "p40=+" m ".pop1"))

    They appear at the end, so i assume mt ID's are fine.

    But why won't they load in the loop installement ?



  • It seems whenever you do a (menuload ...), all previous appended pull down menus are removed (not unloaded).
    This doesn't seem normal behavior.

    I can solve it by doing all the loading first and next add the popups at the end.

    How do i add ribbons using the menucmd ?

    ty


  • More troubles:

    using the customize dialog appending a custom ribbon results in the loss of the previous loaded pull-down menu's.
    Previous loaded custom pulldown menu's and ribbons are gone when re-starting BricsCAD...
  • Dirk,

    I use the following code to load an unload partial menus.
    [code](defun CCL-LOADMENU ( groupnm menufile / oACAD oMenuGrps oMenu)
        (setq oAcad (vlax-get-Acad-Object)) ; retrieve Acad-Object
        (setq oMenuGrps (vla-get-menugroups oAcad)) ; retrieve menugroups
        (setq oMenu (vl-catch-all-apply 'vla-item (list oMenuGrps groupnm))) ; check for the given menugroup
        (if (vl-catch-all-error-p oMenu) ; if an error is thrown, then assume that the menugroup isn't loaded and load
            (if (setq menufile (findfile menufile)) ; check that menu file exists
                (vla-load oMenuGrps menufile) ; if it exists load
            )
            oMenu
        )
    )[/code]
    Note the function above isn't ideal as it relies on triggering an error to load the menu. It doesn't actually determine definitively whether the menugroup is loaded or not.

    [code]; CCL-UNLOADMENU
    ; Load menu will check to see if the given Menu group is loaded.
    ; If it is, then it will be unloaded

    (defun CCL-UNLOADMENU ( groupnm / oACAD oMenuGrps oMenu)
        (setq oAcad (vlax-get-Acad-Object)) ; retrieve Acad-Object
        (setq oMenuGrps (vla-get-menugroups oAcad)) ; retrieve menugroups
        (setq oMenu (vl-catch-all-apply 'vla-item (list oMenuGrps groupnm)))
        (if (vle-vlaobjectp oMenu)
            (vla-unload oMenu)
        )
    )[/code]

    When you FIRST load a partial cui all pull down menus and ribbon tabs are automatically displayed and added to all your workspaces. This is the premise of what the code above works on, it doesn't explicitly try and place any menu items.

    Workspaces are saved in the default.cui and control the visibility of what you see in each workspace. If you subsequently make changes such as adding a pull down, or ribbon tab they will not display until you set their visibility for each of the workspaces that you want to show it in.  This means when testing modifications you may need to unload the re-load your menu.

    Roys code http://forum.bricsys.com/discussion/25105 allows for finer control over what menus you display and where they are displayed. However I believe doing so would require you to iterate through each of the workspaces you want them to display in.


    Regards,

    Jason Bourhill

    CAD Concepts 


  • How do i add ribbons using the menucmd ?


    As far as I'm aware this isn't possible using LISP.

    Regards,

    Jason Bourhill

    CAD Concepts 


  • To check if a menu is loaded you can use the menugroup function:
    [code](menugroup "bricscad")[/code]
  • Doh!! Thanks Roy. Had tried to do it completely in visual lisp as an alternate to an very old one that I had in plain LISP.

    [code]; CCL-LOADMENU
    ; Load menu will check to see if the given Menu group is loaded. If it isn't
    ; it will attemp to load using the menu file name provided.
    ; Returns the menu group object

    (defun CCL-LOADMENU ( groupnm menufile / oACAD oMenuGrps)
        (setq oAcad (vlax-get-Acad-Object)) ; retrieve Acad-Object
        (setq oMenuGrps (vla-get-menugroups oAcad)) ; retrieve menugroups
        (if (not (menugroup groupnm)) ; if the menugroup isn't loaded
                (if (setq menufile (findfile menufile)) (vla-load oMenuGrps menufile)) ; THEN load menu if it exists
                (vla-item oMenuGrps groupnm) ; ELSE return menu object
        )
    )[/code]

    [code]; CCL-UNLOADMENU
    ; Unload menu will check to see if the given Menu group is loaded.
    ; If it is, then it will be unloaded

    (defun CCL-UNLOADMENU ( groupnm / oACAD oMenuGrps)
        (if (menugroup groupnm) ; if the menu group is loaded
            (progn ; THEN
                (setq oAcad (vlax-get-Acad-Object)) ; retrieve Acad-Object
                (setq oMenuGrps (vla-get-menugroups oAcad)) ; retrieve menugroups
                (vla-unload (vla-item oMenuGrps groupnm)) ; unload the menu
                T
            )
        )
    )[/code]


    Regards,

    Jason Bourhill

    CAD Concepts 


  • Thx for all the replies, thing is my CUI's loaded and installed fine for years in ACAD and BricsCAD, now in v15 they don't. It works flawlessly in ACAD2015 so i'd expect it to work in BCAD too.

  • hi,

    i tried to use the above ccl-loadmenu function. First time it crashed BCAD. I gave it another try and then it seemed to stop and the screen is a mess. After restarting they seem all loaded. Could there be a problem when you have many menu's so BCAD needs to start a second line for pull-down menu's ?


    This seems to load the menu and ribbons for all workspaces, is there a way to load in the current workspace only ?

    ty !
  • Hi Dirk,

    Have you raised a support request on these issues? It would seem that there may be something particular to your CUI. You could try resetting the default.cui, by selecting the "Revert to Defaults" button in the bottom left of the CUI dialogue. And creating a new partial menu with a few commands for comparison purposes.

    Regards,

    Jason Bourhill

    CAD Concepts 


  • thx jason,

    i did, added 1 cui file, they are investigating...

    However i discovered now that BCAD only crashes on installment or removal if RIBBONS are ON. If i turn them off it seems to work fine and very fast (next i set ribbon on).




This discussion has been closed.