TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: GDF on April 18, 2020, 10:12:27 AM
-
I'm trying to select a drawing file using a wildcard name within a directory without using the getfiled dialog box.
(setq *Xref* (getfiled "Select a File to Xref" "*BasePlan*.dwg" "*" 4))
Any ideas?
-
I got this to work, but it's not what I'm looking for:
(cond
((= (substr (vl-string-right-trim ".dwg" (getvar 'dwgname)) 18 1) "L")
(setq *Xref* (strcat (getvar "DwgPrefix")(substr (vl-string-right-trim ".dwg" (getvar 'dwgname)) 1 16) "DRH-BasePlan-L.dwg")))
((= (substr (vl-string-right-trim ".dwg" (getvar 'dwgname)) 18 1) "R")
(setq *Xref* (strcat (getvar "DwgPrefix")(substr (vl-string-right-trim ".dwg" (getvar 'dwgname)) 1 16) "DRH-BasePlan-R.dwg")))
)
-
This worked for me. List of files matching
(setq dir
"D:\\Autocad Files\\Lisp\\test_dwgs\\test\\" ext
"*BasePlan*.dwg")
-
Perfect|
Thank you sir
-
This is what I'm using:
(setq *Xref* (strcat (getvar "DwgPrefix")(car (vl-directory-files (getvar "DwgPrefix") "*BasePlan*.dwg" 1))))