第一次看到有这么多中文变量的程序,来试一下我的吧,一次画2条
- (defun c:qx (/ qxscale pts pte dis ang sc ptl ptu ptc ptr ptd ptlist
- ptlist2)
- (if (= (getenv "qxscale") nil)(setenv "qxscale" "50"))
- (mapcar 'princ (list "当前比例: " (getenv "qxscale")))
- (initget "s")
- (setq pts (getpoint "\n起点[比例设置(S)]:"))
- (while (= pts "s")
- (setq qxscale (getreal "\n切断线比例:"))
- (setenv "qxscale" (rtos qxscale 2 2))
- (setq pts (getpoint "\n起点:"))
- )
- (setq pts (trans pts 1 0))
- (setq pte (getpoint pts "\n终点:"))
- (setq pte (trans pte 1 0))
- (setq dis (distance pts pte))
- (setq ang (angle ptS ptE))
- (setq sc (atof (getenv "qxscale")))
- (setq ctp (mapcar '/ (mapcar '+ pts pte) '(2 2 2)))
- (setq ptl (polar ctp (+ pi ang) (* 4 sc)))
- ;;;;左点
- (setq ptu (polar ctp (+ ang (angtof "108")) (* 4 sc)))
- ;;;;上点
- (setq ptd (polar ctp (+ ang (angtof "288")) (* 4 sc)))
- ;;;;下点
- (setq ptr (polar ctp (+ 0 ang) (* 4 sc)))
- ;;;;右点
- (setq ptlist (list pts ptl ptu ctp ptd ptr pte))
- ;;; (undobe)
- (entmake
- (append (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- (cons 90 (length ptlist)))
- (mapcar '(lambda (pt) (cons 10 pt)) ptlist)))
- (setq ptlist2
- (mapcar
- '(lambda (x) (polar x (+ ang (angtof "262")) (* 3 sc)))
- ptlist))
- (entmake
- (append (list '(0 . "LWPOLYLINE")
- '(100 . "AcDbEntity")
- '(100 . "AcDbPolyline")
- (cons 90 (length ptlist2)))
- (mapcar '(lambda (pt) (cons 10 pt)) ptlist2)))
- ;;; (undoe)
- (prin1)
- )
|