8
17
3
初来乍到
;;;;;;;;;;;;;;;;;;;;;;;; ;;; 角度转换 ;;;;;;;;;;;;;;;;;;;;;;;; ;;;参数说明: (defun Degrees->Radians(numberOfDegrees) (* pi (/ numberOfDegrees 180.0)) ) ;;;;;;;;;;;;;;;;;;;;;;;; ;;;二维点转换为三维点 ;;;;;;;;;;;;;;;;;;;;;;;; ;;;参数说明: (defun VD:2dPoint->3dPoint(2dPt) (list (float (car 2dPt)) (float (cdr 2dPt)) 0.0) ) ;;;;;;;;;;;;;;;;;;;;;;;; ;;; 三维点转换为二维点 ;;;;;;;;;;;;;;;;;;;;;;;; ;;;参数说明: (defun VD:3dPoint->2dPoint(3dPt) (list (float (car 3dPt))(float (cadr 3dPt))) ) ;;;;;;;;;;;;;;;;;;;;;;;; ;;; 绘制箭头 ;;;;;;;;;;;;;;;;;;;;;;;; ;;;参数说明: (defun vd:arrow (pt ang ratio / ang1 angleBackward angleUpward angleDownward arrowLength arrowWidth halfWidth pt1 p1 p2 s1 ) (setq ang1 (Degrees->Radians ang) angleBackward (+ ang1 pi) angleUpward (+ ang1 (/ pi 2.0)) angleDownward (+ angleUpward pi) arrowLength (* 2.5 ratio) arrowWidth (* 0.83 ratio) halfWidth (/ arrowWidth 2.0) pt1 (polar pt angleBackward arrowLength) p1 (polar pt1 angleUpward halfWidth) p2 (polar pt1 angleDownward halfWidth) ) (command ".line" pt p1 p2 "c" "") (setq s1 (ssget "C" pt p1)) (command ".hatch" "solid" s1 "") (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;; ;;;绘制坐轴及横向分格线 ;;;;;;;;;;;;;;;;;;;;;;;; ;;;参数说明: (defun vd:coordinate_drawing (p1 p2 space ratio / nStart i nTotal a xEnd yEnd original tp tp1 textHeight s1 ) (setq nStart (fix (/ (cadr p1) space)) i nStart nTotal (- (fix (/ (cadr p2) space)) nStart) a (* ratio 20) Xend (list (+ (car p1) a) (* nStart space) 0.0) yend (list 0.0 (+ (* a 0.5) (cadr p2)) 0.0) original (list 0.0 (cadr xend) 0.0) a (* ratio 3.0) tp (polar xend (* pi 1.3) (* 1.5 a)) textHeight (* ratio 3.0) ) (vd:arrow xend 0 ratio) (vd:arrow yend 90 ratio) (command "line" original yend "") (command "line" original xend "") (setq s1 (ssget "L")) (command "text" tp textHeight 0.0 "X" "") (setq tp (polar yend (* pi 1.25) (* 1.414 a))) (command "text" tp textHeight 0.0 "Y" "") (setq tp (polar original pi a)) (if (= i 0) (progn (command "text" tp textHeight 0.0 "A" "") (setq tp1 (polar original 0.0 (+ (distance Xend original) a) ) ) (command "text" tp1 textHeight 0.0 "A" "") ) ) (repeat nTotal (setq i (1+ i)) (command "offset" space s1 yend "") (setq s1 (ssget "L")) (cond ((= i 1) (setq str "B")) ((= i 2) (setq str "C")) ((= i 3) (setq str "D")) ((= i 4) (setq str "E")) ((= i 5) (setq str "F")) ((= i 6) (setq str "G")) ((= i 7) (setq str "H")) ((= i 8) (setq str "I")) ((= i 9) (setq str "J")) ((= i 10) (setq str "K")) ((= i 11) (setq str "L")) ((= i 12) (setq str "M")) ((= i 13) (setq str "N")) ((= i 14) (setq str "O")) ((= i 15) (setq str "P")) ((= i 16) (setq str "Q")) ((= i 17) (setq str "R")) ((= i 18) (setq str "S")) ((= i 19) (setq str "T")) ((= i 20) (setq str "U"))