;;;;;屏蔽对第一个话框部分选项子程序.
  (defun mod ( gat )
      (if (or (= gat "ppgate") (= gat "tptype")) 
            (mode_tile "tshcs_num" 1)
            (mode_tile "tshcs_num" 0))
      (if (= gat "tptype")
          (mode_tile "ina_b" 1)
          (mode_tile "ina_b" 0)
      )
  )
;;;;;;;;;;;;;加装第二个对话框.
(defun plats ()
  (setq dcl (load_dialog "c:/Autolisp/mold.dcl"))
  (if (< plat_num 10)
    (if (not (new_dialog "mold2_1" dcl)) (exit))  )
  (if (and (< plat_num 16) (> plat_num 9))
    (progn
      (if (not (new_dialog "mold2_2" dcl)) (exit))
      (if (= plat_num 10)
        (progn
          (setq plat_h11 nil)(setq plat_w11 nil)(setq plat_l11 nil)
          (mode_tile "plat_h11" 1)(mode_tile "plat_w11" 1)(mode_tile "plat_l11" 1)
          (setq plat_h12 nil)(setq plat_w12 nil)(setq plat_l12 nil)
          (mode_tile "plat_h12" 1)(mode_tile "plat_w12" 1)(mode_tile "plat_l12" 1)
          (setq plat_h13 nil)(setq plat_w13 nil)(setq plat_l13 nil)
          (mode_tile "plat_h13" 1)(mode_tile "plat_w13" 1)(mode_tile "plat_l13" 1)
          (setq plat_h14 nil)(setq plat_w14 nil)(setq plat_l14 nil)
          (mode_tile "plat_h14" 1)(mode_tile "plat_w14" 1)(mode_tile "plat_l14" 1)
          (setq plat_h15 nil)(setq plat_w15 nil)(setq plat_l15 nil)
          (mode_tile "plat_h15" 1)(mode_tile "plat_w15" 1)(mode_tile "plat_l15" 1)
      ) )
      (if (= plat_num 11)
        (progn
          (setq plat_h12 nil)(setq plat_w12 nil)(setq plat_l12 nil)
          (mode_tile "plat_h12" 1)(mode_tile "plat_w12" 1)(mode_tile "plat_l12" 1)
          (setq plat_h13 nil)(setq plat_w13 nil)(setq plat_l13 nil)
          (mode_tile "plat_h13" 1)(mode_tile "plat_w13" 1)(mode_tile "plat_l13" 1)
          (setq plat_h14 nil)(setq plat_w14 nil)(setq plat_l14 nil)
          (mode_tile "plat_h14" 1)(mode_tile "plat_w14" 1)(mode_tile "plat_l14" 1)
          (setq plat_h15 nil)(setq plat_w15 nil)(setq plat_l15 nil)
          (mode_tile "plat_h15" 1)(mode_tile "plat_w15" 1)(mode_tile "plat_l15" 1)
      ) )
      (if (= plat_num 12)
        (progn
          (setq plat_h13 nil)(setq plat_w13 nil)(setq plat_l13 nil)
          (mode_tile "plat_h13" 1)(mode_tile "plat_w13" 1)(mode_tile "plat_l13" 1)
          (setq plat_h14 nil)(setq plat_w14 nil)(setq plat_l14 nil)
          (mode_tile "plat_h14" 1)(mode_tile "plat_w14" 1)(mode_tile "plat_l14" 1)
          (setq plat_h15 nil)(setq plat_w15 nil)(setq plat_l15 nil)
          (mode_tile "plat_h15" 1)(mode_tile "plat_w15" 1)(mode_tile "plat_l15" 1)
      ) )
      (if (= plat_num 13)
        (progn
          (setq plat_h14 nil)(setq plat_w14 nil)(setq plat_l14 nil)
          (mode_tile "plat_h14" 1)(mode_tile "plat_w14" 1)(mode_tile "plat_l14" 1)
          (setq plat_h15 nil)(setq plat_w15 nil)(setq plat_l15 nil)
          (mode_tile "plat_h15" 1)(mode_tile "plat_w15" 1)(mode_tile "plat_l15" 1)
      ) )
      (if (= plat_num 14)
        (progn
          (setq plat_h15 nil)(setq plat_w15 nil)(setq plat_l15 nil)
          (mode_tile "plat_h15" 1)(mode_tile "plat_w15" 1)(mode_tile "plat_l15" 1)
      ) )
  ) )
  (if (= plat_num 3)
    (progn
      (setq plat_h4 nil)(setq plat_w4 nil)(setq plat_l4 nil)
      (mode_tile "plat_h4" 1)(mode_tile "plat_w4" 1)(mode_tile "plat_l4" 1)
      (setq plat_h5 nil)(setq plat_w5 nil)(setq plat_l5 nil)
      (mode_tile "plat_h5" 1)(mode_tile "plat_w5" 1)(mode_tile "plat_l5" 1)
      (setq plat_h6 nil)(setq plat_w6 nil)(setq plat_l6 nil)
      (mode_tile "plat_h6" 1)(mode_tile "plat_w6" 1)(mode_tile "plat_l6" 1)
      (setq plat_h7 nil)(setq plat_w7 nil)(setq plat_l7 nil)
      (mode_tile "plat_h7" 1)(mode_tile "plat_w7" 1)(mode_tile "plat_l7" 1)
      (setq plat_h8 nil)(setq plat_w8 nil)(setq plat_l8 nil)
      (mode_tile "plat_h8" 1)(mode_tile "plat_w8" 1)(mode_tile "plat_l8" 1)
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
  (if (= plat_num 4)
    (progn
      (setq plat_h5 nil)(setq plat_w5 nil)(setq plat_l5 nil)
      (mode_tile "plat_h5" 1)(mode_tile "plat_w5" 1)(mode_tile "plat_l5" 1)
      (setq plat_h6 nil)(setq plat_w6 nil)(setq plat_l6 nil)
      (mode_tile "plat_h6" 1)(mode_tile "plat_w6" 1)(mode_tile "plat_l6" 1)
      (setq plat_h7 nil)(setq plat_w7 nil)(setq plat_l7 nil)
      (mode_tile "plat_h7" 1)(mode_tile "plat_w7" 1)(mode_tile "plat_l7" 1)
      (setq plat_h8 nil)(setq plat_w8 nil)(setq plat_l8 nil)
      (mode_tile "plat_h8" 1)(mode_tile "plat_w8" 1)(mode_tile "plat_l8" 1)
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
  (if (= plat_num 5)
    (progn
      (setq plat_h6 nil)(setq plat_w6 nil)(setq plat_l6 nil)
      (mode_tile "plat_h6" 1)(mode_tile "plat_w6" 1)(mode_tile "plat_l6" 1)
      (setq plat_h7 nil)(setq plat_w7 nil)(setq plat_l7 nil)
      (mode_tile "plat_h7" 1)(mode_tile "plat_w7" 1)(mode_tile "plat_l7" 1)
      (setq plat_h8 nil)(setq plat_w8 nil)(setq plat_l8 nil)
      (mode_tile "plat_h8" 1)(mode_tile "plat_w8" 1)(mode_tile "plat_l8" 1)
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
  (if (= plat_num 6)
    (progn
      (setq plat_h7 nil)(setq plat_w7 nil)(setq plat_l7 nil)
      (mode_tile "plat_h7" 1)(mode_tile "plat_w7" 1)(mode_tile "plat_l7" 1)
      (setq plat_h8 nil)(setq plat_w8 nil)(setq plat_l8 nil)
      (mode_tile "plat_h8" 1)(mode_tile "plat_w8" 1)(mode_tile "plat_l8" 1)
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
  (if (= plat_num 7)
    (progn
      (setq plat_h8 nil)(setq plat_w8 nil)(setq plat_l8 nil)
      (mode_tile "plat_h8" 1)(mode_tile "plat_w8" 1)(mode_tile "plat_l8" 1)
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
  (if (= plat_num 8)
    (progn
      (setq plat_h9 nil)(setq plat_w9 nil)(setq plat_l9 nil)
      (mode_tile "plat_h9" 1)(mode_tile "plat_w9" 1)(mode_tile "plat_l9" 1)
  ) )
;;;;;;;;;;;;;;;
  (if (/= plat_h1 nil) (set_tile "plat_h1" (rtos plat_h1)))
  (if (/= plat_w1 nil) (set_tile "plat_w1" (rtos plat_w1)))
  (if (/= plat_l1 nil) (set_tile "plat_l1" (rtos plat_l1)))
  (if (/= plat_h2 nil) (set_tile "plat_h2" (rtos plat_h2)))
  (if (/= plat_w2 nil) (set_tile "plat_w2" (rtos plat_w2)))
  (if (/= plat_l2 nil) (set_tile "plat_l2" (rtos plat_l2)))
  (if (/= plat_h3 nil) (set_tile "plat_h3" (rtos plat_h3)))
  (if (/= plat_w3 nil) (set_tile "plat_w3" (rtos plat_w3)))
  (if (/= plat_l3 nil) (set_tile "plat_l3" (rtos plat_l3)))
  (if (/= plat_h4 nil) (set_tile "plat_h4" (rtos plat_h4)))
  (if (/= plat_w4 nil) (set_tile "plat_w4" (rtos plat_w4)))
  (if (/= plat_l4 nil) (set_tile "plat_l4" (rtos plat_l4)))
  (if (/= plat_h5 nil) (set_tile "plat_h5" (rtos plat_h5))) 
  (if (/= plat_w5 nil) (set_tile "plat_w5" (rtos plat_w5)))
  (if (/= plat_l5 nil) (set_tile "plat_l5" (rtos plat_l5)))
  (if (/= plat_h6 nil) (set_tile "plat_h6" (rtos plat_h6)))
  (if (/= plat_w6 nil) (set_tile "plat_w6" (rtos plat_w6)))
  (if (/= plat_l6 nil) (set_tile "plat_l6" (rtos plat_l6)))
  (if (/= plat_h7 nil) (set_tile "plat_h7" (rtos plat_h7)))
  (if (/= plat_w7 nil) (set_tile "plat_w7" (rtos plat_w7)))
  (if (/= plat_l7 nil) (set_tile "plat_l7" (rtos plat_l7)))
  (if (/= plat_h8 nil) (set_tile "plat_h8" (rtos plat_h8)))
  (if (/= plat_w8 nil) (set_tile "plat_w8" (rtos plat_w8)))
  (if (/= plat_l8 nil) (set_tile "plat_l8" (rtos plat_l8)))
  (if (/= plat_h9 nil) (set_tile "plat_h9" (rtos plat_h9)))
  (if (/= plat_w9 nil) (set_tile "plat_w9" (rtos plat_w9)))
  (if (/= plat_l9 nil) (set_tile "plat_l9" (rtos plat_l9)))
  (if (/= plat_h10 nil) (set_tile "plat_h10" (rtos plat_h10)))
  (if (/= plat_w10 nil) (set_tile "plat_w10" (rtos plat_w10)))
  (if (/= plat_l10 nil) (set_tile "plat_l10" (rtos plat_l10)))
  (if (/= plat_h11 nil) (set_tile "plat_h11" (rtos plat_h11)))
  (if (/= plat_w11 nil) (set_tile "plat_w11" (rtos plat_w11)))
  (if (/= plat_l11 nil) (set_tile "plat_l11" (rtos plat_l11)))
  (if (/= plat_h12 nil) (set_tile "plat_h12" (rtos plat_h12)))
  (if (/= plat_w12 nil) (set_tile "plat_w12" (rtos plat_w12)))
  (if (/= plat_l12 nil) (set_tile "plat_l12" (rtos plat_l12)))
  (if (/= plat_h13 nil) (set_tile "plat_h13" (rtos plat_h13)))
  (if (/= plat_w13 nil) (set_tile "plat_w13" (rtos plat_w13)))
  (if (/= plat_l13 nil) (set_tile "plat_l13" (rtos plat_l13)))
  (if (/= plat_h14 nil) (set_tile "plat_h14" (rtos plat_h14)))
  (if (/= plat_w14 nil) (set_tile "plat_w14" (rtos plat_w14)))
  (if (/= plat_l14 nil) (set_tile "plat_l14" (rtos plat_l14)))
  (if (/= plat_h15 nil) (set_tile "plat_h15" (rtos plat_h15)))
  (if (/= plat_w15 nil) (set_tile "plat_w15" (rtos plat_w15)))
  (if (/= plat_l15 nil) (set_tile "plat_l15" (rtos plat_l15)))
;;;;;;;;;;;;;;;;;;;;
  (action_tile "plat_h1" "(setq plat_h1 (atof $value))")
  (action_tile "plat_w1" "(setq plat_w1 (atof $value))")
  (action_tile "plat_l1" "(setq plat_l1 (atof $value))")
  (action_tile "plat_h2" "(setq plat_h2 (atof $value))")
  (action_tile "plat_w2" "(setq plat_w2 (atof $value))(set1 plat_w2)")
  (action_tile "plat_l2" "(setq plat_l2 (atof $value))(set2 plat_l2)")
  (action_tile "plat_h3" "(setq plat_h3 (atof $value))")
  (action_tile "plat_w3" "(setq plat_w3 (atof $value))")
  (action_tile "plat_l3" "(setq plat_l3 (atof $value))")
  (action_tile "plat_h4" "(setq plat_h4 (atof $value))")
  (action_tile "plat_w4" "(setq plat_w4 (atof $value))")
  (action_tile "plat_l4" "(setq plat_l4 (atof $value))")
  (action_tile "plat_h5" "(setq plat_h5 (atof $value))")
  (action_tile "plat_w5" "(setq plat_w5 (atof $value))(set5)")
  (action_tile "plat_l5" "(setq plat_l5 (atof $value))(set6)")
  (action_tile "plat_h6" "(setq plat_h6 (atof $value))")
  (action_tile "plat_w6" "(setq plat_w6 (atof $value))(set5)")
  (action_tile "plat_l6" "(setq plat_l6 (atof $value))(set6)")
  (action_tile "plat_h7" "(setq plat_h7 (atof $value))")
  (action_tile "plat_w7" "(setq plat_w7 (atof $value))(set5)")
  (action_tile "plat_l7" "(setq plat_l7 (atof $value))(set6)")
  (action_tile "plat_h8" "(setq plat_h8 (atof $value))")
  (action_tile "plat_w8" "(setq plat_w8 (atof $value))(set5)")
  (action_tile "plat_l8" "(setq plat_l8 (atof $value))(set6)")
  (action_tile "plat_h9" "(setq plat_h9 (atof $value))")
  (action_tile "plat_w9" "(setq plat_w9 (atof $value))(set5)")
  (action_tile "plat_l9" "(setq plat_l9 (atof $value))(set6)")
  (action_tile "plat_h10" "(setq plat_h10 (atof $value))")
  (action_tile "plat_w10" "(setq plat_w10 (atof $value))(set5)")
  (action_tile "plat_l10" "(setq plat_l10 (atof $value))(set6)")
  (action_tile "plat_h11" "(setq plat_h11 (atof $value))")
  (action_tile "plat_w11" "(setq plat_w11 (atof $value))(set5)")
  (action_tile "plat_l11" "(setq plat_l11 (atof $value))(set6)")
  (action_tile "plat_h12" "(setq plat_h12 (atof $value))")
  (action_tile "plat_w12" "(setq plat_w12 (atof $value))(set5)")
  (action_tile "plat_l12" "(setq plat_l12 (atof $value))(set6)")
  (action_tile "plat_h13" "(setq plat_h13 (atof $value))")
  (action_tile "plat_w13" "(setq plat_w13 (atof $value))(set5)")
  (action_tile "plat_l13" "(setq plat_l13 (atof $value))(set6)")
  (action_tile "plat_h14" "(setq plat_h14 (atof $value))")
  (action_tile "plat_w14" "(setq plat_w14 (atof $value))(set5)")
  (action_tile "plat_l14" "(setq plat_l14 (atof $value))(set6)")
  (action_tile "plat_h15" "(setq plat_h15 (atof $value))")
  (action_tile "plat_w15" "(setq plat_w15 (atof $value))")
  (action_tile "plat_l15" "(setq plat_l15 (atof $value))")
  (action_tile "part" "(done_dialog)(setq part $value)")
  (action_tile "accept" "(done_dialog)(setq part \"0\")")
  (start_dialog)
  (unload_dialog dcl)
  (if (= part "1") (parts))
)
;;;;;;;;;;;;;;;;;;;;;;;

;;;;加装第三个对话框.
(defun parts ()
  (setq dcl (load_dialog "c:/Autolisp/mold.dcl"))
  (if (not (new_dialog "mold3" dcl)) (exit))
  (mode3)
;;;;;;;
  (if (/= gb1_dia nil)     (set_tile "gb1_dia" (rtos gb1_dia)))
  (if (/= gb1_len nil)     (set_tile "gb1_len" (rtos gb1_len)))
  (if (/= gb1_plat nil)    (set_tile "gb1_plat" (rtos gb1_plat)))
  (if (/= sp_dia nil)      (set_tile "sp_dia" (rtos sp_dia)))
  (if (/= sp_len nil)      (set_tile "sp_len" (rtos sp_len)))
  (if (/= sp_plat nil)     (set_tile "sp_plat" (rtos sp_plat)))
  (if (/= gp1_dia nil)     (set_tile "gp1_dia" (rtos gp1_dia)))
  (if (/= gp1_len nil)     (set_tile "gp1_len" (rtos gp1_len)))
  (if (/= gp1_drct nil)    (set_tile "gp1_drct"  gp1_drct))
  (if (/= gp1_plat nil)    (set_tile "gp1_plat" (rtos gp1_plat)))
  (if (/= gp2_dia nil)     (set_tile "gp2_dia" (rtos gp2_dia)))
  (if (/= gp2_len nil)     (set_tile "gp2_len" (rtos gp2_len)))
  (if (/= gp2_drct nil)    (set_tile "gp2_drct"  gp2_drct))
  (if (/= gp2_plat nil)    (set_tile "gp2_plat" (rtos gp2_plat)))
  (if (/= sgp1_dia nil)    (set_tile "sgp1_dia" (rtos sgp1_dia)))
  (if (/= sgp1_len nil)    (set_tile "sgp1_len" (rtos sgp1_len)))
  (if (/= sgp1_plat nil)   (set_tile "sgp1_plat" (rtos sgp1_plat)))
  (if (/= sgp1_com nil)    (set_tile "sgp1_com" sgp1_com))
  (if (/= sgp2_dia nil)    (set_tile "sgp2_dia" (rtos sgp2_dia)))
  (if (/= sgp2_len nil)    (set_tile "sgp2_len" (rtos sgp2_len)))
  (if (/= sgp2_plat nil)   (set_tile "sgp2_plat" (rtos sgp2_plat)))
  (if (/= sgp2_com nil)    (set_tile "sgp2_com" sgp2_com))
  (if (/= sgp3_dia nil)    (set_tile "sgp3_dia" (rtos sgp3_dia)))
  (if (/= sgp3_len nil)    (set_tile "sgp3_len" (rtos sgp3_len)))
  (if (/= sgp3_plat nil)   (set_tile "sgp3_plat" (rtos sgp3_plat)))
  (if (/= sgp3_com nil)    (set_tile "sgp3_com" sgp3_com))
  (if (/= sgp4_dia nil)    (set_tile "sgp4_dia" (rtos sgp4_dia)))
  (if (/= sgp4_len nil)    (set_tile "sgp4_len" (rtos sgp4_len)))
  (if (/= sgp4_plat nil)   (set_tile "sgp4_plat" (rtos sgp4_plat)))
  (if (/= sgp4_com nil)    (set_tile "sgp4_com" sgp4_com))
  (if (/= rp_dia nil)      (set_tile "rp_dia" (rtos rp_dia)))
  (if (/= rp_len nil)      (set_tile "rp_len" (rtos rp_len)))
  (if (/= egp_dia nil)     (set_tile "egp_dia" (rtos egp_dia)))
  (if (/= egp_len nil)     (set_tile "egp_len" (rtos egp_len)))
  (if (/= egp_drct nil)    (set_tile "egp_drct" egp_drct))
  (if (/= tshcs1_dia nil)  (set_tile "tshcs1_dia" (rtos tshcs1_dia)))
  (if (/= tshcs1_len nil)  (set_tile "tshcs1_len" (rtos tshcs1_len)))
  (if (/= tshcs1_plat nil) (set_tile "tshcs1_plat" (rtos tshcs1_plat))) 
  (if (/= tshcs2_dia nil)  (set_tile "tshcs2_dia" (rtos tshcs2_dia)))
  (if (/= tshcs2_len nil)  (set_tile "tshcs2_len" (rtos tshcs2_len)))
  (if (/= tshcs2_plat nil) (set_tile "tshcs2_plat" (rtos tshcs2_plat))) 
  (if (/= bshcs1_dia nil)  (set_tile "bshcs1_dia" (rtos bshcs1_dia)))
  (if (/= bshcs1_len nil)  (set_tile "bshcs1_len" (rtos bshcs1_len)))
  (if (/= bshcs1_plat nil) (set_tile "bshcs1_plat" (rtos bshcs1_plat))) 
  (if (/= bshcs2_dia nil)  (set_tile "bshcs2_dia" (rtos bshcs2_dia)))
  (if (/= bshcs2_len nil)  (set_tile "bshcs2_len" (rtos bshcs2_len)))
  (if (/= bshcs2_plat nil) (set_tile "bshcs2_plat" (rtos bshcs2_plat))) 
  (if (/= bshcs3_dia nil)  (set_tile "bshcs3_dia" (rtos bshcs3_dia)))
  (if (/= bshcs3_len nil)  (set_tile "bshcs3_len" (rtos bshcs3_len)))
  (if (/= bshcs3_plat nil) (set_tile "bshcs3_plat" (rtos bshcs3_plat)))
  (set_tile "ina_b" ina_b)
  (set_tile "egp_drct" egp_drct)
  (set_tile "gp1_drct" gp1_drct)
  (set_tile "gp2_drct" gp2_drct)
  (set_tile "sgp1_com" sgp1_com)
  (set_tile "sgp2_com" sgp2_com)
  (set_tile "sgp3_com" sgp3_com)
  (set_tile "sgp4_com" sgp4_com)
;;;;;;;; 
  (action_tile "gb1_dia" "(setq gb1_dia (atof $value))(set3)")
  (action_tile "gb1_len" "(setq gb1_len (atof $value))")
  (action_tile "gb1_plat" "(setq gb1_plat (atof $value))")
  (action_tile "ina_b" "(setq ina_b $value)")
  (action_tile "sp_dia" "(setq sp_dia (atof $value))(set4)")
  (action_tile "sp_len" "(setq sp_len (atof $value))")
  (action_tile "sp_plat" "(setq sp_plat (atof $value))")
  (action_tile "gp1_dia" "(setq gp1_dia (atof $value))")
  (action_tile "gp1_len" "(setq gp1_len (atof $value))")
  (action_tile "gp1_drct" "(setq gp1_drct $value)")
  (action_tile "gp1_plat" "(setq gp1_plat (atof $value))")
  (action_tile "gp2_dia" "(setq gp2_dia (atof $value))")
  (action_tile "gp2_len" "(setq gp2_len (atof $value))")
  (action_tile "gp2_drct" "(setq gp2_drct $value)")
  (action_tile "gp2_plat" "(setq gp2_plat (atof $value))")
  (action_tile "sgp1_dia" "(setq sgp1_dia (atof $value))")
  (action_tile "sgp1_len" "(setq sgp1_len (atof $value))")
  (action_tile "sgp1_plat" "(setq sgp1_plat (atof $value))")
  (action_tile "sgp1_com" "(setq sgp1_com  $value)")
  (action_tile "sgp2_dia" "(setq sgp2_dia (atof $value))")
  (action_tile "sgp2_len" "(setq sgp2_len (atof $value))")
  (action_tile "sgp2_plat" "(setq sgp2_plat (atof $value))")
  (action_tile "sgp2_com" "(setq sgp2_com  $value)")
  (action_tile "sgp3_dia" "(setq sgp3_dia (atof $value))")
  (action_tile "sgp3_len" "(setq sgp3_len (atof $value))")
  (action_tile "sgp3_plat" "(setq sgp3_plat (atof $value))")
  (action_tile "sgp3_com" "(setq sgp3_com  $value)")
  (action_tile "sgp4_dia" "(setq sgp4_dia (atof $value))")
  (action_tile "sgp4_len" "(setq sgp4_len (atof $value))")
  (action_tile "sgp4_plat" "(setq sgp4_plat (atof $value))")
  (action_tile "sgp4_com" "(setq sgp4_com  $value)")
  (action_tile "rp_dia" "(setq rp_dia (atof $value))")
  (action_tile "rp_len" "(setq rp_len (atof $value))") 
  (action_tile "egp_dia" "(setq egp_dia (atof $value))")
  (action_tile "egp_len" "(setq egp_len (atof $value))")
  (action_tile "egp_drct" "(setq egp_drct $value)")
  (action_tile "tshcs1_dia" "(setq tshcs1_dia (atof $value))")
  (action_tile "tshcs1_len" "(setq tshcs1_len (atof $value))")
  (action_tile "tshcs1_plat" "(setq tshcs1_plat (atof $value))")
  (action_tile "tshcs2_dia" "(setq tshcs2_dia (atof $value))")
  (action_tile "tshcs2_len" "(setq tshcs2_len (atof $value))")
  (action_tile "tshcs2_plat" "(setq tshcs2_plat (atof $value))")
  (action_tile "bshcs1_dia" "(setq bshcs1_dia (atof $value))")
  (action_tile "bshcs1_len" "(setq bshcs1_len (atof $value))")
  (action_tile "bshcs1_plat" "(setq bshcs1_plat (atof $value))")
  (action_tile "bshcs2_dia" "(setq bshcs2_dia (atof $value))")
  (action_tile "bshcs2_len" "(setq bshcs2_len (atof $value))")
  (action_tile "bshcs2_plat" "(setq bshcs2_plat (atof $value))")
  (action_tile "bshcs3_dia" "(setq bshcs3_dia (atof $value))")
  (action_tile "bshcs3_len" "(setq bshcs3_len (atof $value))") 
  (action_tile "plat" "(done_dialog)(setq plat $value)")
  (action_tile "accept" "(done_dialog)(setq plat \"0\")")
  (start_dialog)
  (unload_dialog dcl)
  (if (= plat "1") (plats))
)
;;;;;;;;;;;;

;;;;自动设置板长板宽子程序.
(defun set1 (plat_w2)
  (if (= plat_num 3) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2)) (setq plat_w3 plat_w2)
  ) )
  (if (= plat_num 4) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
  ) )
  (if (= plat_num 5) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
  ) )
  (if (= plat_num 6) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
  ) )
  (if (= plat_num 7) (progn 
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
  ) )
  (if (= plat_num 8) (progn 
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
  ) )
  (if (= plat_num 9) (progn 
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
  ) )
  (if (= plat_num 10) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
  ) )
  (if (= plat_num 11) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
    (set_tile "plat_w11" (rtos plat_w2))(setq plat_w11 plat_w2)
  ) )
  (if (= plat_num 12) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
    (set_tile "plat_w11" (rtos plat_w2))(setq plat_w11 plat_w2)
    (set_tile "plat_w12" (rtos plat_w2))(setq plat_w12 plat_w2)
  ) )
  (if (= plat_num 13) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
    (set_tile "plat_w11" (rtos plat_w2))(setq plat_w11 plat_w2)
    (set_tile "plat_w12" (rtos plat_w2))(setq plat_w12 plat_w2)
    (set_tile "plat_w13" (rtos plat_w2))(setq plat_w13 plat_w2)
  ) )
  (if (= plat_num 14) (progn 
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
    (set_tile "plat_w11" (rtos plat_w2))(setq plat_w11 plat_w2)
    (set_tile "plat_w12" (rtos plat_w2))(setq plat_w12 plat_w2)
    (set_tile "plat_w13" (rtos plat_w2))(setq plat_w13 plat_w2)
    (set_tile "plat_w14" (rtos plat_w2))(setq plat_w14 plat_w2)
  ) )
  (if (= plat_num 15) (progn
    (set_tile "plat_w1" (rtos plat_w2)) (setq plat_w1 plat_w2)
    (set_tile "plat_w3" (rtos plat_w2))(setq plat_w3 plat_w2)
    (set_tile "plat_w4" (rtos plat_w2))(setq plat_w4 plat_w2)
    (set_tile "plat_w5" (rtos plat_w2))(setq plat_w5 plat_w2)
    (set_tile "plat_w6" (rtos plat_w2))(setq plat_w6 plat_w2)
    (set_tile "plat_w7" (rtos plat_w2))(setq plat_w7 plat_w2)
    (set_tile "plat_w8" (rtos plat_w2))(setq plat_w8 plat_w2)
    (set_tile "plat_w9" (rtos plat_w2))(setq plat_w9 plat_w2)
    (set_tile "plat_w10" (rtos plat_w2))(setq plat_w10 plat_w2)
    (set_tile "plat_w11" (rtos plat_w2))(setq plat_w11 plat_w2)
    (set_tile "plat_w12" (rtos plat_w2))(setq plat_w12 plat_w2)
    (set_tile "plat_w13" (rtos plat_w2))(setq plat_w13 plat_w2)
    (set_tile "plat_w14" (rtos plat_w2))(setq plat_w14 plat_w2)
    (set_tile "plat_w15" (rtos plat_w2))(setq plat_w15 plat_w2)
  ) )
)
;;;;;;;;;;;;;;

