经过修改,可以连续绘制- (defun C:zhuangji()
- ; 获取在图元 en 之后产生的图元的选择集;
- (defun last_ent (en / ss)
- (if en
- (progn
- (setq ss (ssadd))
- (while (setq en (entnext en))
- (if (not (member (cdr (assoc 0 (entget en)))
- '("ATTRIB" "VERTEX" "SEQEND")
- )
- )
- (ssadd en ss)
- );if
- );while
- (if (zerop (sslength ss)) (setq ss nil))
- ss
- );progn
- (ssget "_x")
- );if
- )
- (setq rr (getreal "\n 请输入桩基半径<0.5m>:"))
- (setq zz (getpoint "\n 请指定桩中心:"))
- (while zz
- (if (null rr) (setq rr 0.5))
- (setq pt1 (polar zz pi (+ (* rr 0.5) rr)))
- (setq pt2 (polar zz 0 (+ (* rr 0.5) rr)))
- (setq pt3 (polar zz (* 0.5 pi) (+ (* rr 0.5) rr)))
- (setq pt4 (polar zz (* 1.5 pi) (+ (* rr 0.5) rr)))
- (if (not (tblsearch "LAYER" "Cen"))
- (command "layer" "m" "Cen" "c" 2 "" "l" "center2" "" "lw"
- 0.18 "" "")
- )
- (command "layer" "s" "cen" "")
- ; (entmake (list '(0 . "POINT") (cons 10 zz)));去分号制作中心点,
- (setq ss-end (entlast))
- (entmake (list '(0 . "CIRCLE") (cons 10 zz) (cons 40 rr)))
- (entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2)))
- (entmake (list '(0 . "LINE") (cons 10 pt3) (cons 11 pt4)))
- (setq ss-end (last_ent ss-end))
- ;;造快表开始标志实体.
- (and
- (entmake (list'(0 . "BLOCK")'(2 . "*U")'(70 . 1)(cons 10 zz)))
- (setq i 0)
- (repeat (sslength ss-end)
- (setq ent (ssname ss-end i))
- (setq ENDBLK (entmake (entget ent)))
- (entdel ent)
- (setq i (1+ i))
- )
- ) ;;造块表结束标志实体.
- (setq blk (entmake '((0 . "ENDBLK"))));;返回以上块定义.
- (if blk ;如果造块成功.插入一个实例.
- (entmake (list (cons 0 "INSERT") ;生成块实体(和块定义是不同的).
- (cons 2 blk) ;组码2引用块定义.
- (cons 10 zz) ;块插入点,按定义点.
- )
- )
- )
- (setq zz (getpoint "\n 请指定桩中心:"))
- )
- (princ)
- )
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (defun c:tt()
- (if (= (tblsearch "block" "ZZ00") nil)
- (progn
- (setq s0 (entlast))
- (xyp-MkLaCo "TEST2" 2)
- (xyp-circle '(0 0) 0.5)
- (xyp-MkLaColt "Cen" 1 "center2")
- (xyp-line '(-0.6 0) '(0.6 0))
- (xyp-line '(0 -0.6) '(0 0.6))
- (command "block" "ZZ00" '(0 0) (xyp-SSelEntnext s0) "")
- )
- )
- (setq rr (Udist 7 "" "桩径<输入或鼠标直接量取>" rr nil))
- (while (setq p0 (getpoint "\n第一桩芯点: "))
- (command "insert" "ZZ00" p0 rr rr 0)
- )
- (princ)
- )
|