乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 6|回复: 6

[编程交流] LISP安装支持路径a

[复制链接]

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-5 23:15:16 | 显示全部楼层 |阅读模式
我在AfraLISP网站上找到了这个LISP代码。看起来它可以帮助解决我在这里遇到的一些问题,以自动化用户设置。我试过了,它似乎确实有效,但经过如下所示的调整,我最终得到了以下结果:
 
使用两条新路径更新支撑路径,并且它们处于正确的位置。与当前支持路径设置中的所有其他路径一样,输入第一条路径,所有字母均为大写,我在LISP代码中使用的正斜杠转换为反斜杠。第二个条目以所有小写结束,并且没有转换任何斜杠。
 
我还在准备我的菜单。崔(x)上膛了,但我想在继续之前先弄清楚第一部分。
 
 
 
  1. ;inform the user how to run the application
  2. (prompt "\nMy_Menu Menu Installer Loaded...Type My_Menu to run......")
  3. ;define the function
  4. (defun C:My_Menu ( / flag1 loaded temp)
  5. (setq _ACADVERSION (atof (getvar "ACADVER")))
  6. (if (>= ACADVER 19.0) ; AUTOCAD 2013 or 2014
  7.    (setq _MENUNAME "My_Menu.cuix")
  8.    (setq _MENUNAME "My_Menu.cui")
  9.    ); end if
  10. ;add the new support paths
  11.         (addSupportPath "//a_very_long/novell/path/VLISP" 5)
  12.         (addSupportPath "//a_very_long/novell/path/VLISP/3rdPartyLisp" 6)         
  13. ;set the flag
  14. (setq flag1 T)
  15. ;check if the menu is not already loaded
  16. (setq loaded (menugroup "_MENUNAME"))
  17. ;if it is not loaded
  18. (if (= loaded nil)
  19.   ;do the following
  20.   (progn
  21. ;find the menu file
  22.        (setq temp (findfile _MENUNAME))
  23.    ;if you find the menu
  24.           (if temp
  25.         ;do the following
  26.                   (progn
  27.                 ;switch off dialogues
  28.                 (setvar "FILEDIA" 0)
  29.                 ;load the menu
  30.                     (command "menuload" _MENUNAME)
  31.                 ;switch on dialogues
  32.                 (setvar "FILEDIA" 1)
  33.                 ; This is for later use
  34.                        ;install the pulldown
  35.                     ;(menucmd "P11=+VBAMENU.POP1")
  36.                 ;inform the user
  37.                               (prompt "\nLoading My_Menu....\n")
  38.         );progn
  39.         ;menu not find, so do the following
  40.         (progn
  41.                 ;inform the user
  42.                        (alert "Cannot Locate My_Menu Menu.
  43.                  \nCall System Administrator.")
  44.                 ;clear the flag       
  45.                 (setq flag1 nil)
  46.         );progn
  47.    );if
  48.    );progn
  49. );if
  50.         ;if the flag is set
  51.         (if flag1
  52.                 ;inform the user
  53.                               (prompt "\nVBA Menu Loaded....\n")
  54.         );if
  55.    (princ)
  56. );defun
  57. ;subroutine to add support path
  58. (defun addSupportPath (dir pos / tmp c lst)
  59. (setq tmp ""
  60.       c -1
  61. )
  62. (if
  63.         (not
  64.           (member (strcase dir)
  65.                 (setq lst
  66.                   (mapcar 'strcase
  67.                         (parse (getenv "ACAD") ";")
  68.                   )
  69.                 );setq
  70.           );member
  71.         );not       
  72. (progn
  73.         (if (not pos)
  74.                 (setq tmp (strcat (getenv "ACAD") ";" dir))
  75.                 (mapcar '(lambda (x)
  76.                 (setq tmp (if (= (setq c (1+ c)) pos)
  77.                                 (strcat tmp ";" dir ";" x)
  78.                                 (strcat tmp ";" x)
  79.                           )
  80.                 )
  81.                 )
  82.         lst
  83.         )
  84. )
  85. (setenv "ACAD" tmp)
  86. )
  87. )
  88. (princ)
  89. )
  90. ;parsing routine
  91. (defun parse (str delim / lst pos)
  92. (setq pos (vl-string-search delim str))
  93. (while pos
  94.         (setq lst (cons (substr str 1 pos) lst)
  95.                 str (substr str (+ pos 2))
  96.                 pos (vl-string-search delim str)
  97.         )
  98. )
  99. (if (> (strlen str) 0)
  100.         (setq lst (cons str lst))
  101. )
  102.         (reverse lst)
  103. )
  104. (princ);clean load
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-5 23:30:20 | 显示全部楼层
好的,我不知道为什么上面的代码失败了。。。稍后将进一步查看。与此同时,我找到了李·麦克之前的帖子。看起来这可能是这项任务更容易研究的目标。
 
