乐筑天下

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

[编程交流] 用于设置A的Lisp命令

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:45:16 | 显示全部楼层 |阅读模式
有人知道使用lisp例程设置自动保存文件位置的命令是什么吗
 
如下所示,设置模板路径,
 
(vla put TemplateDwgPath*文件*“\\\\Server\\Data\\Cad\U Programs\\Autocad\\Drawing Templates”)
 
我需要设置自动保存文件的位置。
 
请帮忙!!!!
回复

使用道具 举报

59

主题

327

帖子

268

银币

后起之秀

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

铜币
295
发表于 2022-7-5 23:50:57 | 显示全部楼层
你是荷兰人吗?
 
  1. ; MarcoW 09-11-2009
  2. ;
  3. ; first create the function
  4. ; and localise the variables used
  5. (defun c:asf ( / asfloc oldloc)
  6. ; then set some variables that will be used
  7. (setq asfloc (getstring T "\nPlease enter the automatic Save File Location as desired:  ")
  8. oldloc (getvar "savefilepath")
  9. ); end of setq
  10. ; put the new path into the systemvariable
  11. (setvar "savefilepath" asfloc)
  12. ; show the old location once more, you might want to write down its location for you never know if you want it back
  13. (alert (strcat "The old path was: " oldloc))
  14. ; clean exit
  15. (princ)
  16. ; end of defun
  17. )

 
我刚刚写的,但我想它是可行的。
 
有人可能会通过在对话框中选择文件夹来帮助您找到正确的文件夹。
回复

使用道具 举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:54:00 | 显示全部楼层
谢谢
 
不,不是荷兰语,南非荷兰语从simlilar到荷兰语。
回复

使用道具 举报

0

主题

3

帖子

3

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 23:57:47 | 显示全部楼层
这不是你要找的吗?
 
它位于“文件”选项卡下的“选项”中。
004525ja98i3ang93s8aux.jpg
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

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