;;;;;;;自动设置板长子程序.
(defun set2 (plat_l2)
  (if (= plat_num 3) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2)) (setq plat_l3 plat_l2)
  ) )
  (if (= plat_num 4) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
  ) )
  (if (= plat_num 5) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
  ) )
  (if (= plat_num 6) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
  ) )
  (if (= plat_num 7) (progn 
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
  ) )
  (if (= plat_num 8) (progn 
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
  ) )
  (if (= plat_num 9) (progn 
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
  ) )
  (if (= plat_num 10) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_l10" (rtos plat_l2))(setq plat_l10 plat_l2)
  ) )
  (if (= plat_num 11) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_l10" (rtos plat_l2))(setq plat_l10 plat_l2)
    (set_tile "plat_l11" (rtos plat_l2))(setq plat_l11 plat_l2)
  ) )
  (if (= plat_num 12) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_lq0" (rtos plat_l2))(setq plat_lq0 plat_l2)
    (set_tile "plat_lq1" (rtos plat_l2))(setq plat_lq1 plat_l2)
    (set_tile "plat_lq2" (rtos plat_l2))(setq plat_lq2 plat_l2)
  ) )
  (if (= plat_num 13) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_l10" (rtos plat_l2))(setq plat_l10 plat_l2)
    (set_tile "plat_l11" (rtos plat_l2))(setq plat_l11 plat_l2)
    (set_tile "plat_l12" (rtos plat_l2))(setq plat_l12 plat_l2)
    (set_tile "plat_l13" (rtos plat_l2))(setq plat_l13 plat_l2)
  ) )
  (if (= plat_num 14) (progn 
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_l10" (rtos plat_l2))(setq plat_l10 plat_l2)
    (set_tile "plat_l11" (rtos plat_l2))(setq plat_l11 plat_l2)
    (set_tile "plat_l12" (rtos plat_l2))(setq plat_l12 plat_l2)
    (set_tile "plat_l13" (rtos plat_l2))(setq plat_l13 plat_l2)
    (set_tile "plat_l14" (rtos plat_l2))(setq plat_l14 plat_l2)
  ) )
  (if (= plat_num 15) (progn
    (set_tile "plat_l1" (rtos plat_l2)) (setq plat_l1 plat_l2)
    (set_tile "plat_l3" (rtos plat_l2))(setq plat_l3 plat_l2)
    (set_tile "plat_l4" (rtos plat_l2))(setq plat_l4 plat_l2)
    (set_tile "plat_l5" (rtos plat_l2))(setq plat_l5 plat_l2)
    (set_tile "plat_l6" (rtos plat_l2))(setq plat_l6 plat_l2)
    (set_tile "plat_l7" (rtos plat_l2))(setq plat_l7 plat_l2)
    (set_tile "plat_l8" (rtos plat_l2))(setq plat_l8 plat_l2)
    (set_tile "plat_l9" (rtos plat_l2))(setq plat_l9 plat_l2)
    (set_tile "plat_l10" (rtos plat_l2))(setq plat_l10 plat_l2)
    (set_tile "plat_l11" (rtos plat_l2))(setq plat_l11 plat_l2)
    (set_tile "plat_l12" (rtos plat_l2))(setq plat_l12 plat_l2)
    (set_tile "plat_l13" (rtos plat_l2))(setq plat_l13 plat_l2)
    (set_tile "plat_l14" (rtos plat_l2))(setq plat_l14 plat_l2)
    (set_tile "plat_l15" (rtos plat_l2))(setq plat_l15 plat_l2)
  ) )
)
;;;;;;;;;;;;;;;

