- (defun c:tt ()
- (setvar 'osmode 0)
- (setvar 'cmdecho 0)
- (setq dd (Udist 7 "" "偏移距离<输入或鼠标直接量取>" dd nil))
- (if (setq ss (ssget '((0 . "Arc,Circle,Ellipse,*Line"))))
- (progn
- (setq i 0
- aa 0
- )
- (xyp-MkLaCo "偏移后" 6)
- (repeat (sslength ss)
- (setq e (ssname ss i)
- obj (vlax-ename->vla-object e)
- i (1+ i)
- )
- (vl-catch-all-apply 'vla-offset (list obj dd)) ; 左侧偏移
- (setq e1 (entlast))
- (setq p1 (vlax-curve-getStartPoint e1))
- (setq p2 (vlax-curve-getEndPoint e1))
- (vl-catch-all-apply 'vla-offset (list obj (* dd -1))) ; 右侧偏移
- (setq e2 (entlast))
- (setq p3 (vlax-curve-getStartPoint e2))
- (setq p4 (vlax-curve-getEndPoint e2))
- (command "line" p1 p3 "")
- (setq e3 (entlast))
- (command "line" p2 p4 "")
- (setq e4 (entlast))
- (command "-hatch" "p" "ANSI32" "" "" "s" e1 e2 e3 e4 "" "")
- (xyp-SubUpd (list e1 e2 e3 e4) '(8 62) '("偏移后" 6))
- (setq ob (vlax-ename->vla-object (entlast))
- aa (+ aa (* (vla-get-area ob) 1e-6))
- )
- )
- (princ "\n面积 = ")
- (princ aa)
- )
- )
- (princ)
- )
|