MastroLube 发表于 2022-7-5 18:42:59

通过lisp加载Mnu文件

大家好,
我必须从acaddoc创建并加载一个简单的菜单。lsp。
 
这是mnu文件
***MENUGROUP=Cordoli

***POP1                                       
P1-1                               
P1-2[&Load APP]                               
P1-3[&Help]

 
如何添加指令以将lisp加载到此文件中?
(load "cordoli.vlx")
 
然后我必须通过acaddoc加载mnu文件。lsp。如何执行此步骤?
也许是这样?
(vl-load-com)
(setq *mgs* (vla-get-menugroups (vlax-get-acad-object)))
(vla-load *mgs* "cordoli")
正在加载。带有“菜单加载”的mnu文件适用于autocad 2009,但对于my 2015,它不会出现在菜单栏中。
谢谢你的帮助!
 
丹尼斯

wimal 发表于 2022-7-5 18:52:45

创造mns文件并使用菜单加载

MastroLube 发表于 2022-7-5 19:01:56

你能再给我解释一下吗?
 
与此同时,我发现:
(vl-load-com)
(defun c:Example_OnMenuBar()
   ;; This example creates a new menu called TestMenu and inserts a menu item
   ;; into it. The menu is then displayed on the menu bar, and then
   ;; removed from the menu bar.
   (setq acadObj (vlax-get-acad-object))
   (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
   
   ;; Create the new menu
   (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "TestMenu"))
   
   ;; Add a menu item to the new menu
   ;; Assign the macro string the VB equivalent of "ESC ESC _open "
   (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "open" (Chr 32)))
   (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Open" openMacro))
   
   ;; Display the menu on the menu bar
   (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))
   (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
   )
   
   ;; Remove the menu from the menu bar
   (vla-RemoveMenuFromMenuBar (vla-get-Menus currMenuGroup) "TestMenu")
   (if (= (vla-get-OnMenuBar newMenu) :vlax-true)
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is on the menu bar."))
       (alert (strcat "The menu called " (vla-get-Name newMenu) " is not on the menu bar."))
   )
)

rkmcswain 发表于 2022-7-5 19:06:00

您是想加载菜单文件,使其成为唯一加载的菜单,还是将其作为部分加载?

MastroLube 发表于 2022-7-5 19:11:30

我不知道我是否收到了你的问题,但我想把它和所有其他问题(acad等)放在一起。
 
(defun c:Crea_menu()
   ;; This example creates a new menu called TestMenu and inserts a menu item
   ;; into it. The menu is then displayed on the menu bar, and then
   ;; removed from the menu bar.
   (setq acadObj (vlax-get-acad-object))
   (setq currMenuGroup (vla-Item (vla-get-MenuGroups acadObj) 0))
   
   ;; Create the new menu
   (setq newMenu (vla-Add (vla-get-Menus currMenuGroup) "Cordoli"))
   
   ;; Add a menu item to the new menu
   ;; Assign the macro string the VB equivalent of "ESC ESC _open "
   (setq openMacro (strcat (Chr 3) (Chr 3) (Chr 95) "cordolo" (Chr 32)))
   (setq newMenuItem (vla-AddMenuItem newMenu (1+ (vla-get-Count newMenu)) "Avvia l'applicazione" openMacro))

   
   ;; Display the menu on the menu bar
   (vla-InsertInMenuBar newMenu (1+ (vla-get-Count (vla-get-MenuBar acadObj))))

)
 
http://i.imgur.com/erLHVxR.png
 
这似乎在acad2009中有效,但在acad2015中无效

rkmcswain 发表于 2022-7-5 19:16:27

好的,那么你想把它作为部分菜单加载。
 
如果代码运行并且菜单已经加载,会发生什么?

MastroLube 发表于 2022-7-5 19:24:14

我不知道,也许我会出错。。需要尝试一下。
 
为什么它没有出现在autocad2015中?

BIGAL 发表于 2022-7-5 19:31:03

你每次都需要加载吗?为什么不加载一次,然后只使用一个工作区,您可以在工作区中关闭和打开菜单。这里的每个人都在一个以他们的名字命名的工作区工作,所以Deafolt工作区并没有搞砸。

MastroLube 发表于 2022-7-5 19:39:53

你好,比格尔,这是我第二次写这篇文章,因为我的电脑崩溃了
 
嗯,当我安装其他插件时,我的工作场所会有一个菜单栏/功能区。我想和我的一样。
我的和其他插件之间有一个区别:如果我改变工作场所(或刷新它),我的菜单栏就会消失!
 
在这一刻,我用阿卡多克做了所有的事情。lsp,但我相信有更好的方法。我在找那条路。
 
我还制作了一个cordoli。cuix用于在autocad2015中显示色带,我称之为alway by acaddoc。使用此命令的lsp:(命令“\u menuload”“C:\\COBIAX\\cordoli.cuix”)
 
如何制作一个“专业”的附加组件来解决这些问题?
 
谢谢,丹尼斯
 
科尔多利。cuix。拉链
 
此外,我还遇到了这个问题:
命令行无法加载

BIGAL 发表于 2022-7-5 19:45:50

您需要在加载mnu等后保存工作区,否则它将在下一个会话中消失。我们为每个用户提供了单独的工作区,因此强制保存他们的名字,我们没有自动更新,因为任何错误都会被保存,使修复更加困难。
页: [1]
查看完整版本: 通过lisp加载Mnu文件