;;;;;自动设置直司，托司直径子程序.
(defun set3 ()
  (if (<= gp1_dia 0) (progn (set_tile "gp1_dia" (rtos gb1_dia))(setq gp1_dia gb1_dia)))
  (if (<= gp2_dia 0) (progn (set_tile "gp2_dia" (rtos gb1_dia))(setq gp2_dia gb1_dia)))
  (if (<= sgp1_dia 0) (progn (set_tile "sgp1_dia" (rtos gb1_dia))(setq sgp1_dia gb1_dia)))
  (if (<= sgp2_dia 0) (progn (set_tile "sgp2_dia" (rtos gb1_dia))(setq sgp2_dia gb1_dia)))
  (if (<= sgp3_dia 0) (progn (set_tile "sgp3_dia" (rtos gb1_dia))(setq sgp3_dia gb1_dia)))
  (if (<= sgp4_dia 0) (progn (set_tile "sgp4_dia" (rtos gb1_dia))(setq sgp4_dia gb1_dia)))
  (if (<= sp_dia 0) (progn (set_tile "sp_dia" (rtos gb1_dia))(setq sp_dia gb1_dia)))
)
;;;;;;;;;;
;;;;;自动设置直司，托司直径子程序.
(defun set4 ()
  (if (<= gb1_dia 0) (progn (set_tile "gb1_dia" (rtos sp_dia))(setq gb1_dia sp_dia)))
  (if (<= gp1_dia 0) (progn (set_tile "gp1_dia" (rtos sp_dia))(setq gp1_dia sp_dia)))
  (if (<= gp2_dia 0) (progn (set_tile "gp2_dia" (rtos sp_dia))(setq gp2_dia sp_dia)))
  (if (<= sgp1_dia 0) (progn (set_tile "sgp1_dia" (rtos sp_dia))(setq sgp1_dia sp_dia)))
  (if (<= sgp2_dia 0) (progn (set_tile "sgp2_dia" (rtos sp_dia))(setq sgp2_dia sp_dia)))
  (if (<= sgp3_dia 0) (progn (set_tile "sgp3_dia" (rtos sp_dia))(setq sgp3_dia sp_dia)))
  (if (<= sgp4_dia 0) (progn (set_tile "sgp4_dia" (rtos sp_dia))(setq sgp4_dia sp_dia)))
)
;;;;;;;;;;
;;;;;;设最后一块板与倒数第二板的板长.板宽相同.
(defun set5 ()
  (if (= plat_num 6)(progn (set_tile "plat_w6" (rtos plat_w5))(setq plat_w6 plat_w5)))
  (if (= plat_num 7)(progn (set_tile "plat_w7" (rtos plat_w6))(setq plat_w7 plat_w6)))
  (if (= plat_num 8)(progn (set_tile "plat_w8" (rtos plat_w7))(setq plat_w8 plat_w7)))
  (if (= plat_num 9)(progn (set_tile "plat_w9" (rtos plat_w8))(setq plat_w9 plat_w8)))
  (if (= plat_num 10)(progn (set_tile "plat_w10" (rtos plat_w9))(setq plat_w10 plat_w9)))
  (if (= plat_num 11)(progn (set_tile "plat_w11" (rtos plat_w10))(setq plat_w11 plat_w10)))
  (if (= plat_num 12)(progn (set_tile "plat_w12" (rtos plat_w11))(setq plat_w12 plat_w11)))
  (if (= plat_num 13)(progn (set_tile "plat_w13" (rtos plat_w12))(setq plat_w13 plat_w12)))
  (if (= plat_num 14)(progn (set_tile "plat_w14" (rtos plat_w13))(setq plat_w14 plat_w13)))
  (if (= plat_num 15)(progn (set_tile "plat_w15" (rtos plat_w14))(setq plat_w15 plat_w14)))
)
;;;;;;;;;
(defun set6 ()
  (if (= plat_num 6)(progn (set_tile "plat_l6" (rtos plat_l5))(setq plat_l6 plat_l5)))
  (if (= plat_num 7)(progn (set_tile "plat_l7" (rtos plat_l6))(setq plat_l7 plat_l6)))
  (if (= plat_num 8)(progn (set_tile "plat_l8" (rtos plat_l7))(setq plat_l8 plat_l7)))
  (if (= plat_num 9)(progn (set_tile "plat_l9" (rtos plat_l8))(setq plat_l9 plat_l8)))
  (if (= plat_num 10)(progn (set_tile "plat_l10" (rtos plat_l9))(setq plat_l10 plat_l9)))
  (if (= plat_num 11)(progn (set_tile "plat_l11" (rtos plat_l10))(setq plat_l11 plat_l10)))
  (if (= plat_num 12)(progn (set_tile "plat_l12" (rtos plat_l11))(setq plat_l12 plat_l11)))
  (if (= plat_num 13)(progn (set_tile "plat_l13" (rtos plat_l12))(setq plat_l13 plat_l12)))
  (if (= plat_num 14)(progn (set_tile "plat_l14" (rtos plat_l13))(setq plat_l14 plat_l13)))
  (if (= plat_num 15)(progn (set_tile "plat_l15" (rtos plat_l14))(setq plat_l15 plat_l14)))
)

