I would like to take all the vertices out of a multiple-vertices polyline so that it reduces to just its start and end points, can this be done?
(defun c:Test (/ ss i sn l p) (if (setq ss (ssget "_:L" '((0 . "*POLYLINE")))) (repeat (setq i (sslength ss)) (setq sn (ssname ss (setq i (1- i)))) (setq l (vl-remove-if-not (function (lambda (x) (member (car x) '(0 100 8 70 90 410 210))) ) (entget sn) ) ) (setq p (vl-remove-if-not (function (lambda (x) (eq (car x) 10))) (entget sn) ) ) (entmakex (append l (list (car p) (last p)))) (entdel sn) ) ) (princ) )
You're welcome .
I would like to take all the vertices out of a multiple-vertices polyline so that it reduces to just its start and end points, ....
Another way, straightening the Polyline from start to end, if 'ename' is the entity name of the Polyline:
(command "_.pedit" ename "_e" "_s")
(repeat (1- (cdr (assoc 90 (entget ename))))
(command "_g" "_x" "")
And another, that depends on the fact that if not given 40/41/42 values for widths and bulge after vertex locations, it will assume zero for all of them:
(setq edata (entget ename))
(vl-remove-if '(lambda (x) (member (car x) '(10 40 41 42))) edata); all except vertices/widths/bulges
(list (assoc 10 edata)); first vertex
(list (assoc 10 (reverse edata))); last vertex
"_.matchprop" ename "_last" ""
"_.erase" ename ""
Access a broad range of knowledge to help get the most out of your products and services.