本帖最后由 xyp1964 于 2017-11-20 22:00 编辑
- ;; xyp-ScaleEntity 缩放实体或选择集 (xyp-ScaleEntity ename point sc)
- (defun xyp-ScaleEntity (ename point sc / tp pt i s1 x)
- (setq tp (type ename)
- pt (vlax-3D-point (trans point 1 0))
- )
- (cond ((= tp 'ENAME) (vla-scaleentity (xyp-e2o ename) pt sc))
- ((= tp 'PICKSET)
- (setq i -1)
- (while (setq s1 (ssname ename (setq i (1+ i))))
- (vla-scaleentity (xyp-e2o s1) pt sc)
- )
- )
- ((= tp 'LIST) (foreach x (xyp-ScaleEntity x point sc)))
- )
- ename
- )
- ;; 应用实例2: 柱子缩放
- (defun c:tt2 ()
- (CMDLA0)
- (setq ss (ssget '((0 . "LWPOLYLINE") (8 . "柱")))
- l1 '((0 . "Line") (8 . "轴线"))
- l2 '((0 . "DIMENSION") (8 . "COLUMN-平法定位"))
- i -1
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq p1 (xyp-get-9pt s1 1)
- p1 (xyp-get-Pt2XY p1 -200 -200)
- p9 (xyp-get-9pt s1 9)
- p9 (xyp-get-Pt2XY p9 200 200)
- )
- (if (and (setq ss1 (ssget "c" p1 p9 l1))
- (= (sslength ss1) 2)
- )
- (progn
- (setq s2 (ssname ss1 0)
- s3 (ssname ss1 1)
- pt (car (xyp-get-Inters s2 s3 0))
- ss2 (ssget "c" p1 p9 l2)
- ss2(ssadd s1 ss2)
- )
- (xyp-ScaleEntity ss2 pt 0.5)
- (command"dim" "upd" ss2 "" "e")
- )
- )
- )
- (CMDLA1)
- )
|