devitg Posted November 1, 2009 Posted November 1, 2009 From a SSGET at a (setq ins-pt '(785765.0 9.28376e+006 0.0) ) (setq ent-ss (ssget "_c" ins-pt ins-pt '((0 . "LINE") ))) I got all its 10 and 11 code , as I do not know wich one are on the INS-PT. I sort it to Z value and got it , (setq pt-list (list '(785766.0 9.28375e+006 2418.41) '(785768.0 9.28375e+006 2420.24) '(785760.0 9.28377e+006 2421.07) '(785769.0 9.28375e+006 2421.72) '(785770.0 9.28376e+006 2422.19) '(785770.0 9.28376e+006 2422.24) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785762.0 9.28377e+006 2422.77) '(785763.0 9.28377e+006 2422.91) )) It is clear that my common point is (785765.0 9.28376e+006 2422.47) How can I get it from the LIST.? Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 From a SSGET at a (setq ins-pt '(785765.0 9.28376e+006 0.0) ) (setq ent-ss (ssget "_c" ins-pt ins-pt '((0 . "LINE") ))) I got all its 10 and 11 code , as I do not know wich one are on the INS-PT. I sort it to Z value and got it , (setq pt-list (list '(785766.0 9.28375e+006 2418.41) '(785768.0 9.28375e+006 2420.24) '(785760.0 9.28377e+006 2421.07) '(785769.0 9.28375e+006 2421.72) '(785770.0 9.28376e+006 2422.19) '(785770.0 9.28376e+006 2422.24) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785765.0 9.28376e+006 2422.47) '(785762.0 9.28377e+006 2422.77) '(785763.0 9.28377e+006 2422.91) )) It is clear that my common point is (785765.0 9.28376e+006 2422.47) How can I get it from the LIST.? Are you asking how to extract the point in the list that has duplicates? Quote
devitg Posted November 1, 2009 Author Posted November 1, 2009 Are you asking how to extract the point in the list that has duplicates? Yes , because it hold the Z value , just over the block (setq ins-pt '(785765.0 9.28376e+006 0.0) ) Ins-pt is the insertion point of the block , so by (setq ent-ss (ssget "_c" ins-pt ins-pt '((0 . "LINE") ))) I got all the lines that match it's code 10 or code 11 at such point. Now I get all code 10 and 11 , only the repeated value hold the Z over the block's insertion point I tried with (ssget "_c" INS-PT INS-PT (list '(0 . "LINE") '(-4 . "<or") '(-4 . "=,=,*") (cons 10 INS-PT) '(-4 . "=,=,*") (cons 11 INS-PT) '(-4 . "or>"))) Given the * as wildcard for any Z value , but it did not work. See the Sample DWG , So I got all code 10 and 11 from each line , then sort it by it's Z value , an got the LIST with the repeated and not repeated points. The repeated , hold the Z value over the block's insertion point to get the z over the block.dwg Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 Call it a first draft, it will only return 1 duplicate... [color=Yellow](defun DuplicatePoint (#List / #New #Dup) (foreach x #List (if (member x #New) (setq #Dup x) (setq #New (cons x #New)) ) ;_ if ) ;_ foreach #Dup ) ;_ defun[/color] **UPDATE: Much better one posted here: http://www.cadtutor.net/forum/showpost.php?p=280056&postcount=12 I'll leave the original up for posterity. Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 This might also help: ;;; Remove all duplicates from list ;;; #List - List to process ;;; Alan J. Thompson, 04.21.09 (defun AT:ListNoDuplicates (#List / #New) (foreach x #List (or (vl-position x #New) (setq #New (cons x #New))) ) ;_ foreach (reverse #New) ) ;_ defun Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 It work as I need to be .Thanks No problem. Quote
devitg Posted November 1, 2009 Author Posted November 1, 2009 This one is like the REMOVE-DUPS I use , it is not the case , It remove , but do not show wich one is the duplicate. Thanks Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 This one is like the REMOVE-DUPS I use , it is not the case , It remove , but do not show wich one is the duplicate. Thanks I know that. I was just offering another list duplicate example. Quote
alanjt Posted November 1, 2009 Posted November 1, 2009 Thanks.I appreciate it . No problem. I assume you figured everything out. Quote
alanjt Posted November 2, 2009 Posted November 2, 2009 Thought about this over dinner... ;;; Return all all duplicates within list ;;; #List - List to process ;;; Alan J. Thompson, 11.01.09 (defun AT:ListDuplicates (#List) (vl-remove-if-not '(lambda (x) (member x (cdr (member x #List)))) #List ) ;_ vl-remove-if-not ) ;_ defun Will return all duplicates. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.