Author Topic: te get a list of comon word on each member  (Read 2248 times)

0 Members and 1 Guest are viewing this topic.

DEVITG

  • Bull Frog
  • Posts: 481
te get a list of comon word on each member
« on: May 16, 2006, 07:47:36 PM »
I have this list with the names of all the layers in a DWG

Quote
("texto" "cotas" "Norte" "E manzana nros lotes" "E manzana nro" "E manzana lotes" "E manzana" "Defpoints" "D manzana nros  lotes" "D manzana nro" "D manzana lotes" "D manzana" "C manzana nros lotes" "C manzana nro" "C manzana lotes" "C manzana" "B manzana nros lotes" "B manzana nro" "B manzana lotes" "B manzana" "A manzana nros lotes" "A manzana nro" "A manzana lotes" "A manzana" "0")
 

As you can notice ther are a lot of them that contains the word manzana , it stand for the array of parcels in a subdivision or the terrain surrounding  by streets that have parcels inside.
By the way lotes stand for parcel.

Guess it is  well explain , my question.

How I can get the list with all the layers that have this word      manzana inside???

so I will have

Quote
   "E manzana nros lotes" "E manzana nro" "E manzana lotes" "E manzana"  "D manzana nros  lotes" "D manzana nro" "D manzana lotes" "D manzana" "C manzana nros lotes" "C manzana nro" "C manzana lotes" "C manzana" "B manzana nros lotes" "B manzana nro" "B manzana lotes" "B manzana" "A manzana nros lotes" "A manzana nro" "A manzana lotes" "A manzana" 

Thank in advance.



Location @ Córdoba Argentina Using ACAD 2019  at Window 10

uncoolperson

  • Guest
Re: te get a list of comon word on each member
« Reply #1 on: May 16, 2006, 08:02:59 PM »
sick day so i'm away from autocad

but i think something like this is what you might be looking for

Code: [Select]
(setq yourlist '("texto" "cotas" "Norte" "E manzana nros lotes" "E manzana nro" "E manzana lotes" "E manzana" "Defpoints" "D manzana nros  lotes" "D manzana nro" "D manzana lotes" "D manzana" "C manzana nros lotes" "C manzana nro" "C manzana lotes" "C manzana" "B manzana nros lotes" "B manzana nro" "B manzana lotes" "B manzana" "A manzana nros lotes" "A manzana nro" "A manzana lotes" "A manzana" "0") )

(setq thelist (VL-REMOVE-IF-NOT
    '(LAMBDA (partoflist) (wcmatch partoflist "*manzana*"))
    yourlist
  ))


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: te get a list of comon word on each member
« Reply #2 on: May 16, 2006, 08:09:39 PM »
Sorry to hear you're under the weather.
It's almost exactly what I cooked up. You were a little faster though.

Code: [Select]
(defun c:test ()

  (setq masterlist '("texto" "cotas" "Norte" "E manzana nros lotes" "E manzana nro" "E manzana lotes" "E manzana"
                     "Defpoints" "D manzana nros  lotes" "D manzana nro" "D manzana lotes" "D manzana"
                     "C manzana nros lotes" "C manzana nro" "C manzana lotes" "C manzana" "B manzana nros lotes"
                     "B manzana nro" "B manzana lotes" "B manzana" "A manzana nros lotes" "A manzana nro"
                     "A manzana lotes" "A manzana" "0"
                    )
  )

  (setq target "*manzana*")

  (setq result (vl-remove nil
                          (mapcar '(lambda (x) (if (wcmatch x target) x))
                                  masterlist
                          )
               )
  )

)
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.

DEVITG

  • Bull Frog
  • Posts: 481
Re: te get a list of comon word on each member
« Reply #3 on: May 16, 2006, 08:11:55 PM »
Hi Uncool  and Cab , yes it work great .

Thanks a lot

Location @ Córdoba Argentina Using ACAD 2019  at Window 10

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: te get a list of comon word on each member
« Reply #4 on: May 16, 2006, 08:35:23 PM »
Don't get bit by case differences when adopting that code for other purposes.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst