不能填充是因为你的填充边界多选几个物体进去了,所以出错,我将程序部份作了一些调整,以作参考。- (defun c:test ()
- (setq pt0 (getpoint "\n灯杆底部位置:"))
- (setq gd (getpoint pt0 "\n灯高位置:"))
- (setq os (getvar "osmode"))
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (setq xx (car pt0)
- yy (cadr pt0)
- )
- (setq xt (car gd)
- yt (cadr gd)
- )
- (setq aa1 (angle pt0 gd))
- (setq bb1 (distance pt0 gd))
- (setq bb2 (* bb1 (sin aa1)))
- (setq bb (/ bb2 18))
- (setq xx (car pt0)
- yy (cadr pt0)
- )
- (setq xt (car gd)
- yt (cadr gd)
- )
- (setq aa1 (angle pt0 gd))
- (setq bb1 (distance pt0 gd))
- (setq bb2 (* bb1 (sin aa1)))
- (setq bb (/ bb2 18))
- (setq pt1 (list (+ xx (* bb 1)) yy))
- (setq pt2 (list (+ xx (* bb 0.7)) (+ yy (* bb 2.8))))
- (setq pt3 (list (car pt2) (+ (* bb 0.9) (cadr pt2))))
- (setq pt4 (list (+ xx (* bb 0.35)) (+ (* bb 0.9) (cadr pt3))))
- (setq pt5 (list (car pt4) (+ (* bb 10.4) (cadr pt4))))
- (setq pt6 (list (+ (car pt5) (* bb 0.1)) (cadr pt5)))
- (setq pt7 (list (car pt6) (+ (* bb 1.8) (cadr pt6))))
- (setq pt8 (list (- (car pt7) (* bb 0.15)) (+ (cadr pt7) (* bb 0.5))))
- (setq pt9 (list xx (cadr pt8)))
- (setq pt10 (list (+ (car pt7) (* bb 0.9)) (cadr pt7)))
- (setq pt11 (list (+ (car pt10) (* bb 3)) (+ (cadr pt10) (* bb 0.66))))
- ;;(setvar "cecolor" (rtos cc1))
- (setq ent (entlast))
- (setq sum (ssadd))
- (command "line" pt0 pt1 "")
- (command "arc" pt1 "e" pt2 "a" -31)
- (command "pline" pt2 pt3 "")
- (command "arc" pt3 "e" pt4 "a" 118)
- (command "pline" pt4 pt5 pt6 pt7 "")
- (command "arc" pt7 "e" pt8 "a" 90)
- (command "pline" pt8 pt9 "")
- (command "pline" pt7 pt10 "")
- (command "arc" pt10 "e" pt11 "a" 160)
- (if (= ent nil)
- (setq sum (ssget "all"))
- (while (setq ent (entnext ent))
- (ssadd ent sum)
- )
- )
- (command "mirror" sum "" pt0 pt9 "")
- (setq pnt (polar pt0 (angle pt0 pt9) 1))
- ;; (setvar "cecolor" (rtos cc1))
- ;;(command "hatch" "solid" sum "")
- (command "bhatch" "p" "solid" pnt "")
- (setq pt12 (polar pt9 (/ pi 2) (* bb 0.3)))
- (command "pline" pt9 "w" 3 0 pt12 "")
- (setvar "osmode" os)
- (setvar "cmdecho" 1) (princ)
- )
|