本帖最后由 林霄云 于 2019-6-27 09:42 编辑
Lwpolyline使用vla-put-coordinate修改端点时,传入的点应只包括2维数据。即:(vla-put-coordinate enobj para ptob)语句中,ptob不能使用vlax-3d-point生成。而应先(setq ptob (vlax-make-safearray vlax-vbDouble '(0 . 1))),并用vlax-safearray-fill完成赋值。代码片段如下:
- (( = typ "LWPOLYLINE")
- (setq en1 (car en) pt (cadr en) enobj (vlax-ename->vla-object en1) )
- (setq pt1 (get_pline_closest1 en1 pt)
- para (fix (vlax-curve-getParamAtPoint en1 pt1)))
- (setq pt2 (utow (getpoint (wtou pt1) "\n输入新端点:")))
- ;(setq ptob (vlax-variant-value ( vla-get-coordinate enobj para)))
- (setq ptob (vlax-make-safearray vlax-vbDouble '(0 . 1)))
- ;用vlax-make-safearray创建一个数组,包括两个元素
-
- ;(vla-put-coordinate enobj para (vlax-3D-point (list (car pt2) (cadr pt2))))
- ;不能使用vlax-3d-point 返回值有3个元素。
-
- (vlax-safearray-fill ptob (list (car pt2) (cadr pt2)))
- (vla-put-coordinate enobj para ptob)
- ;(vlax-safearray->list (vlax-variant-value pt))
- (vla-Update enobj )
- );cond lwpolyline
|