- (DEFUN $gen-xin-pline-zuo-biao$ (ent pts / b g h i)
- ;更新pl线的坐标,更新直线坐标,不能是多个list,只能是一个list,注意:pts必需是二维点,不是三维点
- (if (and ent pts)
- (PROGN
- (if (and (> (length pts) 1)
- (= (type (car pts)) 'list)
- (= (length (car pts)) 3)
- )
- (progn
- (setq b (vlax-ename->vla-object ent))
- ;(setq ent(car(entsel)))
- (or (AND (= (vla-get-objectname b) "AcDb3dPolyline")
- (setq
- pts
- (mapcar (function (lambda (a) (list (car a) (cadr a) 0)))
- pts
- )
- )
- ) ;这里确保是三维点坐标
- (AND (= (vla-get-objectname b) "AcDbPolyline")
- (setq
- pts
- (mapcar (function (lambda (a) (list (car a) (cadr a))))
- pts
- )
- )
- ) ;这里确保是二维点坐标
- )
- (setq pts (apply 'append pts)) ;拼接成一个list
- )
- )
- (setq g pts)
- (setq h (vl-catch-all-apply
- 'vlax-make-safearray
- (LIST vlax-vbDouble (cons 0 (1- (length g))))
- )
- )
- (setq
- i (vl-catch-all-apply 'vlax-safearray-fill (LIST h g))
- )
- (vl-catch-all-apply
- 'vla-put-Coordinates
- (LIST b (vl-catch-all-apply 'vlax-make-variant (list i)))
- )
- (vl-catch-all-apply 'vla-update (LIST b))
- )
- )
- )
|