ReinierMeyer 发表于 2022-7-5 23:45:16

用于设置A的Lisp命令

有人知道使用lisp例程设置自动保存文件位置的命令是什么吗
 
如下所示,设置模板路径,
 
(vla put TemplateDwgPath*文件*“\\\\Server\\Data\\Cad\U Programs\\Autocad\\Drawing Templates”)
 
我需要设置自动保存文件的位置。
 
请帮忙!!!!

MarcoW 发表于 2022-7-5 23:50:57

你是荷兰人吗?
 

; MarcoW 09-11-2009
;
; first create the function
; and localise the variables used
(defun c:asf ( / asfloc oldloc)
; then set some variables that will be used
(setq asfloc (getstring T "\nPlease enter the automatic Save File Location as desired:")
oldloc (getvar "savefilepath")
); end of setq
; put the new path into the systemvariable
(setvar "savefilepath" asfloc)
; show the old location once more, you might want to write down its location for you never know if you want it back
(alert (strcat "The old path was: " oldloc))
; clean exit
(princ)
; end of defun
)

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

ReinierMeyer 发表于 2022-7-5 23:54:00

谢谢
 
不,不是荷兰语,南非荷兰语从simlilar到荷兰语。

Tekenmeester 发表于 2022-7-5 23:57:47

这不是你要找的吗?
 
它位于“文件”选项卡下的“选项”中。

alanjt 发表于 2022-7-6 00:00:54

我写这篇文章是为了在新机器上运行以完成设置。
显然,你必须对细节进行更改,但它会满足你的需求。
 
