Author Topic: Using a wildcard to select a drawing  (Read 1296 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Using a wildcard to select a drawing
« 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?
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Using a wildcard to select a drawing
« Reply #1 on: April 18, 2020, 10:34:58 AM »
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")))
  )
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Dlanor

  • Bull Frog
  • Posts: 263
Re: Using a wildcard to select a drawing
« Reply #2 on: April 18, 2020, 10:46:18 AM »
This worked for me. List of files matching

Code - Auto/Visual Lisp: [Select]
  1. (setq dir "D:\\Autocad Files\\Lisp\\test_dwgs\\test\\" ext "*BasePlan*.dwg")
  2. (setq flst (vl-directory-files dir ext 1))
  3.  

GDF

  • Water Moccasin
  • Posts: 2081
Re: Using a wildcard to select a drawing
« Reply #3 on: April 18, 2020, 10:58:23 AM »
Perfect|

Thank you sir
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Using a wildcard to select a drawing
« Reply #4 on: April 18, 2020, 11:10:15 AM »
This is what I'm using:

(setq *Xref* (strcat (getvar "DwgPrefix")(car (vl-directory-files (getvar "DwgPrefix") "*BasePlan*.dwg" 1))))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64