;+++++++++++++++++++++++++++++;
;  计算桩数-抗压桩[mini_jszs] ;
;+++++++++++++++++++++++++++++;

(apply
	'(lambda( / x )
		(or mai_pile_text
			(not (setq x (mai_panel_search "谜你结构专业设置文件[mini_jiegou_config].lsp")))
			(load x)
		)
	)
	nil
)

(defun c:mini_jszs ( / txt_pt old_cmd temp ss value_sum pile_num)
	(mini_start nil)
	(mai_last_com "mini_ct")
	(mai_get_scale)
	(setq
		mai_pile_bear (if mai_pile_bear mai_pile_bear 1500.0)
		temp (getreal (strcat "\n请输入单桩承载力特征值(KN):<" (rtos mai_pile_bear 2 2) ">"))
		mai_pile_bear (if temp temp mai_pile_bear)
	)
	(while (setq ss
					(mai_select_first
						(list (cons 0 "TEXT") (cons 8 mai_bear_text))
						"请选择墙柱内力文字:<退出>"
						"没有找到文字."
					)
			)

		(setq
			value_sum
				(apply
					'+ 
					(mapcar 
						'(lambda ( x / y)
							(setq x (mai_dxf 1 x))
							(if (= "N" (strcase (substr x 1 1)))
								(setq x (substr x 3))
							)
							(setq x (abs (atof x)))
							;(if (> y 500) y 0)
						)
						(mai_ssget_2_list ss)
				)
				)
			pile_num (1+ (fix (/ value_sum mai_pile_bear)))
			temp (* mai_scale2 (cadddr maitextname))
		)
		(apply 'mai_create_layer mai_pile_text)
		(mai_draw_text nil (polar txt_pt (* pi 0.5) (* 1.5 temp)) temp 0 (strcat "N=" (rtos value_sum)) (caddr maitextname) nil 0.8)
		(mai_draw_text nil txt_pt temp 0 (strcat "Num=" (itoa pile_num)) (caddr maitextname) nil 0.8)
	)
	(mai_end)
)
