;++++++++++++++++++++++++++;
; 纵横向线和文字标注分离[mini_Label_Split].lsp
;++++++++++++++++++++++++++;

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

(defun c:mini_Label_Split ( / ss n edata ang i )
	(mini_start nil)
	(mai_last_com "mini_xx1")
	; (mai_get_scale)
	; (apply 'mai_create_layer mai_Centroid_layer)
	(setq ss (mai_select_first
				'((0 . "TEXT,LINE"))
				"请选择要横竖分离图层的线和文字:<退出>"
				"没有找到线和文字."
			)
	)
	(apply 'mai_create_layer mai_jiegou_dim_x)
	(apply 'mai_create_layer mai_jiegou_dim_y)
	(foreach ename (mai_ssget_2_list ss)
		(setq
			edata (entget ename)
			n (mai_dxf 0 edata)
		)
		(cond
			(	(= (mai_dxf 0 edata) "LINE")
				(setq
					ang (angle (mai_dxf 10 edata) (mai_dxf 11 edata))
					i	(if (or (>= (* 0.751 pi) ang (* 0.249 pi))
								(>= (* 1.751 pi) ang (* 1.249 pi))
							)
							(car mai_jiegou_dim_x)
							(car mai_jiegou_dim_y)
						)
					edata (subst (cons 8 i) (assoc 8 edata) edata)
				)
				(entmod edata)
			)
			(	(= (mai_dxf 0 edata) "TEXT")
				(setq
					ang (mai_dxf 50 edata)
					i	(if (or (<= ang (* 0.251 pi))
								(>= ang (* 1.749 pi))
								(>= (* 1.251 pi) ang (* 0.749 pi))
							)
							(car mai_jiegou_dim_x)
							(car mai_jiegou_dim_y)
						)
					edata (subst (cons 8 i) (assoc 8 edata) edata)
				)
				(entmod edata)
			)
		)
	)
	(mai_end)
)
