aaryan 发表于 2022-7-6 07:35:50

自动加载菜单文件

大家好,
 
我的要求是如何通过lisp自动加载菜单文件。我已经做了一个lisp,它将支持路径添加到包含lisp例程的文件夹中,并希望向自动加载菜单文件添加代码。
 
任何帮助都将不胜感激。
 
谢谢和问候
Aaryan公司

MSasu 发表于 2022-7-6 07:57:46

请检查之前的讨论;需要根据您使用的版本调整菜单文件的扩展名。

asos2000 发表于 2022-7-6 08:02:47

阅读此

aaryan 发表于 2022-7-6 08:21:48

谢谢。
 
已成功加载。
但是为什么我看不到工具栏呢。这是我试过的。
我还收到一条消息“工具栏未找到”
 
作为asos2000提供的链接
(defun PlaceCCMenu(/ CNT)
(setq CNT 1)
(while (< CNT 24)
   (if (menucmd (strcat "P" (itoa CNT) ".1=?"))
   (setq CNT (1+ CNT))
   (progn (if (> CNT 2)
            (setq CNT (1- CNT))
            (setq CNT 2))
            (menucmd (strcat "p" (itoa CNT) "=+CC.POP1"))
            (setq CNT 25)))))
(defun CChart(/ ProgLoad CCPath)
(setq CCPath "C:\\Program Files\\CC\\CC.01\\")
(cond ((< (distof (substr (getvar "acadver") 1 4)) 16.0)
      (setq ProgLoad (strcat CCPath "CC.mnc")))
       ((and (>= (distof (substr (getvar "acadver") 1 4)) 16.0)
             (< (distof (substr (getvar "acadver") 1 4)) 16.2))
      (setq ProgLoad (findfile (strcat CCPath "CC.mnc"))))
;;;   
       ((and (>= (distof (substr (getvar "acadver") 1 4)) 16.2)
             (< (distof (substr (getvar "acadver") 1 4)) 17.0))
      (setq ProgLoad (findfile (strcat CCPath "CC.cui"))))
;;;
       ((and (>= (distof (substr (getvar "acadver") 1 4)) 17.0)
             (< (distof (substr (getvar "acadver") 1 4)) 18.0))
      (setq ProgLoad (findfile (strcat CCPath "CC.cui"))))
;;;
       ((and (>= (distof (substr (getvar "acadver") 1 4)) 18.0)
             (< (distof (substr (getvar "acadver") 1 4)) 19.0))
      (setq ProgLoad (findfile (strcat CCPath "CC.cui")))))
(cond
   ((/= ProgLoad nil)
    (progn (command "menuunload" "CC" "menuload" ProgLoad)
         (PlaceCCMenu)
         (command "toolbar" "CC" "float" "800,52" "1")
         (princ "\n*** ---------- CC Menu Loaded ---------- ***")))
   ((= ProgLoad nil)
    (alert "CC Program is Not Loaded!")))
(princ))
 
下一个Mircea的代码已编辑。
(setq MyToolsPath "C:\\Program Files\\CC\\CC.01\\")
(setq Menu_Name "CC")
(setq Group_Name "CC")
(if (not (menugroup Group_Name))   ;check if user menu is loaded and load/display if not
(progn
(if (<(atof (getvar "ACADVER")) 16)                        ;versions above R2004
(command "_MENULOAD" (strcat MyToolsPath "CC" ".mns"))   ;.mns file
(command "_MENULOAD" (strcat MyToolsPath "CC" ".mnu"))   ;.mnu file
)
(menucmd "p11=+CC.POP1")                               ;display it as item 10
)
(princ))
 
请帮忙

MSasu 发表于 2022-7-6 08:24:44

我认为AutoCAD 2007的菜单文件格式应为CUI,2010及更高版本的菜单文件格式应为CUIX。

aaryan 发表于 2022-7-6 08:39:04

谢谢我知道了。。。米尔卡
还有一件事,我看不到“帮助”旁边的菜单。会是什么。。。
 
 
当做
页: [1]
查看完整版本: 自动加载菜单文件