;;;modi yft 99.01 参数化的回车场
(defun dl_hcc (/ dcl_id what1 get_ds dl_hcc_bz uctr wb_dlcs    )

;;;;begin of define for built-in function
  (defun szz_tlysk_lsp(wb_dlcs xz_zy / wb wb_lkl wb_lkr wb_bkzhl wb_bkzhr lk_lys dist_tmp
         dist    )
   (setq wb (car wb_dlcs) wb_lkl (cadr wb_dlcs) wb_lkr (caddr wb_dlcs) )
   (setq wb_bkzhl (car wb) wb_bkzhr (cadr wb))
   (if (= xz_zy "R")
     (setq wb_lkl wb_lkr wb_bkzhl wb_bkzhr)
   )
   (setq lk_lys (car wb_lkl) wb_lkl (cdr wb_lkl) wb_bkzhl (cdr wb_bkzhl) dist_tmp 0.0)
   (while wb_bkzhl
    (setq dist (car wb_lkl) dist_tmp (+ dist_tmp dist))
    (if (or (= (car wb_bkzhl) "K") (= (car wb_bkzhl) "M"))
      (setq lk_lys (+ lk_lys dist_tmp) dist_tmp 0.0)
    )
    (setq wb_bkzhl (cdr wb_bkzhl) wb_lkl (cdr wb_lkl))
   )
   lk_lys
  )    ;end of defun
  ;;;
  (defun dl_hcc_bz (bzptb  yx	  /	 bb	p1     k      p2
		     p3	   p4	  inb2	 ddb2	ank    y      xx
		     v	   m	  ddb3	 aa	bb     vx     y1
		     y2	   s	  enb	 ent	pt     dwjx1  dwjx2
		     dwjx3  dwint  dw-cx	 dw-ccbz       #ccbz_err
		   )


;;;----不需界线----
    (defun dwjx3 (/    y    aa	 s    s1   l1	l2   an	  p00  p001
					  m    ins  m1	 bb1  zmax mm	mmm  zz	  zz1  zz2
					  bbb
								 )
      (setq bb1	nil
				    mmm	nil
				    zz1	nil
				    zz3	nil
				    p1	nil
				    p2	nil
      )
      (setq p1 (car bzptb))
      (setq an (+ (/ pi 2) (angle (p# p1) (p# (cadr bzptb))))
				    p2 (polar p1 an 10)
      )
      (setvar "snapang" 0)

      (setq an1 (+ an (/ pi 2)))
      (setq p00 '(0 0 0))
      (setq p001 (polar p00 an1 10))
      (foreach m bb
					(setq ins (inters p00 p001 m (polar m an 10) nil))
					(setq m1 (list ins m))
					(setq bb1 (cons m1 bb1))
      )
      (setq zmax (apply	'max
										(foreach m
										    (setq zz0 (mapcar 'car bb1))
										    (setq mm nil)
										    (foreach m1 m (setq mm (cons (abs m1) mm)))
										    (setq zz1 (cons (cons (apply '+ mm) m) zz1))
										    (setq mmm (cons (apply '+ mm) mmm))
										)
								 )
      )
      (setq zz2 (cdr (assoc (cdr (assoc zmax zz1)) bb1)))
      (foreach m (mapcar 'cdr bb1)
					(if (null (equal zz2 m))
					  (setq zz3 (cons m zz3))
					)
      )
      (setq bbb (cons (car zz2) (mapcar 'car zz3)))
      (setq bb bbb)
      (setq p1 (car zz2))
      (setq p2 (polar p1 an 10))

    )

;;;----尺寸线交叉点----inb2 ddb2
    (defun dwint (mun  /    pp1	 pp2  ang  in1	in2  cc	  m    m1
		  in   dis  dis1 disb disb1	w    n1	  l    lenn
		  s    ss   l1	 inb0 inb  inb1	kk   len  p01  p02
		  ddb  ddb1 dis
		 )
      (setq cc nil
	    disb nil
	    dis1 nil
	    disb1 nil
	    inb	nil
	    inb1 nil
	    inb2 nil
      )
      (setq ddb	 nil
	    ddb1 nil
	    ddb2 nil
	    inb0 nil
	    in1	 nil
	    ddb3 nil
      )
;;;----界尺交点----cc
      (setq p1	(list (car p1) (cadr p1))
	    p2	(list (car p2) (cadr p2))
	    pp1	(caddr bzptb)
	    ang	(angle p1 p2)
	    ang	(+ ang (/ pi 2))
	    pp2	(polar pp1 ang 10)
	    in1	(inters pp1 pp2 p1 p2 nil)
      )
      (if (/= in1 nil)
	(progn
	  (If (and (/= p3 nil) (/= p4 nil))
	    (Progn
	      (setq in2 (inters pp1 pp2 p3 p4 nil))
	      (setq cc (list in2 in1))
	    )
	    (setq cc (list in1))
	  )
	)
      )
;;;----标尺交点----
      (foreach m bb
	(setq m1 (polar m (+ ang (/ pi 2)) 10))
	(setq in (inters pp1 pp2 m m1 nil))
	(setq cc (cons in cc))
	(setq ank (angle in m))
      )
					;
					;----the distance list--
      (foreach m cc
	(setq dis (distance m in1))
	(setq dis1 (cons dis m))
	(setq disb (cons dis1 disb))
      )
      (setq disb1 (mapcar 'car disb))
					;
      (setq s  nil
	    l  nil
	    l1 nil
	    ss nil
      )
      (setq n1 0)
      (setq l disb1)
      (setq lenn (length l))
      (while (< n1 Lenn)
	(setq s (apply 'max l))
	(setq ss (cons s ss))
	(foreach n l
	  (if (/= n s)
	    (setq l1 (cons n l1))
	  )
	)
	(setq l	 l1
	      l1 nil
	)
	(setq n1 (+ n1 1))
	(if (= l nil)
	  (setq n1 lenn)
	)
      )
      (setq inb0 (cons in1 inb))
      (foreach m ss
	(setq in (assoc m disb))
	(setq inb (cons in inb))
	(setq inb1 (mapcar 'cdr inb))
      )
      (setq kk	 inb1
	    inb1 (append inb1 inb0)
	    inb1 (reverse inb1)
	    inb2 (cons (car inb1) inb2)
	    len	 (length inb1)
	    n	 0
      )
      (while (< n (- len 1))
	(setq p01 (nth n inb1)
	      p02 (nth (+ n 1) inb1)
	      dd  (distance p01 p02)
	)
	(if (>= dd 1.0)
	  (progn
	    (setq inb2 (cons p02 inb2))
	    (setq ddb (cons dd ddb))
	  )
	)
	(setq n (+ n 1))
      )
      (setq inb2 (reverse inb2))
      (foreach m ddb
	(setq ddb1 (cons m ddb1))
      )
      (setq ddb1 (reverse ddb1))
      (setq d1 (apply '+ ddb1))
      (setq ddb1 (cons d1 ddb1))
      (setq dis (- (car ddb1) d1))
      (setq len (length ddb1))
      (setq n 0)
      (while (< n len)
	(setq d1 (nth n ddb1))
	(if (= n 1)
	  (setq d1 (+ d1 dis))
	)
	(setq ddb2 (cons d1 ddb2))
	(setq n (+ n 1))
      )
      (if (= mun 1)
	(setq w (DL_GetDimPrec))
      )
      (foreach m ddb2
	(if (= mun 1)
	  (setq m1 (read (rtos m 2 w)))
	  (setq m1 (read (rtos (* 1000.0 m) 2 0)))
	)
	(setq ddb3 (cons m1 ddb3))
      )
      (setq ddb2 (reverse ddb3))

    )

    (defun dw-cx (MUN  /    P11	 P22  AN1  AN	AN11 ANWZ LEN  PA
		  PB   N1   PX1	 PX2  PXX1 PXX2	AWZ  PWZ  WZ   H
		  W    SC   textstyle
		 )
      (SETQ SCA 1.0)
      (SETQ P11 (CAR INB2))
      (SETQ P22 (LAST INB2))
      (SETQ AN1 (ANGLE P11 P22))
      (SETQ AN2 (ANGLE P22 P11))
      (SETQ AN (MIN AN1 AN2))
      (SETQ P11 (POLAR P11 AN2 (* SCA 1)))
      (SETQ P22 (POLAR P22 AN1 (* SCA 1)))
      (COMMAND "line" P11 P22 "")
      (IF (AND (<= AN (/ (* PI 2) 3)) (>= AN 0.0))
	(SETQ AN11 (+ AN (/ PI 2)))
	(SETQ AN11 (- AN (/ PI 2)))
      )
      (IF (AND (<= AN (/ (* PI 2) 3)) (>= AN 0.0))
	(SETQ ANWZ AN)
	(SETQ ANWZ (- AN PI))
      )
      (SETQ LEN (LENGTH INB2))
      (SETQ N 1)
      (SETQ PA (POLAR (CAR INB2) ANK (* SCA -1)))
      (SETQ PB (POLAR PA ANK (* SCA 11.0)))
      (if yx
	(COMMAND "line" PA PB "")
      )
      (SETQ N1 0)
      (WHILE (< N1 LEN)
	(SETQ PX111 (NTH N1 INB2))
	(SETQ PA (POLAR PX111 ANK (* SCA -1)))
	(SETQ PB (POLAR PA ANK (* SCA 11)))
	(if yx
	  (COMMAND "line" PA PB "")
	)
	(SETQ N1 (+ N1 1))
      )
      (SETQ PX1 (CAR INB2))
      (SETQ H  (Dl_GetTextHeight)
	    W  (DL_GetDimPrec)
	    SC (DL_GetDrawingFactor)
      )
      (WHILE (< N LEN)
	(SETVAR "plinewid" (/ (DL_GetLayerLineWidth "pp-bz-ccdx") SC))
	(SETQ PX2 (NTH N INB2))
	(SETQ PXX1 (POLAR (NTH N INB2) (+ AN11 (/ PI -4)) (* SCA 1.0)))
	(SETQ PXX2 (POLAR (NTH N INB2) (+ AN11 (/ PI -4)) (* SCA -1.0)))
	(COMMAND "pline" PXX1 PXX2 "")
	(IF (= N 1)
	  (PROGN (SETQ PXX1 (POLAR PX1 (+ AN11 (/ PI -4)) (* SCA 1.0)))
		 (SETQ PXX2 (POLAR PX1 (+ AN11 (/ PI -4)) (* SCA -1.0)))
		 (COMMAND "pline" PXX1 PXX2 "")
	  )
	)
	(SETQ AWZ (ANGLE PX1 PX2))
	(SETQ PWZ (POLAR PX1 AWZ (/ (DISTANCE PX1 PX2) 2.0)))
	(SETQ PWZ (POLAR PWZ AN11 (/ 1.5 SC)))
	(SETQ WZ (/ (NTH (- N 1) DDB2) 1000.0))
	(setq textstyle (DL_GetTextStyle))
	(COMMAND "text"
		 "s"
		 textstyle
		 "c"
		 PWZ
		 (/ H SC)
		 (* 180 (/ ANWZ PI))
		 (RTOS WZ 2 W)
	)
	(SETQ PX1 PX2)
	(SETQ N (+ N 1))
      )
    )

;;;main
    (if	(and bzptb (listp bzptb) (= 3 (length bzptb)))
      (progn
	(setq bb (reverse (cdr (reverse bzptb))))
	(dwjx3)
	(dwint mun)
	(dw-cx mun)
      )
    )
    (setq enb nil
	  bb  nil
    )
    (princ)
  )

  (defun get_ds	(style	   /	loop1	  ent  w    ang	 ang1 ang2 ang3
		 ri   ri1  ri11	ro   ro1  ro11 dis  dis1 o    o1   o2
		 oo   h	   p	p1   p10  p11  p2   p3	 pp   pp1  pp2
		 pp3  p21  p22	p30  p31  p32  p41  p42	 e    ee   e0
		 e00  e1   e10	e20  e2	  e11  e210 e22	 e220 e3   e30
		 e31  e32  e33	ee11 ee110     ee22 ee220     eee  eeee
		 eee0 eeee0	r    rr	  rrr  d1   d2	 d3   d4   d5
		 d6   d7   d8	d9   d10  d11  d12  po	 a1   fx   what
		 hc1  get_1
		)

    (defun get_1 (style / loop2)
      (setq loop2 t)
      (cond
	((or (= style 1) (= style 2) (= style 3) (= style 7))
	 (setq hh (get_tile "length"))
	 (setq rri (get_tile "rinside"))
	 (setq rro (get_tile "routside"))
	 (setq h (atof hh))
	 (setq ri (atof rri))
	 (setq ro (atof rro))
	 (if (not (or (chknum 0 hh) (chknum 0 rri) (chknum 0 rro)))
	   (progn
	     (setq hh (get_tile "length"))
	     (setq rri (get_tile "rinside"))
	     (setq rro (get_tile "routside"))
	     (setq h (atof hh))
	     (setq ri (atof rri))
	     (setq ro (atof rro))
	   )
	   (progn
	     (set_tile "error" "非法值!")
	     (setq loop2 nil)
	   )
	 )
	)
	((or (= style 4) (= style 5) (= style 6))
	 (setq hh (get_tile "length"))
	 (setq rri (get_tile "rinside"))
	 (setq rro (get_tile "routside"))
	 (setq rr (get_tile "radius"))
	 (setq h (atof hh))
	 (setq ri (atof rri))
	 (setq ro (atof rro))
	 (setq r (atof rr))
	 (if (not (or (chknum 0 hh)
		      (chknum 0 rri)
		      (chknum 0 rro)
		      (chknum 0 rr)
		  )
	     )
	   (progn
	     (setq hh (get_tile "length"))
	     (setq rri (get_tile "rinside"))
	     (setq rro (get_tile "routside"))
	     (setq rr (get_tile "radius"))
	     (setq h (atof hh))
	     (setq ri (atof rri))
	     (setq ro (atof rro))
	     (setq r (atof rr))
	   )
	   (progn
	     (set_tile "error" "非法值!")
	     (setq loop2 nil)
	   )
	 )
	)

	((= style 8)
	 (setq hh (get_tile "length"))
	 (setq rri (get_tile "rinside"))
	 (setq rro (get_tile "routside"))
	 (setq rri1 (get_tile "ri11"))
	 (setq rro1 (get_tile "ro11"))
	 (setq h (atof hh))
	 (setq ri (atof rri))
	 (setq ro (atof rro))
	 (setq ri1 (atof rri1))
	 (setq ro1 (atof rro1))
	 (if (not (or (chknum 0 hh)
		      (chknum 0 rri)
		      (chknum 0 rro)
		      (chknum 0 rri1)
		      (chknum 0 rro1)
		  )
	     )
	   (progn
	     (setq hh (get_tile "length"))
	     (setq rri (get_tile "rinside"))
	     (setq rro (get_tile "routside"))
	     (setq rri1 (get_tile "ri11"))
	     (setq rro1 (get_tile "ro11"))
	     (setq h (atof hh))
	     (setq ri (atof rri))
	     (setq ro (atof rro))
	     (setq ri1 (atof rri1))
	     (setq ro1 (atof rro1))
	     (done_dialog 1)
	   )
	   (progn
	     (set_tile "error" "非法值!")
	     (setq loop2 nil)
	   )
	 )
	)
      )
      loop2
    )


    (defun hc1 (style /)
      (cond
				((= style 1)
				 (setq h  8
				       ri 6
				       ro 24
				 )
				 (if (not (new_dialog "hc1" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (action_tile "accept" "(if (get_1 1) (done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (setq pp1 (polar p1 ang h))
				     (setq pp2 (polar p2 ang h))
				     (setq dis (sqrt (- (* ro ro) (* (/ w 2.0) (/ w 2.0)))))
				     (setq o (polar pp ang dis))
				     (command "arc" pp1 "e" pp2 o)
				     (setq a1 (entlast))
				     (setq e (polar o (+ ang (/ pi 2.0)) ro))
				     (setq ee (polar o (- ang (/ pi 2.0)) ro))
				     (command "circle" o ri)
				     (setq rr (+ ri (/ (- ro ri) 2.0)))
				     (setq p3 (polar p ang (- (+ dis h) (* rr 0.75))))
				     (setq rrr (sqrt (- (* rr rr) (* rr 0.75 rr 0.75))))
				     (setq p31 (polar p3 (+ ang (/ pi 2.0)) rrr))
				     (setq p32 (polar p3 (- ang (/ pi 2.0)) rrr))
				     (command "line" p1 pp1 "")
				     (setq e10 (entlast))
				     (setq e1 (polar p1 ang (/ h 2.0)))
				     (command "line" p2 pp2 "")
				     (setq e20 (entlast))
				     (setq e2 (polar p2 ang (/ h 2.0)))
				     (command "fillet" "r" h)
				     (command "fillet" (list a1 ee) (list e10 e1))
				     (command "fillet" (list a1 e) (list e20 e2))
				     (setq eee (polar o (+ ang (/ pi 2.0)) rr))
				     (setq eeee (polar o (- ang (/ pi 2.0)) rr))
				     (setq e3 (polar p ang (/ h 2.0)))
				     (command "arc" p32 "e" p31 o)
				     (setq e30 (entlast))
				     (command "line" p pp "")
				     (setq el (entlast))
				     (command "fillet" (list e30 eee) (list el e3))
				     (setq e0 (entlast))
				     (command "fillet" (list e30 eeee) (list el e3))
				     (setq e00 (entlast))
				     (command "change" e30 el e0 e00 "" "p" "c" "y" "")
				     (setq d1 (polar o (+ ang (/ pi 2.0)) ri)
								   d6 (polar o (- ang (/ pi 2.0)) ri)
								   d2 (polar o ang ro)
								   d3 (polar d2 (+ ang (/ pi 2.0)) ro)
								   d4 (polar d2 (- ang (/ pi 2.0)) ro)
								   d5 (polar d2 ang (/ h 2.0))
				     )
			
				     (dl_hcc_bz (list d6 d1 o) nil)
				     (dl_hcc_bz (list d3 d4 d5) t)
				   )
				 )
				)
				((= style 2)
				 (setq h  8
				       ri 34
				       ro 42
				 )
				 (if (not (new_dialog "hc2" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (action_tile "accept" "(if (get_1 2)(done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (setq pp1 (polar p1 ang h))
				     (setq pp2 (polar p2 ang h))
				     (setq dis (/ ri 2.0))
				     (setq dis1 (/ ro 2.4))
				     (setq o (polar pp ang dis))
				     (command "line" p pp "")
				     (setq el (entlast))
				     (setq e (polar o (+ ang (/ pi 2.0)) dis1))
				     (setq ee (polar o (- ang (/ pi 2.0)) dis1))
				     (command "line" o e "")
				     (setq e0 (entlast))
				     (command "line" o ee "")
				     (setq e00 (entlast))
				     (setq rrr (/ (- ro w) 2.0))
				     (setq p31 (polar pp2 (+ ang (/ pi 2.0)) rrr))
				     (setq p32 (polar pp1 (- ang (/ pi 2.0)) rrr))
				     (command "line" p31 pp2 "")
				     (setq e10 (entlast))
				     (command "line" p32 pp1 "")
				     (setq e20 (entlast))
				     (setq p21 (polar p31 ang ri))
				     (setq p22 (polar p32 ang ri))
				     (command "line" p31 p21 "")
				     (command "line" p32 p22 "")
				     (command "line" p21 p22 "")
				     (setq e3 (polar p ang (/ h 2.0)))
				     (command "fillet" "r" (/ dis1 2.0))
				     (command "fillet" (list e00 ee) (list el e3))
				     (setq e11 (entlast))
				     (command "fillet" (list e0 e) (list el e3))
				     (setq e22 (entlast))
				     (command "line" e ee "")
				     (setq e33 (entlast))
				     (command "change" el e0 e00 e11 e22 e33 "" "p" "c" "y" "")
				     (command "line" p2 pp2 "")
				     (setq eee0 (entlast))
				     (command "line" p1 pp1 "")
				     (setq eeee0 (entlast))
				     (setq eee (polar p2 ang (/ h 2.0)))
				     (setq eeee (polar p1 ang (/ h 2.0)))
				     (setq e1 (polar pp2 (+ ang (/ pi 2.0)) (/ rrr 2.0)))
				     (setq e2 (polar pp1 (- ang (/ pi 2.0)) (/ rrr 2.0)))
				     (command "fillet" "r" (/ rrr 4.0))
				     (command "fillet" (list eee0 eee) (list e10 e1))
				     (command "fillet" (list eeee0 eeee) (list e20 e2))
				     (setq d1 (polar p21 ang (/ ri 10.0))
					   d2 (polar p22 ang (/ ri 10.0))
					   d3 (polar o ang (/ ri 1.2))
				     )
				     (dl_hcc_bz (list d1 d2 d3) t)
				   )
				 )
				)
				((= style 3)
				 (setq h  8
				       ri 34
				       ro 12
				       fx "fright"
				 )
				 (if (not (new_dialog "hc3" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (action_tile "right" "(setq fx \"fright\")")
				 (action_tile "left" "(setq fx \"fleft\")")
				 (action_tile "accept" "(if (get_1 3) (done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (if (= fx "fright")
				       (progn
								 (setq pp1 (polar p1 ang h))
								 (setq pp2 (polar p2 ang (+ h ri)))
								 (setq dis (/ (- ri ro) 4.0))
								 (setq o (polar pp ang (/ ro 2.0)))
								 (command "line" p o "")
								 (setq el (entlast))
								 (setq
								   e
								    (polar o (- ang (/ pi 2.0)) (- ri dis (/ w 2.0)))
								 )
								 (setq ee (polar pp ang (- ri dis)))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (command "line" o ee "")
								 (setq e00 (entlast))
								 (setq p31 (polar pp2 (- ang (/ pi 2.0)) ro))
								 (setq p32 (polar p31 (- ang pi) (- ri ro)))
								 (command "line" p2 pp2 "")
								 (command "line" p31 pp2 "")
								 (setq p21 (polar p32 (- ang (/ pi 2.0)) (- ri ro)))
								 (setq p22 (polar p21 (- ang pi) ro))
								 (command "line" p31 p32 "")
								 (setq eee0 (entlast))
								 (command "line" p32 p21 "")
								 (setq e10 (entlast))
								 (command "line" p21 p22 "")
								 (command "line" pp1 p22 "")
								 (setq e20 (entlast))
								 (command "line" p1 pp1 "")
								 (setq eeee0 (entlast))
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" dis)
								 (command "fillet" (list e00 ee) (list e0 e))
								 (setq e11 (entlast))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e22 (entlast))
								 (command "line" p ee "")
								 (setq e30 (entlast))
								 (command "change" el e0 e00 e11 e22 e30 "" "p"	"c" "y"
									  "")
								 (setq eee (polar p32 ang dis))
								 (setq eeee (polar p1 ang (/ h 2.0)))
								 (setq e1 (polar p32 (angle p32 p21) dis))
								 (setq
								   e2 (polar pp1 (angle pp1 p22) (/ (- ri w) 2.0))
								 )
								 (command "fillet" "r" dis)
								 (command "fillet" (list eee0 eee) (list e10 e1))
								 (command "fillet" "r" dis)
								 (command "fillet" (list eeee0 eeee) (list e20 e2))
								 (setq d1 (polar pp2 ang (/ ri 10.0))
								       d2 (polar p31 ang (/ ri 10.0))
								       d3 (polar pp ang (/ ri 0.8))
								       d4 (polar pp2 (+ ang (/ pi 2.0)) (/ ri 10.0))
								       d5 (polar d4 (+ ang pi) ri)
								       d6 (polar o
										 (+ ang (/ pi 2.0))
										 (+ (/ ri 4.0) (/ w 2.0))
									  )
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d5 d4 d6) t)
				       )
				     )
				     (if (= fx "fleft")
				       (progn
								 (setq pp2 (polar p2 ang h))
								 (setq pp1 (polar p1 ang (+ h ri)))
								 (setq dis (/ (- ri ro) 4.0))
								 (setq o (polar pp ang (/ ro 2.0)))
								 (command "line" p o "")
								 (setq el (entlast))
								 (setq
								   e
								    (polar o (+ ang (/ pi 2.0)) (- ri dis (/ w 2.0)))
								 )
								 (setq ee (polar pp ang (- ri dis)))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (command "line" o ee "")
								 (setq e00 (entlast))
								 (setq p31 (polar pp1 (+ ang (/ pi 2.0)) ro))
								 (setq p32 (polar p31 (- ang pi) (- ri ro)))
								 (command "line" p1 pp1 "")
								 (command "line" p31 pp1 "")
								 (setq p21 (polar p32 (+ ang (/ pi 2.0)) (- ri ro)))
								 (setq p22 (polar p21 (- ang pi) ro))
								 (command "line" p31 p32 "")
								 (setq eee0 (entlast))
								 (command "line" p32 p21 "")
								 (setq e10 (entlast))
								 (command "line" p21 p22 "")
								 (command "line" pp2 p22 "")
								 (setq e20 (entlast))
								 (command "line" p2 pp2 "")
								 (setq eeee0 (entlast))
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" dis)
								 (command "fillet" (list e00 ee) (list e0 e))
								 (setq e11 (entlast))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e22 (entlast))
								 (command "line" p ee "")
								 (setq e30 (entlast))
								 (command "change" el e0 e00 e11 e22 e30 "" "p"	"c" "y"
									  "")
								 (setq eee (polar p32 ang dis))
								 (setq eeee (polar p2 ang (/ h 2.0)))
								 (setq e1 (polar p32 (angle p32 p21) dis))
								 (setq
								   e2 (polar pp2 (angle pp2 p22) (/ (- ri w) 2.0))
								 )
								 (command "fillet" "r" dis)
								 (command "fillet" (list eee0 eee) (list e10 e1))
								 (command "fillet" "r" dis)
								 (command "fillet" (list eeee0 eeee) (list e20 e2))
								 (setq d1 (polar pp1 ang (/ ri 10.0))
								       d2 (polar p31 ang (/ ri 10.0))
								       d3 (polar pp ang (/ ri 0.8))
								       d4 (polar pp1 (- ang (/ pi 2.0)) (/ ri 10.0))
								       d5 (polar d4 (+ ang pi) ri)
								       d6 (polar o
										 (- ang (/ pi 2.0))
										 (+ (/ ri 4.0) (/ w 2.0))
									  )
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d5 d4 d6) t)
				       )
				     )
				   )
				 )
				)
				((= style 4)
				 (setq h  8
				       ri 10
				       ro 48
				       r  6
				 )
				 (if (not (new_dialog "hc4" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (set_tile "radius" (rtos r 2 2))
				 (action_tile "accept" "(if (get_1 4)(done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (setq pp1 (polar p1 ang h))
				     (setq pp2 (polar p2 ang h))
				     (setq dis (/ ri 2.0))
				     (setq dis1 (/ ro 2.5))
				     (setq o (polar pp ang dis))
				     (command "line" p pp "")
				     (setq el (entlast))
				     (setq e (polar o (+ ang (/ pi 2.0)) dis1))
				     (setq ee (polar o (- ang (/ pi 2.0)) dis1))
				     (command "line" o e "")
				     (setq e0 (entlast))
				     (command "line" o ee "")
				     (setq e00 (entlast))
				     (setq rrr (/ (- ro w) 2.0))
				     (setq p31 (polar pp2 (+ ang (/ pi 2.0)) rrr))
				     (setq p32 (polar pp1 (- ang (/ pi 2.0)) rrr))
				     (command "line" p31 pp2 "")
				     (setq e10 (entlast))
				     (command "line" p32 pp1 "")
				     (setq e20 (entlast))
				     (setq p21 (polar p31 ang ri))
				     (setq p22 (polar p32 ang ri))
				     (command "line" p31 p21 "")
				     (command "line" p32 p22 "")
				     (command "line" p21 p22 "")
				     (setq e3 (polar p ang (/ h 2.0)))
				     (command "fillet" "r" r)
				     (command "fillet" (list e00 ee) (list el e3))
				     (setq e11 (entlast))
				     (command "fillet" (list e0 e) (list el e3))
				     (setq e22 (entlast))
				     (command "line" e ee "")
				     (setq e33 (entlast))
				     (command "change" el e0 e00 e11 e22 e33 "" "p" "c" "y" "")
				     (command "line" p2 pp2 "")
				     (setq eee0 (entlast))
				     (command "line" p1 pp1 "")
				     (setq eeee0 (entlast))
				     (setq eee (polar p2 ang (/ h 2.0)))
				     (setq eeee (polar p1 ang (/ h 2.0)))
				     (setq e1 (polar pp2 (+ ang (/ pi 2.0)) (/ rrr 2.0)))
				     (setq e2 (polar pp1 (- ang (/ pi 2.0)) (/ rrr 2.0)))
				     (command "fillet" "r" r)
				     (command "fillet" (list eee0 eee) (list e10 e1))
				     (command "fillet" (list eeee0 eeee) (list e20 e2))
				     (setq d1 (polar p21 ang (/ ri 6.0))
								   d2 (polar p22 ang (/ ri 6.0))
								   d3 (polar o ang (/ ri 0.9))
								   d4 (polar p31 (+ ang (/ pi 2.0)) (/ ri 4.0))
								   d5 (polar p21 (+ ang (/ pi 2.0)) (/ ri 4.0))
								   d6 (polar o (+ ang (/ pi 2.0)) (/ ro 1.6))
				     )
			
				     (dl_hcc_bz (list d1 d2 d3) t)
				     (dl_hcc_bz (list d4 d5 d6) t)
				   )
				 )
				)
				((= style 5)
				 (setq h  12
				       ri 24
				       ro 8
				       r  4
				       fx "fright"
				 )
				 (if (not (new_dialog "hc5" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (set_tile "radius" (rtos r 2 2))
				 (action_tile "right" "(setq fx \"fright\")")
				 (action_tile "left" "(setq fx \"fleft\")")
				 (action_tile "accept" "(if (get_1 5) (done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (if (= fx "fright")
				       (progn
								 (setq pp1 (polar p1 ang h))
								 (setq pp2 (polar p2 ang (+ h ri)))
								 (setq dis (/ (- ri ro) 4.0))
								 (setq o (polar pp ang (/ ro 2.0)))
								 (command "line" p o "")
								 (setq el (entlast))
								 (setq
								   e
								    (polar o (- ang (/ pi 2.0)) (- ri dis (/ w 2.0)))
								 )
								 (setq ee (polar pp ang (- ri dis)))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (command "line" o ee "")
								 (setq e00 (entlast))
								 (setq p31 (polar pp2 (- ang (/ pi 2.0)) w))
								 (setq p32 (polar p31 (- ang pi) (- ri ro)))
								 (command "line" p2 pp2 "")
								 (command "line" p31 pp2 "")
								 (setq p21 (polar p32 (- ang (/ pi 2.0)) (- ri w)))
								 (setq p22 (polar p21 (- ang pi) ro))
								 (command "line" p31 p32 "")
								 (setq eee0 (entlast))
								 (command "line" p32 p21 "")
								 (setq e10 (entlast))
								 (command "line" p21 p22 "")
								 (command "line" pp1 p22 "")
								 (setq e20 (entlast))
								 (command "line" p1 pp1 "")
								 (setq eeee0 (entlast))
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" r)
								 (command "fillet" (list e00 ee) (list e0 e))
								 (setq e11 (entlast))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e22 (entlast))
								 (command "line" p ee "")
								 (setq e30 (entlast))
								 (command "change" el e0 e00 e11 e22 e30 "" "p"	"c" "y"
									  "")
								 (setq eee (polar p32 ang dis))
								 (setq eeee (polar p1 ang (/ h 2.0)))
								 (setq e1 (polar p32 (- ang (/ pi 2.0)) dis))
								 (setq
								   e2
								    (polar pp1 (- ang (/ pi 2.0)) (/ (- ri w) 2.0))
								 )
								 (command "fillet" "r" r)
								 (command "fillet" (list eee0 eee) (list e10 e1))
								 (command "fillet" "r" (/ (- ri w) 2.0))
								 (command "fillet" (list eeee0 eeee) (list e20 e2))
								 (setq d1 (polar pp2 ang (/ ri 10.0))
								       d2 (polar p31 ang (/ ri 10.0))
								       d3 (polar pp ang (/ ri 0.8))
								       d4 (polar pp2 (+ ang (/ pi 2.0)) (/ ri 10.0))
								       d5 (polar d4 (+ ang pi) ri)
								       d6 (polar o
										 (+ ang (/ pi 2.0))
										 (+ (/ ri 4.0) (/ w 2.0))
									  )
								       d7 (polar p22 (- ang (/ pi 2.0)) (/ ri 2.5))
								       d8 (polar d7 ang ro)
								       d9 (polar o (- ang (/ pi 2.0)) (* 1.2 ri))
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d5 d4 d6) t)
								 (dl_hcc_bz (list d7 d8 d9) t)
				       )
				     )
				     (if (= fx "fleft")
				       (progn
								 (setq pp2 (polar p2 ang h))
								 (setq pp1 (polar p1 ang (+ h ri)))
								 (setq dis (/ (- ri ro) 4.0))
								 (setq o (polar pp ang (/ ro 2.0)))
								 (command "line" p o "")
								 (setq el (entlast))
								 (setq
								   e
								    (polar o (+ ang (/ pi 2.0)) (- ri dis (/ w 2.0)))
								 )
								 (setq ee (polar pp ang (- ri dis)))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (command "line" o ee "")
								 (setq e00 (entlast))
								 (setq p31 (polar pp1 (+ ang (/ pi 2.0)) w))
								 (setq p32 (polar p31 (- ang pi) (- ri ro)))
								 (command "line" p1 pp1 "")
								 (command "line" p31 pp1 "")
								 (setq p21 (polar p32 (+ ang (/ pi 2.0)) (- ri w)))
								 (setq p22 (polar p21 (- ang pi) ro))
								 (command "line" p31 p32 "")
								 (setq eee0 (entlast))
								 (command "line" p32 p21 "")
								 (setq e10 (entlast))
								 (command "line" p21 p22 "")
								 (command "line" pp2 p22 "")
								 (setq e20 (entlast))
								 (command "line" p2 pp2 "")
								 (setq eeee0 (entlast))
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" r)
								 (command "fillet" (list e00 ee) (list e0 e))
								 (setq e11 (entlast))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e22 (entlast))
								 (command "line" p ee "")
								 (setq e30 (entlast))
								 (command "change" el e0 e00 e11 e22 e30 "" "p"	"c" "y"
									  "")
								 (setq eee (polar p32 ang dis))
								 (setq eeee (polar p2 ang (/ h 2.0)))
								 (setq e1 (polar p32 (+ ang (/ pi 2.0)) dis))
								 (setq
								   e2
								    (polar pp2 (+ ang (/ pi 2.0)) (/ (- ri w) 2.0))
								 )
								 (command "fillet" "r" r)
								 (command "fillet" (list eee0 eee) (list e10 e1))
								 (command "fillet" "r" (/ (- ri w) 2.0))
								 (command "fillet" (list eeee0 eeee) (list e20 e2))
								 (setq d1 (polar pp1 ang (/ ri 10.0))
								       d2 (polar p31 ang (/ ri 10.0))
								       d3 (polar pp ang (/ ri 0.8))
								       d4 (polar pp1 (- ang (/ pi 2.0)) (/ ri 10.0))
								       d5 (polar d4 (+ ang pi) ri)
								       d6 (polar o
										 (- ang (/ pi 2.0))
										 (+ (/ ri 4.0) (/ w 2.0))
									  )
								       d7 (polar p22 (+ ang (/ pi 2.0)) (/ ri 2.5))
								       d8 (polar d7 ang ro)
								       d9 (polar o (+ ang (/ pi 2.0)) (* 1.2 ri))
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d5 d4 d6) t)
								 (dl_hcc_bz (list d7 d8 d9) t)
				       )
				     )
				   )
				 )
				)
				((= style 6)
				 (setq h  8
				       ri 12
				       ro 24
				       r  8
				 )
				 (if (not (new_dialog "hc6" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (set_tile "radius" (rtos r 2 2))
				 (action_tile "accept" "(if (get_1 6)(done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (setq pp1 (polar p1 ang h))
				     (setq pp2 (polar p2 ang h))
				     (setq dis (/ ri 2.0))
				     (setq dis1 (/ ro 4.0))
				     (setq o1 (polar pp2 (- ang (/ pi 6.0)) dis))
				     (setq o2 (polar pp1 (+ ang (/ pi 6.0)) dis))
				     (command "line" p pp "")
				     (setq el (entlast))
				     (setq e (polar o1 (+ ang (/ pi 3.0)) (* 0.8 ro)))
				     (setq ee (polar o2 (- ang (/ pi 3.0)) (* 0.8 ro)))
				     (command "line" o1 e "")
				     (setq e0 (entlast))
				     (command "line" o2 ee "")
				     (setq e00 (entlast))
				     (setq rrr (/ (- (* 1.732 ro) ri) 2.0))
				     (setq p31 (polar pp2 (+ ang (/ pi 3.0)) ro))
				     (setq p32 (polar pp1 (- ang (/ pi 3.0)) ro))
				     (command "line" p31 pp2 "")
				     (setq e10 (entlast))
				     (command "line" p32 pp1 "")
				     (setq e20 (entlast))
				     (setq p21 (polar p31 (- ang (/ pi 6.0)) ri))
				     (setq p22 (polar p32 (+ ang (/ pi 6.0)) ri))
				     (command "line" p31 p21 "")
				     (command "line" p32 p22 "")
				     (setq p41 (polar pp2 (- ang (/ pi 6.0)) ri))
				     (setq p42 (polar pp1 (+ ang (/ pi 6.0)) ri))
				     (command "line" p21 p41 "")
				     (setq ee110 (entlast))
				     (command "line" p22 p42 "")
				     (setq ee220 (entlast))
				     (setq e3 (polar p ang (/ h 2.5)))
				     (command "fillet" "r" r)
				     (command "fillet" (list e00 ee) (list el e3))
				     (setq e11 (entlast))
				     (command "fillet" (list e0 e) (list el e3))
				     (setq e22 (entlast))
				     (command "fillet" (list e0 e) (list e00 ee))
				     (setq e33 (entlast))
				     (command "change" el e0 e00 e11 e22 e33 "" "p" "c" "y" "")
				     (command "line" p2 pp2 "")
				     (setq eee0 (entlast))
				     (command "line" p1 pp1 "")
				     (setq eeee0 (entlast))
				     (setq eee (polar p2 ang (/ h 2.0)))
				     (setq eeee (polar p1 ang (/ h 2.0)))
				     (setq e1 (polar pp2 (+ ang (/ pi 3.0)) (/ ro 2.0)))
				     (setq e2 (polar pp1 (- ang (/ pi 3.0)) (/ ro 2.0)))
				     (setq ee11 (polar p41 (+ ang (/ pi 3.0)) (/ ro 2.0)))
				     (setq ee22 (polar p42 (- ang (/ pi 3.0)) (/ ro 2.0)))
				     (command "fillet" "r" r)
				     (command "fillet" (list eee0 eee) (list e10 e1))
				     (command "fillet" (list eeee0 eeee) (list e20 e2))
				     (command "fillet" (list ee110 ee11) (list ee220 ee22))
				     (setq d1 (polar p31 ang (/ ri 0.9))
								   d2 (polar p32 ang (/ ri 0.9))
								   d3 (polar o1 ang (/ ro 0.9))
								   d4 (polar pp2 (+ ang (/ pi 2.0)) (/ ri 0.6))
								   d5 (polar p21 (+ ang (/ pi 2.0)) (- (/ ri 0.61) rrr))
								   d6 (polar o1 (+ ang (/ pi 2.0)) (/ ro 0.8))
				     )
			
				     (dl_hcc_bz (list d1 d2 d3) t)
				     (dl_hcc_bz (list d4 d5 d6) t)
				   )
				 )
				)
				((= style 7)
				 (setq h  8
				       ri 28
				       ro 24
				 )
				 (if (not (new_dialog "hc7" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (action_tile "accept" "(if (get_1 7) (done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (setq pp (polar p ang h))
				     (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
				     (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
				     (setq pp1 (polar p1 ang h))
				     (setq pp2 (polar p2 ang h))
				     (setq dis (/ ro 2.0))
				     (setq o (polar pp ang (* 0.8 ri)))
				     (setq oo (polar pp ang ri))
				     (command "line" pp p "")
				     (setq el (entlast))
				     (setq e (polar o (+ ang (/ pi 2.0)) (* dis 0.6)))
				     (setq ee (polar o (- ang (/ pi 2.0)) (* dis 0.6)))
				     (command "line" o e "")
				     (setq e0 (entlast))
				     (command "line" o ee "")
				     (setq e00 (entlast))
				     (setq p31 (polar oo (+ ang (/ pi 2.0)) dis))
				     (setq p32 (polar oo (- ang (/ pi 2.0)) dis))
				     (setq p21 (polar pp2 (angle pp2 p31) (/ ri 2.0)))
				     (setq p22 (polar pp1 (angle pp1 p32) (/ ri 2.0)))
				     (command "line" p22 pp1 "")
				     (command "line" p21 pp2 "")
				     (setq e3 (polar p ang (/ h 2.0)))
				     (command "fillet" "r" (* dis 0.5))
				     (command "fillet" (list e00 ee) (list el e3))
				     (setq e30 (entlast))
				     (command "fillet" (list e0 e) (list el e3))
				     (setq e31 (entlast))
				     (setq eee (polar oo (+ ang (/ pi 2.0)) (/ dis 2.0)))
				     (setq eeee (polar oo (- ang (/ pi 2.0)) (/ dis 2.0)))
				     (command "line" oo p31 "")
				     (setq eee0 (entlast))
				     (command "line" oo p32 "")
				     (setq eeee0 (entlast))
				     (command "line" p31 pp2 "")
				     (setq p210 (entlast))
				     (command "line" p32 pp1 "")
				     (setq p220 (entlast))
				     (command "line" pp2 p2 "")
				     (command "line" pp1 p1 "")
				     (command "fillet" "r" (* 0.4 dis))
				     (command "fillet" (list eee0 eee) (list p210 p21))
				     (command "fillet" (list eeee0 eeee) (list p220 p22))
				     (command "line" e ee "")
				     (setq e32 (entlast))
				     (command "change" e30 e31 e32 el e0 e00 "" "p" "c" "y" "")
				     (setq d1 (polar pp (+ ang (/ pi 2.0)) (* 0.6 ro))
					   d2 (polar oo (+ ang (/ pi 2.0)) (* 0.6 ro))
					   d3 (polar o (+ ang (/ pi 2.0)) (* 0.8 ro))
					   d4 (polar p31 ang (* 0.2 ri))
					   d5 (polar p32 ang (* 0.2 ri))
					   d6 (polar oo ang (* 0.4 ri))
				     )
			
				     (dl_hcc_bz (list d1 d2 d3) t)
				     (dl_hcc_bz (list d4 d5 d6) t)
				   )
				 )
				)
				((= style 8)
				 (setq h   8
				       ri  42
				       ro  36
				       ri1 8
				       ro1 8
				       fx  "fright"
				 )
				 (if (not (new_dialog "hc8" dcl_id))
				   (exit)
				 )
				 (set_tile "length" (rtos h 2 2))
				 (set_tile "rinside" (rtos ri 2 2))
				 (set_tile "routside" (rtos ro 2 2))
				 (set_tile "ri11" (rtos ri1 2 2))
				 (set_tile "ro11" (rtos ro1 2 2))
				 (action_tile "right" "(setq fx \"fright\")")
				 (action_tile "left" "(setq fx \"fleft\")")
				 (action_tile "accept" "(if (get_1 8)(done_dialog 1))")
				 (setq what (start_dialog))
				 (if (= what 1)
				   (progn
				     (if (= fx "fright")
				       (progn
								 (setq pp (polar p ang h))
								 (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
								 (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
								 (setq pp1 (polar p1 ang h))
								 (setq pp2 (polar p2 ang (+ ri h)))
								 (setq dis (- ri (/ ri1 2.20)))
								 (setq dis1 (/ ro 1.5))
								 (setq o (polar pp ang dis))
								 (command "line" p pp "")
								 (setq el (entlast))
								 (setq e (polar o (- ang (/ pi 2.0)) dis1))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (setq p31 (polar pp2 (- ang (/ pi 2.0)) ro))
								 (setq p32 (polar p31 (- ang pi) ri1))
								 (command "line" p31 pp2 "")
								 (setq eeee0 (entlast))
								 (command "line" p32 p31 "")
								 (setq p21 (polar p32 (+ ang (/ pi 2.0)) ro1))
								 (command "line" p32 p21 "")
								 (command "line" p2 pp2 "")
								 (setq eee0 (entlast))
								 (command "line" p21 pp1 "")
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" (* 0.6 ro))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e11 (entlast))
								 (command "line" p1 pp1 "")
								 (command "line" o e "")
								 (setq e00 (entlast))
								 (command "fillet" "r" (* 0.1 ro))
								 (command "fillet" (list e00 e) (list el e3))
								 (setq e30 (entlast))
								 (command "change" el e0 e11 e00 e30 "" "p" "c" "y" "")
								 (setq eee (polar p2 ang h))
								 (setq eeee (polar pp2 (- ang (/ pi 2.0)) (/ ro 2.0)))
								 (command "fillet" "r" (* ro 0.2))
								 (command "fillet" (list eee0 eee) (list eeee0 eeee))
								 (setq d1  (polar pp2 ang (/ ri 6.0))
								       d2  (polar p31 ang (/ ri 6.0))
								       d3  (polar o ang (/ ri 2.0))
								       d4  (polar eee (+ ang (/ pi 2.0)) (/ ro 4.0))
								       d5  (polar pp2 (+ ang (/ pi 2.0)) (/ ro 4.0))
								       d6  (polar o (+ ang (/ pi 2.0)) (/ ro 1.5))
								       d7  (polar p21 (- ang pi) (/ ri 3.0))
								       d8  (polar p32 (- ang pi) (/ ri 3.0))
								       d9  (polar p32 (- ang pi) (/ ri 2.5))
								       d10 (polar p32 (- ang (/ pi 2.0)) (/ ro 3.5))
								       d11 (polar p31 (- ang (/ pi 2.0)) (/ ro 3.5))
								       d12 (polar p32 (- ang (/ pi 2.0)) (/ ro 3.0))
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d4 d5 d6) t)
								 (dl_hcc_bz (list d7 d8 d9) t)
								 (dl_hcc_bz (list d10 d11 d12) t)
				       )
				     )
				     (if (= fx "fleft")
				       (progn
								 (setq pp (polar p ang h))
								 (setq p1 (polar p (- ang (/ pi 2.0)) (/ w 2.0)))
								 (setq p2 (polar p (+ ang (/ pi 2.0)) (/ w 2.0)))
								 (setq pp2 (polar p2 ang h))
								 (setq pp1 (polar p1 ang (+ ri h)))
								 (setq dis (- ri (/ ri1 2.20)))
								 (setq dis1 (/ ro 1.5))
								 (setq o (polar pp ang dis))
								 (command "line" p pp "")
								 (setq el (entlast))
								 (setq e (polar o (+ ang (/ pi 2.0)) dis1))
								 (command "line" o e "")
								 (setq e0 (entlast))
								 (setq p31 (polar pp1 (+ ang (/ pi 2.0)) ro))
								 (setq p32 (polar p31 (- ang pi) ri1))
								 (command "line" p31 pp1 "")
								 (setq eeee0 (entlast))
								 (command "line" p32 p31 "")
								 (setq p21 (polar p32 (- ang (/ pi 2.0)) ro1))
								 (command "line" p32 p21 "")
								 (command "line" p1 pp1 "")
								 (setq eee0 (entlast))
								 (command "line" p21 pp2 "")
								 (setq e3 (polar p ang (/ h 2.0)))
								 (command "fillet" "r" (* 0.6 ro))
								 (command "fillet" (list e0 e) (list el e3))
								 (setq e11 (entlast))
								 (command "line" p2 pp2 "")
								 (command "line" o e "")
								 (setq e00 (entlast))
								 (command "fillet" "r" (* 0.1 ro))
								 (command "fillet" (list e00 e) (list el e3))
								 (setq e30 (entlast))
								 (command "change" el e0 e11 e00 e30 "" "p" "c" "y" "")
								 (setq eee (polar p1 ang h))
								 (setq eeee (polar pp1 (+ ang (/ pi 2.0)) (/ ro 2.0)))
								 (command "fillet" "r" (* ro 0.2))
								 (command "fillet" (list eee0 eee) (list eeee0 eeee))
								 (setq d1  (polar pp1 ang (/ ri 6.0))
								       d2  (polar p31 ang (/ ri 6.0))
								       d3  (polar o ang (/ ri 2.0))
								       d4  (polar eee (- ang (/ pi 2.0)) (/ ro 4.0))
								       d5  (polar pp1 (- ang (/ pi 2.0)) (/ ro 4.0))
								       d6  (polar o (- ang (/ pi 2.0)) (/ ro 1.5))
								       d7  (polar p21 (- ang pi) (/ ri 3.0))
								       d8  (polar p32 (- ang pi) (/ ri 3.0))
								       d9  (polar p32 (- ang pi) (/ ri 2.5))
								       d10 (polar p32 (+ ang (/ pi 2.0)) (/ ro 3.5))
								       d11 (polar p31 (+ ang (/ pi 2.0)) (/ ro 3.5))
								       d12 (polar p32 (+ ang (/ pi 2.0)) (/ ro 3.0))
								 )
						
								 (dl_hcc_bz (list d1 d2 d3) t)
								 (dl_hcc_bz (list d4 d5 d6) t)
								 (dl_hcc_bz (list d7 d8 d9) t)
								 (dl_hcc_bz (list d10 d11 d12) t)
				       )
				     )
				   )
				 )
				)
      )
    )
;;;;end of define for built-in function



    (setq loop1 t)
    (while (and loop1 (null ent))
     ;;; (setq os (getvar "osmode"))
      (sa_osmode)
      (setvar "osmode" 1)
      (initget "U")
      (setq p (getpoint "\n 回车退出 / 回退 U / 拾取道路中心线端点:"))
     ;; (setvar "osmode" os)
      (re_osmode)
      (cond
				((null p)
				 (setq loop1 nil
				       ent nil
				 )
				)
				((= p "U")
				 (setq ent nil)
				 (if (<= (getvar "undomarks") uctr)
				   (prompt "\n已全部回退!")
				   (progn
				     (if (= 13 (getvar "undoctl"))
				       (command ".undo" "e")
				     )
				     (command ".undo" "b")
				   )
				 )
				)
				(t
				 (if (null (setq ent (mentselp p  (list (cons 8 "AXIS") (cons 0 "LINE,ARC") (list -3 '("SZDLZYXX")))
								   nil
						      )
								   )
				     )
				   (prompt "\n 没有选中道路中心线端点")
				   (progn
				     (HY_UndoM)
				       (progn
								 (#ppas "drawroad")
								 (setq wb_dlcs (arx_dllk ent p))
								 (setq w (szz_tlysk_lsp wb_dlcs "L"))
								 (setq w (* w 2.0))
				       )
		
				     (cond  ;;得到朝向路外的切线方向角
				       ((= (cdr (assoc 0 (entget ent))) "LINE")
								(setq p10 (cdr (assoc 10 (entget ent)))
								      p11 (cdr (assoc 11 (entget ent)))
								)
								(if (> (distance p p10) (distance p p11))
								  (setq ang (angle p10 p11))
								  (setq ang (angle p11 p10))
								)
				       )
				       ((= (cdr (assoc 0 (entget ent))) "ARC")
								(setq ang1 (cdr (assoc 50 (entget ent)))
								      ang2 (cdr (assoc 51 (entget ent)))
								      po   (cdr (assoc 10 (entget ent)))
								      ang3 (angle po p)
								)
								(if (< (abs (- ang1 ang3)) 0.1)
								  (setq ang (- ang3 (/ pi 2.0)))
								)
								(if (< (abs (- ang2 ang3)) 0.1)
								  (setq ang (+ ang3 (/ pi 2.0)))
								)
				       )
				     )
				     (hc1 style)
				     (setq ent nil)
				   )
				 )
				)
      )
    )
  )

  (HY_SV)
  (HY_Set0)
  (setq uctr (HY_ClearUNDO))
  (DL_MakeLayer "pp-dl-hcc")
  (if (< (setq dcl_id (szdl_load_dlg "dl_hcc1.dcl"))
				 0
      )
    (exit)
  )
  (if (not (new_dialog "hc" dcl_id))
    (exit)
  )
  (setq what1 2)
  (while (> what1 0)
    (playsld "dl_hcc1.sld" "11")
    (playsld "dl_hcc2.sld" "22")
    (playsld "dl_hcc3.sld" "33")
    (playsld "dl_hcc4.sld" "44")
    (playsld "dl_hcc5.sld" "55")
    (playsld "dl_hcc6.sld" "66")
    (playsld "dl_hcc7.sld" "77")
    (playsld "dl_hcc8.sld" "88")
    (action_tile "11" "(done_dialog 2)")
    (action_tile "22" "(done_dialog 3)")
    (action_tile "33" "(done_dialog 4)")
    (action_tile "44" "(done_dialog 5)")
    (action_tile "55" "(done_dialog 6)")
    (action_tile "66" "(done_dialog 7)")
    (action_tile "77" "(done_dialog 8)")
    (action_tile "88" "(done_dialog 9)")
    (action_tile "accept" "(done_dialog 1)")
    (setq what1 (start_dialog))
    (cond
      ((= what1 2) (get_ds 1))
      ((= what1 3) (get_ds 2))
      ((= what1 4) (get_ds 3))
      ((= what1 5) (get_ds 4))
      ((= what1 6) (get_ds 3))
      ((= what1 7) (get_ds 6))
      ((= what1 8) (get_ds 7))
      ((= what1 9) (get_ds 8))
    )
  )
  (unload_dialog dcl_id)
  (HY_Set1)
  (HY_RV)
  (princ)
)    ;end of defun
;;
;;
(princ)
