Author Topic: Filter for drawing files  (Read 1996 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Filter for drawing files
« on: March 26, 2009, 02:41:18 PM »
At a loss...

(setq DwgList (vl-directory-files DirPath "A*.dwg" 1))

How would I modify the above line to filter all A, M, E, P and S letters?

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

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Filter for drawing files
« Reply #1 on: March 26, 2009, 02:46:14 PM »
(setq DwgList (vl-directory-files DirPath "[AMEPS]*.dwg" 1))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Filter for drawing files
« Reply #2 on: March 26, 2009, 02:56:08 PM »
At a loss...

(setq DwgList (vl-directory-files DirPath "A*.dwg" 1))

How would I modify the above line to filter all A, M, E, P and S letters?

Gary

I don't believe vl-directory-files supports wcmatch filtering, but supports traditional DOS dir command wild carding (?|*).

If true, then:

Code: [Select]
(vl-remove-if-not
   '(lambda (x) (wcmatch (strcase x) "[AMEPS]*"))
    (vl-directory-files DirPath "*.dwg" 1)
)

Should work.

<untested|coded blind>

Edit: Fixed dumb typo, wth is with me lately.
« Last Edit: March 26, 2009, 03:00:34 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

GDF

  • Water Moccasin
  • Posts: 2081
Re: Filter for drawing files
« Reply #3 on: March 26, 2009, 03:03:50 PM »
Michael and Alan

Thanks

Michael your solution worked pecfectly.

Thanks again guys
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Filter for drawing files
« Reply #4 on: March 26, 2009, 03:06:16 PM »
Michael and Alan

Thanks

Michael your solution worked pecfectly.

Thanks again guys

That there is poetry.  :-D

<glad it worked>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst