;;----------------------------------------------------------- ;; VLAX-REMOVE-VERTEX, (c)2001, John F. Uhden, Cadlantic ;; Function to delete a vertex of any POLYLINE ;; given either the 'ENAME or VLA-OBJECT name of the entity ;; and either an index number or the coordinate of the vertex ;; (defun vlax-remove-vertex (object what / name coords index n i new ilist) (vl-load-com) (and (or (and (= (type object) 'ENAME) (setq object (vlax-ename->vla-object object)) ) (= (type object) 'VLA-OBJECT) ) (princ (setq name (vlax-get object "ObjectName"))) (vl-position name '("AcDbPolyline" "AcDb2dPolyline" "AcDb3dPolyline")) (setq coords (vlax-get object "Coordinates")) (setq n (length coords)) (cond ((= (type what) 'INT) (setq index (* what (if (= name "AcDbPolyline") 2 3))) (and (>= index 0)(< index n)) ) ((= name "AcDbPolyline") (and (listp what) (setq i (vl-list-length what)) (vl-position i '(2 3)) (vl-every 'numberp what) (setq index (vlax-curve-getParamAtPoint object what)) (setq index (* 2 (fix (+ index 0.5)))) ) ) ((wcmatch name "AcDb#dPolyline") (and (listp what) (setq i (vl-list-length what)) (vl-position i '(2 3)) (vl-every 'numberp what) (setq index (vlax-curve-getParamAtPoint object what)) (setq index (* 3 (fix (+ index 0.5)))) ) ) ) (setq i 0) (if (= name "AcDbPolyline") (setq ilist (list index (1+ index))) (setq ilist (list index (1+ index)(+ index 2))) ) (foreach item coords (if (not (vl-position i ilist)) (setq new (cons item new)) ) (setq i (1+ i)) ) (not (vl-catch-all-apply 'vlax-put (list object "Coordinates" (reverse new)))) ) )