;;;------------------------------------------------------------
;;; 通用查询程序
;;; 2007/6/11
;;; 修改记录
;;;------------------------------------------------------------
(defun  myload(fname / fname1)
  (setvar "cmdecho" 0)
  (setq fname1 (strcat (cntfwl) "lsp/" fname ".lsp"))
  (if (findfile fname1)
    (load fname1)
  )
)
(defun  cx( / t1 t2 t3 t4 t5 ent tcm cx_ff dcl_id fmsj ss p p1 p2 whileflag qx_type
					isLoadOrr isLoadIC)
	(setq *error* global_err)	
	(setvar "cmdecho" 0)
	(setq t1 (getvar "PICKFIRST"))
	(setq ss (ssget "I"))
	(setq ent nil)
	(if (and ss (= (sslength ss) 1))
		(setq ent (ssname ss 0) ss nil)
	)
	(command "PICKFIRST" t1)
	(setq whileflag t);;;判断是否动态查询
	(if (IsLoaded_ORRDS 1);;;判断是否加载旧路改造软件
		(setq isLoadOrr T)
		(setq isLoadOrr nil)
	)
	(if (IsLoaded_IDS 1);;;判断是否加载互通式立交软件
		(setq isLoadIC T)
		(setq isLoadIC nil)
	)
	(while whileflag
		(if (not ent) 
			(progn
				(setvar "errno" 0)
				(setq ent (car (entsel "\n回车返回 / <请选择要查询的实体>:")))
				(if (= (getvar "errno") 52)
					(setq whileflag nil)
				)
			)
			(setq whileflag nil)
		)
		(setq cx_ff T)
		(if ent ;不为空的时候才执行通用查询
			(progn
				(setq cx_ff nil)
			    (setq tcm (strcase (cdr (assoc 8 (entget ent)))))
				(cond
					;;文字
					((or (if_lx ent "TEXT") (if_lx ent "MTEXT"))
						(setq cx_ff T)
						(command ".ddedit" ent "")
					)
					;;;旧路改造通用查询
					((and isLoadOrr (>= (setq nType (ORR_GETENTITYPE ent)) 0))
						(progn
							(if (= nType 0)
								(ORR_AreaEdit ent)
							)
							(if (= nType 1)
								(ORR_CurveEdit ent)
							)
							(if (= nType 2)
								(ORR_UnitEdit ent)								
							)
							(setq cx_ff T)
						)
					)
					;处理曲线
					((> (setq qx_type (DL_GetQxType ent)) 0);获取曲线类型，0不执行
						;(princ qx_type);打印曲线类型
						(cond
							;不处理直线（0）和圆弧（-1）
							((= qx_type 1);基本型
								(#ppas "pm_line")
								(JBXQX ent)
								(#ppuas "pm_line")
								(setq cx_ff T)
							)
							((= qx_type 2);凸形
								(#ppas "pm_line")
								(TXQX ent)
								(#ppuas "pm_line")
								(setq cx_ff T)
							)
							((or (= qx_type 3) (= qx_type 4) (= qx_type 5));同向复曲线
								(#ppas "pm_line")
								(TXFQX ent)
								(#ppuas "pm_line")
								(setq cx_ff T)
							)
							((= qx_type 6);直圆形曲线
								(if isLoadIC
									(Ic_ZY ent)
									(prompt "\n 没有加载互通式立交软件，无法查询直圆型缓和曲线。\n")
								)
								(setq cx_ff T)
							)
							((= qx_type 7);圆圆S
								(if isLoadIC
									(Ic_S ent)
									(prompt "\n 没有加载互通式立交软件，无法查询圆圆S型缓和曲线。\n")
								)
								(setq cx_ff T)
							)					
							((= qx_type 8);圆圆C
								(if isLoadIC
									(Ic_C ent)
									(prompt "\n 没有加载互通式立交软件，无法查询圆圆C型缓和曲线。\n")
								)
								(setq cx_ff T)
							)
							((= qx_type 9);圆圆卵
								(if isLoadIC
									(Ic_L ent)
									(prompt "\n 没有加载互通式立交软件，无法查询圆圆卵型缓和曲线。\n")
								)
								(setq cx_ff T)
							)					
							((= qx_type 10);积木法－回旋线
								(if isLoadIC
									(IC_AEAMCLOTHOID ent)
									(prompt "\n 没有加载互通式立交软件，无法查询积木法回旋线单元。\n")
								)
								(setq cx_ff T)
							)
							((= qx_type 12);三单元回头曲线
								(if isLoadIC
									(IC_HTQX ent)
									(prompt "\n 没有加载互通式立交软件，无法查询回头曲线。\n")
								)
								(setq cx_ff T)
							)
							((= qx_type 13);五单元平曲线
								(#ppas "pm_line")
								(djdwdy ent)
								(#ppuas "pm_line")
								(setq cx_ff T)
							)
							((= qx_type 14);五单元回头曲线
								(#ppas "pm_line")
								(wdyhtqx ent)
								(#ppuas "pm_line")
								(setq cx_ff T)
							)
						)
					)
					;修改道路信息
					((= tcm "AXIS")
						(progn
							(setq cx_ff T)
							(#ppas "drawroad")
							(DL_ChangeRoadInfo ent)
						)
					)
				)
			)
		)
	    (if (not cx_ff)
			(progn
				(prompt "\nAutoCAD实体。\n")
			)
		)		
	    (setq ent nil)
	)
	(setq *error* nil)	
	(princ) 
)