;;;;;;;屏蔽第三个对话框子程序.
(defun mode3 ()
  (if (= gat "sgate") 
    (progn (mode_tile "sp_dia" 1) (mode_tile "sp_len" 1) (mode_tile "sp_plat" 1)
           (setq sp_dia 0) (setq sp_len 0) (setq sp_plat 0)))
  (if (= gat "tptype") (progn (mode_tile "gb1_dia" 1) (mode_tile "gb1_len" 1)
                          (setq gb1_dia 0) (setq gb1_len 0)
                          (mode_tile "gb1_plat" 1)(mode_tile "ina_b" 1)
                          (setq gb1_plat 0)))
  (if (= gp_num 1) (progn (mode_tile "gp2_dia" 1) (mode_tile "gp2_len" 1)
                          (setq gp2_dia 0) (setq gp2_len 0)
                          (mode_tile "gp2_plat" 1) (mode_tile "gp2_drct" 1)
                          (setq gp2_plat 0)))
  (if (<= gp_num 0)
    (progn (mode_tile "gp1_dia" 1)(mode_tile "gp1_len" 1)(mode_tile "gp1_plat" 1)
           (mode_tile "gp1_drct" 1)
           (setq gp1_dia 0)(setq gp1_len 0)(setq gp1_plat 0)
           (mode_tile "gp2_dia" 1)(mode_tile "gp2_len" 1)(mode_tile "gp2_plat" 1)
           (mode_tile "gp2_drct" 1)
           (setq gp2_dia 0)(setq gp2_len 0)(setq gp2_plat 0)))
  (if (= sgp_num 3)
    (progn (mode_tile "sgp4_dia" 1) (mode_tile "sgp4_len" 1) (mode_tile "sgp4_plat" 1)
           (mode_tile "sgp4_com" 1)
           (setq sgp4_dia 0) (setq sgp4_len 0) (setq sgp4_plat 0)))
  (if (= sgp_num 2)
    (progn (mode_tile "sgp4_dia" 1) (mode_tile "sgp4_len" 1) (mode_tile "sgp4_plat" 1)
           (mode_tile "sgp4_com" 1)
           (setq sgp4_dia 0) (setq sgp4_len 0) (setq sgp4_plat 0)
           (mode_tile "sgp3_dia" 1) (mode_tile "sgp3_len" 1) (mode_tile "sgp3_plat" 1)
           (mode_tile "sgp3_com" 1)
           (setq sgp3_dia 0) (setq sgp3_len 0) (setq sgp3_plat 0)))
  (if (= sgp_num 1)
    (progn (mode_tile "sgp4_dia" 1) (mode_tile "sgp4_len" 1) (mode_tile "sgp4_plat" 1)
           (mode_tile "sgp4_com" 1)
           (setq sgp4_dia 0) (setq sgp4_len 0) (setq sgp4_plat 0)
           (mode_tile "sgp3_dia" 1) (mode_tile "sgp3_len" 1) (mode_tile "sgp3_plat" 1)
           (mode_tile "sgp3_com" 1)
           (setq sgp3_dia 0) (setq sgp3_len 0) (setq sgp3_plat 0)
           (mode_tile "sgp2_dia" 1) (mode_tile "sgp2_len" 1) (mode_tile "sgp2_plat" 1)
           (mode_tile "sgp2_com" 1)
           (setq sgp2_dia 0) (setq sgp2_len 0) (setq sgp2_plat 0)))
  (if (<= sgp_num 0)
    (progn (mode_tile "sgp4_dia" 1) (mode_tile "sgp4_len" 1) (mode_tile "sgp4_plat" 1)
           (mode_tile "sgp4_com" 1)
           (setq sgp4_dia 0) (setq sgp4_len 0) (setq sgp4_plat 0)
           (mode_tile "sgp3_dia" 1) (mode_tile "sgp3_len" 1) (mode_tile "sgp3_plat" 1)
           (mode_tile "sgp3_com" 1)
           (setq sgp3_dia 0) (setq sgp3_len 0) (setq sgp3_plat 0)
           (mode_tile "sgp2_dia" 1) (mode_tile "sgp2_len" 1) (mode_tile "sgp2_plat" 1)
           (mode_tile "sgp2_com" 1)
           (setq sgp2_dia 0) (setq sgp2_len 0) (setq sgp2_plat 0)
           (mode_tile "sgp1_dia" 1) (mode_tile "sgp1_len" 1) (mode_tile "sgp1_plat" 1)
           (mode_tile "sgp1_com" 1)
           (setq sgp1_dia 0) (setq sgp1_len 0) (setq sgp1_plat 0)))
  (if (= egp_yn "0") 
    (progn (mode_tile "egp_dia" 1) (mode_tile "egp_len" 1) (mode_tile "egp_drct" 1)
           (setq egp_dia 0) (setq egp_len 0)))
  (if (= tshcs_num 1)
    (progn (mode_tile "tshcs2_dia" 1)(mode_tile "tshcs2_len" 1)(mode_tile "tshcs2_plat" 1)
           (setq tshcs2_dia 0)(setq tshcs2_len 0)(setq tshcs2_plat 0)))
  (if (<= tshcs_num 0)
    (progn (mode_tile "tshcs2_dia" 1)(mode_tile "tshcs2_len" 1)(mode_tile "tshcs2_plat" 1)
           (setq tshcs2_dia 0)(setq tshcs2_len 0)(setq tshcs2_plat 0)
           (mode_tile "tshcs1_dia" 1)(mode_tile "tshcs1_len" 1)(mode_tile "tshcs1_plat" 1)
           (setq tshcs1_dia 0)(setq tshcs1_len 0)(setq tshcs1_plat 0)))
  (if (<= bshcs_num 0)
    (progn (mode_tile "bshcs2_dia" 1)(mode_tile "bshcs2_len" 1)(mode_tile "bshcs2_plat" 1)
           (setq bshcs2_dia 0)(setq bshcs2_len 0)(setq bshcs2_plat 0)
           (mode_tile "bshcs1_dia" 1)(mode_tile "bshcs1_len" 1)(mode_tile "bshcs1_plat" 1)
           (setq bshcs1_dia 0)(setq bshcs1_len 0)(setq bshcs1_plat 0)
           (mode_tile "bshcs3_dia" 1)(mode_tile "bshcs3_len" 1)(mode_tile "bshcs3_plat" 1)
           (setq bshcs3_dia 0)(setq bshcs3_len 0)(setq bshcs3_plat 0)))
  (if (= bshcs_num 1)
    (progn (mode_tile "bshcs2_dia" 1)(mode_tile "bshcs2_len" 1)(mode_tile "bshcs2_plat" 1)
           (setq bshcs2_dia 0)(setq bshcs2_len 0)(setq bshcs2_plat 0)
           (mode_tile "bshcs3_dia" 1)(mode_tile "bshcs3_len" 1)(mode_tile "bshcs3_plat" 1)
           (setq bshcs3_dia 0)(setq bshcs3_len 0)(setq bshcs3_plat 0)))
)
;;;;;;;;;;;;
;;;;;;;绘直钉子程序.
(defun gb (/ d1 h no p pt1 pt2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 r
             s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 ss w )
	(setvar "cecolor" "3")
	(setq 	no (strcat "gp" (rtos nd))
		d1 (findp no 1)
		 h (findp no 2)
		 r (findp no 3)
		 w (findp no 4)
		 p (findp no 5)
		p1 (list (+ (car pt) (/ d1 2)) (cadr pt))
		p2 (list (- (car pt) (/ d1 2)) (- (cadr pt) h))
		p3 (list (+ (car pt) (/ d 2)) (cadr p2))
		p4 (list (- (car pt) (/ d 2)) (- (cadr pt) (- l (+ (* 2 p) (/ w 2)))))
		p5 (list (car p4) (- (cadr p4) w))
		p6 (list (car p3) (- (cadr p5) p))
		p7 (list (car p6) (- (cadr p6) w))
		p8 (list (car p7) (- (cadr pt) l))
		p9 (list (car p5) (cadr p8))
	     	p10 (list (car p5) (cadr p7))
		pt1 (list (- (car p2) 0.5) (cadr pt))   
		pt2 (list (+ (car p1) 0.5) (cadr p3)) )
        (rectang pt1 pt2)
	(setq ss (entlast))
	(rectang p1 p2)
	(setq s1 (entlast))
	(rectang p3 p4)
	(setq s2 (entlast))
	(rectang p5 p6)
	(setq s3 (entlast))
	(command "pline" p7 p8 p9 p10 "")
	(setq s4 (entlast))
	(command "fillet" "r" r "fillet" "p" s4)
	(setq s5 (entlast))
	(command "line" p7 p10 "")
	(setq s6 (entlast))
	(command "arc" p4 "e" p5 "a" "-180")
	(setq s7 (entlast))
	(command "arc" p6 "e" p7 "a" "180")
	(setq s8 (entlast))
	(command "mirror" s7 "" pt (list (car pt) 1000) "")
	(setq s9 (entlast))
	(command "mirror" s8 "" pt (list (car pt) 1000) "")
	(setq s10 (entlast))
	(if (= x "1") (command "rotate" ss s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 "" pt "180"))
  )
