home *** CD-ROM | disk | FTP | other *** search
- ;**************************************
- ;* The program for drawing *
- ;**************************************
- ;(DEFUN XB ()
- (SETVAR "CMDECHO" 0)
- (MENUCMD "S=IN1")
- (setq fpt (getpoint "\n╙├ ╩« ╫╓ ╧▀ ╢¿ ╧│ ▒Γ ╞≡ ╩╝ ├µ: "))
- (setq dgl (getreal "\n╩Σ ╚δ ╞≡ ╩╝ ├µ ┤ª ╡╣ ╜╟=: "))
- (setq dr1 (getstring "\n╩Σ ╚δ ╕├ ╢╬ ╓▒ ╛╢=: "))
- (setq dr (atof dr1))
- (setq n (getreal "\n╩Σ ╚δ ╧│ ▒Γ ╩² =: "))
- (if (or (= n 2) (= n 4))(progn
- (setq a1 (getstring "\n╩Σ ╚δ ╧│ ▒Γ ┐φ ╢╚ =: "))
- (setq sch "" xch "" a (atof a1))
- ))
- (if (= n 6)(progn
- (setq fpt2 (getpoint "\n╙├ ╩« ╫╓ ╧▀ ╢¿ ╧ K -> ╬╗ ╓├ "))
- ))
- (if (= n 4)(progn
- (while (or (< a (* 0.707 dr)) (>= a dr))
- (if (< a (* 0.707 dr))(setq a1 (getstring "\n┐φ ╢╚ ╠½ ╨í ! ╓╪ ╨┬ ╩Σ ╚δ ┐φ ╢╚=: ") a (atof a1)))
- (if (>= a dr)(setq a1 (getstring "\n┐φ ╢╚ ╠½ ┤≤ ! ╓╪ ╨┬ ╩Σ ╚δ ┐φ ╢╚=: ") a (atof a1)))
- )
- ))
- (setq yn (getstring "\n╙╨ ╖± ╣½ ▓ε (N)? "))
- (if (or (= yn "y") (= yn "Y"))(progn
- (setq sch (getstring "\n╔╧ ╞½ ▓ε=: "))
- (setq xch (getstring "\n╧┬ ╞½ ▓ε=: "))
- (setq xch (substr xch 2))
- ))
- (setq b1 (getstring "\n╩Σ ╚δ ╧│ ▒Γ │ñ ╢╚ =: ( ╚⌠╗∙├µ╘┌╙╥,╩Σ╕║╓╡ ) "))
- (setq fpt1 (getpoint "\n╙├ ╩« ╫╓ ╧▀ ╢¿ ╧│ ▒Γ ╞╩ ├µ ═╝ ╬╗ ╓├: "))
- (setq xc (car fpt) yc (cadr fpt) b (atof b1) atl dgl)
- (if (< b 0.)(setq dgl (- 0 dgl)))
- (if (/= dgl 0)(progn
- (command "erase" (list (+ xc dgl) (+ yc 2)) "")
- (command "erase" (list (+ xc dgl (* 0.1 dgl)) (+ yc 2)) "")
- (command "erase" (list (+ xc dgl (* 0.1 dgl)) (+ yc 2)) "")
- ))
- (if (or (= n 2) (= n 6))(progn
- (command "dim" "hor" (list xc yc) (list (+ xc b) yc) (list (+ xc (/ b 2)) (- yc (/ dr 2) 20)) "1" "exit")
- ))
- (if (= n 4)(progn
- (command "dim" "hor" (list xc (- yc (/ dr 2))) (list (+ xc b) (- yc (/ dr 2))) (list (+ xc (/ b 2)) (- yc (/ dr 2) 20)) "1" "exit")
- ))
- (command "erase" "l" "")
- (command "line" (list xc (- yc (/ dr 2) 20)) (list (+ xc b) (- yc (/ dr 2) 20)) "")
- (if (< b 0.)(setq b1 (substr b1 2)))
- (command "text" (list (- (+ xc (/ b 2)) 4) (- yc (/ dr 2) 18)) "4" "0" b1)
- (if (or (= n 2) (= n 4))(progn
- (command "pline" (list (+ xc (/ b 2)) (+ yc (/ dr 2) 8)) "w" "1" "1" (list (+ xc (/ b 2)) (+ yc (/ dr 2) 4)) "")
- (command "pline" (list (+ xc (/ b 2)) (- yc (/ dr 2) 3)) (list (+ xc (/ b 2)) (- yc (/ dr 2) 7)) "")
- (command "text" (list (+ xc (/ b 2) 3) (+ yc (/ dr 2) 10)) "5" "0" "F")
- (command "text" (list (+ xc (/ b 2) 3) (- yc (/ dr 2) 12)) "5" "0" "F")
- (setq c (/ (* dr dr) 4) d (/ (* a a) 4))
- (setq h (sqrt (- c d)))
- (setq ll1 0 ll2 0)
- (if (/= sch "")(setq ll1 (strlen sch)))
- (if (/= xch "")(setq ll2 (strlen xch)))
- (setq nn (strlen a1))
- (setq ll (max ll1 ll2) ll (* (+ ll nn 1) 4))
- ))
- (if (= n 2)(progn
- (setq tof (list xc (+ yc h)))
- (setq bof (list xc (- yc h)))
- (setq toe (list (+ xc b) (+ yc h)))
- (setq boe (list (+ xc b) (- yc h)))
- (setq botl (list xc (+ (- yc (/ dr 2)) atl)))
- (setq botr (list (+ xc dgl) (- yc (/ dr 2))))
- (setq bog (list (+ xc dgl) (- yc h)))
- (setq tog (list (+ xc dgl) (+ yc h)))
- (setq topl (list xc (- (+ yc (/ dr 2)) atl)))
- (setq topr (list (+ xc dgl) (+ yc (/ dr 2))))
- (if (/= dgl 0)(command "pline" tof "w" "0.35" "0.35" topl topr tog tof toe boe bog botr botl bof bog ""))
- (if (= dgl 0)(command "pline" tof "w" "0.35" "0.35" toe boe bof tof ""))
- (command "line" tof boe "")
- (command "line" bof toe "")
- (redraw)
- (setq xc (car fpt1) yc (cadr fpt1))
- (setq xc1 (- xc (/ a 2)) yc1 (+ yc h) xc2 (+ xc (/ a 2)))
- (setq ycc1 (- yc h))
- (command "pline" (list xc1 yc1) (list xc1 ycc1) "arc" "second" (list xc (- yc (/ dr 2))) (list xc2 ycc1) "l" (list xc2 yc1) "arc" "second" (list xc (+ yc (/ dr 2))) (list xc1 yc1) "")
- (command "hatch" "u" "45" "5" "" "l" "")
- (command "layer" "s" "1" "")
- (command "line" (list (- xc1 3) yc) (list (+ xc2 3) yc) "")
- (command "line" (list xc (+ yc (/ dr 2) 3)) (list xc (- yc (/ dr 2) 3)) "")
- (command "layer" "s" "0" "")
- (command "dim" "hor" (list xc1 yc1) (list xc2 yc1) (list xc (+ yc (/ dr 2) 10)) "o" "exit")
- (command "erase" "l" "")
- (command "line" (list xc1 (+ yc (/ dr 2) 10)) (list xc2 (+ yc (/ dr 2) 10)) "")
- (if (> a ll)(setq fg (list (+ xc1 (/ (- a ll) 2) 4) (+ yc 12 (/ dr 2)))))
- (if (<= a ll)(setq fg (list (+ xc2 5) (+ yc 12 (/ dr 2)))))
- (command "text" fg "4" "0" a1)
- (if (= nn 2)(setq fg (list (+ (car fg) 8) (cadr fg))))
- (if (/= sch "")(progn
- (command "text" (list (car fg) (+ (cadr fg) 2.5)) "2" "0" "+")
- (command "text" (list (+ (car fg) 2) (+ (cadr fg) 2.5)) "2" "0" sch)
- ))
- (if (/= xch "")(progn
- (command "text" (list (car fg) (cadr fg)) "2" "0" "-")
- (command "text" (list (+ (car fg) 2) (cadr fg)) "2" "0" xch)
- ))
- ))
- (if (= n 4)(progn
- (setq rr (sqrt (- (* dr dr) (* a a))))
- (setq x1 (* 0.3535 (- a rr)))
- (setq y1 (- (* 0.707 a) x1))
- (setq tof (list (+ xc b) (+ yc (/ dr 2))))
- (setq topl (list (+ xc b) (+ yc x1)))
- (setq toe (list (+ xc dgl) (+ yc x1)))
- (setq topr (list xc (+ yc x1)))
- (setq botr (list xc (- yc x1)))
- (setq boe (list (+ xc dgl) (- yc x1)))
- (setq botl (list (+ xc b) (- yc x1)))
- (setq bof (list (+ xc b) (- yc (/ dr 2))))
- (command "pline" tof "w" "0.35" "0.35" topl topr toe boe botr botl bof "")
- (setq xc (car fpt1) yc (cadr fpt1))
- (command "pline" (list (- xc x1) (+ yc y1)) "arc" "second" (list xc (+ yc (/ dr 2))) (list (+ xc x1) (+ yc y1)) "l" (list (+ xc y1) (+ yc x1)) "")
- (command "array" "l" "" "c" (list xc yc) "90" "4" "y")
- (command "hatch" "u" "45" "5" "" "w" (list (- xc (/ dr 2) 1) (- yc (/ dr 2) 1)) (list (+ xc (/ dr 2) 1) (+ yc (/ dr 2) 1)) "")
- (command "circle" fpt1 (/ dr 2))
- (command "layer" "s" "1" "")
- (command "line" (list (- xc (/ dr 2) 3) yc) (list (+ xc (/ dr 2) 3) yc) "")
- (command "line" (list xc (+ yc (/ dr 2) 3)) (list xc (- yc (/ dr 2) 3)) "")
- (command "layer" "s" "0" "")
- (setq ll (- ll 4))
- (if (> a ll)(setq fg (list (+ xc (- (* 0.707 (+ (/ dr 2) 10)) (* 0.707 (/ ll 2)))) (+ yc (* 0.707 (+ (/ dr 2) 10)) (* 0.707 (/ ll 2))))))
- (if (<= a ll)(setq fg (list (+ xc (* 0.707 (+ (/ dr 2) 10)) (* 0.707 (/ a 2))) (+ yc (- (* 0.707 (+ (/ dr 2) 10)) (* 0.707 (/ a 2)))))))
- (command "dim" "rotated" "315" (list (- xc x1) (+ yc y1)) (list (+ xc x1) (- yc y1)) fg "1" "exit")
- (command "erase" "l" "")
- (setq ff (+ (/ dr 2) 10))
- (setq fh (list (+ (- xc x1) (* 0.707 (- ff (/ rr 2)))) (+ (+ yc y1) (* 0.707 (- ff (/ rr 2))))))
- (setq fk (list (+ (+ xc x1) (* 0.707 (+ ff (/ rr 2)))) (+ (- yc y1) (* 0.707 (+ ff (/ rr 2))))))
- (command "line" fh fk "")
- (if (> a ll)(setq fg (list (+ xc (- (* 0.707 (+ (/ dr 2) 12)) (* 0.707 (/ ll 2)))) (+ yc (* 0.707 (+ (/ dr 2) 12)) (* 0.707 (/ ll 2))))))
- (if (<= a ll)(setq fg (list (+ xc (* 0.707 (+ (/ dr 2) 12)) (* 0.707 (/ a 2))) (+ yc (- (* 0.707 (+ (/ dr 2) 12)) (* 0.707 (/ a 2)))))))
- (command "text" fg "4" "315" a1)
- (if (= nn 2)(setq fg (list (+ (car fg) 5.7) (- (cadr fg) 5.7))))
- (if (/= sch "")(progn
- (command "text" (list (+ (car fg) 1.8) (+ (cadr fg) 1.8)) "2" "315" "+")
- (command "text" (list (+ (car fg) 3.3) (- (cadr fg) 0.5)) "2" "315" sch)
- ))
- (if (/= xch "")(progn
- (command "text" (list (- (car fg) 0.7) (- (cadr fg) 0.7)) "2" "315" "-")
- (command "text" (list (+ (car fg) 0.8) (- (cadr fg) 2.2)) "2" "315" xch)
- ))
- ))
- (if (= n 6)(progn
- (setq x1 (+ xc b) x2 (+ xc dgl) y1 (+ yc (/ dr 2)) y2 (- yc (/ dr 2)) y3 (+ yc (/ dr 4)) y4 (- yc (/ dr 4)) )
- (command "pline" (list x1 y1) "w" "0.35" "" (list x1 y2) "")
- (command "pline" (list x1 y3) "w" "0.35" "" (list x2 y3) "")
- (command "pline" (list x1 y4) "w" "0.35" "" (list x2 y4) "")
- (command "pline" (list x2 y1) "w" "0.35" "" "arc" "sec" (list xc (- y1 (/ dr 8))) (list x2 y3) "sec" (list xc yc) (list x2 y4) "sec" (list xc (+ y2 (/ dr 8))) (list x2 y2) "")
- (setq xc (car fpt2) yc (cadr fpt2))
- (if (< b 0)(progn
- (command "pline" (list xc yc) "w" "0" "1.2" (list (+ xc 4) yc) "")
- (command "line" (list (+ xc 4) yc) (list (+ xc 8) yc) "")
- (command "text" (list (+ xc 11) (- yc 2)) "5" "0" "K")
- ))
- (if (> b 0)(progn
- (command "pline" (list xc yc) "w" "0" "1.2" (list (- xc 4) yc) "")
- (command "line" (list (- xc 4) yc) (list (- xc 8) yc) "")
- (command "text" (list (- xc 14) (- yc 2)) "5" "0" "K")
- ))
- (setq xc (car fpt1) yc (cadr fpt1))
- (setq r1 (* 0.433 dr))
- (setq p1 (list (- xc r1) (+ yc (/ dr 4))))
- (setq p2 (list xc (+ yc (/ dr 2))))
- (setq p3 (list (+ xc r1) (+ yc (/ dr 4))))
- (setq p4 (list (+ xc r1) (- yc (/ dr 4))))
- (setq p5 (list xc (- yc (/ dr 2))))
- (setq p6 (list (- xc r1) (- yc (/ dr 4))))
- (command "layer" "s" "1" "")
- (command "line" (list (- xc r1 3) yc) (list (+ xc r1 3) yc) "")
- (command "line" (list xc (+ yc (/ dr 2) 3)) (list xc (- yc (/ dr 2) 3)) "")
- (command "layer" "s" "0" "")
- (command "pline" p1 "w" "0.35" "" p2 p3 p4 p5 p6 p1 "")
- (command "pline" (list xc (+ yc r1)) "a" "ce" (list xc yc) "a" "180" "cl")
- (command "dim" "hor" p6 p4 (list xc (- yc (/ dr 2) 15)) "1" "exit")
- (command "erase" "l" "")
- (command "line" (list (- xc r1) (- yc (/ dr 2) 15)) (list (+ xc r1) (- yc (/ dr 2) 15)) "")
- (setq r2 (/ (fix (* 10 (+ 0.05 (* r1 2)))) 10))
- (command "text" (list (- xc 4) (- yc (/ dr 2) 10)) "4" "0" r2)
- (command "dim" "vert" p2 p5 (list (+ xc r1 15) yc) "1" "exit")
- (command "erase" "l" "")
- (command "line" (list (+ xc r1 15) (+ yc (/ dr 2))) (list (+ xc r1 15) (- yc (/ dr 2))) "")
- (command "text" (list (+ xc r1 10) (- yc 5)) "4" "90" dr1)
- ))
- (if (or (= n 2) (= n 4))(progn
- (command "text" (list (- xc 8) (+ yc (/ dr 2) 22)) "5" "0" "F")
- (command "pline" (list (- xc 3) (+ yc (/ dr 2) 25)) "w" "0.4" "0.4" (list (+ xc 1) (+ yc (/ dr 2) 25)) "")
- (command "text" (list (+ xc 4) (+ yc (/ dr 2) 22)) "5" "0" "F")
- ))
- (if (= n 6)(progn
- (command "insert" "kx" (list xc (+ yc (/ dr 2) 18)) "0.5" "" "0")
- ))
- (MENUCMD "S=SCREEN")
- (redraw)
- ;)
- ;(XB)