838510233 发表于 2015-1-8 10:03
能发给我用下吗?
不是很成熟啊,用了一个Gu_xl版主的一个vlx,将直线,请注意是直线生成闭合多段线的程序,再然后就是标注面积并将面积提取到txt文本的东西。- ;;-------------------------------------------------------------
- ;;批量标注多边形面积(已做比例1/1000^2处理)
- ;;-------------------------------------------------------------
- (defun c:plmj ( / ee h i slst ss vlalst x xy)
- (vl-load-com)
- (setq ss (ssget '((0 . "LWPOLYLINE"))))
- (setq slst (ss-en ss))
- (setq slst
- (vl-remove-if
- 'not
- (mapcar
- '(lambda (x)
- (if
- (= (vlax-curve-isClosed (vlax-ename->vla-object x)) T) ;;判断为闭合的图元名组表
- x
- )
- )
- slst
- )
- )
- )
- (setq vlalst (mapcar 'vla-get-Area (mapcar 'vlax-ename->vla-object slst)))
- (setq i 0)
- (repeat (length slst)
- (bwh (nth i slst))
- (setq ee (emake (* (nth i vlalst) 1) xy h))
- ;;; (entmod ee)
- (setq i (1+ i))
- )
- (princ)
- )
- ;;=====================================================
- ;;文本内容提取
- (defun c:tqwb (/ e elist fn fna i ss v1 v10 v8 vlist)
- (princ "\n文本提取程序 carrot1983 2008/11/13")
- (if (and
- (setq ss (ssget '((0 . "*TEXT*"))))
- (setq fna (getfiled "保存文本提取的信息" "" "txt" 5))
- )
- (progn
- (setq i 0)
- (while (< i (sslength ss))
- (setq e (ssname ss i))
- (setq elist (entget e))
- (setq v1 (cdr (assoc 1 elist)))
- (setq v10 (cdr (assoc 10 elist)))
- (setq v10 (mapcar 'rtos v10))
- (setq v8 (cdr (assoc 8 elist)))
- (setq vlist (cons (strcat v1
- ","
- (car v10)
- ","
- (cadr v10)
- ","
- (caddr v10)
- ","
- v8
- )
- vlist
- )
- )
- (setq i (1+ i))
- )
- (setq fn (open fna "w"))
- (write-line "内容,X,Y,Z,图层" fn)
- (foreach v vlist
- (write-line v fn)
- )
- (close fn)
- (startapp "notepad" fna)
- )
- )
- (princ)
- )
|