(defun c:CES-Setup (/ #Files #Layout #Flag)
(vl-load-com)
(and
   (not
   (vl-catch-all-error-p
       (vl-catch-all-apply
         '(lambda ()
            (setq #Files(vla-get-files
                            (vla-get-preferences (vlax-get-acad-object))
                        ) ;_ vla-get-files
                  #Layout (vla-get-activelayout
                            (vla-get-activedocument (vlax-get-acad-object))
                        ) ;_ vla-get-activelayout
            ) ;_ setq
            ;; *********************
            ;; **AutoSave Path**
            ;; *********************
            (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
            (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
            ;; ***************************
            ;; **Printer Config Path**
            ;; ***************************
            (vla-put-PrinterConfigPath
            #Files
            "s:\\cadd standards\\Plotters"
            ) ;_ vla-put-PrinterConfigPath
            (vla-refreshplotdeviceinfo #Layout)
            ;; ***********************
            ;; **Plotstyles Path**
            ;; ***********************
            (vla-put-printerstylesheetpath
            #Files
            "s:\\cadd standards\\Plotstyles"
            ) ;_ vla-put-printerstylesheetpath
            (vla-refreshplotdeviceinfo #Layout)
            ;; *********************
            ;; **Template Path**
            ;; *********************
            (vla-put-TemplateDwgPath
            #Files
            "s:\\cadd standards\\Template"
            ) ;_ vla-put-TemplateDwgPath
            ;; *********************
            ;; **QNew Template**
            ;; *********************
            (vla-put-QNewTemplateFile
            #Files
            "s:\\cadd standards\\Template\\CES_Template.dwt"
            ) ;_ vla-put-QNewTemplateFile
            ;; *********************
            ;; **Support Paths**
            ;; *********************
            (vla-put-supportpath
            #Files
            (strcat ";s:\\cadd standards\\startup"
                      ";s:\\cadd standards\\lisp"
                      ";s:\\cadd standards\\linetypes"
                      ";s:\\cadd standards\\fonts"
                      ";s:\\cadd standards\\ces layers"
                      ";"
                      (vla-get-supportpath #Files)
            ) ;_ strcat
            ) ;_ vla-put-supportpath
            ;; ***************************
            ;; **Tool Palettes Paths**
            ;; ***************************
            (vla-put-ToolPalettePath
            #Files
            (strcat "S:\\CADD Standards\\Toolpalette\\Palettes;"
                      (vla-get-ToolPalettePath #Files)
            ) ;_ strcat
            ) ;_ vla-put-ToolPalettePath
          ) ;_ lambda
       ) ;_ vl-catch-all-apply
   ) ;_ vl-catch-all-error-p
   ) ;_ not
   (alert
   (strcat
       "AutoCAD has been setup for Capital Engineering & Surveying, Inc. Standards.\n\n"
       "                      Please restart AutoCAD."
   ) ;_ strcat
   ) ;_ alert
) ;_ and
(princ)
) ;_ defun
(alert "Type: \"CES-SETUP\" to run setup.")
(princ)

MonkeyTurnip 发表于 2022-7-6 00:05:00

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

ReMark 发表于 2022-7-6 00:06:49

您是否按照alanjt的建议对代码进行了任何更改?

MonkeyTurnip 发表于 2022-7-6 00:13:03

 
是的,这是我修改过的代码。我还试着准确地编写代码,看看会发生什么,但两个代码都没有发生任何变化
 
(defun c:setup (/ #Files #Layout #Flag)
(vl-load-com)
(and
   (not
   (vl-catch-all-error-p
       (vl-catch-all-apply
         '(lambda ()
            (setq #Files(vla-get-files
                            (vla-get-preferences (vlax-get-acad-object))
                        ) ;_ vla-get-files
                  #Layout (vla-get-activelayout
                            (vla-get-activedocument (vlax-get-acad-object))
                        ) ;_ vla-get-activelayout
            ) ;_ setq
            ;; *********************
            ;; **AutoSave Path**
            ;; *********************
            (mapcar 'vl-mkdir (list "c:\\TEMP" "c:\\TEMP\\ACAD"))
            (vla-put-autosavepath #Files "c:\\TEMP\\ACAD")
            ;; ***************************
            ;; **Printer Config Path**
            ;; ***************************
            (vla-put-PrinterConfigPath
            #Files
            "c:\\AutoCAD Setup\\Plotter files"
            ) ;_ vla-put-PrinterConfigPath
            (vla-refreshplotdeviceinfo #Layout)
            ;; ***********************
            ;; **Plotstyles Path**
            ;; ***********************
            (vla-put-printerstylesheetpath
            #Filesls
            "c:\\AutoCAD Setup\\Plot Styles"
            ) ;_ vla-put-printerstylesheetpath
            (vla-refreshplotdeviceinfo #Layout)
            ;; *********************
            ;; **Template Path**
            ;; *********************
            (vla-put-TemplateDwgPath
            #Files
            "c:\\AutoCAD Setup\\Template"
            ) ;_ vla-put-TemplateDwgPath
            ;; *********************
            ;; **QNew Template**
            ;; *********************
            (vla-put-QNewTemplateFile
            #Files
            "=c:\\AutoCAD Setup\\Template\\PROJECT TEMPLATE.dwt"
            ) ;_ vla-put-QNewTemplateFile
            ;; *********************
            ;; **Support Paths**
            ;; *********************
            (vla-put-supportpath
            #Files
            (strcat ";c:\\AutoCAD Setup\\Startup"
                      ";c:\\AutoCAD Setup\\lisp"
                      ";c:\\AutoCAD Setup\\Line Types"
                      ";c:\\AutoCAD Setup\\Fonts"
                      ";c:\\AutoCAD Setup\\Layers"
      ";c:\\AutoCAD Setup\\Hatch Patterns"
                      ";"
                      (vla-get-supportpath #Files)
            ) ;_ strcat
            ) ;_ vla-put-supportpath
            ;; ***************************
            ;; **Tool Palettes Paths**
            ;; ***************************
            (vla-put-ToolPalettePath
            #Files
            (strcat "c:\\AutoCAD Setup\\CAD_Blocks\\;"
                      (vla-get-ToolPalettePath #Files)
            ) ;_ strcat
            ) ;_ vla-put-ToolPalettePath
          ) ;_ lambda
       ) ;_ vl-catch-all-apply
   ) ;_ vl-catch-all-error-p
   ) ;_ not
   (alert
   (strcat
       "AutoCAD has been setup Standards.\n\n"
       "                   Please restart AutoCAD."
   ) ;_ strcat
   ) ;_ alert
) ;_ and
(princ)
) ;defun
(alert "Type: \"SETUP\" to run setup.")
(princ)

ReMark 发表于 2022-7-6 00:15:49

您对整个代码感兴趣,而不仅仅是指定自动保存文件位置的部分?

MonkeyTurnip 发表于 2022-7-6 00:17:34

 
是的,完整的代码,我希望它作为新机器的第一个设置,所以我可以只运行LISP
页: [1] 2
查看完整版本: 用于设置A的Lisp命令