Jump to content

Encircle subsequent vertices of polyline with the same coordinates


Recommended Posts

Posted

I'm task to find subsequent vertices of polyline with the same coordinates or zero distance and remove the one vertex.

Having thousand corners of lot is not easy to scroll on the polyline properties.

Seek for help to anybody to make a lisp to find the TWO VERTEX WITH ZERO DISTANCE and delete or remove the other one. And ask whether Encircle or not the point.

May ask to encircle it just to give us a marker where I should start editing of the corner label. Any help would be greatly appreciated.

Posted

Not to search www, I'll dig something from my library that's related to this task... It just relates on removing duplicate vertices, but not encircing them - for this, you have to make the codes be adequate to your specific request, witch is IMO unneccessary...

 

Regards, M.R.

HTH

Clean_polys.lsp

Posted

:)It really help!! Thank you M.R. for sharing.. I only ask circle just to give me some clue where to start the correction of my label cause vertices labeled equally to the vertex number. But this lisp is ok, it will remove trouble of my work..

Posted (edited)

Chocolate

 

(defun c:remseg	(/ ss pts_ pts i before after bd dup)
;;;		pBe 23Nov2013		;;;
[color="blue"](setvar 'pdmode   34)[/color]
 (if (setq pts_ nil
    ss	 (ssget "_:L" '((0 . "LWPOLYLINE")))
     )
   (repeat (setq i (sslength ss))
     (setq pts_ nil [color="blue"]dup nil[/color]
    pl	 (vlax-ename->vla-object (ssname ss (setq i (1- i))))
     )
     (setq before (/ (length
		(setq pts (Vlax-get pl 'Coordinates))
	      )
	      2
	   )
     )
     (while pts
(setq pts_ (cons (list (car pts) (cadr pts)) pts_)
      pts  (cddr pts)
)
     )
     (while pts_
(setq pts  (cons (car pts_) pts)
     [color="blue"] bf (length pts_)[/color]
      pts_ (vl-remove (car pts_) pts_)
)
[color="blue"](if (> (- bf (length pts_) ) 1)
  	(setq dup (cons (car pts) dup)))[/color]

     )
     (setq after (length pts))
     (vlax-put pl 'Coordinates (apply 'append pts))
     (if (> before after)
[color="blue"](progn
  (foreach p dup
    (entmakex (list (cons 0 "POINT")
                 (cons 10 p))))[/color]
(princ (Strcat "\nBefore: "
	       (itoa before)
	       "\tAfter : "
	       (itoa after)
       )
)
  )
(princ "\n<<No Duplicates found>>")
     )
   )
 )
 (princ)
)
(vl-load-com)

Edited by pBe
Add Marker via points entity
Posted

Good for cleaning polyline. Thanx.. my only problem of this are the before and after. Did not match to the location of duplicate vertex.

Posted
Good for cleaning polyline. Thanx.. my only problem of this are the before and after. Did not match to the location of duplicate vertex.

 

Not sure what you mean notview, the before and after prints is to show how many "points" it has before and after processing. DO you really want to put a marker on the location?

Posted

Yes, that is what I really want the marker where the duplicate vertex found. Thank you for the explanation of before and after, I thought that was the location of vertex.:D

Posted
Yes, that is what I really want the marker where the duplicate vertex found.

 

Code at post #4 updated [For now i used a "point" entity for a marker].

 

Still don't get the reasoning for the marker though. :)

Posted

Cheers!!! It works perfect!! You are greatly appreciated!! :thumbsup:

  • 3 weeks later...
Posted

pBe, I found something not ok.. I will show it in a figure..

Posted
SUBSEQUENT.jpgCan you make some changes, I want the result RESULT B.
Posted

Can anybody help.. I want the result of RESULT B figure.

Posted

Overkill command removes duplicate vertices.

Posted
Can anybody help.. I want the result of RESULT B figure.

 

Post that particular pline NotView, Maybe an isolated case or maybe not.

 

Overkill command removes duplicate vertices.

 

I didn't know that.. Goes to show you how much time i spent working on CAD nowadays :D

Posted

You may check this pline pBe..

Thank you for the time you spent with this thread!!:)

 

Right BMR, thanks!, OVERKILL can also remove duplicate vertices.

 

I can suggest pBe, you may check the output of overkill with the said sample pline, and that's the correct I want.

But still needed the guide points of the position of duplicate vertices, after the removed of that duplicate vertices.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...