;;;------------------------------
;;; 1998.03.05 thu
;;; 地形断面
;;;------------------------------
(defun dxdm (/	    laydm  layzr  laysj	 laybj	laypt  pdold  orold
	     p00    p01	   p02	  ptb	 ang	fhb    ptbgb  zrbgb
	     sjbgb  zrmin  zrmax  sjmin	 sjmax	bgmin  bgmax  ccc
	     aa	    bb	   dd	  hh	 ww	app    ss1    ss2
	     iiii   nnnn   zr_triangle   sj_triangle
	    )
	    
(defun dxdm_error(ccc / )
  (DL_Destory_TRiAngle  zr_triangle)
  (DL_Destory_TRiAngle  sj_triangle)
)
  
  (HY_SV)
  (HY_UndoM)
  (setq	laydm "PP-TF-DM"
	layzr "PP-TF-DMZ"
	laysj "PP-TF-DMS"
	laybj "PP-TF-BJ"
	laypt "PP-DX-PT,PP-SJ-PT"
  )
;;;  (mk_lay "PP-TF-DM*")
  (mk_lay laydm)
  (mk_lay layzr)
  (mk_lay laysj)
  (mk_lay laybj)
  (mk_lay "PP-DX-PT")
  (mk_lay "PP-SJ-PT")

  (setvar "clayer" laydm)
  (setvar "plinewid" 0.0)
  (setq orold (getvar "orthomode"))
					;-------------------------------------------------------
  (setq hh (/ (Dl_GetTextHeight) (DL_GetDrawingFactor)))	;*** text high
  (setq ww (DL_GetDimPrec))			;*** 小数位数 ***
  (setq	aa 2.0
	bb 1.0
  )					;*** long/short line
  (setq dd 2)				;*** delt
					;-------------------------------------------------------
  (setq	ss1 (ssget "x"
		   (list '(0 . "POINT") (cons 8 laypt) '(-3 ("ZRBG")))
	    )
  )
  (setq	ss2 (ssget "x"
		   (list '(0 . "POINT") (cons 8 laypt) '(-3 ("SJBG")))
	    )
  )
  (cond
    ((and (/= ss1 nil) (/= ss2 nil))
     (setq zr_triangle (DL_InitTriangle "ZRBG" laypt)) 
     (setq sj_triangle (DL_InitTriangle "SJBG" laypt))
     (setq app "ALL")
    )
    ((and (/= ss1 nil) (= ss2 nil)) 
     (setq zr_triangle (DL_InitTriangle "ZRBG" laypt))
     (setq app "ZRBG")
    )
    ((and (= ss1 nil) (/= ss2 nil)) 
     (setq sj_triangle (DL_InitTriangle "SJBG" laypt))
     (setq app "SJBG")
    )
    (t
     (beep)
     (prompt "\n还没有定义标高离散点, 程序退出.")
     (exit)
    )
  )
  
  
  (pusherr dxdm_error)
  (setq p01 (getpoint "\n剖断位置起点:"))
  (if p01
    (progn
      (initget 1)
      (setq p02 (getpoint p01 "\n到点:"))
      (setq ang (angle p01 p02))
      (setvar "snapang" ang)
      (setvar "orthomode" 1)
      (setq ptb (cons p02 (cons p01 ptb)))
      (command ".pline" p01 p02)
      (setq p00	p01
	    p01	p02
      )
      (while (setq p02 (getpoint p01 "\n回车返回 /<到点>:"))
	(command p02)
	(setq p01 p02)
	(setq ptb (cons p01 ptb))
      )
      (command "")
      (setq e (entlast))
      (initget 1)
      (setq ang (getangle p01 "\n剖视方向:"))
      (setq ccc (getstring "\n剖视图编号<1>:"))
      (if (= ccc "")
	(setq ccc "1")
	(setq ccc (strcase ccc))
      )
      (jj_psf ptb ang ccc)		;*** 剖视符
					;(entdel e)
      (setvar "snapang" 0.0)
      (setq ptb (mapcar '(lambda (x) (z_p 0.0 x)) ptb))
      (setq ptb (big_h ptb))		;*** 增大
      (if (and (> ang pi) (< ang (* 1.999 pi)))
	(setq ptb (reverse ptb))
      )   
      ;;;初始化三角网
      (cond
      ((and (/= ss1 nil) (/= ss2 nil))
       (setq zr_triangle (DL_InitTriangle "ZRBG" laypt)) 
       (setq sj_triangle (DL_InitTriangle "SJBG" laypt))
      )
      ((and (/= ss1 nil) (= ss2 nil)) 
       (setq zr_triangle (DL_InitTriangle "ZRBG" laypt))
      )
      ((and (= ss1 nil) (/= ss2 nil)) 
       (setq sj_triangle (DL_InitTriangle "SJBG" laypt))
      )
      )  
      (prompt "\n提取标高信息, 请稍候...")
      (setq iiii 0
	    nnnn 1
      )

      (cond
	((= app "ALL")
	 (repeat (length ptb)
	   (setq x     (nth iiii ptb))
	   (setq fhb1 (GetPtBg_Triangle zr_triangle x))
	   (if (null fhb1) (setq fhb1  (p_ptbg x "ZRBG" laypt)))
	   (setq fhb2 (GetPtBg_Triangle sj_triangle x))
	   (if (null fhb2) (setq fhb2  (p_ptbg x "SJBG" laypt)))
	   (if (or (null fhb1) (null fhb2))
	       (princ)
	       (setq ptbgb (cons (list x fhb1 fhb2) ptbgb))
	   )
	   (HY_Waiting)
	   (princ)
;;;10:03 99-2-2add (princ)
	   (setq iiii (1+ iiii))
	 )
	)
	((= app "ZRBG")
	 (repeat (length ptb)
	   (setq x     (nth iiii ptb))
	   (setq fhb (GetPtBg_Triangle zr_triangle x))
	   (if (null fhb) (setq fhb  (p_ptbg x app laypt)))
	   (if (null fhb)
	       (princ)
	       (setq ptbgb (cons (list x fhb 0.0) ptbgb))
	   )
	   (HY_Waiting)
	   (setq iiii (1+ iiii))
	 )
	)
	((= app "SJBG")
	 (repeat (length ptb)
	   (setq x     (nth iiii ptb))
	   (setq fhb (GetPtBg_Triangle sj_triangle x))
	   (if (null fhb) (setq fhb  (p_ptbg x app laypt)))
	   (if (null fhb)
	       (princ)
	       (setq ptbgb (cons (list x 0.0 fhb) ptbgb))
	   )
	   (HY_Waiting)
	   (setq iiii (1+ iiii))
	 )
	)
      )
      (setq ptbgb (reverse ptbgb))
      (setq zrbgb (mapcar 'cadr ptbgb)
	    sjbgb (mapcar 'caddr ptbgb)
	    zrmin (apply 'min zrbgb)
	    zrmax (apply 'max zrbgb)
	    sjmin (apply 'min sjbgb)
	    sjmax (apply 'max sjbgb)
	    bgmin (min zrmin sjmin)
	    bgmax (max zrmax sjmax)
      )
      (cond
	((= app "ALL") 
	 (hz_dm ptbgb bgmin bgmax app)
	 ;;删除的顺序必须和加入的顺序相反，否则序号已经改变删除将失败
	 (DL_Destory_TRiAngle sj_triangle)
	 (DL_Destory_TRiAngle zr_triangle)
	)
	((= app "ZRBG")
	 (hz_dm ptbgb zrmin zrmax app)
	 (DL_Destory_TRiAngle zr_triangle)
	)
	((= app "SJBG") 
	 (hz_dm ptbgb sjmin sjmax app)
	 (DL_Destory_TRiAngle sj_triangle)
	)
      )
    )
  )
  (clr_err)
  (setvar "orthomode" orold)
  (HY_RV)
)
;;------------------------------
(defun hz_dm (ptbgb bgmin bgmax	app   /	    p000  p001	p002  p003
	      bgc   xs	  ii	ll    y0    bb1	  bb2	p00   p01
	      p02   p03	  p04	zrbg1 zrbg2 sjbg1 sjbg2	dd0   cc1
	      cc2   cc3	  fhb
	     )

  (initget 1)
  (setq p000 (getpoint "\n地形断面左下角位置:"))
  (initget 6)
  (setq xs (getreal "\n竖向放大系数<10.0>:"))
  (if (= xs nil)
    (setq xs 10.0)
  )
  (if (>= bgmin 0.0)
    (setq bgmin (fix bgmin))
    (setq bgmin (- (fix bgmin) 1))
  )
  (setq bgmin (- bgmin 1))
  (setq bgmax (1+ (fix bgmax)))

  (setq	bgc  (- bgmax bgmin)
	p001 (list (car p000) (+ (* xs bgc) (cadr p000)) 0.0)
	y0   (cadr p000)
  )
  (setq	ii  0
	ll  (length ptbgb)
	p00 p000
  )
  (repeat (- ll 1)
    (setq bb1	(nth ii ptbgb)
	  bb2	(nth (+ ii 1) ptbgb)
	  p01	(nth 0 bb1)
	  p02	(nth 0 bb2)
	  zrbg1	(- (nth 1 bb1) bgmin)
	  zrbg2	(- (nth 1 bb2) bgmin)
	  sjbg1	(- (nth 2 bb1) bgmin)
	  sjbg2	(- (nth 2 bb2) bgmin)
	  dd0	(distance p01 p02)
	  p01	(list (car p00) (+ y0 (* zrbg1 xs)) 0.0)
	  p02	(list (+ (car p00) dd0) (+ y0 (* zrbg2 xs)) 0.0)
	  p03	(list (car p00) (+ y0 (* sjbg1 xs)) 0.0)
	  p04	(list (+ (car p00) dd0) (+ y0 (* sjbg2 xs)) 0.0)
	  p00	(polar p00 0.0 dd0)
    )
    (if	(/= app "SJBG")
      (progn
	(setvar "clayer" layzr)
	(command ".line"
		 (z_p (nth 1 bb1) p01)
		 (z_p (nth 1 bb2) p02)
		 ""
	)
      )
    )
    (if	(/= app "ZRBG")
      (progn
	(setvar "clayer" laysj)
	(command ".line"
		 (z_p (nth 2 bb1) p03)
		 (z_p (nth 2 bb2) p04)
		 ""
	)
      )
    )
    (setq ii (1+ ii))
  )
  (setq	p002 (list (car p00) (cadr p001) 0.0)
	p003 (list (car p00) (cadr p000) 0.0)
  )
  (setvar "clayer" laydm)
  (command ".pline" p000 "w" 0.5 0.5 p001 p002 p003 "c")
  (jj_bc0 p000 p003)
  (jj_bc90 p000 p001 bgmin bgc xs)
  (setq	cc1 (strcat "地形断面图 " ccc "-" ccc)
	cc2 "自然标高曲线"
	cc3 "设计标高曲线"
  )
  (setq p01 (polar p001 (* 0.5 pi) (* 0.7 hh)))
  (command "text" "j" "ML" p01 hh 0.0 cc1)
  (setq	fhb (textbox (list (cons 1 cc1)))
	fhb (abs (- (car (nth 0 fhb)) (car (nth 1 fhb))))
	p01 (polar p01 0.0 (* 1.2 fhb))
  )
  (setvar "clayer" layzr)
  (command "line" p01 (setq p01 (polar p01 0.0 20.0)) "")
  (setq p01 (polar p01 0.0 hh))
  (command "text" "j" "ML" p01 hh 0.0 cc2)

  (setq p01 (polar p01 0.0 (* 1.2 fhb)))
  (setvar "clayer" laysj)
  (command "line" p01 (setq p01 (polar p01 0.0 20.0)) "")
  (setq p01 (polar p01 0.0 hh))
  (command "text" "j" "ML" p01 hh 0.0 cc3)

)
;;------------------------------
;; 0 方向标尺
;;------------------------------
(defun jj_bc0 (p000 p003 / p00 ii x0 ang p01 p02)

  (setq	p00 p000
	ii  0
	x0  (car p003)
	ang (* 1.5 pi)
  )
  (while (<= (car p00) x0)
    (if	(= (rem ii 5) 0.0)
      (progn
	(setq p01 (polar p00 ang aa)
	      p02 (polar p01 ang (* 1.5 hh))
	)
	(command "line" p00 p01 "")
	(command "text" "j" "mc" p02 hh 0.0 (itoa (fix (* ii dd))))
      )
      (progn
	(setq p01 (polar p00 ang bb))
	(command "line" p00 p01 "")
      )
    )
    (setq p00 (polar p00 0.0 dd)
	  ii  (1+ ii)
    )
  )
)
;;------------------------------
;; 90 方向标尺
;;------------------------------
(defun jj_bc90 (p000 p001 bgmin bgc xs / p00 ii y0 ang p01 p02 cc dd0)

  (setq	p00 p000
	ii  0
	y0  (cadr p001)
	ang pi
	dd0 (/ xs 5)
  )
  (while (<= (cadr p00) y0)
    (if	(= (rem ii 5) 0)
      (progn
	(setq p01 (polar p00 ang aa)
	      p02 (polar p01 ang (* 2.0 hh))
	      cc  (rtos (+ bgmin (* ii 0.2)) 2 ww)
	)
	(command "line" p00 p01 "")
	(command "text" "j" "mc" p02 hh 0.0 cc)
      )
      (progn
	(setq p01 (polar p00 ang bb))
	(command "line" p00 p01 "")
      )
    )
    (setq p00 (polar p00 (* 0.5 pi) dd0)
	  ii  (1+ ii)
    )
  )
)
;;------------------------------
;; 剖视符
;;------------------------------
(defun jj_psf (ptb ang ccc / sca aa bb dd ii ps pm pe an1 an2 jiao)

  (setq	sca  (DL_GetDrawingFactor)
	aa   (/ 4.0 sca)		;*** long
	bb   (/ -2.0 sca)		;*** short
	dd   (/ 1.0 sca)		;*** width
	jiao (* (/ ang pi) 180.0)
	jiao (- jiao 90)
  )
  (if (and (> jiao 135.0) (< jiao 315.0))
    (setq jiao (+ jiao 180.0))
  )
  (setvar "plinewid" dd)
  (setq ii 1)
  (repeat (- (length ptb) 2)
    (setq ps  (nth (- ii 1) ptb)
	  pm  (nth ii ptb)
	  pe  (nth (+ ii 1) ptb)
	  an1 (angle pm ps)
	  an2 (angle pm pe)
    )
    (command ".pline" (polar pm an1 aa) (polar pm an1 bb) "")
    (command ".pline" (polar pm an2 aa) (polar pm an2 bb) "")
    (setq ii (1+ ii))
  )
  (repeat 2
    (setq an1 ang
	  pm  (car ptb)
    )
    (setq an2 (angle (car ptb) (cadr ptb)))
    (command ".pline" (polar pm an1 aa) (polar pm an1 bb) "")
    (command ".pline" (polar pm an2 aa) (polar pm an2 bb) "")
    (setq ps (polar pm an1 aa)
	  ps (polar ps an2 (- aa))
    )
    (command "text" "j" "mc" ps (/ 7.0 (DL_GetDrawingFactor)) jiao ccc)
    (setq ptb (reverse ptb))
  )
)
;;------------------------------
;; 增大 (ptb->bigb ptb)
;;------------------------------
(defun big_h (ptb / ii dd0 bigb dd nn p01 p02 ang)

  (setq dd0 (getreal "\n采样间距(m)<10.0>:"))
  (if (= dd0 nil)
    (setq dd0 10.0)
  )

  (setq ii 0)
  (repeat (- (length ptb) 1)
    (setq p01  (nth ii ptb)
	  p02  (nth (+ ii 1) ptb)
	  ang  (angle p01 p02)
	  dd   (distance p01 p02)
	  bigb (cons p01 bigb)
	  nn   (fix (/ dd dd0))
    )
    (if	(> nn 2)
      (repeat (- nn 1)
	(setq bigb (cons (setq p01 (polar p01 ang dd0)) bigb))
      )
    )
    (setq bigb (cons p02 bigb))
    (setq ii (1+ ii))
  )
  bigb
)
;;;------------------------------
;;;地形透出
(defun #txtc(/ ss)
  (setq ss (ssget "x" '((0 . "IMAGE"))))
  (if (and ss (> (sslength ss) 0))
    (command ".draworder" ss "" "back"
             ".transparency" ss "" "on"
    )
  )
  (setq ss (ssget "x" '((0 . "HATCH")(2 . "SOLID*"))))
  (if (and ss (> (sslength ss) 0))
    (command ".draworder" ss "" "back")
  )
  (princ)
)

;;;------------------------------
;;; 1998.05.12 tue
;;; 三维地形
;;;------------------------------
(defun 3ddx (/	   lay	 laypt app   wgbl  fdbl	 ss    ii    e
	     p00   p01	 p02   p03   p04   bg1	 bg2   bg3   bg4
	     w_triangle ptlist ptss)
  (hy_set0)
  (setq ss (ssget "x" '((0 . "POINT") (8 . "PP-DX-PT") (-3 ("ZRBG")))))
  (if (= ss nil)
    (progn
      (beep)
      (prompt
	"\n自然等高线没有离散化或没有定义标高离散点. 程序退出."
      )
      (exit)
    )
  )

(defun 3ddx_error( ccc / )
  (DL_Destory_Triangle w_triangle)
)

 ;;;(HY_SV)
  (undo_m)
  (setq	lay   "PP-DX-3D"
	laypt "PP-DX-PT"
	app   "ZRBG"
  )
  (DL_MakeLayer lay)
					;======================================
  (setq p01 (getpoint "\n边界第一点:"))
  (if (/= p01 nil)
    (progn
      (setq ptlist (cons p01 ptlist))
      (setq p00 p01)
      (setq ss (ssadd))
      (command "line" p01)
      (initget 1)
      (setq p02 (getpoint p01 "\n第二点:"))
      (setq ptlist (cons p02 ptlist))
      (command p02)
      (setq ss (ssadd (entlast) ss))
      (setq p01 p02)
      (initget 1)
      (setq p02 (getpoint p01 "\n第三点:"))
      (setq ptlist (cons p02 ptlist))
      (command p02)
      (setq ss (ssadd (entlast) ss))
      (setq p01 p02)

      (while p02
	(setq p02 (getpoint p01 "\n回车封闭折线 /<下一点>:"))
	(if p02
	  (progn
	    (setq ptlist (cons p02 ptlist))
	    (command p02)
	    (setq ss (ssadd (entlast) ss))
	    (setq p01 p02)
	  )
	)
      )
      
      				;----- 最后一点与第一点重合就算了 -------------
      (if (< (HY_PtPMDist p00 p01) 1.0e-6)
	(command "")
	(progn
	  (command "c")
	  (setq ss (ssadd (entlast) ss))
	)
      )

      
      (setq ptss (ssget "CP" ptlist '((0 . "POINT") (8  . "PP-DX-PT") (-3 ("ZRBG")))))
      (if ptss
      (progn
      (setq w_triangle (DL_InitTriangle app laypt))				;======================================
      (initget 6)
      (setq wgbl (getint "\n网格间距(米)<10>:"))
      (if (= wgbl nil)
	(setq wgbl 10)
      )
      (setq fdbl (getreal "\n竖向放大系数<1.0>:"))
      (if (= fdbl nil)
	(setq fdbl 1.0)
      )

      (setq e0 (ent_last))
      (command "hatch" "*3ddx" wgbl 0.0 ss "")
      (command ".erase" ss "")
      (setq ss (get_last e0))
		;======================================

      (if ss
	(progn
          (pusherr 3ddx_error)
	  (setq ii 0)
	  (repeat (sslength ss)
	    (setq e   (ssname ss ii)
		  ii  (1+ ii)
		  p01 (cdr (assoc 10 (entget e)))
		  p02 (polar p01 0.0 wgbl)
		  p03 (polar p02 (* 0.5 pi) wgbl)
		  p04 (polar p01 (* 0.5 pi) wgbl)
            )
            (setq bg1 (GetPtBg_Triangle w_triangle p01)
                  bg2 (GetPtBg_Triangle w_triangle p02)
                  bg3 (GetPtBg_Triangle w_triangle p03)
                  bg4 (GetPtBg_Triangle w_triangle p04)
            )
            (if (null bg1) (setq bg1 (p_ptbg p01 app laypt)))
            (if (null bg2) (setq bg2 (p_ptbg p02 app laypt)))
            (if (null bg3) (setq bg3 (p_ptbg p03 app laypt)))
            (if (null bg4) (setq bg4 (p_ptbg p04 app laypt)))
            (if (and bg1 bg2 bg3 bg4)
                (progn
                (setq
		  p01 (z_p (* fdbl bg1) p01)
		  p02 (z_p (* fdbl bg2) p02)
		  p03 (z_p (* fdbl bg3) p03)
		  p04 (z_p (* fdbl bg4) p04)
	        )
	        (mk3dm (list p01 p02 p03 p04) lay)
	        )
	     )
	  )
	  (command ".erase" ss "")
	  (DL_destory_Triangle w_triangle)
	  (clr_err)
	)
      )
     )
     )
     (if ss (command ".erase" ss ""))
    )
  )

 ;;; (HY_RV)
  (hy_set1)
  (princ)
)
;;;-----------------------------
;;; 1996.08.02 fri
;;; 1996.09.09 mon modify
;;; 3D视图转换 ---- 3dvpt.lsp
;;;-----------------------------
(defun 3dvpt (/ dcl_id x y what jiao n m_dcl)
  (szload pub_save_var "wwpublic")
  (pub_save_var)
  (HY_SV)
  (setq dcl_id (szdl_load_dlg "szdldx3d.dcl"))
  (if (not (new_dialog "stzh" dcl_id))
    (exit)
  )
  (setq n 1)
  (repeat 9
    (playsld (strcat "stzh(stzh" (itoa n) ")")
	     (strcat "stzh" (itoa n))
    )
    (setq n (1+ n))
  )
  (action_tile
    "stzh1"
    "(setq jiao 135 string \"135度等轴视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh2"
    "(setq jiao  90 string \"背立面视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh3"
    "(setq jiao  45 string \" 45度等轴视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh4"
    "(setq jiao 180 string \"左立面视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh5"
    "(setq jiao 999 string \"平面视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh6"
    "(setq jiao   0 string \"右立面视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh7"
    "(setq jiao 225 string \"225度等轴视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh8"
    "(setq jiao 270 string \"正立面视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )
  (action_tile
    "stzh9"
    "(setq jiao 315 string \"315度等轴视图\")(set_tile \"xzjg\" (strcat \"选择结果:\" string))"
  )

  (action_tile "sm" "(sm)")

  (action_tile "accept" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")

  (setq what (start_dialog))
  (if (= what 1)
    (stzh jiao)
  )

  (unload_dialog dcl_id)
  (HY_RV)
  (pub_re_var)
  (princ)
)
;;------------------------------
;; 1996.08.02 fri
;; 视图转换 stzh(jiao)
;;------------------------------
(defun stzh (jiao / layzr laysj fhb lay)

					;(setq layzr "P_TF_3DZR")
					;(setq laysj "P_TF_3DSJ")
					;(setvar "clayer" "0")
;;;(DL_MakeLayer "PP-COM")
  (cond
    ((= jiao 0) (command "vpoint" '(1 0 0)))
    ((= jiao 45) (command "vpoint" '(1 1 1)))
    ((= jiao 90) (command "vpoint" '(0 1 0)))
    ((= jiao 135) (command "vpoint" '(-1 1 1)))
    ((= jiao 180) (command "vpoint" '(-1 0 0)))
    ((= jiao 225) (command "vpoint" '(-1 -1 1)))
    ((= jiao 270) (command "vpoint" '(0 -1 0)))
    ((= jiao 315) (command "vpoint" '(1 -1 1)))
    ((= jiao 999) (command "vpoint" '(0 0 1)))
  )
  (princ)
)

;;;透视图
;;;writer yhj
;;;modi yft 99.03.18
(defun ~ts_draw	(sty / ~setts ~tspy ~spxz ~czxz)
;;;设透视图
  (defun ~setts	()
    (command ".dview" "all" "" "d" 300 "d" pause "")
    (princ)
  )
;;;透视平移
  (defun ~tspy ()
    (setvar "highlight" 0)
    (command ".dview" "all" "")
    (setvar "highlight" 1)
    (princ "\n请点取平移的起点: ")
    (command "pa" pause)
    (princ "\n点取平移的终点: ")
    (command pause "")
    (princ)
  )
;;;水平旋转
  (defun ~spxz ()
    (setvar "highlight" 0)
    (command ".dview" "all" "")
					;(command ".dview" "")
    (setvar "highlight" 1)
    (princ "\n请确定水平旋转位置: ")
    (command "ca" "" pause "")
    (princ)
  )
;;;垂直旋转
  (defun ~czxz ()
    (setvar "highlight" 0)
    (command ".dview" "all" "")
					;(command ".dview" "")
    (setvar "highlight" 1)
    (princ "\n请确定垂直旋转位置: ")
    (command "ca" "t" "" pause "")
    (princ)
  )

;;;main function
  (szload pub_save_var "wwpublic")
  (pub_save_var)
  (HY_SV)
  (cond
    ((= sty 1)
     (~setts)
;;;设透视图
    )
    ((= sty 2)
     (~tspy)
;;;透视平移
    )
    ((= sty 3)
     (~spxz)
;;;水平旋转
    )
    ((= sty 4)
     (~czxz)
;;;垂直旋转
    )
  )
  (HY_RV)
  (pub_re_var)
  (princ)
)
;;;------------------------------
;;; 1996.10.12 sat
;;; 曲面着色 shadem.lsp
;;;------------------------------
(defun shadem()
  (command "shademode" "g")
  ;(command "regen")
  (prompt "\n白色为自然标高面;")
  (prompt "\n红色为设计标高面。")
  (princ)  
)
;;------------------------------
