本帖最后由 Gu_xl 于 2013-3-19 21:23 编辑
终于想到解决办法了,就是自定义一下偏移命令函数
- (defun gxl-Offset (obj d / Flag minpoint maxpoint acadver rtn)
- (setq acadver (substr (getvar "acadver") 1 2))
- (vla-GetBoundingBox obj 'minpoint 'maxpoint)
- (setq maxpoint (vlax-safearray->list maxpoint))
- (if (or (>= (abs(car maxpoint)) 10000.0)(>= (abs(cadr maxpoint)) 10000.0))
- (setq Flag t)
- )
- (cond ((and flag (= "16" acadver) (= (vla-get-ObjectName obj) "AcDbPolyline"))
- (vla-move obj minpoint (vlax-3d-point '(0 0 0)))
- (setq rtn (VL-CATCH-ALL-APPLY 'vla-Offset (list obj d)))
- (if (not (VL-CATCH-ALL-ERROR-P rtn))
- (progn
- (vla-move obj (vlax-3d-point '(0 0 0)) minpoint)
- (vla-move (vlax-ename->vla-object (entlast)) (vlax-3d-point '(0 0 0)) minpoint)
- )
- )
- rtn
- )
- (t
- (VL-CATCH-ALL-APPLY 'vla-Offset (list obj d))
- )
- )
- )
|