Code Red > AutoLISP (Vanilla / Visual)

How to extract data from this list?

<< < (2/3) > >>

Lee Mac:
Another -

--- Code - Auto/Visual Lisp: ---(defun foo ( x l )    (mapcar '(lambda ( i ) (vl-remove x i)) (vl-remove-if-not '(lambda ( i ) (member x i)) l)))
--- Code - Auto/Visual Lisp: ---_$ (foo "M1" l)(("cable01" "E1") ("cable02" "E2") ("cable03" "E3") ("cable06" "E2"))_$ (foo "E1" l)(("cable01" "M1") ("cable04" "M4"))

HasanCAD:

--- Quote from: kdub on March 21, 2019, 06:42:07 AM ---How are you currently getting the data results ? Post code ?

--- End quote ---
I imported from an Excel worksheet using http://www.lee-mac.com/readcsv.html



--- Quote from: kdub on March 21, 2019, 06:42:07 AM ---What result did you expect in the samples you have shown ?

--- End quote ---

The result could be MText I can handle this issue.


--- Quote from: kdub on March 21, 2019, 06:42:07 AM ---Is the data format consistantly shaped ??

--- End quote ---
I did not get this point
What I want to do is
- Read CSV file I handled using http://www.lee-mac.com/readcsv.html
- type the machine tag
- The lisp gives me all other machines tag connected to this machine. This what I am asking for
- Insert the data as MText or a table I can handle using Entmakex.

I hope it is clear.
Attched CSV Cables Data

HasanCAD:

--- Quote from: Marc'Antonio Alessi on March 21, 2019, 07:19:20 AM ---Maybe rebuild the list is one option:
...

--- End quote ---

Thanks Marc'Antonio
But not showing the other tag

HasanCAD:

--- Quote from: kpblc on March 21, 2019, 07:38:22 AM ---Maybe something like this?

--- End quote ---
Thanks for your help but gives error

--- Quote ---; error: bad argument type: consp "HVT-16-0120"
--- End quote ---

Edit: Working perfect There was mistake from my side.
Thanks kpblc

HasanCAD:

--- Quote from: Grrr1337 on March 21, 2019, 08:42:37 AM ---
--- Code - Auto/Visual Lisp: ---(defun f ( k aL )  (apply 'append (mapcar '(lambda (x) (if (member k (cdr x)) (list (vl-remove k x)))) aL)))

--- End quote ---
Thanks Grrr1337
Working perfect

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version