;;;;;;;;;;;;;;;;;;;;
;;;;;;中托钉
 (defun gbn (/ d1 h no p pt1 pt2 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 r 
              s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 ss w)
	(setvar "cecolor" "3")
	(setq 	no (strcat "gp" (rtos nd))
		d1 (findp no 1)
		 h (findp no 2)
		 r (findp no 3)
		 w (findp no 4)
		 p (findp no 5)
		p1 (list (+ (car pt) (/ d1 2)) (cadr pt))
		p2 (list (- (car pt) (/ d1 2)) (- (cadr pt) h))
		p3 (list (+ (car pt) (/ d 2)) (cadr p2))
		p4 (list (- (car pt) (/ d 2)) (- (cadr pt) (- l (+ (* 2 p) (/ w 2)))))
		p5 (list (car p4) (- (cadr p4) w))
		p6 (list (car p3) (- (cadr p5) p))
		p7 (list (car p6) (- (cadr p6) w))
		p8 (list (car p7) (- (cadr pt) l))
		p9 (list (car p5) (cadr p8))
	     	p10 (list (car p5) (cadr p7))
		p11 (list (car p9) (- (cadr p9) 5))
		p12 (list (car pt) (- (cadr p11) (* d 0.3)))
		p13 (list (car p8) (cadr p11))
		pt1 (list (- (car p2) 0.5) (cadr pt))
		pt2 (list (+ (car p1) 0.5) (cadr p3)))
	(rectang pt1 pt2)
	(setq ss (entlast))
	(rectang p1 p2)
	(setq s1 (entlast))
	(rectang p3 p4)
	(setq s2 (entlast))
	(rectang p5 p6)
	(setq s3 (entlast))
	(command "pline" p7 p8 p9 p10 "")
	(setq s4 (entlast))
	(command "fillet" "r" r "fillet" "p" s4)
	(setq s5 (entlast))
	(command "line" p7 p10 "")
	(setq s6 (entlast))
	(command "arc" p4 "e" p5 "a" "-180")
	(setq s7 (entlast))
	(command "arc" p6 "e" p7 "a" "180")
	(setq s8 (entlast))
	(command "mirror" s7 "" pt (list (car pt) 0) "")
	(setq s9 (entlast))
	(command "mirror" s8 "" pt (list (car pt) 0) "")
	(setq s10 (entlast))
	(command "pline" p3 p13 p12 p11 p4 p11 p13 "")
	(setq s11 (entlast))
	(if (= x "1") (command "rotate" ss s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 s11 "" pt "180"))
  )

