Results 1 to 4 of 4

Thread: Remove the list if one of member equal to A

  1. #1
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Remove the list if one of member equal to A

    For example: I have a data list like below:
    1,1,1,1
    A,2,0,0
    2,3,3,2
    A,4,0,0
    3,5,3,2
    4,6,3,3

    How to write the lisp code so that i can remove the list if there a member equal to A?
    Then the list should return like below:
    1,1,1,1
    2,3,3,2
    3,5,3,2
    4,6,3,3

    Thanks in advance.

  2. #2
    I could stop if I wanted to kpblc2000's Avatar
    Join Date
    2006-09
    Posts
    212
    Login to Give a bone
    0

    Default Re: Remove the list if one of member equal to A

    Something like this
    Code:
    _$ (setq lst '("1,1,1,1"
    "A,2,0,0"
    "2,3,3,2"
    "A,4,0,0"
    "3,5,3,2"
    "4,6,3,3"))
    ("1,1,1,1" "A,2,0,0" "2,3,3,2" "A,4,0,0" "3,5,3,2" "4,6,3,3")
    _$ (vl-remove-if '(lambda(x) (wcmatch(strcase x) "*A*")) lst)
    ("1,1,1,1" "2,3,3,2" "3,5,3,2" "4,6,3,3")
    or
    Code:
    _$ (setq a 16.56)
    16.56
    _$ (setq lst (list '(1 1 1 1)
    (list A 2 0 0)
    '(2 3 3 2)
    (list A 4 0 0)
    '(3 5 3 2)
    '(4 6 3 3)))
    ((1 1 1 1) (16.56 2 0 0) (2 3 3 2) (16.56 4 0 0) (3 5 3 2) (4 6 3 3))
    _$ (vl-remove-if '(lambda(x) (vl-remove-if-not '(lambda(y) (equal y a)) x)) lst)
    ((1 1 1 1) (2 3 3 2) (3 5 3 2) (4 6 3 3))
    I think so.

  3. #3
    Active Member
    Join Date
    2006-10
    Posts
    80
    Login to Give a bone
    0

    Default Re: Remove the list if one of member equal to A

    Even I try too many time, I still cannot get the solution.
    Attached here are my lisp code, dwg, csv file and xml file.
    Please do try my code on my drawing.
    What I want to remove are the list when value of column A in csv file equal to NC or DB.
    Because of that value, a few rectangulars have been drawn at centre cross mark.
    I dont want to draw the rectagular at centre cross mark.
    Please help me modify my code. Thanks.
    Attached Files Attached Files
    Last edited by noadea; 2007-08-29 at 07:13 AM.

  4. #4
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Remove the list if one of member equal to A

    One more:
    Code:
    (setq lst '(
                (1 1 1 1)
                (9 2 0 0)
                (2 3 3 2)
                (9 4 0 0)
                (3 5 3 2)
                (4 6 3 3)
               )
    )
    
    (setq A 9)
    
    (setq nlst (vl-remove-if '(lambda (x) (vl-position A x)) lst))

Similar Threads

  1. remove *.dst files from recently accessed documents list
    By Wish List System in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2013-11-06, 07:48 PM
  2. Need to remove printers from list...
    By asdemeter in forum Hardware
    Replies: 1
    Last Post: 2010-08-23, 06:08 PM
  3. Remove drawings or subsets from sheet list.
    By jkipfer in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2005-02-22, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •