MarcoW 发表于 2022-7-6 11:18:20

这个“Afrali”需要帮助

单击此链接查看整个例程:
http://www.afralisp.net/archive/vl/acadset.htm
 
这部分是我的问题所在:

;;;=================================
;;;Set up the AfraLisp Support Paths

;set the path to the AfraLisp subdirectory.
(setq netpath "C:\\AfraLisp2002")

;set the support paths to the AutoCAD default
(setenv "ACAD" "")

;store the default paths
(setq defpath (getenv "ACAD"))

;set up the AfraLisp paths
(setenv "ACAD" (strcat
defpath ";"
netpath ";"
netpath "\\" "Menu;"
netpath "\\" "CadLisp2k;"
netpath "\\" "CadLib2k;"
netpath "\\" "CadMech;"
netpath "\\" "Hatching;"
netpath "\\" "Help;"
netpath "\\" "Profiles;"
))

;set up the custom template path
(setenv "TemplatePath" (strcat netpath "\\" "Templates"))

;inform the user
(prompt "\nAfraLisp Support Paths Defined\n")

;;;================

 
我该如何修改代码,使当前搜索路径保持不变,从而添加新路径?我正在做一些事情,但每当我执行例程时,它都会像应该的那样复制配置文件,但SFSP会被新的覆盖?
 
对不起,如果我不完全清楚。。。我的目标是保留SFSP并添加新的,而不是丢失旧的。
 
我们非常感谢您的帮助。
 
顺便说一句:当然,所有学分都要归功于AfraLisp!!

lpseifert 发表于 2022-7-6 11:25:39

在此处查看如何将文件夹添加到支持路径
http://www.afralisp.net/visual-lisp/tutorials/beginning-visual-lisp-part-2.php

alanjt 发表于 2022-7-6 11:30:59

这是我为工作而编写的一个。。。
 
(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)

MarcoW 发表于 2022-7-6 11:34:47

谢谢大家!!
 
现在让我今晚做一些家庭作业!!

MarcoW 发表于 2022-7-6 11:39:26

 
 
艾伦,
 
也许我读得不够好,但你的和我的有什么不同?我的意思是,你的添加路径了吗?

alanjt 发表于 2022-7-6 11:43:09

是的,它添加了路径。我采用了可视化Lisp路线,如Larry的链接所示。此外,除支持路径外,mine还设置了许多其他路径(例如ToolPalette、绘图仪配置、QNew模板、模板等)。请看评论部分。

MarcoW 发表于 2022-7-6 11:48:58

好吧,我看不见。
 
既然你(也许还有其他很多人)已经这样走了,我相信这可能是一个好方法!
 
我确实读过,艾伦,也读过评论。Allready尝试了一下,虽然没有成功,但会成功的。
 
我有一个和你一样的例行公事,但我不需要做那么多事情。(我使用工具选项板和SFSP。)我的问题是添加。。。就像我说的。
 
非常感谢您的回复,我现在可以继续讲一会儿了

alanjt 发表于 2022-7-6 11:51:16

 
如果路径不存在,它将不起作用。
 
即使它超出了您的需要,它也为您提供了添加其他几个选项的选项。
 
祝你快乐。

MarcoW 发表于 2022-7-6 11:56:19

 
你的意思是,只有当路径存在时,它才有效,对吗?
为什么这不起作用:
 

(vla-put-supportpath
            #Files
       (strcat ";C:\\MarcoW"
                      ";"
                      (vla-get-supportpath #Files)
            ) ;_ strcat
            )

 
... 而地图“C:\MarcoW”确实存在
 
另一个问题,可能与此有关:
“怎么了?”在代码中(上面我用蓝色表示)。
那东西在代码中做什么?我这样问是因为在我的代码中它似乎在这行的末尾。。。
 
谢谢你帮我。

alanjt 发表于 2022-7-6 12:02:37

 
你发布的内容对我来说很好。实际上,它在没有创建路径的情况下添加了它。
 
就分号而言,它只是中断到下一条路径(多条路径)。我只是把它放在开头,因为放在第一位似乎有点干净/整洁。
 
这就像在字符串中使用“\n”。
 
如。
(strcat“\nALAN”“\n汤普森”)=(strcat“\nALAN\n”“汤普森”)
页: [1] 2
查看完整版本: 这个“Afrali”需要帮助