rodrigo_sjc_sp Posted August 26, 2013 Posted August 26, 2013 I have a polyline, and this has the same vertex overlapping, how to identify the vertex overlapping and zooming in it? Using lisp. Quote
Tuns Posted August 26, 2013 Posted August 26, 2013 So you have a polyline with a vertex, and you want to zoom in on this vertex? Quote
Lee Mac Posted August 26, 2013 Posted August 26, 2013 Do you mean that the polyline has two or more vertices located at the same position? Quote
LanloyLisp Posted August 26, 2013 Posted August 26, 2013 Zooming a duplicate vertex in a polyline seems not appropriate. A better approach maybe is to encircle the duplicate vertices. Quote
rodrigo_sjc_sp Posted August 27, 2013 Author Posted August 27, 2013 It is as if the operator autocad, to make a polyline , create a new vertex on the other another vertex or drag one over the other. Do I just need to zoom in on this vertex. Lee, That's it. It is as if a vertex had another about it. Quote
Lee Mac Posted August 27, 2013 Posted August 27, 2013 Try this simple program: ([color=BLUE]defun[/color] c:vdupes ( [color=BLUE]/[/color] e i s ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] s ([color=BLUE]ssget[/color] '((0 . [color=MAROON]"LWPOLYLINE"[/color])))) ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] s)) ([color=BLUE]foreach[/color] x (LM:ListDupesFuzz ([color=BLUE]vl-remove-if-not[/color] '([color=BLUE]lambda[/color] ( x ) ([color=BLUE]=[/color] 10 ([color=BLUE]car[/color] x))) ([color=BLUE]setq[/color] e ([color=BLUE]entget[/color] ([color=BLUE]ssname[/color] s ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))))) ) 1e-8 ) ([color=BLUE]entmake[/color] ([color=BLUE]list[/color] '(0 . [color=MAROON]"CIRCLE"[/color]) '(8 . [color=MAROON]"Duplicate-Vertices"[/color]) [color=GREEN];; Layer[/color] x '(40 . 1.0) [color=GREEN];; Radius[/color] '(62 . 1) [color=GREEN];; Colour[/color] ([color=BLUE]assoc[/color] 210 e) ) ) ) ) ) ([color=BLUE]princ[/color]) ) [color=GREEN];; List Duplicates with Fuzz - Lee Mac[/color] [color=GREEN];; Returns a list of items appearing more than once in a supplied list[/color] ([color=BLUE]defun[/color] LM:ListDupesFuzz ( l f [color=BLUE]/[/color] c r x ) ([color=BLUE]while[/color] l ([color=BLUE]setq[/color] x ([color=BLUE]car[/color] l) c ([color=BLUE]length[/color] l) l ([color=BLUE]vl-remove-if[/color] '([color=BLUE]lambda[/color] ( y ) ([color=BLUE]equal[/color] x y f)) ([color=BLUE]cdr[/color] l)) ) ([color=BLUE]if[/color] ([color=BLUE]<[/color] ([color=BLUE]length[/color] l) ([color=BLUE]1-[/color] c)) ([color=BLUE]setq[/color] r ([color=BLUE]cons[/color] x r)) ) ) ([color=BLUE]reverse[/color] r) ) ([color=BLUE]princ[/color]) The above will circle the duplicate vertices, with all circles generated on their own layer. Quote
marko_ribar Posted August 27, 2013 Posted August 27, 2013 I've changed codes in the link I provided above... Codes had many lacks - they were old and I forgot what were they all about, but now they are OK... Note that it's worth reading [EDIT] comments and from post #4 on the thread of link I provided... When you find self-intersecting points, you can encircle them with entmake circle entities like in example Lee showed... M.R. Quote
rodrigo_sjc_sp Posted August 28, 2013 Author Posted August 28, 2013 Thanks to all ! I used the code made by Lee as a base, and ran the zoom .. Quote
rodrigo_sjc_sp Posted August 29, 2013 Author Posted August 29, 2013 Sorry for the delay here is more code shared with everybody, who wants to use in the future (defun vs ( / e i s ) (if (setq s (ssget "_x" '((0 . "LWPOLYLINE")))) (repeat (setq i (sslength s)) (foreach x (LM:ListDupesFuzz (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (setq e (entget (ssname s (setq i (1- i))))) ) 1e-8 ) (entmake (list '(0 . "CIRCLE") '(8 . "Duplicate-Vertices") ;; Layer x '(40 . 1.0) ;; Radius '(62 . 1) ;; Colour (assoc 210 e) ) ) (setq selpline2 (ssget "_x" (list '(0 . "CIRCLE")(cons 8 "Duplicate-Vertices")))) (setq m 0) (repeat (sslength selpline2) (setq pline_ent2 (ssname selpline2 m)) (setq lis_ent2 (entget pline_ent2)) (Alert "Attention. Vertex superimposed. I will show through a Zoom.") (COMMAND "ZOOM" "OBJECT" pline_ent2 "") (exit) ) ) ) ) (princ) ) ;; List Duplicates with Fuzz - Lee Mac ;; Returns a list of items appearing more than once in a supplied list (defun LM:ListDupesFuzz ( l f / c r x ) (while l (setq x (car l) c (length l) l (vl-remove-if '(lambda ( y ) (equal x y f)) (cdr l)) ) (if (< (length l) (1- c)) (setq r (cons x r)) ) ) (reverse r) ) (princ) Quote
rodrigo_sjc_sp Posted August 29, 2013 Author Posted August 29, 2013 Thanks again everyone, this above code is based on code from Lee Quote
Lee Mac Posted August 29, 2013 Posted August 29, 2013 You're very welcome Rodrigo Here is an alternative perhaps: (defun vs ( / e i s ) (if (setq s (ssget "_x" '((0 . "LWPOLYLINE")))) (repeat (setq i (sslength s)) (foreach x (LM:ListDupesFuzz (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) (setq e (entget (ssname s (setq i (1- i))))) ) 1e-8 ) (command "_.zoom" "_Object" (entmakex (list '(0 . "CIRCLE") '(8 . "Duplicate-Vertices") ;; Layer x '(40 . 1.0) ;; Radius '(62 . 1) ;; Colour (assoc 210 e) ) ) "" ) (princ "\nPress any key to view next duplicate...") (grread) ) ) ) (princ) ) ;; List Duplicates with Fuzz - Lee Mac ;; Returns a list of items appearing more than once in a supplied list (defun LM:ListDupesFuzz ( l f / c r x ) (while l (setq x (car l) c (length l) l (vl-remove-if '(lambda ( y ) (equal x y f)) (cdr l)) ) (if (< (length l) (1- c)) (setq r (cons x r)) ) ) (reverse r) ) (princ) Quote
marko_ribar Posted August 29, 2013 Posted August 29, 2013 (edited) Here is mine version (with help of LM) for encircling and cleaning checking of LWPOLYLINES... (Used subfunctions from link posted and gile's subfunctions for cleaning LWs and LM subfunctions for encircling LWs)... M.R. checklwpls.lsp Edited September 20, 2013 by marko_ribar 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.