- 积分
- 11077
- 明经币
- 个
- 注册时间
- 2011-4-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 spp_wall 于 2015-7-24 08:55 编辑
现在程序 是预设图层 然后点选不同层数的建筑面积 通过图层来计算出不同层建筑的1层面积 最后进行层数计算!
看有没可能有批量的办法 不需点选 改成框选 然后自己识别每层建筑的面积(一般建筑都是闭合多段线 里面有文字 比如 砼、砼2这样的分类) 是否能通过识别文字外的闭合多断线来统计面积 然后汇总!
(defun bz()
(setvar "cmdecho" 0)
(setq pt (getpoint "\n选取点:"))
(while pt
(command "bpoly" pt "")
(setq en (entlast))
(if (/= en nil)
(progn
(command "area" "o" en)
(setq aa (getvar "area"))
(redraw en 3)
(command "text" "s" "standard" pt "1" "0" (rtos aa 2 2)))
)
(entdel en)
(setq pt (getpoint "\n选取点:"))
)
(prin1)
)
(defun tc()
(sub_chk_layer)
(prin1)
)
(defun sub_chk_layer ()
(setq chklay (tblsearch "layer" "Z"))
(if (null chklay)(command "layer" "n" "Z" "c" "4" "Z" ""))
(setq chklay (tblsearch "layer" "Z2"))
(if (null chklay)(command "layer" "n" "Z2" "c" "4" "Z2" ""))
(setq chklay (tblsearch "layer" "Z3"))
(if (null chklay)(command "layer" "n" "Z3" "c" "4" "Z3" ""))
(setq chklay (tblsearch "layer" "Z4"))
(if (null chklay)(command "layer" "n" "Z4" "c" "4" "Z4" ""))
(setq chklay (tblsearch "layer" "Z5"))
(if (null chklay)(command "layer" "n" "Z5" "c" "4" "Z5" ""))
(setq chklay (tblsearch "layer" "Z6"))
(if (null chklay)(command "layer" "n" "Z6" "c" "4" "Z6" ""))
(setq chklay (tblsearch "layer" "C"))
(if (null chklay)(command "layer" "n" "C" "c" "4" "C" ""))
(setq chklay (tblsearch "layer" "C2"))
(if (null chklay)(command "layer" "n" "C2" "c" "4" "C2" ""))
(setq chklay (tblsearch "layer" "C3"))
(if (null chklay)(command "layer" "n" "C3" "c" "4" "C3" ""))
(setq chklay (tblsearch "layer" "C4"))
(if (null chklay)(command "layer" "n" "C4" "c" "4" "C4" ""))
(setq chklay (tblsearch "layer" "C5"))
(if (null chklay)(command "layer" "n" "C5" "c" "4" "C5" ""))
(setq chklay (tblsearch "layer" "C6"))
(if (null chklay)(command "layer" "n" "C6" "c" "4" "C6" ""))
(setq chklay (tblsearch "layer" "B"))
(if (null chklay)(command "layer" "n" "B" "c" "4" "B" ""))
(setq chklay (tblsearch "layer" "B2"))
(if (null chklay)(command "layer" "n" "B2" "c" "4" "B2" ""))
(setq chklay (tblsearch "layer" "B3"))
(if (null chklay)(command "layer" "n" "B3" "c" "4" "B3" ""))
(setq chklay (tblsearch "layer" "B4"))
(if (null chklay)(command "layer" "n" "B4" "c" "4" "B4" ""))
(setq chklay (tblsearch "layer" "B5"))
(if (null chklay)(command "layer" "n" "B5" "c" "4" "B5" ""))
(setq chklay (tblsearch "layer" "B6"))
(if (null chklay)(command "layer" "n" "B6" "c" "4" "B6" ""))
(setq chklay (tblsearch "layer" "B7"))
(if (null chklay)(command "layer" "n" "B7" "c" "4" "B7" ""))
(setq chklay (tblsearch "layer" "B8"))
(if (null chklay)(command "layer" "n" "B8" "c" "4" "B8" ""))
(setq chklay (tblsearch "layer" "B9"))
(if (null chklay)(command "layer" "n" "B9" "c" "4" "B9" ""))
(setq chklay (tblsearch "layer" "T"))
(if (null chklay)(command "layer" "n" "T" "c" "4" "T" ""))
(setq chklay (tblsearch "layer" "T2"))
(if (null chklay)(command "layer" "n" "T2" "c" "4" "T2" ""))
(setq chklay (tblsearch "layer" "T3"))
(if (null chklay)(command "layer" "n" "T3" "c" "4" "T3" ""))
(setq chklay (tblsearch "layer" "T4"))
(if (null chklay)(command "layer" "n" "T4" "c" "4" "T4" ""))
(setq chklay (tblsearch "layer" "T5"))
(if (null chklay)(command "layer" "n" "T5" "c" "4" "T5" ""))
(setq chklay (tblsearch "layer" "T6"))
(if (null chklay)(command "layer" "n" "T6" "c" "4" "T6" ""))
(setq chklay (tblsearch "layer" "T7"))
(if (null chklay)(command "layer" "n" "T7" "c" "4" "T7" ""))
(setq chklay (tblsearch "layer" "T8"))
(if (null chklay)(command "layer" "n" "T8" "c" "4" "T8" ""))
(setq chklay (tblsearch "layer" "T9"))
(if (null chklay)(command "layer" "n" "T9" "c" "4" "T9" ""))
(setq chklay (tblsearch "layer" "T10"))
(if (null chklay)(command "layer" "n" "T10" "c" "4" "T10" ""))
(setq chklay (tblsearch "layer" "D"))
(if (null chklay)(command "layer" "n" "D" "c" "4" "D" ""))
(setq chklay (tblsearch "layer" "D2"))
(if (null chklay)(command "layer" "n" "D2" "c" "4" "D2" ""))
(setq chklay (tblsearch "layer" "厂房1"))
(if (null chklay)(command "layer" "n" "厂房1" "c" "4" "厂房1" ""))
(setq chklay (tblsearch "layer" "厂房2"))
(if (null chklay)(command "layer" "n" "厂房2" "c" "4" "厂房2" ""))
(setq chklay (tblsearch "layer" "建"))
(if (null chklay)(command "layer" "n" "建" "c" "4" "建" ""))
(setq chklay (tblsearch "layer" "简易"))
(if (null chklay)(command "layer" "n" "简易" "c" "4" "简易" ""))
(setq chklay (tblsearch "layer" "砖房"))
(if (null chklay)(command "layer" "n" "砖房" "c" "4" "砖房" ""))
(setq chklay (tblsearch "layer" "砖房2"))
(if (null chklay)(command "layer" "n" "砖房2" "c" "4" "砖房2" ""))
)
(defun out ()
(setvar "cmdecho" 0)
(setq all 0)
(setq ss (ssget "x" (list '(0 . "text,mtext") (cons 8 lay))))
(setq n 0 k 0)
(if (/= ss nil)
(progn
(repeat (sslength ss)
(setq en (ssname ss n))
(setq en_data (entget en))
(setq aa (atof (cdr (assoc 1 en_data))))
(mjljaa)
(setq n (1+ n))
)
)
(setq k 0 all 0)
)
(if (or (/= k 0) (/= all 0))
(progn
(if (or (= lay "T")(= lay "B") (= lay "C") (= lay "D")(= lay "建")(= lay "简易")(= lay "Z"))
(alert (strcat lay "\房共有<"(itoa k)">栋房子参与了统计,建筑面积为:"(rtos all 2 2)"平方米"))
(alert (strcat lay "\房共有<"(itoa k)">栋房子参与了统计,建筑面积为:"(rtos (* all (atoi (substr lay 2 2))) 2 2)"平方米"))
)
)
)
)
(defun mjljaa ()
(setq all (+ all aa))
(setq k (1+ k))
)
(prompt"\n统计房屋面积<mj>")
(prin1)
(defun tj()
(setq lay "T")
(out)
(setq lay "T2")
(out)
(setq lay "T3")
(out)
(setq lay "T4")
(out)
(setq lay "T5")
(out)
(setq lay "T6")
(out)
(setq lay "T7")
(out)
(setq lay "T8")
(out)
(setq lay "T0")
(out)
(setq lay "T10")
(out)
(setq lay "B")
(out)
(setq lay "B2")
(out)
(setq lay "B3")
(out)
(setq lay "B4")
(out)
(setq lay "B5")
(out)
(setq lay "B6")
(out)
(setq lay "B7")
(out)
(setq lay "B8")
(out)
(setq lay "B9")
(out)
(setq lay "C")
(out)
(setq lay "C2")
(out)
(setq lay "C3")
(out)
(setq lay "C4")
(out)
(setq lay "C5")
(out)
(setq lay "Z")
(out)
(setq lay "Z2")
(out)
(setq lay "Z3")
(out)
(setq lay "Z4")
(out)
(setq lay "Z5")
(out)
(setq lay "Z6")
(out)
(setq lay "建")
(out)
(setq lay "简易")
(out)
)
(defun c:tjcq()
(PRINC "\n第一步:输入TC,有没有发现图层里面多了很多图层
第二步:先选择图层,A2房,就先选择A2层,输入BZ,在A2房内任处位置点击鼠标左键,如果数字标不出来,说明没有闭合。
第三步:输入TJ,根据图层来统计不同层数的建筑面积,注意是建筑面积,(一层占地X1,二层占地x2,类推)\n(其中C:厂房 T:砼 Z:砖 B其他)原作者:lxh410224 \n")
(initget " tc bz tj")
(setq mingl (getkword "预设图层(tc),标注面积(bz),统计面积(tj):"))
(cond ((= mingl "tc") (tc))
((= mingl "bz") (bz))
((= mingl "tj") (tj))
)
)
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|