;;;;;;;;;;;;
;;;;绘托司子程序.
(defun gp (/ d1 d2 h no p1 p2 p3 p4 p5 p6 pt1 pp ss s0 s1 s2 s3 s4)
	(setvar "cecolor" "141")
	(setq no (strcat "gb" (rtos nd)) 
		d1 (findp no 1)
		d2 (findp no 2)
		 h (findp no 3)
		p1 (list (- (car pt) (/ d 2)) (cadr pt))
	 	p2 (list (- (car pt) (/ d2 2)) (cadr pt))
		p3 (list (car p2) (- (cadr pt) h))
		p4 (list (- (car pt) (/ d1 2)) (cadr p3))
		p5 (list (car p4) (- (cadr pt) l))
		p6 (list (car p1) (cadr p5))
		pt1 (list (- (car p3) 0.5) (cadr p3))
		pp (list (car pt) 1000))
	(command "pline" p1 p2 p3 p4 p5 p6 "c")
	(setq s1 (entlast))
	(command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
	(setq s2 (entlast))
	(command "mirror" s1 "" pt pp "")
	(setq s3 (entlast))
        (command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
	(setq s4 (entlast))
	(rectang p2 pt1)
	(setq ss (entlast))
	(command "mirror" ss "" pt pp "")
	(setq s0 (entlast))
	(if (= x "1") (command "rotate" ss s0 s1 s2 s3 s4 "" pt "180"))
  )
;;;;;;;;;;;

;;;;绘有介子头水口边子程序.
(defun sp (/ d1 d2 d3 d4 h h1 h2 l1 l2 no ol p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13
             p14 p15 p16 p17 p18 p19 p20 p21 p22 p pt1 pt2 r s ss s1 s2 s3 s4 w)
	(setvar "cecolor" "6")
	(setq no (strcat "sp" (rtos nd))
		d1 (findp no 1)
		d2 (findp no 4)
		d3 (findp no 6)
		d4 (findp no 7)
		h1 (findp no 2)
		h2 (findp no 3)
		l1 (findp no 5)
		l2 d2
		r (findp no 8)
		w (findp no 9)
		p (findp no 10)
		p1 (list (- (car pt) (/ d1 2)) (cadr pt))
		p2 (list (+ (car pt) (/ d1 2)) (- (cadr pt) h1))
		p3 (list (- (car pt) (/ d 2)) (cadr p2))
		p4 (list (+ (car pt) (/ d 2)) (- (cadr pt) (- l (+ (* 3 p) (/ w 2)))))
		p5 (list (car p4) (- (cadr p4) w))
		p6 (list (car p3) (- (cadr p4) p))
		p7 (list (car p6) (- (cadr p6) w))
		p8 (list (car p5) (- (cadr p6) p))
		p9 (list (car p8) (- (cadr p8) w))
		p10 (list (car p9) (- (cadr pt) l))
		p11 (list (car p7) (cadr p10))
		p12 (list (car p7) (cadr p9))
		p13 (list (car p1) (cadr p11))
		p14 (list (car p2) (- (cadr p10) h2))
	 	p15 (list (- (car pt) (/ d3 2)) (cadr p14))
		p16 (list (+ (car pt) (/ d3 2)) (- (cadr p15) l2))
		p17 (list (+ (car pt) (/ d4 2)) (cadr p14))
		p18 (list (- (car pt) (/ d4 2)) (+ (cadr p15) l1))
		p19 (list (+ (car pt) (/ d2 2)) (cadr p14))
		p20 (list (- (car pt) (/ d2 2)) (- (cadr p18) (/ (- d2 d4) 2)))
		p21 (list (car p17) (cadr p18))
		p22 (list (car pt) (+ (cadr p18) (* d4 0.3)))
		pt1 (list (- (car p1) 0.5) (cadr p1))
		pt2 (list (+ (car p2) 0.5) (cadr p2)))
	(rectang pt1 pt2)
	(rectang p1 p2)
	(rectang p3 p4)
	(rectang p5 p6)
	(rectang p7 p8)
	(rectang p13 p14)
	(rectang p15 p16)
  	(setq s (entlast))
	(command "hatch" "ANSI37,N" (/ d3 10) "" s "" "pline" p9 p10 p11 p12 "")
	(setq ss (entlast))
	(command "fillet" "r" r "fillet" "p" ss "line" p9 p12 "")
	(command "arc" p4 "e" p5 "a" "180")
	(setq s1 (entlast))
	(command "arc" p7 "e" p6 "a" "180")
	(setq s2 (entlast))
	(command "arc" p8 "e" p9 "a" "180" )
	(setq s3 (entlast))
	(setq ol (getvar "celtype"))
	(setvar "celtype" "hidden")
	(rectang p17 p18)
	(rectang p19 p20)
	(command "line" p18 p22 p21 "" "line" p18 p20 "")
	(setq s4 (entlast))
        (setvar "celtype" ol)
	(command "mirror" s1 s2 s3 s4 "" pt (list (car pt) 1000) "")
  )
;;;;;;;;;;
;;;;;;;绘无介子头水口边子程序.
(defun spn (/ d1 d2 d3 d4 h h1 h2 l1 l2 no ol p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 
              p pt1 pt2 r s ss s1 s2 s3 s4 w)
	(setvar "cecolor" "6")
	(setq no (strcat "sp" (rtos nd))
		d1 (findp no 1)
		d2 (findp no 4)
		d3 (findp no 6)
		d4 (findp no 7)
		h1 (findp no 2)
		h2 (findp no 3)
		l1 (findp no 5)
		l2 d2
		r (findp no 8)
		w (findp no 9)
		p (findp no 10)
		p1 (list (- (car pt) (/ d1 2)) (cadr pt))
		p2 (list (+ (car pt) (/ d1 2)) (- (cadr pt) h1))
		p3 (list (- (car pt) (/ d 2)) (cadr p2))
		p4 (list (+ (car pt) (/ d 2)) (- (cadr pt) (- l (+ (* 3 p) (/ w 2)))))
		p5 (list (car p4) (- (cadr p4) w))
		p6 (list (car p3) (- (cadr p4) p))
		p7 (list (car p6) (- (cadr p6) w))
		p8 (list (car p5) (- (cadr p6) p))
		p9 (list (car p8) (- (cadr p8) w))
		p10 (list (car p9) (- (cadr pt) l))
		p11 (list (car p7) (cadr p10))
		p12 (list (car p7) (cadr p9))
		pt1 (list (- (car p1) 0.5) (cadr p1))
		pt2 (list (+ (car p2) 0.5) (cadr p2)))
	(rectang pt1 pt2)
	(rectang p1 p2)
	(rectang p3 p4)
	(rectang p5 p6)
	(rectang p7 p8)
	(command "pline" p9 p10 p11 p12 "")
	(setq ss (entlast))
	(command "fillet" "r" r "fillet" "p" ss "line" p9 p12 "")
	(command "arc" p4 "e" p5 "a" "180")
	(setq s1 (entlast))
	(command "arc" p7 "e" p6 "a" "180")
	(setq s2 (entlast))
	(command "arc" p8 "e" p9 "a" "180" )
	(setq s3 (entlast))
	(command "mirror" s1 s2 s3 "" pt (list (car pt) 1000) "")
  )
;;;;;;;;;;;;;
;;;;;;绘直司子程序.
 (defun sgp (/ d1 p1 p2 s1 s2)
	(setvar "cecolor" "4")
	(setq d1 (findp (strcat "gb" (rtos nd)) 1)
              p1 (list (- (car pt) (/ d1 2)) (cadr pt))
              p2 (list (- (car pt) (/ d 2)) (+ (cadr pt) l)))
	(rectang p1 p2)
	(setq s1 (entlast))
	(command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
	(command "mirror" s1 "" pt (list (car pt) 1000) "")
	(command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
  )
;;;;;;;;;;;;
;;;;;;;回针子程序.
(defun rp (/ d1 p1 p2 p3 p4 pt1 pt2)
  (setvar "cecolor" "21")
  (if (= d (fix d))
    (progn
    (setq d1 (+ d 5)
          p1 (list (- (car pt) (/ d1 2)) (cadr pt)) )
    (if (<= d 20)
      (setq p2 (list (+ (car pt) (/ d1 2)) (+ (cadr pt) 4)))
      (setq p2 (list (+ (car pt) (/ d1 2)) (+ (cadr pt) 8)))  )
    (setq p3 (list (- (car pt) (/ d 2)) (cadr p2))
          p4 (list (+ (car pt) (/ d 2)) (+ (cadr pt) l))
          pt1 (list (- (car p1) 0.5) (cadr p1))
          pt2 (list (+ (car p2) 0.5) (cadr p2))  )
  ) )
  (if (/= d (fix d))
    (setq d1 (+ d 6.35)
          p1 (list (- (car pt) (/ d1 2)) (cadr pt))
          p2 (list (+ (car pt) (/ d1 2)) (+ (cadr pt) 6.35))
          p3 (list (- (car pt) (/ d 2)) (cadr p2))
          p4 (list (+ (car pt) (/ d 2)) (+ (cadr pt) l))
          pt1 (list (- (car p1) 0.5) (cadr p1))
          pt2 (list (+ (car p2) 0.5) (cadr p2))  )
  ) 
	(rectang pt1 pt2)
	(rectang p1 p2)
	(rectang p3 p4)
)
;;;;;;;
;;;;;;中托司子程序.
(defun egb (/ d1 d2 l1 l2 h no ss s1 s2 p1 p2 p3 p4 p5 p6 p7 p8 pt1)
  (setvar "cecolor" "31")
  (setq no (strcat "egb" (rtos nd))
	d1 (findp no 1) 
	d2 (findp no 2)
	h (findp no 3) )
  (if (= egp_drct "in_ejp")
    (setq p1 (list (- (car pt) (/ d 2)) (+ (cadr pt) ejrp_h))
          p2 (list (- (car pt) (/ d1 2)) (cadr p1))
	  p3 (list (car p2) (cadr pt))
	  p4 (list (- (car pt) (/ d2 2)) (cadr p3))
	  p5 (list (car p4) (- (cadr pt) h))
	  p6 (list (car p3) (cadr p5))
	  p7 (list (car p6) (- (cadr pt) ejp_h))
	  p8 (list (car p1) (cadr p7))
	  pt1 (list (- (car p5) 0.5) (cadr p5)) )
  )
  (if (= egp_drct "in_ejrp")
    (setq p1 (list (- (car pt) (/ d 2)) (+ (cadr pt) (- ejrp_h h)))
          p2 (list (- (car pt) (/ d1 2)) (cadr p1))
	  p3 (list (car p2) (cadr pt))
	  p4 (list (- (car pt) (/ d2 2)) (cadr p3))
	  p5 (list (car p4) (- (cadr pt) h))
	  p6 (list (car p3) (cadr p5))
	  p7 (list (car p6) (- (cadr p6) ejp_h))
	  p8 (list (car p1) (cadr p7))
	  pt1 (list (- (car p5) 0.5) (cadr p5)) )
  )
	(command "pline" p1 p2 p3 p4 p5 p6 p7 p8 "c")
	(setq s1 (entlast))
	(command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
	(command "mirror" s1 "" pt (list (car pt) 0) "")
	(command "hatch" "ANSI31,N" (/ d 25) "" "l" "")
	(rectang p4 pt1)
	(setq ss (entlast))
	(command "mirror" ss "" pt (list (car pt) 0) "")
  )
;;;;;;;;;;;;;;;;;
;;;;;;;杯头螺丝.
 (defun cs (/ d1 d2 h no p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 pt1 pt2 ss
                 s1 s2 s3 s4 s5 s6 s7 s8 s9)
	(setvar "cecolor" "1")
  	(setq no (strcat "cs" (rtos nd))
	      d1 (findp no 1)
	      d2 (findp no 2)
	       h d
	      p1 (list (+ (car pt) (/ d1 2)) (cadr pt))
	      p2 (list (- (car pt) (/ d1 2)) (- (cadr pt) h))
	      p3 (list (- (car pt) (/ d 2)) (cadr p2))
	      p4 (list (+ (car pt) (/ d 2)) (- (cadr p3) (- l (/ (- d d2) 2))))
	      p5 (list (car p4) (- (cadr p3) (/ l 2)))
	      p6 (list (car p3) (cadr p5))
	      p7 (list (- (car pt) (/ d2 2)) (cadr p6))
	      p8 (list (+ (car pt) (/ d2 2)) (- (cadr p3) l))
	      p9 (list (car p4) (- (cadr p8) 5))
	     p10 (list (car p8) (cadr p9))
	     p11 (list (car p7) (cadr p9))
	     p12 (list (car pt) (- (cadr p9) (* d2 0.3)))
	     pt1 (list (- (car p1) 0.5) (cadr p1))
	     pt2 (list (+ (car p2) 0.5) (cadr p2)))
	(rectang pt1 pt2)
	(setq ss (entlast))
        (rectang p1 p2)
	(setq s1 (entlast))
	(rectang p3 p4)
	(setq s2 (entlast))
	(command "line" p5 p6 "")
	(setq s3 (entlast))
	(rectang p7 p8)
	(setq s4 (entlast))
	(command "line" p4 p8 "")
	(setq s5 (entlast))
	(command "mirror" s5 "" pt (list (car pt) 1000) "")
	(setq s6 (entlast))
	(rectang p6 p9)
	(setq s7 (entlast))
	(rectang p7 p10)
	(setq s8 (entlast))
	(command "pline" p10 p11 p12 "c")
	(setq s9 (entlast))
	(if (= x "1") (command "rotate" ss s1 s2 s3 s4 s5 s6 s7 s8 s9 "" pt "180"))
  )
;;;;;;;;;;;;;;;;;;;;
;;;;加标题.
(defun a0 (/ col otxt
         ang1 ang2 th1 th2 aa bb ang3 ll1 lw1 lw2 lpo1 lpo2 lp3 lp4 lp5 lp6 lp7 lp8 lp9
         po1 po2 po3 po03 po4 po04 po5 po6 po7 po8 po9 po10 po11 po12 po13 po14 po15 po16 po17 
         po18 po19 po20 po21 po22 po23 po24 po25 po26 po27 po28 po29 po30 po31 po32 po33 po34 
         po35 po36 po37 po38 po39 po40 po41 po42 po43 po44 po45 po46 po47 po48 po49 po50 po51
         po52 po53 po54 po55 po56 po57 po58 po59 po60 po61 po62 po63 po64 po65 po66 p013 p022 
         p032 Po68 po69 po70 po71 po72 po73 po74 po75 po76)

  (setq otxt (getvar "textstyle")  col (getvar "cecolor") olt (getvar "celtype") )
  (setvar "celtype" "continuous")  (command "color" 131)
  (setq lpo1 (list (- (car (getvar "extmin")) 10) (+ (cadr (getvar "extmax")) 5))
	lpo2 (list (car (getvar "extmax")) (- (cadr (getvar "extmin")) 5)))
  (setq lw1 (+ (abs (cadr lpo1)) (abs (cadr lpo2)))
	ll1 (/ (* 317 lw1) 210) lw2 (/ (* 25 ll1) 317)
	 aa (/ lw2 25)          bb (/ ll1 317)
	th1 (/ (* 2.4 ll1) 317)	th2 (/ (* 3.2 ll1) 317)
	lw3 (/ lw2 3)		pw1 (* (/ 0.5 317) 0.6 ll1)
	lp1 (list (- (car lpo1) (* 1.5 lw2)) (cadr lpo1))
	lp3 (list (+ (car lp1) lw2) (cadr lpo2))
	lp4 (list (+ (car lp1) ll1) (cadr lpo2))
	lx1 (car lp3)		ly1 (cadr lp3)
	lp5 (list (+ lx1 (* aa 8)) (+ ly1 (* bb 171)))
	lp6 (list (car lp1) (cadr lp4))
	lp7 (list (car lp4) (cadr lp1))
	lp8 (list (car lp1) (cadr lp5))
	lp9 (list (car lp5) (cadr lp1))
	po1  (list (- lx1 (* aa 17)) (+ ly1 (* bb 45)))
	po2  (list (- lx1 (* aa 5)) (+ ly1 (* bb 38)))
	po3  (list (- lx1 (* aa 19.5)) (+ ly1 (* bb 57.5)))
	po03 (list (- lx1 (* aa 14)) (+ ly1 (* bb 57.5)))
	po4  (list (- lx1 (* aa 7)) (+ ly1 (* bb 57.5)))
	po04 (list (- lx1 (* aa 1.5)) (+ ly1 (* bb 57.5)))
	po5  (list (- lx1 (* aa 19.5)) (+ ly1 (* bb 71)))
	po6  (list (- lx1 (* aa 14)) (+ ly1 (* bb 71)))
	po7  (list (- lx1 (* aa 7)) (+ ly1 (* bb 71)))
	po8  (list (- lx1 (* aa 1.5)) (+ ly1 (* bb 71)))
	po9  (list (- lx1 (* aa 17)) (+ ly1 (* bb 82.5)))
	po10 (list (- lx1 (* aa 5)) (+ ly1 (* bb 82.5)))
	po11 (list (- lx1 (* aa 17)) (+ ly1 (* bb 97.5)))
	po12 (list (- lx1 (* aa 5)) (+ ly1 (* bb 97.5)))
	po13 (list (- lx1 (* aa 17)) (+ ly1 (* bb 119)))
        p013 (list (- lx1 (* aa 11)) (+ ly1 (* bb 119)))
	po14 (list (- lx1 (* aa 5)) (+ ly1 (* bb 119)))
	p015 (list (- lx1 (* aa 20)) (+ ly1 (* bb 178)))
	po16 (list (+ lx1 (* aa 6)) (+ ly1 (* bb 178)))
	p016 (list (+ lx1 (* aa 6)) (+ ly1 (* bb 204)))
	po15 (list (- lx1 (* aa 20)) (+ ly1 (* bb 204)))
	po20 (list lx1 (+ ly1 (* bb 78)))
	po21 (list (- (car po20) lw2) (cadr po20))
	po22 (list (- lx1 (/ lw2 2) ) (+ ly1 (* bb 25)))
        p022 (list (car po22) ly1)
	po23 (list (car po22) (+ ly1 (* bb 171)))
        p023 (list (car po22) (+ ly1 (* bb 107)))
	po24 (list (- lx1 (/ (* 2 lw2) 3)) ly1)
	po25 (list (car po24) (+ ly1 (* bb 25)))
	po26 (list lx1 (+ ly1 (* bb 64)))
	po27 (list lx1 (+ ly1 (* bb 78)))
	po28 (list lx1 (+ ly1 (* bb 87)))
	po29 (list lx1 (+ ly1 (* bb 107)))
	po30 (list lx1 (+ ly1 (* bb 25)))
	po31 (list lx1 (+ ly1 (* bb 9)))
	po32 (list (- lx1 (* aa 21)) (+ ly1 (* bb 195)))
        p032 (list (+ lx1 (* aa 7))(+ ly1 (* bb 195)))
	po33 (list (- lx1 (/ lw2 3)) (cadr po24))
	po34 (list (car po33) (cadr po25))
        po35 (list (+ lx1 (* aa 7)) (+ ly1 (* bb 191)))
	po36 (list (- lx1 (* aa 7)) (+ ly1 (* bb 205)))
        po37 (list (- lx1 (* aa 7)) (+ ly1 (* bb 177)))
	po38 (list (- lx1 (* aa 21)) (+ ly1 (* bb 191)))
	po39 (list lx1 (cadr lp5))
	po40 (list (+ lx1 (* aa 281)) (+ ly1 (* bb 210)))
	po41 (list (+ lx1 (* aa 281)) (+ ly1 (* bb 194)))
	po42 (list (+ lx1 (* aa 281)) (+ ly1 (* bb 202)))
	po43 (list (+ lx1 (* aa 292)) (+ ly1 (* bb 202)))
	po44 (list (+ lx1 (* aa 287)) (+ ly1 (* bb 206)))
	po45 (list (+ lx1 (* aa 287)) (+ ly1 (* bb 202.5)))
	po46 (list (+ lx1 (* aa 292)) (+ ly1 (* bb 194)))
        po52 (list (+ lx1 (* aa 237)) (+ ly1 (* bb 210)))
        po53 (list (+ lx1 (* aa 237)) (+ ly1 (* bb 194)))
        po54 (list (+ lx1 (* aa 237)) (+ ly1 (* bb 202)))
        po55 (list (+ lx1 (* aa 238)) (+ ly1 (* bb 203.8)))
        po56 (list (+ lx1 (* aa 243)) (+ ly1 (* bb 206)))
        po57 (list (+ lx1 (* aa 246)) (+ ly1 (* bb 203.8)))
        po58 (list (- lx1 (* aa 5)) (+ ly1 (* bb 12)))
        po60 (list (+ lx1 (* aa 8)) ly1)
        po61 (list (car po60) (+ ly1 (* bb 87)))
        po62 (list (car po60) (+ ly1 (* bb 25)))
        po63 (list (car po60) (+ ly1 (* bb 56)))
        po64 (list (car po60) (+ ly1 (* bb 112)))
        po65 (list (car po60) (+ ly1 (* bb 141.5)))
        po66 (list (+ lx1 (* aa 5.6)) (+ ly1 (* bb 85)))
        po67 (list (+ lx1 (* aa 5.6)) (+ ly1 (* bb 169)))
	po17 (list (+ lx1 (* aa 5.6)) (+ ly1 (* bb 12)))
	po18 (list (+ lx1 (* aa 5.6)) (+ ly1 (* bb 99)))
	po19 (list (- lx1 (* aa 17)) (+ ly1 (* bb 12)))
        po68 (list (+ lx1 (* aa 150)) (+ ly1 (* bb 202)))     ;修改于13/02/2003 李平
        po69 (list (+ lx1 (* aa 150)) (+ ly1 (* bb 210)))
        po70 (list (+ lx1 (* aa 193.5)) (+ ly1 (* bb 204.5)))  
        po71 (list (+ lx1 (* aa 150)) (+ ly1 (* bb 194)))
        po72 (list (+ lx1 (* aa 180)) (+ ly1 (* bb 196.5)))
        po73 (list (+ lx1 (* aa 185)) (+ ly1 (* bb 200)))
        po74 (list (+ lx1 (* aa 189)) (+ ly1 (* bb 196)))
        po75 (list (+ lx1 (* aa 198.5)) (+ ly1 (* bb 200)))
        po76 (list (+ lx1 (* aa 202.5)) (+ ly1 (* bb 196)))
	ang1 90
	ang2 90
	ang3 0  )
  (command "text" "j" "c" po1 th2 ang1 order
           "text" "j" "c" po58 th2 "" "0")
  (command "text" "j" "c" po9 th2 ang1 "" 
	"text" "j" "c" po10 "" "" "板厚"
	"text" "j" "c" po17 "" "" "绘 图"
	"text" "j" "c" po18 "" "" "审 图"
	"text" "j" "c" po19 "" "" "图 号"
	"text" "j" "r" po66 "" "" "  年 月 日"
	"text" "j" "r" po67 "" "" "  年 月 日"
        "text" "j" "c" po70 th1 ang3 "备注: 1.调度用,可加注文字不可改尺寸 2.品检用，可计数"
        "text" "j" "c" po72 th2 "" "3.流程: 有  无"                     ;修改于13/02/2003 李平
        "line" po20 po21 "" 
        "copy" (entlast) "" "m" po20  po28 po29 po30  ""
        "line" po22 po23 ""
        "line" po22 p022 ""  "line" po61 (polar po61 pi (* aa 8)) ""
        "copy" (entlast) "" "m" po61 po62 po63 po64 po65 "" 
	"line" lp3 po39 ""  "pline" lp1 "w" pw1 "" lp6 lp4 lp7 "c"
	"pline" lp8 lp5 lp9 ""   "pline" po60 "w" pw1 "" lp5 ""
                "pline" '(0 0)  "w" 0 0 ""
	"line" po42 po43 ""
        "line" po43 po54 "" "line" po46 po53 po52 ""
        "line" po46 po71 po69 ""                             ;修改于13/02/2003 李平
        (rectang po73 po74)  
        (rectang po75 po76)
        "line" po55 (polar po55 (/ pi 3) (* aa 5)) (polar po55 0 (* aa 5)) "c"
        "line" po56 (polar po56 0 (* aa 3)) ""
        "line" po57 (polar po57 (/ pi 3) (* aa 5)) (polar po57 0 (* aa 5)) "c"
        "line" (polar po55 (/ pi -2) (* aa 8)) (polar (polar po55 (/ pi 3) (* aa 5))(/ pi -2) (* aa 8))
               (polar (polar po55 0 (* aa 5)) (/ pi -2) (* aa 8)) "c"
        "line" (polar po56 (/ pi -2) (* aa 8)) (polar (polar po56 (/ pi -2) (* aa 8)) 0 (* aa 3)) ""
        "line" (polar po57 (/ pi -2) (* aa 8)) (polar (polar po57 (/ pi 3) (* aa 5))(/ pi -2) (* aa 8))
               (polar (polar po57 0 (* aa 5)) (/ pi -2) (* aa 8)) "c"
        "mirror" po71 po53 "si" po43 po54 "y"                                         ;12/12/2001 zy
        "move" "w" (polar po69 (/ pi 2) 1) (polar po46 (/ pi -2) 1) "si" po46 lp4                   
        "celtype" "continuous"
	"zoom" "e" "redraw" )
  (setvar "cecolor" col) (setvar "textstyle" otxt) (setvar "celtype" olt)
  (princ)
)
;;;;;;;;;;;