Author Topic: Wildcard values in lisp question  (Read 2262 times)

0 Members and 1 Guest are viewing this topic.

diarmuid

  • Bull Frog
  • Posts: 417
Wildcard values in lisp question
« on: February 10, 2011, 05:23:00 AM »
Look at the part of a lisp I have written below

At one part of the lisp, it checks to see if the file  a particular number.  If so, then it quits.
The list of drawings shown below is much, much longer than shown, but you get the idea.


Code: [Select]

(setq pfdcheck (getvar "dwgname"))

(if      (or
                    (= pfdcheck "WN49090010001.dwg")
                    (= pfdcheck "WN49090010002.dwg")
                    (= pfdcheck "WN49090010003.dwg")
                    (= pfdcheck "WN49090010004.dwg")
                    (= pfdcheck "WN49090010005.dwg")
                    (= pfdcheck "WN49090010006.dwg")
                    (= pfdcheck "WN49090010007.dwg")
                    (= pfdcheck "WN49090010008.dwg")
                    )
             
               
               
               (progn
                    (prompt "\nNot a P&ID Drawing.")
                    (prompt "\n ")
                    (princ)
                    (quit)
                                     
               );end progn
        )





What I’m wondering is, can I do a wildcard type scenario.  The first 10000 series drawings have been reserved for PFD’s, and I want to exclude them from the next part of the lisp.

So what I’m trying to convey is  could I do something like:

(= pfdcheck "WN4909001****.dwg")


Instead of having a long list of drawings that i have to manage as new files get added.

Any help or hints would be greatly appreciated

Regards

Diarmuid

If you want to win something run the 100m, if you want to experience something run a marathon

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Wildcard values in lisp question
« Reply #1 on: February 10, 2011, 05:33:05 AM »
Hi,

Look at the wcmatch LISP function topis in the developer's help.
Quote
# (pound)   Matches any single numeric digit.

Code: [Select]
(wcmatch pfdcheck "WN4909001####.dwg")
Speaking English as a French Frog

diarmuid

  • Bull Frog
  • Posts: 417
Re: Wildcard values in lisp question
« Reply #2 on: February 10, 2011, 06:14:26 AM »
Perfect,

thanks

Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon