我对通配符有点陌生,不完全了解它们是如何工作的以及何时可以使用它们。现在,我正试图在代码中使用它们,这将允许我获得有关我试图定义的文件路径的一些附加信息。下面的代码是我正在处理的代码,我遇到了问题:
- [font=Times New Roman][size=3](defun c:insdat (/ bti jobnumb firstnumb secondnumb chngnumb filepth)
- (vl-load-com)
- (command "-layer" "m" "G-PLAN-DATM-____-____-N" "lo" "G-PLAN-DATM-____-____-N" "")
- (initget 1)
- (setq jobnumb (getstring "\nEnter The 7 didgit Job Number:"))
- (setq jobnumblen (strlen jobnumb))
- (cond ((/= jobnumblen 7)
- (print "The Job Number Must Be Exactly 7 Digits Long! Try Again.")
- (exit)
- );cond
- );cond
- (initget 1)
- (setq chngord (getstring "\nEnter Change Order Number:"))
- (setq chngordlen (strlen chngord))
- (setq firstnumb (substr jobnumb 1 3)
- secondnumb (substr jobnumb 4 7)
- filepth (strcat "J:\" firstnumb "\" secondnumb "\" chngord "[url="file://\\prod\\Sheet"]\\prod\\Sheet[/url] Metal\")
- );setq
- (if (vl-file-directory-p filepth)
- (progn
- (setq dept "prod")
- );progn
- (progn
- (setq dept "4-Detailing")
- );progn
- );if
- (setq filepth (strcat "J:\" firstnumb "\" secondnumb "\" chngord "\" dept "[url="file://\\Sheet"]\\Sheet[/url] Metal\"))[/size][/font]
- [font=Times New Roman][size=3] (if
- (setq bti
- (getfiled "Select Block to Insert" filepth "dwg" 0)
- );if
- (progn
- (command "._-Insert" bti "_S" 1.0 "0,0,0" 0.00 "" "")
- (while
- (/= 0 (getvar "CMDACTIVE"))
- (command pause)
- );while
- );progn
- (princ "\nNo File picked.")
- );if
- (princ)
- (setvar "CLAYER" "0")
- );defun[/size][/font]
这是我遇到的问题。我们的文件目录是如何工作的,首先我们必须指定一个3位数的数字才能进入一个文件夹,然后你需要指定一个4位数的数字才能进入下一个文件夹,但我有一个问题。我可以很好地指定4位数字,但4位数字后面有时(通常)跟着工作的名字,所以看起来像“4***-凯悦4楼”。因此,我想知道是否有一个通配符可以用来获取与该4位数字相关联的作业名,并重新定义我试图切换到“getfield”函数的文件路径。代码现在相当草率,因为我还没有做任何清理或任何形式的重写。
谢谢 |