jamesfear 发表于 2022-7-6 09:36:23

更改文件选项卡(选项Di

我一直在给自己一个头像,试图找出是否有办法用Lisp或宏重命名工具选项板文件位置;
 
 
 
我知道我可以手动更改它,只需重命名它(双击左键或F2),但我需要每周在20台计算机上做一次。

MSasu 发表于 2022-7-6 10:16:20

您可以使用:
 
(setvar "*_TOOLPALETTEPATH"
       (strcat "C:\\Documents and Settings\\"
               UserName
               "\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette02"))
 
只要根据需要更改用户名即可。
 
当做
米尔恰

harrison-matt 发表于 2022-7-6 10:23:25

Jamesfear,
 
该命令(由tp02在命令行调用)将识别当前正在运行的操作系统,获取用户的登录名,并根据操作系统版本构建路径,将其设置为系统变量*\u toolpalettepath。然后程序检查目录是否存在,如果存在,则设置变量,否则会告诉您它不存在。

(defun c:tp02 (/)
(vl-load-com)
(setq        windows
(strcase
   (vl-registry-read
   "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
   "ProductName"
   )
)
)
(setq loginname (getvar 'loginname))
(cond
   ((wcmatch windows "*XP*")
   (progn
(setq path (strcat "C:\\Documents and Settings\\"
                   loginname
                   "\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette"
           )
)
   )
   )
   ((or (wcmatch windows "*VISTA*") (wcmatch windows "*7*"))
   (progn
(setq path (strcat "C:\\Users\\"
                   loginname
                   "\\AppData\\Roaming\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette"
           )
)
   )
   )
   (T (princ "\nThis version of the Operating System is not compatible with your path selections!")))
(if (vl-file-directory-p path)
   (setvar '*_toolpalettepath (strcat path "02"))
   (princ "\nLocation of toolpalette directory does not exist:"))
(princ))

 
否则,要了解“文件”选项卡的其余部分:
下面是一个解释:

(vl-load-com) ;It is good practice to have this in your code when you are using vl, vla, vlr or vlax functions
(setq Options_dialog (vla-get-preferences                ;the vla function that grabs preferences (options) from
             (vlax-get-acad-object)))                ;the Acad object (your open & active autocad session)
(setq files (vla-get-files Options_dialog))                ;this will grab the "files tab" of the prefernces object
(vlax-dump-object files T)                                ;by "dumping" the object you get all of the possible interactions
;you can use "(vla-get-********" much like getvar
;and you can use "vla-put-*******" much like setvar
;if you have no idea what setvar and getvar are you need to learn every system variable that Cad has to offer.

 
希望这能有所帮助,提示:在使用visual lisp时,只需将所有内容转储即可。
 
谨致问候,
 
马特

jamesfear 发表于 2022-7-6 10:50:34

谢谢你们的帮助,真的很感激
页: [1]
查看完整版本: 更改文件选项卡(选项Di