;|
   命令：REIN_SCL
   功能：对TSSD结构软件的钢筋大样图的点钢筋根据比例缩放
   说明：1、请在世界坐标系下使用。
        2、回车处理图中所有箍筋，否则，用户要选箍筋进行处理
       
|;
(defun c:REIN_SCL (/ old_cmd ss scl e e1 box p1 ss1 arcinfo cen wid n  plobj chk_pt len dots)
 (defun chk_pt (pt pts / x)
   (foreach x pts (if (< (distance pt x) $dist) (setq pt x)))
   pt
 )
 
  (mai_start nil)
  (prompt "\n请选取要缩放点钢筋的外箍筋<全选>:")
  (if (not $tssd_rein_scl)
      (setq $tssd_rein_scl 1.0)
  )
  (if (not (setq ss (ssget '((0 . "lwpolyline") (8 . "*rein")))))
      (setq ss (ssget "x" '((0 . "lwpolyline") (70 . 0) (8 . "*rein"))))
  )
  (if (not ss) (exit))
  (initget 6)
  (if (setq scl (getreal (strcat "\n请输入点钢筋缩放比例<" (rtos $tssd_rein_scl 2 2) ">:")))
      (setq $tssd_rein_scl scl)
  )
  (setq $dist 200
        n 0
		len (sslength ss)
  )	       ; 搜索顶点范围，找点钢筋
  (while (< n len)
    (setq e (ssname ss n)
	      n (1+ n)
		  plobj (vlax-ename->vla-object e)
 	)
	(if (> (vlax-curve-getDistAtParam plobj (vlax-curve-getendparam plobj)) (* 3 $dist))
	    (progn
    (setq box (mapcar '(lambda (x) (trans x 0 1)) (mai_ss_rectangle e))
          wid (mai_dxf 40 e)
		  dots (ssget "c" (car box) (caddr box) '((8 . "rein") (0 . "LWPOLYLINE")))
	)
    (foreach e1 (mai_ssget_2_list dots)
	    (setq cen (mai_ss_rectangle e1)
	          cen (mai_divide_point (car cen) (caddr cen) 0.5)
			  p1 (trans (vlax-curve-getClosestPointTo plobj cen) 0 1)
			  p1 (chk_pt p1 box)
			  p1 (polar p1 (angle p1 (trans cen 0 1)) (/ (* (sqrt 2) wid) 2))
		)
	    (command "_.scale" e1 "" "non" p1 $tssd_rein_scl)
    )
    )
    )
  )
  (mai_end)
)
