scs编码与南方Cass编码的转换求解
(defun c:crsx(/wlist listcz ss i en)(if(not(tblserch "layer" "识别后的房屋注记"))
(command "layer" "n" "识别后的房屋注记" ""));如果不存在图层怎新建图层
(if(not(tblserch "layer" "无法识别"))
(command "layer" "n" "无法识别" ""));如果不存在图层怎新建图层
(setq oldpk (getver "PICKSTYLE") (setvar "PICKSTYLE" 0)
(vl-load-com)
(regapp "SOUTH") (setq wlist())
(setq listcz (("砼"14111)("混"141161)("简"141200)("简"141200)("土"141101)("厕"158800)))
(setq ss (ssget "x" ((-4."<or") (70.1) (70.129) (-4."or>"))));选取闭合建筑物轮廓线
(if ss (prong (setq i 0)
(repeat (sslength ss )
(setq en (Vlax-get en-Coordinates )) (setq j 0) (setq listzbx ())
(while (<j(length listzb))
(setq listzbx (append listzbx (list (list (nth j listzb) (nth (+ j 1) listzb)))))
(if (="AcDb2dPolyline" (vlax-get en-ObjectName ))
(setq j (1+ j)))
(setq j (+ j 2)))
(setq ss1 (ssget "cp" listzbx ((0 . "TEXT")(8 . "ZJ"))))
(setq ss2 (ssadd))
(if ss1 (fenxiwenzi) (command ("change" ss "p" "la" "无法识别" ""))
(setq i (1+ i))))) (setvar "PICKSTYLE" oldpk)
(defun fenxiwenzi()
(setq cengshu "1")
(setq nr (cdr (assoc 1 (entget (ssname ss1 0)))))
(if (= (strlen nr) 2) (setq caizhi (substr nr 1 2 )))
(if (= (strlen nr) 3) (progn (setq caizhi (substr nr 1 2)) (setq cengshu(substr nr 3 1))))
(if (> (strlen nr) 3) (progn (setq caizhi (substr nr 1 2))
(if (and (> (ascii (substr nr 4 1)) 47)(< (ascii (substr nr 4 1)) 59))
(setq cengshu (substr nr 3 2))
(setq cengshu (substr nr 3 1)))))
(if (assoc caizhi listcz)
(progn (setq listkzsx (list -3 (list "SOUTH" (CONS 1000 (itoa (nth 0 (cdr (assoc caizhi listcz)))))
(cons 1040 (atof cengshu)))))
(setq endata (entget (ssname ss i)))
(setq ss2 (ssadd (ssname ss i) ss2))
(setq endata (append endata (list listkzsx)))
(entmod endata)
(if (/= cengshu "1")
(progn (command "layer" "s" "识别后的房屋注记" "")
(setq enws (ssname ss1 0))
(setq endatawz (enget enwz))
(setq ptwz (polar (cdr(assoc 10 endatawz)) 0 0.7232) (/ pi 2 0.25))
(setq oldys (getvar "textstyle"))
(setvar "textstyle" "细等线体")
(command "text" "j" "mr" ptwz "0.5" "" caizhi)
(wenzisx (entlast)) (setq ss2 (ssadd (entlast) ss2))(setvar "textstyle" oldys)
(setq oldys (getvar "textstyle"))
(setvar "textstyle" "正等线体")
(command "text" "j" "ml" (polar ptwz 0 0.25) "0.4" "" cengshu)
(wenzisx (entlast))
(setq ss2 (ssadd (entlast) ss2)) (setvar "textstyle" oldys))
(prong (command "layer" "s" "识别后的房屋注记" "")
(setq enwz (ssname ss1 0)) (setq endatawz (entget enwz))
(setq ptwz (polar (polar (cdr(assoc 10 endatawz)) 0 0.7232) (/ pi 2) 0.25))
(setq oldys (getvar "textstyle")) (setvar "textstyle" "细等线体")
(command "text" "j" "mr" ptwz "0.5" "" caizhi) (wenzisx (entlast))
(setq ss2 (ssadd (entlast) ss2)) (setvar "textstyle" oldys)))
(command "erase" (ssname ss1 0) "" ))))
(defun wenzisx (enwzsx) (setq endatawzsx (entget enwzsx))
(setq listwzsx (list -3 (list "SOUTH" (cons 1000 "141111-1"))))
(setq endatawzsx (append endatawzsx (list listwzsx)))
(entmod endatawzsx))
程序运行时显示列表有缺陷求改进
页:
[1]