TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: matrix2005in on May 29, 2006, 02:06:34 PM

Title: Delete single vertex by picking a polyline
Post by: matrix2005in on May 29, 2006, 02:06:34 PM
hi

any one have a lisp for deleting a vertex in plyline by picking it..... 8-)


thanks

mathew
Title: Re: Delete single vertex by picking a polyline
Post by: ElpanovEvgeniy on May 29, 2006, 02:24:28 PM
hi

any one have a lisp for deleting a vertex in plyline by picking it..... 8-)


thanks

mathew
The polyline should be shared into two parts or be deleted point?
Title: Re: Delete single vertex by picking a polyline
Post by: Dinosaur on May 29, 2006, 02:40:41 PM
There may be a solution for you in THIS (http://www.theswamp.org/index.php?topic=5251.0) thread.
Title: Re: Delete single vertex by picking a polyline
Post by: Jeff_M on May 30, 2006, 08:26:30 PM
I thought I'd posted this before, but I'm not finding it now.....
Code: [Select]
(defun c:vtx-del (/ bulges coords ent idx param pt)
  (defun removenth (n lst / i rtn)
   (reverse
      (progn
         (setq i -1)
         (foreach x lst
            (if (/= n (setq i (1+ i)))
               (setq rtn (cons x rtn))
            )
         )
         rtn
)
      )
    )
  (command "undo" "be")
  (while (and (setq ent (entsel "\nSelect vertex to remove: "))
      (eq (cdr (assoc 0 (entget (car ent)))) "LWPOLYLINE")
      (setq pt (osnap (cadr ent) "near")
    ent (vlax-ename->vla-object (car ent)))
      )
    (setq param (atoi (rtos (vlax-curve-getparamatpoint ent pt) 2 0)))
    (setq coords (vlax-get ent 'coordinates)
  idx -1
  bulges nil)
    (repeat (/ (length coords) 2)
      (setq bulges (cons (vla-getbulge ent (setq idx (1+ idx))) bulges))
      )
    (setq bulges (removenth param (reverse bulges)))
    (repeat 2
      (setq coords (removenth (* 2 param) coords))
      )
    (vlax-put ent 'coordinates coords)
    (setq idx -1)
    (foreach bulge bulges
      (vla-setbulge ent (setq idx (1+ idx)) bulge)
      )
    )
  (command "undo" "end")
  (princ)
  )
Title: Re: Delete single vertex by picking a polyline
Post by: whdjr on February 23, 2009, 08:29:08 AM
Just found this topic Jeff.  Thanks! It is what I need.
Title: Re: Delete single vertex by picking a polyline
Post by: CAB on February 23, 2009, 09:20:56 AM
This is also a related thread:
http://www.theswamp.org/index.php?topic=19865.0
Title: Re: Delete single vertex by picking a polyline
Post by: whdjr on February 23, 2009, 09:33:46 AM
This is also a related thread:
http://www.theswamp.org/index.php?topic=19865.0
That's a very cool thread CAB, but what I currently needed was to just remove specific vertices, not necessarily inline vertices.