LISP安装支持路径a
我在AfraLISP网站上找到了这个LISP代码。看起来它可以帮助解决我在这里遇到的一些问题,以自动化用户设置。我试过了,它似乎确实有效,但经过如下所示的调整,我最终得到了以下结果:使用两条新路径更新支撑路径,并且它们处于正确的位置。与当前支持路径设置中的所有其他路径一样,输入第一条路径,所有字母均为大写,我在LISP代码中使用的正斜杠转换为反斜杠。第二个条目以所有小写结束,并且没有转换任何斜杠。
我还在准备我的菜单。崔(x)上膛了,但我想在继续之前先弄清楚第一部分。
;inform the user how to run the application
(prompt "\nMy_Menu Menu Installer Loaded...Type My_Menu to run......")
;define the function
(defun C:My_Menu ( / flag1 loaded temp)
(setq _ACADVERSION (atof (getvar "ACADVER")))
(if (>= ACADVER 19.0) ; AUTOCAD 2013 or 2014
(setq _MENUNAME "My_Menu.cuix")
(setq _MENUNAME "My_Menu.cui")
); end if
;add the new support paths
(addSupportPath "//a_very_long/novell/path/VLISP" 5)
(addSupportPath "//a_very_long/novell/path/VLISP/3rdPartyLisp" 6)
;set the flag
(setq flag1 T)
;check if the menu is not already loaded
(setq loaded (menugroup "_MENUNAME"))
;if it is not loaded
(if (= loaded nil)
;do the following
(progn
;find the menu file
(setq temp (findfile _MENUNAME))
;if you find the menu
(if temp
;do the following
(progn
;switch off dialogues
(setvar "FILEDIA" 0)
;load the menu
(command "menuload" _MENUNAME)
;switch on dialogues
(setvar "FILEDIA" 1)
; This is for later use
;install the pulldown
;(menucmd "P11=+VBAMENU.POP1")
;inform the user
(prompt "\nLoading My_Menu....\n")
);progn
;menu not find, so do the following
(progn
;inform the user
(alert "Cannot Locate My_Menu Menu.
\nCall System Administrator.")
;clear the flag
(setq flag1 nil)
);progn
);if
);progn
);if
;if the flag is set
(if flag1
;inform the user
(prompt "\nVBA Menu Loaded....\n")
);if
(princ)
);defun
;subroutine to add support path
(defun addSupportPath (dir pos / tmp c lst)
(setq tmp ""
c -1
)
(if
(not
(member (strcase dir)
(setq lst
(mapcar 'strcase
(parse (getenv "ACAD") ";")
)
);setq
);member
);not
(progn
(if (not pos)
(setq tmp (strcat (getenv "ACAD") ";" dir))
(mapcar '(lambda (x)
(setq tmp (if (= (setq c (1+ c)) pos)
(strcat tmp ";" dir ";" x)
(strcat tmp ";" x)
)
)
)
lst
)
)
(setenv "ACAD" tmp)
)
)
(princ)
)
;parsing routine
(defun parse (str delim / lst pos)
(setq pos (vl-string-search delim str))
(while pos
(setq lst (cons (substr str 1 pos) lst)
str (substr str (+ pos 2))
pos (vl-string-search delim str)
)
)
(if (> (strlen str) 0)
(setq lst (cons str lst))
)
(reverse lst)
)
(princ);clean load
好的,我不知道为什么上面的代码失败了。。。稍后将进一步查看。与此同时,我找到了李·麦克之前的帖子。看起来这可能是这项任务更容易研究的目标。
和往常一样,李·麦克的代码非常准确,而且工作得非常好。来自AfraLISP的代码也有一个用于添加新菜单项的模块,我想了解这一部分。随着附近的IT部门推出新的更新计算机,这种代码将使它们快速同步。 好的,再一次感谢唯一的李。看起来我可以让这个代码工作。这是我需要帮助的地方。我运行代码并在支持文件路径中安装了两个新条目,一切顺利。然后我在其中一个路径中添加一个菜单,如下所示:
(command "._MENULOAD" "I:/My_Path/My_Menu.cuix")
这将加载菜单,它将出现在“加载/卸载自定义设置”对话框窗口中,但菜单项不会像我手动执行此操作那样出现在AutoCAD屏幕的顶部。那么,我需要向上面的命令添加什么才能使其显示在顶部呢? 除了设置的路径之外,您还可以进行打印机自动保存打印后台处理等操作,如果需要其他操作,也可以进行post。
; just 1 part of all the Config files stuff
;make new support paths exist + new
; By BIGAL 2014
(setq *files*(vla-get-files(vla-get-preferences (vlax-get-Acad-object))))
(setq paths (vla-get-SupportPath *files*))
;make new support paths exist + new
(setq cpaths
"P:\\autodesk\\supportfiles;
P:\\autodesk\\lisp;
P:\\autodesk\\fonts;
P:\\autodesk\\hfs fonts;"
)
(setq newpath (strcat cpaths paths))
(vla-put-SupportPath *files* newpath)
; end use of *files*
(vlax-release-object *files*) 好的,我已经找到了支持途径。我可以制作一个新的部分菜单的代码。诀窍似乎是如何使新的局部菜单显示在AutoCAD屏幕的顶行。任何人任何人任何人布勒。。。。。布勒。。。。布勒! 你在执行“命令”“菜单加载”吗?可能使用VL方法。Visual Lisp开发人员圣经中有很多关于如何操作和加载菜单的信息。这提到了让加载的菜单成为组的一部分,这听起来像是你的问题。
手动菜单加载然后菜单出现总是适合我,没有试过lisp。请发布这段代码。 我使用此代码加载菜单
(defun C:smc-melb ( / flag1 loaded temp)
;set the flag
(setq flag1 T)
;check if the menu is not already loaded
(setq loaded (menugroup "SMC-Melbourne"))
;if it is not loaded
(if (= loaded nil)
;do the following
(progn
;find the menu file
(setq temp (findfile "SMC-Melbourne.MNU"))
;if you find the menu
(if temp
;do the following
(progn
;switch off dialogues
(setvar "FILEDIA" 0)
;load the menu
(command "menuload" "SMC-Melbourne")
;switch on dialogues
(setvar "FILEDIA" 1)
;install the pulldown
(menucmd "P15=+SMC-Melbourne.POP25")
;inform the user
(prompt "\nLoading SMC Melbourne Menu....\n")
);progn
;menu not find, so do the following
(progn
;inform the user
(alert "SMC Melbourne Not Installed.....")
;clear the flag
(setq flag1 nil)
);progn
);if
);progn
);if
;if the flag is set
(if flag1
;inform the user
(prompt "\nSMC Melbourne Loaded....\n")
);if
(princ)
);defun
页:
[1]