铜币
438
发表于 2022-7-6 00:00:54 | 显示全部楼层
我写这篇文章是为了在新机器上运行以完成设置。
显然,你必须对细节进行更改,但它会满足你的需求。
 
  1. (defun c:CES-Setup (/ #Files #Layout #Flag)
  2. (vl-load-com)
  3. (and
  4.    (not
  5.      (vl-catch-all-error-p
  6.        (vl-catch-all-apply
  7.          '(lambda ()
  8.             (setq #Files  (vla-get-files
  9.                             (vla-get-preferences (vlax-get-acad-object))
  10.                           ) ;_ vla-get-files
  11.                   #Layout (vla-get-activelayout
  12.                             (vla-get-activedocument (vlax-get-acad-object))
  13.                           ) ;_ vla-get-activelayout
  14.             ) ;_ setq
  15.             ;; *********************
  16.             ;; **  AutoSave Path  **
  17.             ;; *********************
  18.             (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
  19.             (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
  20.             ;; ***************************
  21.             ;; **  Printer Config Path  **
  22.             ;; ***************************
  23.             (vla-put-PrinterConfigPath
  24.               #Files
  25.               "s:\\cadd standards\\Plotters"
  26.             ) ;_ vla-put-PrinterConfigPath
  27.             (vla-refreshplotdeviceinfo #Layout)
  28.             ;; ***********************
  29.             ;; **  Plotstyles Path  **
  30.             ;; ***********************
  31.             (vla-put-printerstylesheetpath
  32.               #Files
  33.               "s:\\cadd standards\\Plotstyles"
  34.             ) ;_ vla-put-printerstylesheetpath
  35.             (vla-refreshplotdeviceinfo #Layout)
  36.             ;; *********************
  37.             ;; **  Template Path  **
  38.             ;; *********************
  39.             (vla-put-TemplateDwgPath
  40.               #Files
  41.               "s:\\cadd standards\\Template"
  42.             ) ;_ vla-put-TemplateDwgPath
  43.             ;; *********************
  44.             ;; **  QNew Template  **
  45.             ;; *********************
  46.             (vla-put-QNewTemplateFile
  47.               #Files
  48.               "s:\\cadd standards\\Template\\CES_Template.dwt"
  49.             ) ;_ vla-put-QNewTemplateFile
  50.             ;; *********************
  51.             ;; **  Support Paths  **
  52.             ;; *********************
  53.             (vla-put-supportpath
  54.               #Files
  55.               (strcat ";s:\\cadd standards\\startup"
  56.                       ";s:\\cadd standards\\lisp"
  57.                       ";s:\\cadd standards\\linetypes"
  58.                       ";s:\\cadd standards\\fonts"
  59.                       ";s:\\cadd standards\\ces layers"
  60.                       ";"
  61.                       (vla-get-supportpath #Files)
  62.               ) ;_ strcat
  63.             ) ;_ vla-put-supportpath
  64.             ;; ***************************
  65.             ;; **  Tool Palettes Paths  **
  66.             ;; ***************************
  67.             (vla-put-ToolPalettePath
  68.               #Files
  69.               (strcat "S:\\CADD Standards\\Toolpalette\\Palettes;"
  70.                       (vla-get-ToolPalettePath #Files)
  71.               ) ;_ strcat
  72.             ) ;_ vla-put-ToolPalettePath
  73.           ) ;_ lambda
  74.        ) ;_ vl-catch-all-apply
  75.      ) ;_ vl-catch-all-error-p
  76.    ) ;_ not
  77.    (alert
  78.      (strcat
  79.        "AutoCAD has been setup for Capital Engineering & Surveying, Inc. Standards.\n\n"
  80.        "                      Please restart AutoCAD."
  81.      ) ;_ strcat
  82.    ) ;_ alert
  83. ) ;_ and
  84. (princ)
  85. ) ;_ defun
  86. (alert "Type: "CES-SETUP" to run setup.")
  87. (princ)
回复

使用道具 举报

3

主题

19

帖子

16

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 00:05:00 | 显示全部楼层
 
有点突兀,我已经尝试了我引用的代码,但它什么也没做。。。
 
我正在使用AutoCAD2013 full,
 
我已将完整代码复制到一个打开的lisp框中,并将其保存为CES-SETUP
加载它就像我有许多其他的LISP一样,一个警告框显示“键入CES-SETUP以运行”
 
我这样做了,什么也没有,命令行没有显示错误,只是像发生了什么事情一样继续前进。然后说命令:
 
在选项中,没有任何变化。
 
我也修改了所有的路径,以适应我的设置,仍然没有什么。。。
 
我做错了什么?
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 00:06:49 | 显示全部楼层
您是否按照alanjt的建议对代码进行了任何更改?
回复

使用道具 举报

3

主题

19

帖子

16

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 00:13:03 | 显示全部楼层
 
是的,这是我修改过的代码。我还试着准确地编写代码,看看会发生什么,但两个代码都没有发生任何变化
 
  1. (defun c:setup (/ #Files #Layout #Flag)
  2. (vl-load-com)
  3. (and
  4.    (not
  5.      (vl-catch-all-error-p
  6.        (vl-catch-all-apply
  7.          '(lambda ()
  8.             (setq #Files  (vla-get-files
  9.                             (vla-get-preferences (vlax-get-acad-object))
  10.                           ) ;_ vla-get-files
  11.                   #Layout (vla-get-activelayout
  12.                             (vla-get-activedocument (vlax-get-acad-object))
  13.                           ) ;_ vla-get-activelayout
  14.             ) ;_ setq
  15.             ;; *********************
  16.             ;; **  AutoSave Path  **
  17.             ;; *********************
  18.             (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
  19.             (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
  20.             ;; ***************************
  21.             ;; **  Printer Config Path  **
  22.             ;; ***************************
  23.             (vla-put-PrinterConfigPath
  24.               #Files
  25.               "c:\\AutoCAD Setup\\Plotter files"
  26.             ) ;_ vla-put-PrinterConfigPath
  27.             (vla-refreshplotdeviceinfo #Layout)
  28.             ;; ***********************
  29.             ;; **  Plotstyles Path  **
  30.             ;; ***********************
  31.             (vla-put-printerstylesheetpath
  32.               #Filesls
  33.               "c:\\AutoCAD Setup\\Plot Styles"
  34.             ) ;_ vla-put-printerstylesheetpath
  35.             (vla-refreshplotdeviceinfo #Layout)
  36.             ;; *********************
  37.             ;; **  Template Path  **
  38.             ;; *********************
  39.             (vla-put-TemplateDwgPath
  40.               #Files
  41.               "c:\\AutoCAD Setup\\Template"
  42.             ) ;_ vla-put-TemplateDwgPath
  43.             ;; *********************
  44.             ;; **  QNew Template  **
  45.             ;; *********************
  46.             (vla-put-QNewTemplateFile
  47.               #Files
  48.               "=c:\\AutoCAD Setup\\Template\\PROJECT TEMPLATE.dwt"
  49.             ) ;_ vla-put-QNewTemplateFile
  50.             ;; *********************
  51.             ;; **  Support Paths  **
  52.             ;; *********************
  53.             (vla-put-supportpath
  54.               #Files
  55.               (strcat ";c:\\AutoCAD Setup\\Startup"
  56.                       ";c:\\AutoCAD Setup\\lisp"
  57.                       ";c:\\AutoCAD Setup\\Line Types"
  58.                       ";c:\\AutoCAD Setup\\Fonts"
  59.                       ";c:\\AutoCAD Setup\\Layers"
  60.         ";c:\\AutoCAD Setup\\Hatch Patterns"
  61.                       ";"
  62.                       (vla-get-supportpath #Files)
  63.               ) ;_ strcat
  64.             ) ;_ vla-put-supportpath
  65.             ;; ***************************
  66.             ;; **  Tool Palettes Paths  **
  67.             ;; ***************************
  68.             (vla-put-ToolPalettePath
  69.               #Files
  70.               (strcat "c:\\AutoCAD Setup\\CAD_Blocks\\;"
  71.                       (vla-get-ToolPalettePath #Files)
  72.               ) ;_ strcat
  73.             ) ;_ vla-put-ToolPalettePath
  74.           ) ;_ lambda
  75.        ) ;_ vl-catch-all-apply
  76.      ) ;_ vl-catch-all-error-p
  77.    ) ;_ not
  78.    (alert
  79.      (strcat
  80.        "AutoCAD has been setup Standards.\n\n"
  81.        "                   Please restart AutoCAD."
  82.      ) ;_ strcat
  83.    ) ;_ alert
  84. ) ;_ and
  85. (princ)
  86. ) ;defun
  87. (alert "Type: "SETUP" to run setup.")
  88. (princ)
回复

使用道具 举报

10

主题

8258

帖子

8335

银币

初来乍到

Rank: 1

铜币
31
发表于 2022-7-6 00:15:49 | 显示全部楼层
您对整个代码感兴趣,而不仅仅是指定自动保存文件位置的部分?
回复

使用道具 举报

3

主题

19

帖子

16

银币

初来乍到

Rank: 1

铜币
15
发表于 2022-7-6 00:17:34 | 显示全部楼层
 
是的,完整的代码,我希望它作为新机器的第一个设置,所以我可以只运行LISP
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 21:31 , Processed in 1.613246 second(s), 74 queries .

© 2020-2025 乐筑天下

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