(defun c:XDTB_POLYCX (/ dis keyword nums nums1 ss x)
(defun _tongji (ss)
(apply
'+
(mapcar
'(lambda (x)
(xdrx_getpropertyvalue x "numverts")
)
(xdrx_pickset->ents ss)
)
)
)
(defun _keyword (keyword)
(cond
((= keyword "BE")
(if (setq dis (getreal (xdrx_prompt "\n长度容差
">:" t
)
)
)
(setq #poly_cxdistol dis)
)
)
((= keyword "SE")
(if (setq dis (getreal (xdrx_prompt "\n角度容差
">:" t
)
)
)
(setq #poly_cxangletol dis)
)
)
)
(xdrx_document_setprec #poly_cxdistol #poly_cxangletol)
(xdrx_prompt "\n当前设置:长度容差= " #poly_cxdistol ",角度容差="
#poly_cxangletol
)
)
(if (not #poly_cxdistol)
(setq #poly_cxdistol 10.)
)
(if (not #poly_cxangletol)
(setq #poly_cxangletol 1)
)
(xdrx_begin)
(xdrx_document_setprec #poly_cxdistol #poly_cxangletol)
(xdrx_prompt "\n当前设置:长度容差= " #poly_cxdistol ",角度容差="
#poly_cxangletol
)
(xdrx_initssget "\n选取要抽稀的多段线[长度容差(BE)/角度容差(SE)]:"
"BE SE" "" "_keyword" ""
)
(if (setq ss (xdrx_ssget '((0 . "*POLYLINE"))))
(progn
(xdrx_polyline_convertfrom ss)
(setq nums (_tongji ss))
(xdrx_polyline_compress ss t)
(setq nums1 (_tongji ss))
(xdrx_prompt "\n总共顶点数 " nums " , 抽稀后顶点数 " nums1 " ,删除了 "
(- nums nums1) " 个顶点."
)
)
)
(xdrx_end)
(princ)
)