	; 命令：mini_rein_scl
	; 功能：对TSSD结构软件的钢筋大样图的点钢筋根据比例缩放
	; 对大样图的点钢筋根据比例缩放[mini_rein_scl].lsp
	; 说明：回车处理图中所有箍筋，否则，用户要选箍筋进行处理
	
(apply
	'(lambda( / x )
		(or mai_pile_text
			(not (setq x (mai_panel_search "谜你结构专业设置文件[mini_jiegou_config].lsp")))
			(load x)
		)
	)
	nil
)

(defun c:mini_rein_scl (/ old_cmd ss scl e e1 box p1 dd cen plobj chk_pt len dots r_lay)
	(mai_start T)
	(mai_last_com "mini_rein_scl")
	(mai_get_scale)
	(prompt "\n请选取要缩放点钢筋的外箍筋:<全选>")
	(setq r_lay (strcat "*rein," (car mai_rein_layer)  "," (car mai_rein_l_layer)))
	(or mai_rein_scl
		(setq mai_rein_scl 1.0)
	)
	(setq
		mai_rein_scl_dist 200
	)     ; 搜索顶点范围，找点钢筋
	(or (setq ss (ssget (list (cons 0 "lwpolyline") (cons 8 r_lay))))
		(setq ss (ssget "x" (list (cons 0 "lwpolyline") (cons 70 0) (cons 8 r_lay))))
	)
	(or ss (exit))
	(initget 6)
	(if (setq scl (getreal (strcat "\n请输入点钢筋缩放比例:<" (rtos mai_rein_scl 2 2) ">")))
		(setq mai_rein_scl scl)
	)
	(foreach e (mai_ssget_2_list ss)
		(if (> (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) (* 3 mai_rein_scl_dist))
			(progn
				(setq
					box (mai_ss_rectangle e)
					dots (ssget "c" (car box) (caddr box) (list (cons 0 "lwpolyline") (cons 8 r_lay)))
					dots (mai_ssget_2_list dots)
					dots (mapcar '(lambda(x / y)(if (setq y(mai_PLine_isDonut x)) (list (car y) x))) dots)
					dots (vl-remove nil dots)
					box (mapcar '(lambda(x)(trans x 1 0)) box)
				)
				(foreach e1 box
					(setq
						p1 (trans (vlax-curve-getclosestpointto e e1) 0 1)
						dots (mapcar '(lambda(x) (cons (distance p1 (car x)) x)) dots)
						dd (apply 'min (mapcar 'car dots))
						cen (mai_assoc dd dots)
						dots (vl-remove-if '(lambda(x)(mai_equal cen x)) dots)
						dots (mapcar 'cdr dots)
						cen (caddr cen)
					)
					(command "_.scale" cen "" "non" p1 mai_rein_scl)
				)
				(foreach e1 dots
					(setq p1 (trans (vlax-curve-getclosestpointto e (trans (car e1) 1 0)) 0 1))
					(command "_.scale" (cadr e1) "" "non" p1 mai_rein_scl)
				)
			)
		)
	)
	(mai_end)
)
