这个接着最后一点画线,感觉"像"pl命令。对于闭合线可能不是正确的结果。- (defun C:TT (/ EN OBJ PT PP END_PT N N_PT )
- (defun HH:GetCurveNum (obj)
- (if (vlax-curve-isClosed obj)
- (fix (1- (vlax-curve-getendParam obj)))
- (fix (vlax-curve-getendParam obj))
- )
- )
- (if (and (setq EN (entsel "\n选择多选线: "))
- (setq EN (car EN))
- (sssetfirst nil (ssadd EN))
- (setq OBJ (vlax-ename->vla-object EN))
- (or (= (vla-get-objectname OBJ) "AcDbPolyline")
- (and (princ "\n所选的对象不是多段线。") nil)
- )
- )
- (progn
- (setq end_pt(vlax-curve-getEndPoint OBJ))
- (while (if end_pt (setq PT (getpoint end_pt "\n指定新顶点: ")) (setq PT (getpoint "\n指定新顶点: ")))
- (setq PT (trans PT 1 0)
- ;PP (vlax-curve-getclosestpointto OBJ PT)
- pp (vlax-3d-point pt)
- )
- (setq N(HH:GetCurveNum obj))
-
- (setq n_pt(vlax-safearray-fill
- (vlax-make-safearray vlax-vbdouble '(0 . 1))
- (list(car pt)(cadr pt))
- ))
- (vla-addvertex obj (1+ n) n_pt )
- (setq end_pt(vlax-curve-getEndPoint OBJ))
- )
- )
- )
- (sssetfirst)
- (princ)
- )
|