Author Topic: Delete single vertex by picking a polyline  (Read 14474 times)

0 Members and 1 Guest are viewing this topic.

matrix2005in

  • Guest
Delete single vertex by picking a polyline
« 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

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Delete single vertex by picking a polyline
« Reply #1 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?

Dinosaur

  • Guest
Re: Delete single vertex by picking a polyline
« Reply #2 on: May 29, 2006, 02:40:41 PM »
There may be a solution for you in THIS thread.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Delete single vertex by picking a polyline
« Reply #3 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)
  )

whdjr

  • Guest
Re: Delete single vertex by picking a polyline
« Reply #4 on: February 23, 2009, 08:29:08 AM »
Just found this topic Jeff.  Thanks! It is what I need.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Delete single vertex by picking a polyline
« Reply #5 on: February 23, 2009, 09:20:56 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

whdjr

  • Guest
Re: Delete single vertex by picking a polyline
« Reply #6 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.