;;;1998.08.26
(defun park (/	       what1	 dcl_id	   tile_v    #park1
	     aa	       bb1	 bb2	   bb3	     bb4
	     #chk      #v_search subdlg1   draw	     draw_1
	     #drawpark #park2	 #chk1	   #jsmany   jsmany
	     #drawpark2		 #park3	   #chk2     jsarea
	     #drawpark3		 draw_2	   #js	     #bb1
	     #bb2      #readv
	    )

  (defun #park1	(/ what	A B C D	E Wv lp	Wu Wt Au img size pxsize czsize
		 tdsize)
    (setq what 10)
    (while (> what 0)
      (if (not (new_dialog "park1" dcl_id))
	(exit)
      )
      (if (= what 10)
	(progn
	  (mode_tile "C2" 1)
	  (mode_tile "D" 1)
	  (setq what 9)
	  (set_tile "size" " 3.2x1.6")
	  (set_tile "pxsize" "5.2")
	  (set_tile "czsize" "2.6")
	  (set_tile "tdsize" "3.0")

	)
      )
      (if E
	(set_tile "E" (itoa E))
      )

      (action_tile "B1" "(errnil)(bb4)(#bb1)")
      (action_tile "B2" "(errnil)(bb2)(#bb2)")
      (action_tile "B3" "(errnil)(bb3)(#bb1)")

      (action_tile
	"D1"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(#bb1)"
      )
      (action_tile
	"D2"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(subdlg1)(#bb1)"
      )
      (action_tile "D3" "(errnil)(#bb1)(bb1)")
      (foreach tile '("C1" "C2")
	(action_tile tile "(errnil)(#bb1)")
      )
      (foreach tile '("A1" "A2" "A3" "A4" "A5")
	(action_tile tile "(errnil)(#bb1)")
      )

      (action_tile
	"accept"
	"(if (#chk) (progn (aa) (done_dialog 1)))"
      )
      (setq what (start_dialog))
      (cond
	((= what 1)
	 (#v_search)
	 (#readv)
	 (HY_SV)
	 (#drawpark)
	 (HY_RV)
	)
      )
    )
    (princ)
  )

  (defun aa ()
    (setq A (get_tile "A"))
    (setq C (get_tile "C"))
  )

  (defun #readv	()
    (setq lp (read pxsize)
	  Wv (read czsize)
	  Wt (read tdsize)
    )
  )

  (defun bb2 ()
    (mode_tile "D" 0)
    (mode_tile "C2" 1)
    (set_tile "C1" "1")
	(set_tile "D1" "1")
  )
  (defun #bb2 ()
    (set_tile "size" " ")
    (set_tile "pxsize" " ")
    (set_tile "czsize" " ")
    (set_tile "tdsize" " ")
	
	(setq D1 (get_tile "D1")
    )
    (if	(= D1 "1")
		(progn 
			(set_tile "size" " 3.2x1.6")
			(set_tile "pxsize" "5.2000")
			(set_tile "czsize" "4.1000")
			(set_tile "tdsize" "3.0000")
		)
	)
  )


  (defun bb3 ()
    (mode_tile "D" 1)
    (mode_tile "C2" 0)
    (set_tile "D1" "0")
    (set_tile "D2" "0")
    (set_tile "D3" "0")
  )

  (defun bb4 ()
    (mode_tile "D" 1)
    (mode_tile "C2" 1)
    (set_tile "C1" "1")
    (set_tile "D1" "0")
    (set_tile "D2" "0")
    (set_tile "D3" "0")
  )

  (defun bb1 ()
    (mode_tile "C2" 0)
  )
  (defun #bb1 ()
    (aa)
    (setq B (get_tile "B")
	  D (get_tile "D")
    )
    (if	(/= B "B2")
      (progn
	(#v_search)
	(if (= A 1)
	  (set_tile "size" " 3.2x1.6")
	)
	(if (= A 2)
	  (set_tile "size" " 5.0x1.8")
	)
	(if (= A 3)
	  (set_tile "size" " 8.7x2.5")
	)
	(if (= A 4)
	  (set_tile "size" " 12.0x2.5")
	)
	(if (= A 5)
	  (set_tile "size" " 18.0x2.5")
	)
	(set_tile "pxsize" (rtos lp))
	(set_tile "czsize" (rtos Wv))
	(set_tile "tdsize" (rtos Wt))
      )
    )
    (if	(and (= B "B2") D)
      (progn
	(#v_search)
	(if (= A 1)
	  (set_tile "size" " 3.2x1.6")
	)
	(if (= A 2)
	  (set_tile "size" " 5.0x1.8")
	)
	(if (= A 3)
	  (set_tile "size" " 8.7x2.5")
	)
	(if (= A 4)
	  (set_tile "size" " 12.0x2.5")
	)
	(if (= A 5)
	  (set_tile "size" " 18.0x2.5")
	)
	(set_tile "pxsize" (rtos lp))
	(set_tile "czsize" (rtos Wv))
	(set_tile "tdsize" (rtos Wt))
      )
    )

  )


  (defun #chk (/ ok)
    (setq ok t)
    (setq B	 (get_tile "B")
	  E	 (get_tile "E")
	  D	 (get_tile "D")
	  pxsize (get_tile "pxsize")
	  czsize (get_tile "czsize")
	  tdsize (get_tile "tdsize")
    )
    (cond
      ((and E (or (chknum 0 E) (/= (type (read E)) 'INT)))
       (beep)
       (set_tile "error" "车位数量参数无效!")
       (mode_tile "E" 2)
       (setq ok nil)
      )
      ((and (= B "B2") (null D))
       (beep)
       (set_tile "error" "斜列式倾斜角未选定!")
       (setq ok nil)
      )
      ((chknum 1.5 pxsize)
       (beep)
       (set_tile "error" "平行通道的车位尺寸无效!")
       (mode_tile "pxsize" 2)
       (setq ok nil)
      )
      ((chknum 1.5 czsize)
       (beep)
       (set_tile "error" "垂直通道的车位尺寸无效!")
       (mode_tile "czsize" 2)
       (setq ok nil)
      )
      ((chknum 2.9 tdsize)
       (beep)
       (set_tile "error" "通道宽度尺寸无效!")
       (mode_tile "tdsize" 2)
       (setq ok nil)
      )
    )
    ok
  )
  (defun #v_search (/ m n wid m_fn)
    (setq n 0
	  m 0
    )
;;;(if (and E (= 'STR (type E)) ) (setq E (read E)))
    (repeat 5
      (setq n (1+ n))
      (if (= A (strcat "A" (itoa n)))
	(setq A n)
      )
    )
    (repeat 3
      (setq m (1+ m))
      (if (= B (strcat "B" (itoa m)))
	(setq B m)
      )
    )
    (if	(= B 2)
      (progn
	(setq n 0)
	(repeat	3
	  (setq n (1+ n))
	  (if (= D (strcat "D" (itoa n)))
	    (setq D n)
	  )
	)
      )
      (setq D 0)
    )
    (if	(or (= D 3) (= B 3))
      (progn
	(setq m 0)
	(repeat	2
	  (setq m (1+ m))
	  (if (= C (strcat "C" (itoa m)))
	    (setq C m)
	  )
	)
      )
      (setq C 1)
    )
    (setq m_fn (strcat (HY_GetInstallDir) hyszdl_gv_commres_dir)
	  m_fn (strcat m_fn "\\" hyszdl_gv_dat_dir)
	  m_fn (strcat m_fn "\\park.dat")
    )
    (setq wid (getdat m_fn))
    (setq m (list (car (cadr wid)) (cadr (cadr wid)) (caddr wid)))
    (setq wid (list (car wid) m (cadddr wid)))
    (setq m (nth (1- B) wid))
    (if	(= B 2)
      (progn
	(setq m (nth (1- D) m))
	(if (= D 3)
	  (setq m (nth (1- C) m))
	)
      )
    )
    (if	(= B 3)
      (setq m (nth (1- C) m))
    )
    (setq Wv (nth (1- A) m)
	  lp (nth (+ (1- A) 5) m)
	  Wt (nth (+ (1- A) 10) m)
    )

    (if	(or (= B 1) (= B 3) (= D 1) (and (= D 2) (= img 3)) (= D 3))
      (setq Wu (+ Wt (* 2 Wv)))
      (setq Wu (+ (* (- Wv (* 0.25 lp)) 2) Wt))
    )
    (setq Au (* Wu (/ lp 2)))
  )

  (defun subdlg1 (/ what)
    (setq what 1
	  img 1
    )
    (while (> what 0)
      (if (not (new_dialog "subdlg1" dcl_id))
	(exit)
      )
      (playsld "park1" "img1")
      (playsld "park2" "img2")
      (playsld "park3" "img3")
      (mode_tile "img1" 2)
      (action_tile "img1" "(mode_tile \"img1\" 2)(setq img 1)")
      (action_tile "img2" "(mode_tile \"img2\" 2)(setq img 2)")
      (action_tile "img3" "(mode_tile \"img3\" 2)(setq img 3)")
      (action_tile "accept" "(done_dialog 1)")
      (setq what (start_dialog))
      (cond
	((= what 1) (setq what 0))
      )
    )
  )


  (defun draw (ptt / pt p1 p2 p3 pt1 pt2 ent1 entlst entlst1 w l w1 w2)
    ;;平行 垂直---------

    (DL_MakeLayer "pp-dl-tcc")
    (if	(or (= B 3) (= B 1))
      (progn
	(if (= B 3)
	  (setq p1 (polar ptt ang lp))
	)
	(if (= B 1)
	  (progn
	    (if	(= A 1)
	      (setq p1 (polar ptt ang 3.2))
	    )
	    (if	(= A 2)
	      (setq p1 (polar ptt ang 5.0))
	    )
	    (if	(= A 3)
	      (setq p1 (polar ptt ang 8.7))
	    )
	    (if	(= A 4)
	      (setq p1 (polar ptt ang 12.0))
	    )
	    (if	(= A 5)
	      (setq p1 (polar ptt ang 18.0))
	    )
	  )
	)
	(setq p2 (polar p1 (+ ang (dtor 90)) Wv)
	      p3 (polar ptt (+ ang (dtor 90)) Wv)
	)
	(setq ent1 (ent_last))
	(command ".pline" ptt p1 p2 p3 "c")
	(setq entlst (entlast))
	(if (>= E 4)
	  (if (= 0 (rem E 2))
	    (progn
	      (command ".array" entlst "" "r" 1 (/ E 2) lp)
	      (command ".line" ptt (polar ptt ang (* lp (/ E 2))) "")
	      (command ".line"
		       ptt
		       (polar ptt (+ ang (dtor 90)) (+ Wv (/ Wt 2)))
		       ""
	      )
	      (command ".copy"
		       (entlast)
		       ""
		       ptt
		       (polar ptt ang (* lp (/ E 2)))
	      )
	    )
	    (progn (command ".array" entlst "" "r" 1 (/ (- E 1) 2) lp)
		   (command ".line"
			    ptt
			    (polar ptt ang (* lp (/ (+ E 1) 2)))
			    ""
		   )
		   (command ".line"
			    ptt
			    (polar ptt (+ ang (dtor 90)) (+ Wv (/ Wt 2)))
			    ""
		   )
		   (command ".copy"
			    (entlast)
			    ""
			    ptt
			    (polar ptt ang (* lp (/ (+ E 1) 2)))
		   )

	    )
	  )
	)
	(if (= E 2)
	  (progn
	    (command ".line" ptt (polar ptt ang lp) "")
	    (command ".line"
		     ptt
		     (polar ptt (+ ang (dtor 90)) (+ Wv (/ Wt 2)))
		     ""
	    )
	    (command ".copy" (entlast) "" ptt (polar ptt ang lp))
	  )
	)

	(if (= E 3)
	  (progn
	    (command ".line" ptt (polar ptt ang (* lp 2)) "")
	    (command ".line"
		     ptt
		     (polar ptt (+ ang (dtor 90)) (+ Wv (/ Wt 2)))
		     ""
	    )
	    (command ".copy" (entlast) "" ptt (polar ptt ang (* lp 2)))
	  )
	)

	(setq ent1 (get_last ent1))
	(setq pt1 (polar ptt (+ ang (dtor 90)) (+ Wv (/ Wt 2)))
	      pt2 (polar pt1 ang 5)
	)
	(if (/= E 1)
	  (progn
	    (command ".mirror" ent1 "" pt1 pt2 "n")
	    (if	(/= 0 (rem E 2))
	      (command ".copy"
		       entlst
		       ""
		       ptt
		       (polar ptt ang (* lp (/ (- E 1) 2)))
	      )
	    )
	  )
	)

      )
    )
    ;;斜列--------------    
    (if	(= B 2)
      (progn
	(if (= D 1)
	  (setq D 30)
	)
	(if (= D 2)
	  (setq D 45)
	)
	(if (= D 3)
	  (setq D 60)
	)
	(setq w (* (sin (dtor D)) lp))
	(setq l (- (/ Wv (sin (dtor D))) (* lp (cos (dtor D)))))

	(if (and (= D 45) (/= img 3))
	  (progn
	    (if	(= img 1)
	      (progn
		(setq pt (polar ptt ang (* (+ l w) (sin (dtor D))))
		      p1 (polar pt (+ (dtor D) ang) w)
		      p2 (polar p1 (+ ang (dtor (+ 90 D))) l)
		      p3 (polar pt (+ ang (dtor (+ 90 D))) l)
		)
		(setq ent1 (ent_last))
		(command ".pline" pt p1 p2 p3 "c")
		(setq entlst (entlast))

		(if (>= E 8)
		  (progn
		    (command ".copy" entlst "" p2 p2)
		    (setq entlst1 (entlast))
		    (command ".rotate" entlst "" p3 90)
		    (if	(= 0 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ E 4)
			       lp
		      )
		    )
		    (if	(= 1 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 1) 4)
			       lp
		      )
		    )
		    (if	(= 2 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 2) 4)
			       lp
		      )
		    )
		    (if	(= 3 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 3) 4)
			       lp
		      )
		    )
		  )
		  (if (>= E 4)
		    (progn
		      (command ".copy" entlst "" p2 p2)
		      (setq entlst1 (entlast))
		      (command ".rotate" entlst "" p3 90)
		    )
		  )
		)
	      )
	    )
	    (if	(= img 2)
	      (progn
		(setq pt (polar ptt ang (* (+ l l) (sin (dtor D))))
		      p1 (polar pt (+ (dtor D) ang) w)
		      p2 (polar p1 (+ ang (dtor (+ 90 D))) l)
		      p3 (polar pt (+ ang (dtor (+ 90 D))) l)
		)
		(setq ent1 (ent_last))
		(command ".pline" pt p1 p2 p3 "c")
		(setq entlst (entlast))

		(if (>= E 8)
		  (progn
		    (command ".copy" entlst "" p2 p2)
		    (setq entlst1 (entlast))
		    (command ".rotate" entlst "" (midpt p2 p3) 180)
		    (if	(= 0 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ E 4)
			       lp
		      )
		    )
		    (if	(= 1 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 1) 4)
			       lp
		      )
		    )
		    (if	(= 2 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 2) 4)
			       lp
		      )
		    )
		    (if	(= 3 (rem E 4))
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 3) 4)
			       lp
		      )
		    )
		  )
		  (if (>= E 4)
		    (progn
		      (command ".copy" entlst "" p2 p2)
		      (setq entlst1 (entlast))
		      (command ".rotate" entlst "" (midpt p2 p3) 180)
		    )
		  )
		)
	      )
	    )
	  )

	  (progn
	    (setq pt (polar ptt ang (* w (sin (dtor D))))
		  p1 (polar pt (+ (dtor D) ang) l)
		  p2 (polar p1 (+ ang (dtor (+ 90 D))) w)
		  p3 (polar pt (+ ang (dtor (+ 90 D))) w)
	    )
	    (setq ent1 (ent_last))
	    (command ".pline" pt p1 p2 p3 "c")
	    (setq entlst (entlast))
	  )
	)

	(if (or (= D 30) (and (= D 45) (= img 3)) (= D 60))
	  (if (>= E 4)
	    (if	(= 0 (rem E 2))
	      (command ".array" entlst "" "r" 1 (/ E 2) lp)
	      (command ".array" entlst "" "r" 1 (/ (- E 1) 2) lp)
	    )
	  )
	)

	(setq ent1 (get_last ent1))
	(if (and (= D 45) (/= img 3))
	  (progn
	    (if	(= img 1)
	      (setq pt1	(polar pt
			       (+ ang (dtor 90))
			       (+ (* 0.7071 (+ (* 0.7071 lp) (- l w)))
				  Wv
				  (/ Wt 2)
			       )
			)
	      )
	    )
	    (if	(= img 2)
	      (setq pt1	(polar pt
			       (+ ang (dtor 90))
			       (+ (* l 0.7071) Wv (/ Wt 2))
			)
	      )
	    )
	  )
	  (setq pt1 (polar pt (+ ang (dtor 90)) (+ Wv (/ Wt 2))))
	)
	(setq pt2 (polar pt1 ang 5))

	(if (/= E 1)
	  (progn
	    (command ".mirror" ent1 "" pt1 pt2 "n")

	    (if	(or (= D 30) (and (= D 45) (= img 3)) (= D 60))
	      (progn
		(if (/= 0 (rem E 2))
		  (progn
		    (command ".copy"
			     entlst
			     ""
			     pt
			     (polar pt ang (* lp (/ (- E 1) 2)))
		    )
		    (setq pt (polar pt (+ pi ang) (* w (sin (dtor D))))
			  w1 (+ (* w (sin (dtor D))) (* l (cos (dtor D))))
		    )
		    (command ".line"
			     pt
			     (polar pt ang (+ w1 (* lp (/ (- E 1) 2))))
			     ""
		    )
		    (command ".copy"
			     (entlast)
			     ""
			     pt
			     (polar pt (+ ang (dtor 90)) (+ Wt (* 2 Wv)))
		    )
		    (command ".line"
			     pt
			     (polar pt (+ ang (dtor 90)) (+ Wt (* 2 Wv)))
			     ""
		    )
		    (command ".copy"
			     (entlast)
			     ""
			     pt
			     (polar pt ang (+ w1 (* lp (/ (- E 1) 2))))
		    )
		  )
		)
		(if (= 0 (rem E 2))
		  (progn
		    (setq pt (polar pt (+ pi ang) (* w (sin (dtor D))))
			  w1 (+ (* w (sin (dtor D))) (* l (cos (dtor D))))
		    )
		    (command ".line"
			     pt
			     (polar pt ang (+ w1 (* lp (- (/ E 2) 1))))
			     ""
		    )
		    (command ".copy"
			     (entlast)
			     ""
			     pt
			     (polar pt (+ ang (dtor 90)) (+ Wt (* 2 Wv)))
		    )
		    (command ".line"
			     pt
			     (polar pt (+ ang (dtor 90)) (+ Wt (* 2 Wv)))
			     ""
		    )
		    (command ".copy"
			     (entlast)
			     ""
			     pt
			     (polar pt ang (+ w1 (* lp (- (/ E 2) 1))))
		    )
		  )
		)
	      )
	    )


	    (if	(and (= D 45) (= img 1))
	      (progn
		(if (= E 3)
		  (progn
		    (command ".copy" entlst "" p1 p1)
		    (command ".rotate" entlst "" p3 90)
		    (command ".redraw")
		  )
		)

		(if (> E 3)
		  (progn
		    (if	(= 1 (rem E 4))
		      (command ".copy"
			       entlst
			       ""
			       pt
			       (polar pt ang (* lp (/ (- E 1) 4)))
		      )
		    )

		    (if	(= 2 (rem E 4))
		      (progn
			(command ".copy"
				 entlst
				 ""
				 pt
				 (polar pt ang (* (/ (- E 2) 4) lp))
			)
			(command ".mirror" (entlast) "" pt1 pt2 "n")
		      )
		    )

		    (if	(= 3 (rem E 4))
		      (progn
			(command ".copy"
				 entlst
				 ""
				 pt
				 (polar pt ang (* (/ (- E 3) 4) lp))
			)
			(command ".mirror" (entlast) "" pt1 pt2 "n")
			(command ".copy"
				 entlst1
				 ""
				 pt
				 (polar pt ang (* (/ (- E 3) 4) lp))
			)
		      )
		    )
		    (setq pt (polar pt
				    (+ pi ang)
				    (* (+ l w) (sin (dtor D)))
			     )
			  w1 (+	(* (+ l w) (sin (dtor D)))
				(* w (cos (dtor D)))
			     )
			  w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
		    )
		    (if	(= 0 (rem E 4))
		      (command ".line"
			       pt
			       (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
			       ""
		      )
		      (if (= 3 (rem E 4))
			(command ".line"
				 pt
				 (polar pt ang (+ w1 (* lp (/ E 4))))
				 ""
			)
			(command ".line"
				 pt
				 (polar pt ang (+ w2 (* lp (/ E 4))))
				 ""
			)
		      )
		    )
		    (command
		      ".copy"
		      (entlast)
		      ""
		      pt
		      (polar pt
			     (+ ang (dtor 90))
			     (*	2
				(+ (* 0.7071 (+ (* 0.7071 lp) (- l w)))
				   Wv
				   (/ Wt 2)
				)
			     )
		      )
		    )
		    (command
		      ".line"
		      pt
		      (polar pt
			     (+ ang (dtor 90))
			     (*	2
				(+ (* 0.7071 (+ (* 0.7071 lp) (- l w)))
				   Wv
				   (/ Wt 2)
				)
			     )
		      )
		      ""
		    )
		    (if	(= 0 (rem E 4))
		      (command ".copy"
			       (entlast)
			       ""
			       pt
			       (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
		      )
		      (if (= 3 (rem E 4))
			(command ".copy"
				 (entlast)
				 ""
				 pt
				 (polar pt ang (+ w1 (* lp (/ E 4))))
			)
			(command ".copy"
				 (entlast)
				 ""
				 pt
				 (polar pt ang (+ w2 (* lp (/ E 4))))
			)
		      )
		    )
		  )
		)
	      )
	    )

	    (if	(and (= D 45) (= img 2))
	      (progn
		(if (= E 3)
		  (progn
		    (command ".copy" entlst "" p1 p1)
		    (command ".rotate" entlst "" (midpt p2 p3) 180)
		    (command ".redraw")
		  )
		)

		(if (> E 3)
		  (progn
		    (if	(= 1 (rem E 4))
		      (command ".copy"
			       entlst
			       ""
			       pt
			       (polar pt ang (* lp (/ (- E 1) 4)))
		      )
		    )

		    (if	(= 2 (rem E 4))
		      (progn
			(command ".copy"
				 entlst
				 ""
				 pt
				 (polar pt ang (* (/ (- E 2) 4) lp))
			)
			(command ".mirror" (entlast) "" pt1 pt2 "n")
		      )
		    )

		    (if	(= 3 (rem E 4))
		      (progn
			(command ".copy"
				 entlst
				 ""
				 pt
				 (polar pt ang (* (/ (- E 3) 4) lp))
			)
			(command ".mirror" (entlast) "" pt1 pt2 "n")
			(command ".copy"
				 entlst1
				 ""
				 pt
				 (polar pt ang (* (/ (- E 3) 4) lp))
			)
		      )
		    )
		    (setq pt (polar pt
				    (+ pi ang)
				    (* (+ l l) (sin (dtor D)))
			     )
			  w1 (+	(* (+ l l) (sin (dtor D)))
				(* w (cos (dtor D)))
			     )
			  w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
		    )
		    (if	(= 0 (rem E 4))
		      (command ".line"
			       pt
			       (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
			       ""
		      )
		      (if (= 3 (rem E 4))
			(command ".line"
				 pt
				 (polar pt ang (+ w1 (* lp (/ E 4))))
				 ""
			)
			(if (or (= A 1) (= A 2))
			  (command ".line"
				   pt
				   (polar pt ang (+ w2 (* lp (/ E 4))))
				   ""
			  )
			  (command
			    ".line"
			    pt
			    (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
			    ""
			  )
			)
		      )
		    )
		    (command
		      ".copy"
		      (entlast)
		      ""
		      pt
		      (polar pt
			     (+ ang (dtor 90))
			     (*	2
				(+ (* 0.7071 (+ (* 0.7071 lp) (- l w)))
				   Wv
				   (/ Wt 2)
				)
			     )
		      )
		    )
		    (command
		      ".line"
		      pt
		      (polar pt
			     (+ ang (dtor 90))
			     (*	2
				(+ (* 0.7071 (+ (* 0.7071 lp) (- l w)))
				   Wv
				   (/ Wt 2)
				)
			     )
		      )
		      ""
		    )
		    (if	(= 0 (rem E 4))
		      (command ".copy"
			       (entlast)
			       ""
			       pt
			       (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
		      )
		      (if (= 3 (rem E 4))
			(command ".copy"
				 (entlast)
				 ""
				 pt
				 (polar pt ang (+ w1 (* lp (/ E 4))))
			)
			(if (or (= A 1) (= A 2))
			  (command ".copy"
				   (entlast)
				   ""
				   pt
				   (polar pt ang (+ w2 (* lp (/ E 4))))
			  )
			  (command
			    ".copy"
			    (entlast)
			    ""
			    pt
			    (polar pt ang (+ w1 (* lp (- (/ E 4) 1))))
			  )
			)
		      )
		    )
		  )
		)
	      )
	    )
	  )
	)
      )
    )
  )

  (defun draw_1	(E #pt / pt p1 p2 p3 entlst entlst1 w l)

    ;;平行 垂直---------
    (DL_MakeLayer "pp-dl-tcc")
    (if	(or (= B 3) (= B 1))
      (progn
	(if (= B 3)
	  (setq p1 (polar #pt ang lp))
	)
	(if (= B 1)
	  (progn
	    (if	(= A 1)
	      (setq p1 (polar #pt ang 3.2))
	    )
	    (if	(= A 2)
	      (setq p1 (polar #pt ang 5.0))
	    )
	    (if	(= A 3)
	      (setq p1 (polar #pt ang 8.7))
	    )
	    (if	(= A 4)
	      (setq p1 (polar #pt ang 12.0))
	    )
	    (if	(= A 5)
	      (setq p1 (polar #pt ang 18.0))
	    )
	  )
	)
	(setq p2 (polar p1 (+ ang (dtor 90)) Wv)
	      p3 (polar #pt (+ ang (dtor 90)) Wv)
	)
	(command ".pline" #pt p1 p2 p3 "c")
	(setq entlst (entlast))
	(if (> E 1)
	  (command ".array" entlst "" "r" 1 E lp)
	)
      )
    )
    ;;斜列--------------    
    (if	(= B 2)
      (progn
	(if (= D 1)
	  (setq D 30)
	)
	(if (= D 2)
	  (setq D 45)
	)
	(if (= D 3)
	  (setq D 60)
	)
	(setq w (* (sin (dtor D)) lp))
	(setq l (- (/ Wv (sin (dtor D))) (* lp (cos (dtor D)))))

	(if (or (= D 30) (and (= D 45) (= img 3)) (= D 60))
	  (progn
	    (setq pt (polar #pt ang (* w (sin (dtor D))))
		  p1 (polar pt (+ (dtor D) ang) l)
		  p2 (polar p1 (+ ang (dtor (+ 90 D))) w)
		  p3 (polar pt (+ ang (dtor (+ 90 D))) w)
	    )
	    (command ".pline" pt p1 p2 p3 "c")
	    (setq entlst (entlast))
	    (if	(> E 1)
	      (command ".array" entlst "" "r" 1 E lp)
	    )
	  )
	)

	(if (and (= D 45) (= img 1))
	  (progn
	    (setq pt (polar #pt ang (* (+ l w) (sin (dtor D))))
		  p1 (polar pt (+ (dtor D) ang) w)
		  p2 (polar p1 (+ ang (dtor (+ 90 D))) l)
		  p3 (polar pt (+ ang (dtor (+ 90 D))) l)
	    )
	    (command ".pline" pt p1 p2 p3 "c")
	    (setq entlst (entlast))
	    (if	(> E 2)
	      (progn
		(command ".copy" entlst "" p2 p2)
		(setq entlst1 (entlast))
		(command ".rotate" entlst "" p3 90)
		(if (= 0 (rem E 2))
		  (command ".array" entlst entlst1 "" "r" 1 (/ E 2) lp)
		  (if (/= 3 E)
		    (progn
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 1) 2)
			       lp
		      )
		      (command ".copy"
			       entlst
			       ""
			       pt
			       (polar pt ang (* lp (/ (- E 1) 2)))
		      )
		    )
		  )
		)
	      )
	    )
	    (if	(= E 2)
	      (progn
		(command ".copy" entlst "" p2 p2)
		(setq entlst1 (entlast))
		(command ".rotate" entlst "" p3 90)
	      )
	    )
	  )
	)

	(if (and (= D 45) (= img 2))
	  (progn
	    (setq pt (polar #pt ang (* (+ l l) (sin (dtor D))))
		  p1 (polar pt (+ (dtor D) ang) w)
		  p2 (polar p1 (+ ang (dtor (+ 90 D))) l)
		  p3 (polar pt (+ ang (dtor (+ 90 D))) l)
	    )
	    (command ".pline" pt p1 p2 p3 "c")
	    (setq entlst (entlast))
	    (if	(> E 2)
	      (progn
		(command ".copy" entlst "" p2 p2)
		(setq entlst1 (entlast))
		(command ".rotate" entlst "" (midpt p2 p3) 180)
		(if (= 0 (rem E 2))
		  (command ".array" entlst entlst1 "" "r" 1 (/ E 2) lp)
		  (if (/= E 3)
		    (progn
		      (command ".array"
			       entlst
			       entlst1
			       ""
			       "r"
			       1
			       (/ (- E 1) 2)
			       lp
		      )
		      (command ".copy"
			       entlst
			       ""
			       pt
			       (polar pt ang (* lp (/ (- E 1) 2)))
		      )
		    )
		  )
		)
	      )
	    )
	    (if	(= E 2)
	      (progn
		(command ".copy" entlst "" p2 p2)
		(setq entlst1 (entlast))
		(command ".rotate" entlst "" (midpt p2 p3) 180)
	      )
	    )
	  )
	)
      )
    )
  )


  (defun #drawpark (/ loop pt ang)
    (setq loop t
	  E    (read E)
    )
    (while loop
      (if (and (= D 2) (= B 2) (or (= img 1) (= img 2)) (< E 4))
	(progn
	  (beep)
	  (prompt "车位数量应大于3!")
	  (setq loop nil)
	)
	(progn

	  (setq pt (#getpt nil "\n  回车退出 / 插入点"))
	  (cond
	    ((null pt)
	     (setq loop	nil
		   what	0
		   what1 0
	     )
	    )
	    (t
;;;(undo_m)
	     (HY_SV)
	     (setq ang (#setangpt pt ""))
	     (setvar "snapang" ang)
	     (command ".text"
		      (polar pt (- ang (dtor 90)) 7)
		      5
		      (* (/ 180 pi) ang)
		      (strcat " 车位 " (rtos E 2 0) "个")
	     )
	     (draw pt)
	     (HY_RV)
	    )
	  )
	)
      )
    )
  )

  (defun #park2	(/     what  A	   B	 C     D     Wv	   lp	 Wu
		 Wt    Au    img   zs	 wid1  long  width lon1	 ys
		 #sym  size  pxsize	 czsize	     tdsize
		)
    (setq what 10)
    (while (> what 0)
      (if (not (new_dialog "park2" dcl_id))
	(exit)
      )
      (if (= what 10)
	(progn
	  (mode_tile "C2" 1)
	  (mode_tile "D" 1)
	  (setq what 9)
	  (set_tile "size" " 3.2x1.6")
	  (set_tile "pxsize" "5.2")
	  (set_tile "czsize" "2.6")
	  (set_tile "tdsize" "3.0")

	)
      )

      (action_tile "B1" "(errnil)(bb4) (#bb1)")
      (action_tile "B2" "(errnil)(bb2)(#bb2)")
      (action_tile "B3" "(errnil)(bb3)(#bb1)")

      (action_tile
	"D1"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(#bb1)"
      )
      (action_tile
	"D2"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(subdlg1)(#bb1)"
      )
      (action_tile "D3" "(errnil)(bb1)(#bb1)")

      (action_tile
	"jsmany"
	"(errnil)(if (#chk1) (progn (#jsmany)))"
      )

      (foreach tile '("C1" "C2")
	(action_tile tile "(errnil)(#bb1)")
      )
      (foreach tile '("long" "width")
	(action_tile tile "(errnil)")
      )
      (foreach tile '("A1" "A2" "A3" "A4" "A5")
	(action_tile tile "(errnil)(#bb1)")
      )

      (action_tile
	"accept"
	"(if (#chk1) (progn (#jsmany)(done_dialog 1)))"
      )
      (setq what (start_dialog))
      (cond
	((= what 1)
	 (HY_SV)
	 (#drawpark2)
	 (HY_RV)
	)
      )
    )
  )

  (defun #chk1 (/ ok)
    (setq ok t)
    (aa)
    (setq B	 (get_tile "B")
	  D	 (get_tile "D")
	  long	 (get_tile "long")
	  width	 (get_tile "width")
	  pxsize (get_tile "pxsize")
	  czsize (get_tile "czsize")
	  tdsize (get_tile "tdsize")

    )
    (#v_search)
    (#readv)
    (cond
      ((and (= B "B2") (null D))
       (beep)
       (set_tile "error" "斜列式倾斜角未选定!")
       (setq ok nil)
      )
      ((chknum 0 long)
       (beep)
       (set_tile "error" "停车场长度参数无效!")
       (setq ok nil)
      )
      ((chknum 0 width)
       (beep)
       (set_tile "error" "停车场宽度参数无效!")
       (setq ok nil)
      )
      ((and (or (= B 1) (= B 3) (= D 1) (and (= D 2) (= img 3)) (= D 3))
	    (chknum Wu width)
       )
       (beep)
       (set_tile "error" "停车场宽度太小!")
       (setq ok nil)
      )
      ((and (= D 2)
	    (or (= img 2) (= img 1))
	    (chknum (- (* 2 Wu) Wt) width)
       )
       (beep)
       (set_tile "error" "停车场宽度太小!")
       (setq ok nil)
      )
      ((and (or (= B 1) (= B 3)) (chknum lp long))
       (beep)
       (set_tile "error" "停车场长度太小!")
       (setq ok nil)
      )
      ((and (or (= D 1) (and (= D 2) (= img 3)) (= D 3))
	    (chknum (+ (* lp
			  (sin (dtor (* (+ D 1) 15)))
			  (sin (dtor (* (+ D 1) 15)))
		       )
		       lp
		    )
		    long
	    )
       )
       (beep)
       (set_tile "error" "停车场长度太小!")
       (setq ok nil)
      )
      ((or (and (= D 2) (= img 1) (chknum (+ (/ lp 2) Wv) long))
	   (and (= D 2) (= img 2) (chknum (- (* Wv 2) (/ lp 2)) long))
       )
       (beep)
       (set_tile "error" "停车场长度太小!")
       (setq ok nil)
      )
;;;----
      ((> (read width) (read long))
       (beep)
       (set_tile "error" "停车场长度应不小于宽度!")
       (setq ok nil)
      )
      ((chknum 1.5 pxsize)
       (beep)
       (set_tile "error" "平行通道的车位尺寸无效!")
       (mode_tile "pxsize" 2)
       (setq ok nil)
      )
      ((chknum 1.5 czsize)
       (beep)
       (set_tile "error" "垂直通道的车位尺寸无效!")
       (mode_tile "czsize" 2)
       (setq ok nil)
      )
      ((chknum 2.9 tdsize)
       (beep)
       (set_tile "error" "通道宽度尺寸无效!")
       (mode_tile "tdsize" 2)
       (setq ok nil)
      )

    )
    ok
  )

  (defun #jsmany (/ #long #width #zs1 #zs2)
    (setq #width width
	  #long	 long
    )

    (setq width	#long
	  long	#width
    )
    (jsmany)
    (setq #zs1 zs)

    (setq width	#width
	  long	#long
    )
    (jsmany)
    (setq #zs2 zs)

    (if	(> #zs2 #zs1)
      (setq zs #zs2
	    #sym t
      )
      (progn
	(setq width #long
	      long  #width
	)
	(jsmany)
      )
    )
    (setq width	(read #width)
	  long	(read #long)
    )
    (set_tile "jsmany1" (rtos zs 2 0))
  )


  (defun jsmany	(/ #ang l w)
    (setq width	(read width)
	  long	(read long)
    )
    (if	(/= D 0)
      (setq #ang (dtor (* (+ D 1) 15))
	    w	 (* (sin #ang) lp)
	    l	 (- (/ Wv (sin #ang)) (* lp (cos #ang)))
      )
    )
    (if	(or (= B 1) (= B 3))
      (progn
	(setq lon1 (fix (/ long lp))
	      wid1 (fix (/ width Wu))
;;;ys (- (/ width Wu) wid1)
	      ys   (- width (* wid1 Wu))
	)
	(setq zs (* lon1 wid1 2))
	(if (>= ys Wv)
	  (setq zs (+ zs lon1))
	)
      )
    )

    (if	(and (= B 2) (or (= D 1) (= D 3) (and (= D 2) (= img 3))))
      (progn
	(setq lon1 (+ 1
		      (fix (/ (- long (* l (cos #ang)) (* w (sin #ang))) lp))
		   )
	      wid1 (fix (/ width Wu))
;;;ys (- (/ width Wu) wid1)
	      ys   (- width (* wid1 Wu))
	      zs   (* lon1 wid1 2)
	)
	(if (>= ys Wv)
	  (setq zs (+ zs lon1))
	)
      )
    )

    (if	(and (= D 2) (= img 1))
      (progn
	(setq lon1 (fix (/ (- long (* l (sin #ang))) lp))
	      wid1 (fix (/ width (* 2 Wu)))
;;;ys (- (/ width (* 2 Wu)) wid1)
	      ys   (- width (* 2 Wu wid1))
	      zs   (* lon1 wid1 4)
	)
	(if (>= ys (- Wu Wt))
	  (setq zs (+ zs (* 2 lon1)))
	)
      )
    )

    (if	(and (= D 2) (= img 2))
      (progn
	(setq lon1 (+ 1 (fix (/ (- long (* (+ l w l) (sin #ang))) lp)))
	      wid1 (fix (/ width (* 2 Wu)))
;;;ys (- (/ width(* 2 Wu)) wid1)
	      ys   (- width (* 2 wid1 Wu))
	      zs   (* lon1 wid1 4)
	)
	(if (>= ys (- Wu Wt))
	  (setq zs (+ zs (* 2 lon1)))
	)
      )
    )
  )

  (defun #drawpark2 (/ E loop pta ang #pta)
    (if	(or (= B 1) (= B 3))
      (setq E (* 2 lon1))
    )
    (if	(and (= B 2) (or (= D 1) (= D 3) (and (= D 2) (= img 3))))
      (setq E (* 2 lon1))
    )
    (if	(and (= D 2) (= img 1))
      (setq E (* 4 lon1))
    )
    (if	(and (= D 2) (= img 2))
      (setq E (* 4 lon1))
    )
    (setq loop t)
    (while loop
      (if (and (= D 2) (= B 2) (or (= img 1) (= img 2)) (< E 4))
	(progn
	  (beep)
	  (prompt "每排车位数量应大于3!")
	  (setq loop nil)
	)
	(progn
	  (setq pta (#getpt nil "\n  回车退出 / 插入点"))
	  (cond
	    ((null pta)
	     (setq loop	nil
		   what	0
		   what1 0
	     )
	    )
	    (t
	     (HY_SV)
	     (setq ang (#setangpt pta ""))
	     (setvar "snapang" ang)
	     (setq #pta pta)
	     (repeat wid1
	       (draw pta)
	       (if (or (= B 1) (= B 3))
		 (setq pta (polar pta (+ ang (dtor 90)) Wu))
	       )
	       (if (and	(= B 2)
			(or (= D 30) (= D 60) (and (= D 45) (= img 3)))
		   )
		 (setq pta (polar pta (+ ang (dtor 90)) Wu))
	       )
	       (if (and (= D 45) (= img 1))
		 (setq pta (polar pta (+ ang (dtor 90)) (* 2 Wu)))
	       )
	       (if (and (= D 45) (= img 2))
		 (setq pta (polar pta (+ ang (dtor 90)) (* 2 Wu)))
	       )
	     )

	     (if (or (= B 1)
		     (= B 3)
		     (and (= B 2)
			  (or (= D 1) (= D 3) (and (= D 2) (= img 3)))
		     )
		 )
	       (if (>= ys Wv)
		 (draw_1 (/ E 2) pta)
	       )
	     )
	     (if (and (= D 2) (or (= img 1) (= img 2)))
	       (if (>= ys (- Wu Wt))
		 (draw_1 (/ E 2) pta)
	       )
	     )
;;;(if (> ys 0.5) (draw_1 (/ E 2) pta))

	     (if #sym
	       (command
		 ".pline"
		 #pta
		 (polar #pta ang long)
		 (polar (polar #pta ang long) (+ ang (dtor 90)) width)
		 (polar #pta (+ ang (dtor 90)) width)
		 "c"
	       )
	       (command
		 ".pline"
		 #pta
		 (polar #pta ang width)
		 (polar (polar #pta ang width) (+ ang (dtor 90)) long)
		 (polar #pta (+ ang (dtor 90)) long)
		 "c"
	       )
	     )
	     (command ".change"
		      (entlast)
		      ""
		      "properties"
		      "color"
		      "red"
		      ""
	     )
	     (&sxdw (strcat "S="
			    (rtos (* long width) 2 0)
			    "m^2("
			    (rtos long 2 1)
			    "x"
			    (rtos width 2 1)
			    ")"
			    "  车位 "
			    (rtos zs 2 0)
			    "个"
		    )
		    (polar #pta (- ang (dtor 90)) 7)
		    (/ 5.0 (DL_GetDrawingFactor))
		    "BL"
		    ang
	     )

					;            (command ".text" (polar #pta (- ang (dtor 90)) 7) 5 (* (/ 180  pi) ang)
					;              (strcat "S=" (rtos (* long width) 2 0) "m^2(" (rtos long 2 1) "x"
					;              (rtos width 2 1) ")" "  车位 " (rtos zs 2 0) "个"))
	     (HY_RV)
	    )
	  )
	)
      )
    )
  )

  (defun #park3	(/	what   A      B	     C	    D	   Wv
		 lp	Wu     Wt     Au     img    area   allmany
		 evermany      size   pxsize czsize tdsize
		)
    (setq what 10)
    (while (> what 0)
      (if (not (new_dialog "park3" dcl_id))
	(exit)
      )
      (if (= what 10)
	(progn
	  (mode_tile "C2" 1)
	  (mode_tile "D" 1)
	  (setq what 9)
	  (set_tile "size" " 3.2x1.6")
	  (set_tile "pxsize" "5.2")
	  (set_tile "czsize" "2.6")
	  (set_tile "tdsize" "3.0")

	)
      )

      (action_tile "B1" "(errnil)(bb4)(#bb1)")
      (action_tile "B2" "(errnil)(bb2)(#bb2)")
      (action_tile "B3" "(errnil)(bb3)(#bb1)")

      (action_tile
	"D1"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(#bb1)"
      )
      (action_tile
	"D2"
	"(errnil)(mode_tile \"C2\" 1)(set_tile \"C1\" \"1\")(subdlg1)(#bb1)"
      )
      (action_tile "D3" "(errnil)(bb1)(#bb1)")

      (action_tile
	"jsarea"
	"(errnil)(if (#chk2) (progn (jsarea)))"
      )

      (foreach tile '("C1" "C2")
	(action_tile tile "(errnil)(#bb1)")
      )
      (foreach tile '("allmany" "evermany")
	(action_tile tile "(errnil)")
      )
      (foreach tile '("A1" "A2" "A3" "A4" "A5")
	(action_tile tile "(errnil)(#bb1)")
      )

      (action_tile
	"accept"
	"(if (#chk2) (progn (jsarea)(done_dialog 1)))"
      )
      (setq what (start_dialog))
      (cond
	((= what 1)
	 (HY_SV)
	 (#drawpark3)
	 (HY_RV)
	)
      )
    )
    (princ)
  )


  (defun #chk2 (/ ok)
    (setq ok t)
    (aa)
    (setq B	   (get_tile "B")
	  D	   (get_tile "D")
	  allmany  (get_tile "allmany")
	  evermany (get_tile "evermany")
	  pxsize   (get_tile "pxsize")
	  czsize   (get_tile "czsize")
	  tdsize   (get_tile "tdsize")

    )
    (#v_search)
    (#readv)
    (cond
      ((and (= B "B2") (null D))
       (beep)
       (set_tile "error" "斜列式倾斜角未选定!")
       (setq ok nil)
      )
      ((or (chknum 0 allmany) (wcmatch allmany "`.*"))
       (beep)
       (set_tile "error" "车位总数参数无效!")
       (setq ok nil)
      )
      ((/= 'INT (type (read allmany)))
       (beep)
       (set_tile "error" "车位总数参数无效!")
       (setq ok nil)
      )

      ((or (chknum 0 evermany) (wcmatch evermany "`.*"))
       (beep)
       (set_tile "error" "每排车位数参数无效!")
       (setq ok nil)
      )
      ((/= 'INT (type (read evermany)))
       (beep)
       (set_tile "error" "每排车位数参数无效!")
       (setq ok nil)
      )

      ((> (read evermany) (read allmany))
       (beep)
       (set_tile "error" "车位总数应不小于每排车位数!")
       (setq ok nil)
      )

      ((and (or (= B 1) (= B 3) (= D 1) (and (= D 2) (= img 3)) (= D 3))
	    (< (read allmany) 2)
       )
       (beep)
       (set_tile "error" "车位总数太小!")
       (setq ok nil)
      )
      ((or (and (= D 2) (= img 1) (> 4 (read allmany)))
	   (and (= D 2) (= img 2) (> 4 (read allmany)))
       )
       (beep)
       (set_tile "error" "车位总数太小!")
       (setq ok nil)
      )

      ((and (or (= B 1) (= B 3) (= D 1) (and (= D 2) (= img 3)) (= D 3))
	    (< (read evermany) 2)
       )
       (beep)
       (set_tile "error" "每排车位数太小!")
       (setq ok nil)
      )
      ((or (and (= D 2) (= img 1) (> 4 (read evermany)))
	   (and (= D 2) (= img 2) (> 4 (read evermany)))
       )
       (beep)
       (set_tile "error" "每排车位数太小!")
       (setq ok nil)
      )
      ((chknum 1.5 pxsize)
       (beep)
       (set_tile "error" "平行通道的车位尺寸无效!")
       (mode_tile "pxsize" 2)
       (setq ok nil)
      )
      ((chknum 1.5 czsize)
       (beep)
       (set_tile "error" "垂直通道的车位尺寸无效!")
       (mode_tile "czsize" 2)
       (setq ok nil)
      )
      ((chknum 2.9 tdsize)
       (beep)
       (set_tile "error" "通道宽度尺寸无效!")
       (mode_tile "tdsize" 2)
       (setq ok nil)
      )
    )
    ok
  )


  (defun jsarea	()
    (setq allmany  (read allmany)
	  evermany (read evermany)
    )
    (if	(= B 2)
      (progn
	(if (= D 1)
	  (setq D 30)
	)
	(if (= D 2)
	  (setq D 45)
	)
	(if (= D 3)
	  (setq D 60)
	)
      )
    )
    (#js)
    (set_tile "jsarea1" (rtos area 2 0))
  )

  (defun #drawpark3 (/ E loop pta #pta ang)
    (setq loop t
	  E    evermany
    )
    (while loop
      (setq pta (#getpt nil "\n  回车退出 / 插入点"))
      (cond
	((null pta)
	 (setq loop nil
	       what 0
	       what1 0
	 )
	)
	(t
	 (HY_SV)
	 (setq ang (#setangpt pta ""))
	 (setvar "snapang" ang)
	 (setq #pta pta)
	 (repeat (fix (/ allmany evermany))
	   (draw pta)
	   (if (or (= B 1) (= B 3))
	     (setq pta (polar pta (+ ang (dtor 90)) Wu))
	   )
	   (if (and (= B 2)
		    (or (= D 30) (= D 60) (and (= D 45) (= img 3)))
	       )
	     (setq pta (polar pta (+ ang (dtor 90)) Wu))
	   )
	   (if (and (= D 45) (= img 1))
	     (setq pta (polar pta (+ ang (dtor 90)) (* 2 Wu)))
	   )
	   (if (and (= D 45) (= img 2))
	     (setq pta (polar pta (+ ang (dtor 90)) (* 2 Wu)))
	   )
	 )
	 (draw_2 pta)
	 (HY_RV)
	)
      )
    )
  )

  (defun draw_2
	 (#ptb / #many E @p1 @p2 @p3 #temp #temp1 w l #w #l #w1 #w2)
    (setq #many	(rem allmany evermany)
	  E	evermany
    )
    (if	(/= D 0)
      (setq w  (* (sin (dtor D)) lp)
	    l  (- (/ Wv (sin (dtor D))) (* lp (cos (dtor D))))
	    #w (* (sin (dtor D)) w)
	    #l (* (cos (dtor D)) l)
      )
    )
    (if	(/= #many 0)
      (progn
	(if (or	(= B 1)
		(= B 3)
		(and (= B 2)
		     (or (= D 30) (= D 60) (and (= D 45) (= img 3)))
		)
	    )
	  (progn
	    (if	(/= 0 (rem E 2))
	      (setq E (+ E 1))
	    )
	    (if	(<= #many (/ E 2))
	      (draw_1 #many #ptb)
	      (progn
		(setq E #many)
		(draw #ptb)
	      )
	    )
	  )
	)

	(if (and (= D 45) (or (= img 1) (= img 2)))
	  (progn
	    (if	(/= 0 (rem E 4))
	      (setq E (* (+ 1 (/ E 4)) 4))
	    )
	    (if	(<= #many (/ E 2))
	      (draw_1 #many #ptb)
	      (progn
		(setq E #many)
		(draw #ptb)
	      )
	    )
	  )
	)
      )
    )

    (if	(or (= B 1) (= B 3))
      (progn
	(setq E evermany)
	(if (/= 0 (rem E 2))
	  (setq E (+ E 1))
	)
	(setq @p1 (polar #pta ang (* lp (/ E 2))))
	(setq #temp (fix (/ allmany evermany)))
	(if (= #many 0)
	  (setq #temp1 0)
	  (if (<= #many (/ E 2))
;;;modi ------
	    (setq #temp1 Wv)
;;;-----------
	    (setq #temp1 Wu)
	  )
	)
	(setq @p2 (polar @p1 (+ ang (dtor 90)) (+ (* Wu #temp) #temp1)))
	(setq
	  @p3 (polar #pta (+ ang (dtor 90)) (+ (* Wu #temp) #temp1))
	)
      )
    )

    (if	(and (= B 2)
	     (or (= D 30) (= D 60) (and (= D 45) (= img 3)))
	)
      (progn
	(setq E evermany)
	(if (/= 0 (rem E 2))
	  (setq E (+ E 1))
	)
	(setq @p1 (polar #pta ang (+ #w #l (* lp (- (/ E 2) 1)))))
	(setq #temp (fix (/ allmany evermany)))
	(if (= #many 0)
	  (setq #temp1 0)
	  (if (<= #many (/ E 2))
	    (setq #temp1 Wv)
	    (setq #temp1 Wu)
	  )
	)
	(setq @p2 (polar @p1 (+ ang (dtor 90)) (+ (* Wu #temp) #temp1)))
	(setq
	  @p3 (polar #pta (+ ang (dtor 90)) (+ (* Wu #temp) #temp1))
	)
      )
    )

    (if	(and (= D 45) (= img 1))
      (progn
	(setq #w1 (+ (* (+ l w) (sin (dtor D))) (* w (cos (dtor D))))
	      #w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
	      E	  evermany
	)
	(if (= 0 (rem E 4))
	  (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	  (if (= 3 (rem E 4))
	    (setq @p1 (polar #pta ang (+ #w1 (* lp (/ E 4)))))
	    (setq @p1 (polar #pta ang (+ #w2 (* lp (/ E 4)))))
	  )
	)
	(if (<= #many (/ E 2))
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	  )
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	  )
	)
      )
    )

    (if	(and (= D 45) (= img 2))
      (progn
	(setq #w1 (+ (* (+ l l) (sin (dtor D))) (* w (cos (dtor D))))
	      #w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
	      E	  evermany
	)
	(if (= 0 (rem E 4))
	  (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	  (if (= 3 (rem E 4))
	    (setq @p1 (polar #pta ang (+ #w1 (* lp (/ E 4)))))
	    (if	(or (= A 1) (= A 2))
	      (setq @p1 (polar #pta ang (+ #w2 (* lp (/ E 4)))))
	      (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	    )
	  )
	)
	(if (<= #many (/ E 2))
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	  )
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	  )
	)
      )
    )
    (command ".pline" #pta @p1 @p2 @p3 "c")
    (command ".change"
	     (entlast)
	     ""
	     "properties"
	     "color"
	     "red"
	     ""
    )
    (&sxdw (strcat "S="
		   (rtos area 2 0)
		   "m^2("
		   (rtos (distance #pta @p1) 2 1)
		   "x"
		   (rtos (distance @p1 @p2) 2 1)
		   ")"
		   "  车位 "
		   (rtos allmany 2 0)
		   "个"
	   )
	   (polar #pta (- ang (dtor 90)) 7)
	   (/ 5.0 (DL_GetDrawingFactor))
	   "BL"
	   ang
    )


					;  (command ".text" (polar #pta (- ang (dtor 90)) 7) 5 (* (/ 180 pi) ang)
					;     (strcat "S=" (rtos area 2 0) "m^2(" (rtos (distance #pta @p1) 2 1) "x"
					;     (rtos (distance @p1 @p2) 2 1) ")" "  车位 " (rtos allmany 2 0) "个"))

  )

  (defun #js (/	#many E	@p1 @p2	@p3 #temp #temp1 w l #w	#l #w1 #w2 #pta
	      ang)
    (setq #pta '(0 0 0)
	  ang  0
    )
    (setq #many (rem allmany evermany))
    (if	(/= D 0)
      (setq w  (* (sin (dtor D)) lp)
	    l  (- (/ Wv (sin (dtor D))) (* lp (cos (dtor D))))
	    #w (* (sin (dtor D)) w)
	    #l (* (cos (dtor D)) l)
      )
    )
    (if	(or (= B 1) (= B 3))
      (progn
	(setq E evermany)
	(if (/= 0 (rem E 2))
	  (setq E (+ E 1))
	)
	(setq @p1 (polar #pta ang (* lp (/ E 2))))
	(setq #temp (fix (/ allmany evermany)))
	(if (= #many 0)
	  (setq #temp1 0)
	  (if (<= #many (/ E 2))
	    (setq #temp1 Wv)
	    (setq #temp1 Wu)
	  )
	)
	(setq @p2 (polar @p1 (+ ang (dtor 90)) (+ (* Wu #temp) #temp1)))
	(setq
	  @p3 (polar #pta (+ ang (dtor 90)) (+ (* Wu #temp) #temp1))
	)
      )
    )

    (if	(and (= B 2)
	     (or (= D 30) (= D 60) (and (= D 45) (= img 3)))
	)
      (progn
	(setq E evermany)
	(if (/= 0 (rem E 2))
	  (setq E (+ E 1))
	)
	(setq @p1 (polar #pta ang (+ #w #l (* lp (- (/ E 2) 1)))))
	(setq #temp (fix (/ allmany evermany)))
	(if (= #many 0)
	  (setq #temp1 0)
	  (if (<= #many (/ E 2))
	    (setq #temp1 Wv)
	    (setq #temp1 Wu)
	  )
	)
	(setq @p2 (polar @p1 (+ ang (dtor 90)) (+ (* Wu #temp) #temp1)))
	(setq
	  @p3 (polar #pta (+ ang (dtor 90)) (+ (* Wu #temp) #temp1))
	)
      )
    )

    (if	(and (= D 45) (= img 1))
      (progn
	(setq #w1 (+ (* (+ l w) (sin (dtor D))) (* w (cos (dtor D))))
	      #w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
	      E	  evermany
	)
	(if (= 0 (rem E 4))
	  (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	  (if (= 3 (rem E 4))
	    (setq @p1 (polar #pta ang (+ #w1 (* lp (/ E 4)))))
	    (setq @p1 (polar #pta ang (+ #w2 (* lp (/ E 4)))))
	  )
	)
	(if (<= #many (/ E 2))
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	  )
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	  )
	)
      )
    )

    (if	(and (= D 45) (= img 2))
      (progn
	(setq #w1 (+ (* (+ l l) (sin (dtor D))) (* w (cos (dtor D))))
	      #w2 (+ (* l (sin (dtor D))) (* w (cos (dtor D))))
	      E	  evermany
	)
	(if (= 0 (rem E 4))
	  (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	  (if (= 3 (rem E 4))
	    (setq @p1 (polar #pta ang (+ #w1 (* lp (/ E 4)))))
	    (if	(or (= A 1) (= A 2))
	      (setq @p1 (polar #pta ang (+ #w2 (* lp (/ E 4)))))
	      (setq @p1 (polar #pta ang (+ #w1 (* lp (- (/ E 4) 1)))))
	    )
	  )
	)
	(if (<= #many (/ E 2))
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (+ Wu (* 2 Wu (/ allmany evermany))) Wt)
		  )
	    )
	  )
	  (progn
	    (setq
	      @p2 (polar @p1
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	    (setq
	      @p3 (polar #pta
			 (+ ang (dtor 90))
			 (- (* 2 Wu (+ 1 (/ allmany evermany))) Wt)
		  )
	    )
	  )
	)
      )
    )
    (setq area (* (distance #pta @p1) (distance @p1 @p2)))
  )



  (HY_Set0)
  (if (null #getpt)
    (#ppls "pppp")
  )

  (setq what1 10)
  (setq dcl_id nil)
  (if (null dcl_id)
    (setq dcl_id (szdl_load_dlg "park"))
  )
  (if (> dcl_id 0)
    (progn
      (while (> what1 0)
	(if (not (new_dialog "mainmenu" dcl_id))
	  (exit)
	)
	(if tile_v
	  (set_tile tile_v "1")
	  (progn (set_tile "s1" "1") (setq tile_v "s1"))
	)
	(foreach tile '("s1" "s2" "s3")
	  (action_tile tile "(setq tile_v $key)")
	)
	(action_tile "accept" "(done_dialog 1)")
	(setq what1 (start_dialog))
	(cond
	  ((= what1 1)
	   (if (= tile_v "s1")
	     (#park1)
	   )
	   (if (= tile_v "s2")
	     (#park2)
	   )
	   (if (= tile_v "s3")
	     (#park3)
	   )
	  )
	)
      )
    )
  )
  (unload_dialog dcl_id)
  (setq dcl_id nil)
  (HY_Set1)
)
(princ)