和往常一样,李·麦克的代码非常准确,而且工作得非常好。来自AfraLISP的代码也有一个用于添加新菜单项的模块,我想了解这一部分。随着附近的IT部门推出新的更新计算机,这种代码将使它们快速同步。
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-5 23:37:04 | 显示全部楼层
好的,再一次感谢唯一的李。看起来我可以让这个代码工作。这是我需要帮助的地方。我运行代码并在支持文件路径中安装了两个新条目,一切顺利。然后我在其中一个路径中添加一个菜单,如下所示:
  1. (command "._MENULOAD" "I:/My_Path/My_Menu.cuix")

这将加载菜单,它将出现在“加载/卸载自定义设置”对话框窗口中,但菜单项不会像我手动执行此操作那样出现在AutoCAD屏幕的顶部。那么,我需要向上面的命令添加什么才能使其显示在顶部呢?
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 23:52:46 | 显示全部楼层
除了设置的路径之外,您还可以进行打印机自动保存打印后台处理等操作,如果需要其他操作,也可以进行post。
 
  1. ; just 1 part of all the Config files stuff
  2. ;make new support paths exist + new
  3. ; By BIGAL 2014
  4. (setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))
  5. (setq paths (vla-get-SupportPath *files*))
  6. ;make new support paths exist + new
  7. (setq cpaths
  8. "P:\\autodesk\\supportfiles;
  9. P:\\autodesk\\lisp;
  10. P:\\autodesk\\fonts;
  11. P:\\autodesk\\hfs fonts;"
  12. )
  13. (setq newpath (strcat cpaths paths))
  14. (vla-put-SupportPath *files* newpath)
  15. ; end use of *files*
  16. (vlax-release-object *files*)
回复

使用道具 举报

180

主题

639

帖子

463

银币

中流砥柱

Rank: 25

铜币
897
发表于 2022-7-6 00:03:26 | 显示全部楼层
好的,我已经找到了支持途径。我可以制作一个新的部分菜单的代码。诀窍似乎是如何使新的局部菜单显示在AutoCAD屏幕的顶行。任何人任何人任何人布勒。。。。。布勒。。。。布勒!
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 00:07:15 | 显示全部楼层
你在执行“命令”“菜单加载”吗?可能使用VL方法。Visual Lisp开发人员圣经中有很多关于如何操作和加载菜单的信息。这提到了让加载的菜单成为组的一部分,这听起来像是你的问题。
 
手动菜单加载然后菜单出现总是适合我,没有试过lisp。请发布这段代码。
回复

使用道具 举报

52

主题

156

帖子

104

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-6 00:24:38 | 显示全部楼层
我使用此代码加载菜单
  1. (defun C:smc-melb ( / flag1 loaded temp)
  2. ;set the flag
  3. (setq flag1 T)
  4. ;check if the menu is not already loaded
  5. (setq loaded (menugroup "SMC-Melbourne"))
  6. ;if it is not loaded
  7. (if (= loaded nil)
  8.   ;do the following
  9.   (progn
  10. ;find the menu file
  11.        (setq temp (findfile "SMC-Melbourne.MNU"))
  12.    ;if you find the menu
  13.           (if temp
  14. ;do the following
  15.     (progn
  16.   ;switch off dialogues
  17.   (setvar "FILEDIA" 0)
  18.   ;load the menu
  19.       (command "menuload" "SMC-Melbourne")
  20.   ;switch on dialogues
  21.   (setvar "FILEDIA" 1)
  22.   ;install the pulldown
  23.       (menucmd "P15=+SMC-Melbourne.POP25")
  24.   ;inform the user
  25.          (prompt "\nLoading SMC Melbourne Menu....\n")
  26. );progn
  27. ;menu not find, so do the following
  28. (progn
  29.   ;inform the user
  30.                        (alert "SMC Melbourne Not Installed.....")
  31.   ;clear the flag
  32.   (setq flag1 nil)
  33. );progn
  34.    );if
  35.    );progn
  36. );if
  37. ;if the flag is set
  38. (if flag1
  39.   ;inform the user
  40.          (prompt "\nSMC Melbourne Loaded....\n")
  41. );if
  42.    (princ)
  43. );defun
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 00:03 , Processed in 0.439901 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表