Author Topic: Removing vertices ?  (Read 4266 times)

0 Members and 1 Guest are viewing this topic.

agbbvw

  • Guest
Removing vertices ?
« on: May 26, 2017, 03:16:33 AM »
hi guys,

i need help, i rly looked up on internet but i have not found a solution yet.

i need theese codes which are given below in vba. like "select pline and done !" <3
pls help me.

kerry's code. he has a wonderfull code. (respect)
Quote
(defun c:remove-vertex ( / CNT EPOINT INDEX INDEXLIST NAME NEWLIST OBJENT VERTEXLIST)
;;; kwb 20050519
  (and (setq objent (vlax-ename->vla-object (car (entsel))))
       (vl-position (setq name (vlax-get objent "ObjectName")) '("AcDbPolyline"))
                                   ;"AcDb2dPolyline" "AcDb3dPolyline"))
       (setq vertexlist (vlax-get objent "Coordinates"))
       (while
         (and (setq epoint (getpoint "Select Vertex to remove"))
              (setq cnt     0
                    newlist '()
                    index   (* 2 (fix (+ 0.5 (vlax-curve-getparamatpoint objent epoint))))
              )
              (setq indexlist (list index (1+ index)))
              ;;
              (foreach ordinate vertexlist
                (if (not (vl-position cnt indexlist))
                  (setq newlist (cons ordinate newlist))
                )
                (setq cnt (1+ cnt))
              )
              (not (vl-catch-all-apply 'vlax-put
                                       (list objent "Coordinates" (reverse newlist))
                   )
              )
              (setq vertexlist (vlax-get objent "Coordinates"))
         )
       )
  )
)