- (defun cx-ss2en
- (ss / enlst)
- (cond
- ((= (type ss) 'PICKSET)
- (vl-remove-if-not '(lambda (x) (= (type x) 'ENAME)) (mapcar 'cadr (ssnamex SS)))
- )
- ((= (type ss) 'LIST)
- (setq enlst (ssadd))
- (last (mapcar '(lambda (x) (ssadd x enlst)) ss))
- )
- ((='ename(type ss))
- (ssadd ss)
- )
- )
- )
- ;[功能]点表求面积
- (defun getarea (l)
- (abs(* 0.5
- (apply
- '+
- (mapcar
- '(lambda (a b) (- (* (car a) (cadr b)) (* (car b) (cadr a))))
- l
- (append (cdr l) (list (car l)))
- )
- )
- ) )
- );;;;;;;;;;;;;;;;;;;
- (defun vxs(e / p a b n ob q et d d1 en et)
- (setq a(entget e)ob(vlax-ename->vla-object e)et(cdr(assoc 0 a))n 0 p nil d nil)
- (cond((="LWPOLYLINE"et)
- (repeat(length a)(setq b (nth n a) n (+ n 1))
- (if (= 10 (car b))(progn
- (setq q(list (cadr b) (caddr b))d1(vlax-curve-getDistAtPoint ob q))
- (if p (if (not(member d1 d)) (setq p (append p (list q))d (append d (list d1))))
- (setq p (list q)))))))
- ((="POLYLINE"et)
- (SETQ EN (ENTGET (SETQ E (ENTNEXT E))))
- (WHILE (/= (CDR (ASSOC 0 EN)) "SEQEND")
- (SETQ q (CDR (ASSOC 10 EN))d1(vlax-curve-getDistAtPoint ob q)q(reverse(cdr(reverse q))))
- (if p(if (not(member d1 d)) (setq p (append p (list q))d (append d (list d1))))(setq p(list q)))
- (SETQ EN (ENTGET (SETQ E (ENTNEXT E)))))
- (setq p(reverse p))))P)
- ;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;;;;;;;;;;;;;;;;;
- (defun zxzb (pts / len pt )
- (setq len (length pts))
- (setq pt (mapcar
- '(lambda(x)
- (/ x len)
- )
- (apply
- 'mapcar
- (cons '+ pts)
- )
- )
- ) pt)
- (defun c:dmmj ( / hxbl hxbl dmx zbb mj xzzb SSA x); hxbl hxbl dmx zbb
- (setq hxbl (getint "\n请输入断面横向比例 1 :"))
- (setq zxbl (getint "\n请输入断面纵向比例 1 :"))
- (setq ssa (ssget '( (0 . "LWPOLYLINE") ) ) ) ;(8 . "0")
- (foreach x (cx-ss2en ssa)
- ;(setq dmx (car(entsel "\n请选择要标注断面面积的闭合多段线:")))
- (setq zbb (vxs x))
- (setq xzbb (mapcar '(lambda (a ) (list (* (car a)(/ hxbl 1000.000) ) (* (cadr a)(/ zxbl 1000.000) ) )
- )
- zbb)
- )
- (setq mj (getarea xzbb))
- (entmake (list '(0 . "TEXT") '(8 . "fgbaj")(cons 1 (rtos mj 2 3)) (cons 10 (zxzb zbb) ) (cons 40 3.0)))
-
- )
- )
|