应该是代码其余部分有问题吧- (defun lm-get-Centroid (ty / obj pt x y)
- (setq obj (vlax-ename->vla-object ty))
- (vla-getboundingbox obj 'p1 'p2)
- (mapcar 'set'(x1 y1) (vlax-safearray->list p1 ))
- (mapcar 'set'(x2 y2) (vlax-safearray->list p2 ))
- (setq pt(list (/(+ x1 x2)2.0) (/(+ y1 y2)2.0)))
- pt
- )
- (setq
- ss1 (ssadd)
- ss(ssget)
- pt1(getpoint)
- pt2(getpoint)
- i 0
- )
- (repeat (sslength ss)
- (setq ent (ssname ss i)) ; 获取选择集中的第一个对象
- (setq pt0(lm-get-Centroid ent))
- (setq vlaObj (vlax-ename->vla-object ent)) ; 将实体名称转换为 VLA 对象
- (setq vlaObjCopy(vla-Mirror vlaObj (vlax-3D-point pt1) (vlax-3D-point pt2)) ); 镜像对象
- (ssadd (vlax-vla-object->ename vlaObjcopy) ss1)
- (setq i (1+ i))
- )
- (sssetfirst nil ss1)
|