home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 6.img / SUPPORT4.LIB / DDVPOINT.LSP < prev    next >
Encoding:
Text File  |  1993-02-19  |  15.3 KB  |  556 lines

  1. ;;;   DDVPOINT.LSP
  2. ;;;   ¬⌐┼v (C) 1992  Autodesk ñ╜Ñq
  3. ;;;
  4. ;;;   Ñ╗│n┼ΘºK╢O¿╤▒z╢iªµÑ⌠ª≤Ñ╬│~╗▌¿D¬║½■¿⌐íB¡╫º∩ñ╬╡oªµ, ª²¼O░╚╜╨┐φ┤`ñU¡z
  5. ;;;   ¡∞½h :
  6. ;;;
  7. ;;;   1)  ñWªC¬║¬⌐┼v│qºi░╚╗▌ÑX▓{ªb¿Cñ@Ñ≈½■¿⌐∙╪íC
  8. ;;;   2)  ¼█├÷¬║╗í⌐·ñσÑ≤ñ]Ñ▓╢╖⌐·╕ⁿ¬⌐┼v│qºiñ╬Ñ╗╢╡│\Ñi│qºiíC
  9. ;;;
  10. ;;;   Ñ╗│n┼Θ╢╚┤ú¿╤º@¼░└│Ñ╬ñW¬║░╤ª╥, ª╙Ñ╝┴n⌐·⌐╬┴⌠ºtÑ⌠ª≤½O├╥; ╣∩⌐≤Ñ⌠ª≤»S«φ
  11. ;;;   Ñ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºtÑX¿π¬║½O├╥, ªbª╣ñ@╖ºñ⌐ÑHº_╗{íC
  12. ;;;
  13. ;;;
  14. ;;;   C:DDVPOINT - 3D Viewpoint presets dialogue for use with the
  15. ;;;                AutoCAD Release 12 Standard Menu.
  16. ;;;
  17. ;;;                Uses DDVPOINT.DCL for the dialogue definition.
  18. ;;;                The slide image is in ACAD.SLB.
  19.  
  20. ;;;
  21. ;;; ===========================================================================
  22. ;;; ===================== load-time error checking ============================
  23. ;;;
  24.  
  25.   (defun ai_abort (app msg)
  26.      (defun *error* (s)
  27.         (if old_error (setq *error* old_error))
  28.         (princ)
  29.      )
  30.      (if msg
  31.        (alert (strcat " └│Ñ╬╡{ªí┐∙╗~: "
  32.                       app
  33.                       " \n\n  "
  34.                       msg
  35.                       "  \n"
  36.               )
  37.        )
  38.      )
  39.      (exit)
  40.   )
  41.  
  42. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  43. ;;; and then try to load it.
  44. ;;;
  45. ;;; If it can't be found or it can't be loaded, then abort the
  46. ;;; loading of this file immediately, preserving the (autoload)
  47. ;;; stub function.
  48.  
  49.   (cond
  50.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  51.  
  52.      (  (not (findfile "ai_utils.lsp"))                     ; find it
  53.         (ai_abort "DDVPOINT"
  54.                   (strcat "ºΣñú¿∞íuAI_UTILS.LSPív└╔«╫;"
  55.                           "\n  ╜╨└╦¼díusupportívÑ╪┐²íC")))
  56.  
  57.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it
  58.         (ai_abort "DDVPOINT" "╡L¬k╕ⁿñJíuAI_UTILS.LSPív└╔«╫"))
  59.   )
  60.  
  61.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  62.       (ai_abort "DDVPOINT" nil)         ; a Nil <msg> supresses
  63.   )                                    ; ai_abort's alert box dialog.
  64.  
  65. ;;; ==================== end load-time operations ===========================
  66.  
  67. (defun ai_ddvp_start ( / image_x image_y image_h slide_x slide_y slide_h)
  68.   (start_image "ddvp_image")
  69.   (slide_image
  70.     0 0
  71.     (- (setq image_x (dimx_tile "ddvp_image")) 1)
  72.     (- (setq image_y (dimy_tile "ddvp_image")) 1)
  73.     "acad(ddvp3d)"
  74.   )
  75.   (end_image)
  76.   (setq
  77.         image_x (float image_x)
  78.         image_y (float image_y)
  79.         slide_x 12.4265
  80.         slide_y 9.0
  81.         image_h (/ image_x image_y)
  82.         slide_h (/ slide_x slide_y)
  83.   )
  84.   (if (< slide_h image_h)
  85.     (setq slide_y image_y
  86.           slide_x (* slide_y slide_h)
  87.     )
  88.     (setq slide_x image_x
  89.           slide_y (* slide_x (/ slide_y slide_x))
  90.     )
  91.   )
  92.   (setq ai_ddvp_bx (fix (* 0.295 slide_x))
  93.         ai_ddvp_ax (fix (* 0.65 slide_x))
  94.         ai_ddvp_by (fix (* 0.4875 slide_y))
  95.   )
  96. ;;;
  97. ;;;   For AutoCAD Chinese version ONLY.
  98. ;;;   Because the font size used for Chinese version is 16*18 instead of
  99. ;;;   8*16, the origin defined in "image coordinate system" requires a
  100. ;;;   displacement of 131 in positive Y direction to justify starting
  101. ;;;   point of image_vector.
  102. ;;;
  103.   (if (= "big5" (getvar "SYSCODEPAGE"))
  104.     (setq ai_ddvp_by (+ ai_ddvp_by 131))
  105.   )
  106. ;;;
  107. )
  108.  
  109. (defun ai_rtd (arg)
  110.   (/ (* arg 180.0) pi)
  111. )
  112.  
  113. (defun ai_dtr (arg)
  114.   (* pi (/ arg 180.0))
  115. )
  116.  
  117. (defun ai_ang3dv (v1 v2)
  118.   (if (not (equal v1 v2 1e-12))
  119.     (ai_arccos
  120.       (/ (ai_dotp v1 v2)
  121.          (* (sqrt (ai_dotp v1 v1))
  122.             (sqrt (ai_dotp v2 v2))
  123.          )
  124.       )
  125.     )
  126.     (eval '0.0)
  127.   )
  128. )
  129.  
  130. (defun ai_arccos (ang)
  131.   (if (not (equal ang 1.0 1e-06))
  132.     (if (not (equal ang -1.0 1e-06))
  133.       (atan (sqrt (- 1.0 (expt ang 2.0))) ang)
  134.       (eval pi)
  135.     )
  136.     (eval '0.0)
  137.   )
  138. )
  139.  
  140. (defun ai_dotp (v1 v2)
  141.   (+
  142.     (* (car v1) (car v2))
  143.     (* (cadr v1) (cadr v2))
  144.     (* (caddr v1) (caddr v2))
  145.   )
  146. )
  147.  
  148. (defun ai_ddvp_do ()
  149.   (if (or (>= ai_ddvp_b_curr 360.0)
  150.           (< ai_ddvp_b_curr 0.0)
  151.           (null ai_ddvp_b_curr)
  152.       )
  153.     (progn
  154.       (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)
  155.       (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)
  156.       (mode_tile "ddvp_val_x" 2)
  157.       (set_tile "error" "╗PíuX ╢bív¬║º¿¿ñ╡L«─íC")
  158.     )
  159.     (if (or (> ai_ddvp_a_curr 90.0)
  160.             (< ai_ddvp_a_curr -90.0)
  161.             (null ai_ddvp_a_curr)
  162.         )
  163.       (progn
  164.         (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
  165.         (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
  166.         (mode_tile "ddvp_val_xyp" 2)
  167.         (set_tile "error" "Ñ╤íuXYÑ¡¡▒ív╢q░_¬║Ñ⌡¿ñ╡L«─íC")
  168.       )
  169.       (done_dialog 1)
  170.     )
  171.   )
  172. )
  173.  
  174. (defun ai_ddvp_set_a (ang)
  175.   (setq ai_ddvp_a_curr ang)
  176.   (if (or (> ang 90.0)
  177.           (< ang -90.0)
  178.           (null ang)
  179.       )
  180.     (progn
  181.       (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
  182.       (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
  183.       (set_tile "error" "Ñ╤íuXYÑ¡¡▒ív╢q░_¬║Ñ⌡¿ñ╡L«─íC")
  184.     )
  185.     (progn
  186.       (set_tile "error" "")
  187.       (ai_ddvp_drx ai_ddvp_a_last ai_ddvp_ax 0)
  188.       (setq ai_ddvp_a_last ai_ddvp_a_curr ai_ddvp_t T)
  189.       (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1))
  190.       (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 1)
  191.       (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 7)
  192.     )
  193.   )
  194. )
  195.  
  196. (defun ai_ddvp_set_b (ang)
  197.   (setq ai_ddvp_b_curr ang)
  198.   (if (or (>= ang 360.0)
  199.           (< ang 0.0)
  200.           (null ang)
  201.       )
  202.     (progn
  203.       (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)
  204.       (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)
  205.       (set_tile "error" "╗PíuX ╢bív¬║º¿¿ñ╡L«─íC")
  206.     )
  207.     (progn
  208.       (set_tile "error" "")
  209.       (ai_ddvp_drx ai_ddvp_b_last ai_ddvp_bx 0)
  210.       (if (= ang 360.0)
  211.         (setq ai_ddvp_b_curr 0.0
  212.               ai_ddvp_a_curr 90.0
  213.               ai_ddvp_p T
  214.               ai_ddvp_b_last ai_ddvp_b_curr
  215.         )
  216.         (setq ai_ddvp_b_last ai_ddvp_b_curr ai_ddvp_t T)
  217.       )
  218.       (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))
  219.       (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 1)
  220.       (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 7)
  221.     )
  222.   )
  223. )
  224.  
  225. (defun ai_ddvp_drx (ang x1 col / a x2 y2)
  226.   (setq a (polar (list 0.0 0.0)
  227.                  (- (* 2.0 pi) (ai_dtr ang))
  228.                  33.0
  229.           )
  230.         x2 (+ x1 (fix (car a)))
  231.         y2 (+ ai_ddvp_by (fix (cadr a)))
  232.   )
  233.   (start_image "ddvp_image")
  234.   (vector_image x1 ai_ddvp_by x2 y2 col)
  235.   (end_image)
  236. )
  237.  
  238. (defun ai_ddvp_image (x y / ang1 ang2 list_xy list_axby list_bxby)
  239.   (setq list_xy (list x y)
  240.         list_axby (list ai_ddvp_ax ai_ddvp_by)
  241.         list_bxby (list ai_ddvp_bx ai_ddvp_by)
  242.   )
  243.   (if (> x (- ai_ddvp_ax 1))
  244.     (progn
  245.       (setq ang1 (ai_rtd (- (* 2.0 pi) (angle list_xy list_axby))))
  246.       (if (< 90.0 ang1)
  247.         (setq ang1 (- ang1 180.0))
  248.       )
  249.       (if (< (distance list_xy list_axby) 40)
  250.         (ai_ddvp_set_a ang1)
  251.         (if (< (distance list_xy list_axby) 84)
  252.           (cond ((= ang1 0.0)
  253.                  (ai_ddvp_set_a 0.0)
  254.                 )
  255.                 ((< ang1 -72.0)
  256.                  (ai_ddvp_set_a -90.0)
  257.                 )
  258.                 ((< ang1 -53.0)
  259.                  (ai_ddvp_set_a -60.0)
  260.                 )
  261.                 ((< ang1 -38.0)
  262.                  (ai_ddvp_set_a -45.0)
  263.                 )
  264.                 ((< ang1 -20.0)
  265.                  (ai_ddvp_set_a -30.0)
  266.                 )
  267.                 ((< ang1 -6.0)
  268.                  (ai_ddvp_set_a -10.0)
  269.                 )
  270.                 ((< ang1 6.0)
  271.                  (ai_ddvp_set_a 0.0)
  272.                 )
  273.                 ((< ang1 20.0)
  274.                  (ai_ddvp_set_a 10.0)
  275.                 )
  276.                 ((< ang1 38.0)
  277.                  (ai_ddvp_set_a 30.0)
  278.                 )
  279.                 ((< ang1 53.0)
  280.                  (ai_ddvp_set_a 45.0)
  281.                 )
  282.                 ((< ang1 72.0)
  283.                  (ai_ddvp_set_a 60.0)
  284.                 )
  285.                 (T
  286.                  (ai_ddvp_set_a 90.0)
  287.                 )
  288.           )
  289.         )
  290.       )
  291.     )
  292.     (progn
  293.       (setq ang2 (ai_rtd (+ pi (- (* 2.0 pi) (angle list_xy list_bxby)))))
  294.       (if (< 360.0 ang2)
  295.         (setq ang2 (- ang2 360.0))
  296.       )
  297.       (if (< (distance list_xy list_bxby) 40)
  298.         (ai_ddvp_set_b ang2)
  299.         (cond ((= ang2 0.0)
  300.                (ai_ddvp_set_b 0.0)
  301.               )
  302.               ((< ang2 22.5)
  303.                (ai_ddvp_set_b 0.0)
  304.               )
  305.               ((< ang2 67.5)
  306.                (ai_ddvp_set_b 45.0)
  307.               )
  308.               ((< ang2 112.5)
  309.                (ai_ddvp_set_b 90.0)
  310.               )
  311.               ((< ang2 157.5)
  312.                (ai_ddvp_set_b 135.0)
  313.               )
  314.               ((< ang2 202.5)
  315.                (ai_ddvp_set_b 180.0)
  316.               )
  317.               ((< ang2 247.5)
  318.                (ai_ddvp_set_b 225.0)
  319.               )
  320.               ((< ang2 292.5)
  321.                (ai_ddvp_set_b 270.0)
  322.               )
  323.               ((< ang2 337.5)
  324.                (ai_ddvp_set_b 315.0)
  325.               )
  326.               ((< ang2 360.0)
  327.                (ai_ddvp_set_b 0.0)
  328.               )
  329.               (T
  330.                (ai_ddvp_set_b 270.0)
  331.               )
  332.         )
  333.       )
  334.     )
  335.   )
  336. )
  337.  
  338. (defun ai_ddvp_plan ()
  339.   (ai_ddvp_set_a 90.0)
  340.   (ai_ddvp_set_b 270.0)
  341. )
  342.  
  343. (defun ai_ddvp_setvdir (a b)
  344.   (list (* (sin (ai_dtr (- 90.0 a))) (cos (ai_dtr b)))
  345.         (* (sin (ai_dtr (- 90.0 a))) (sin (ai_dtr b)))
  346.         (cos (ai_dtr (- 90.0 a)))
  347.   )
  348. )
  349.  
  350. (defun ai_ddvp_set_abs ()
  351.   (setq ai_ddvp_wv 1)
  352.   (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)
  353.   (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)
  354.   (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0)
  355.   (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)
  356.   (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base))
  357.   (ai_ddvp_setang (trans ai_ddvp_vdir_base 1 0 T))
  358.   (setq ai_ddvp_a_base ai_ddvp_a
  359.         ai_ddvp_b_base ai_ddvp_b
  360.   )
  361.  
  362.   (setq ai_ddvp_vdir_curr
  363.         (ai_ddvp_fixzero
  364.           (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 1 0 T)
  365.         )
  366.   )
  367.   (ai_ddvp_setang ai_ddvp_vdir_curr)
  368.   (setq ai_ddvp_a_curr ai_ddvp_a
  369.         ai_ddvp_b_curr ai_ddvp_b
  370.   )
  371.  
  372.   (ai_ddvp_set_a ai_ddvp_a_curr)
  373.   (ai_ddvp_set_b ai_ddvp_b_curr)
  374. )
  375.  
  376.  
  377. (defun ai_ddvp_set_rel ()
  378.   (setq ai_ddvp_wv 0)
  379.   (ai_ddvp_drx ai_ddvp_b_curr ai_ddvp_bx 0)
  380.   (ai_ddvp_drx ai_ddvp_a_curr ai_ddvp_ax 0)
  381.   (ai_ddvp_drx ai_ddvp_b_base ai_ddvp_bx 0)
  382.   (ai_ddvp_drx ai_ddvp_a_base ai_ddvp_ax 0)
  383.   (setq ai_ddvp_vdir_base (ai_ddvp_fixzero ai_ddvp_vdir_base))
  384.   (ai_ddvp_setang ai_ddvp_vdir_base)
  385.   (setq ai_ddvp_a_base ai_ddvp_a
  386.         ai_ddvp_b_base ai_ddvp_b
  387.   )
  388.   (setq ai_ddvp_vdir_curr
  389.         (ai_ddvp_fixzero
  390.           (trans (ai_ddvp_setvdir ai_ddvp_a_curr ai_ddvp_b_curr) 0 1 T)
  391.         )
  392.   )
  393.   (if ai_ddvp_init
  394.     (setq ai_ddvp_vdir_curr (ai_ddvp_fixzero (trans ai_ddvp_vdir_curr 1 0 T))
  395.           ai_ddvp_init nil
  396.     )
  397.   )
  398.   (ai_ddvp_setang ai_ddvp_vdir_curr)
  399.   (setq ai_ddvp_a_curr ai_ddvp_a
  400.         ai_ddvp_b_curr ai_ddvp_b
  401.   )
  402.   (ai_ddvp_set_a ai_ddvp_a_curr)
  403.   (ai_ddvp_set_b ai_ddvp_b_curr)
  404. )
  405.  
  406. (defun ai_ddvp_fixzero (vector / vector_x vector_y vector_z)
  407.   (setq vector_x (car vector)
  408.         vector_y (cadr vector)
  409.         vector_z (caddr vector)
  410.   )
  411.   (if (equal vector_x 0.0 1e-06)
  412.     (setq vector_x 0.0)
  413.   )
  414.   (if (equal vector_y 0.0 1e-06)
  415.     (setq vector_y 0.0)
  416.   )
  417.   (if (equal vector_z 0.0 1e-06)
  418.     (setq vector_z 0.0)
  419.   )
  420.   (list vector_x vector_y vector_z)
  421. )
  422.  
  423. (defun ai_ddvp_setang (viewdir / viewdir_x viewdir_y viewdir_z ai_viewdir)
  424.   (setq ai_viewdir (ai_ddvp_fixzero viewdir)
  425.         ai_ddvp_b (ai_rtd (angle ai_viewdir '(0.0 0.0)))
  426.   )
  427.   (if (equal (list (car ai_viewdir) (cadr ai_viewdir)) '(0.0 0.0) 1e-06)
  428.     (setq ai_ddvp_a 90.0)
  429.     (setq ai_ddvp_a (ai_rtd (ai_ang3dv
  430.                              ai_viewdir
  431.                              (list (car ai_viewdir) (cadr ai_viewdir) 0.0)
  432.                             )
  433.                     )
  434.     )
  435.   )
  436.   (if (< (caddr ai_viewdir) 0.0)
  437.     (setq ai_ddvp_a (- 0.0 ai_ddvp_a))
  438.     (setq ai_ddvp_a (abs ai_ddvp_a))
  439.   )
  440.   (if (>= ai_ddvp_b 180.0)
  441.     (setq ai_ddvp_b (- ai_ddvp_b 180.0))
  442.     (setq ai_ddvp_b (+ ai_ddvp_b 180.0))
  443.   )
  444.   (if (or (= ai_ddvp_a 90.0) (= ai_ddvp_a -90.0))
  445.     (setq ai_ddvp_b 270.0)
  446.   )
  447. )
  448.  
  449. (defun do_help (cmd)
  450.   (if (= (type acad_helpdlg) 'EXSUBR)
  451.     (acad_helpdlg "acad.hlp" cmd)
  452.     (alert "ºΣñú¿∞íu¿DºU╣∩╕▄íví╨ xload acadapp íC")
  453.   )
  454.   (princ)
  455. )
  456.  
  457. (defun ai_ddvp_main ()
  458.   (ai_ddvp_start)
  459.   (ai_ddvp_setang ai_ddvp_vdir_base)
  460.   (setq ai_ddvp_a_base ai_ddvp_a
  461.         ai_ddvp_b_base ai_ddvp_b
  462.         ai_ddvp_vdir_curr (ai_ddvp_fixzero
  463.                             (ai_ddvp_setvdir ai_ddvp_a_base ai_ddvp_b_base)
  464.                           )
  465.   )
  466.   (ai_ddvp_setang ai_ddvp_vdir_curr)
  467.   (setq ai_ddvp_a_curr ai_ddvp_a
  468.         ai_ddvp_a_last ai_ddvp_a_curr
  469.         ai_ddvp_b_curr ai_ddvp_b
  470.         ai_ddvp_b_last ai_ddvp_b_curr
  471.   )
  472.   (if (= 0 ai_ddvp_wv)
  473.     (progn
  474.       (ai_ddvp_set_rel)
  475.       (set_tile "ddvp_rel_ucs" "1")
  476.     )
  477.     (ai_ddvp_set_abs)
  478.   )
  479.   (setq ai_ddvp_t nil)
  480.   (set_tile "ddvp_val_x" (rtos ai_ddvp_b_curr 2 1))
  481.   (set_tile "ddvp_val_xyp" (rtos ai_ddvp_a_curr 2 1))
  482.   (action_tile "ddvp_abs_wcs" "(ai_ddvp_set_abs)")
  483.   (action_tile "ddvp_rel_ucs" "(ai_ddvp_set_rel)")
  484.   (action_tile "ddvp_image" "(ai_ddvp_image $x $y)")
  485.   (action_tile "ddvp_val_x" "(ai_ddvp_set_b (distof $value))")
  486.   (action_tile "ddvp_val_xyp" "(ai_ddvp_set_a (distof $value))")
  487.   (action_tile "ddvp_set_plan" "(ai_ddvp_plan)")
  488.   (action_tile "accept" "(ai_ddvp_do)")
  489.   (action_tile "cancel" "(done_dialog 0)")
  490.   (action_tile "help" "(do_help \"DDVPOINT\")")
  491.   (if (= (start_dialog) 1)
  492.     (if ai_ddvp_t
  493.       (progn
  494.         (command "._WORLDVIEW" ai_ddvp_wv)
  495.         (command "._VPOINT" "_R"
  496.                  (strcat "<<" (rtos ai_ddvp_b_curr 2))
  497.                  (strcat "<<" (rtos ai_ddvp_a_curr 2))
  498.         )
  499.       )
  500.     )
  501.   )
  502. )
  503.  
  504. (defun c:ddvpoint ( / ai_ddvp_wv ai_ddvp_vdir_base ai_ddvp_vdir_curr
  505.                       ai_ddvp_bx ai_ddvp_ax ai_ddvp_by ai_ddvp_a_curr
  506.                       ai_ddvp_b_curr ai_ddvp_a_base ai_ddvp_b_base ai_ddvp_p
  507.                       ai_ddvp_t ai_ddvp_init ai_ddvp_a ai_ddvp_b
  508.                       ai_ddvp_a_last ai_ddvp_b_last
  509.                       app dcl_id old_cmd undo_init
  510.                   )
  511.  
  512.   ;; Set up error function.
  513.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
  514.         old_error  *error*            ; save current error function
  515.         *error* ai_error              ; new error function
  516.   )
  517.  
  518.   (setvar "cmdecho" 0)
  519.  
  520.   (cond
  521.      (  (not (ai_notrans)))                       ; transparent not OK
  522.      (  (not (ai_acadapp)))                       ; ACADAPP.EXP xloaded?
  523.      (  (not (setq dcl_id (ai_dcl "ddvpoint"))))  ; is .DCL file loaded?
  524.      (T (ai_undo_push)
  525.         (ddvpoint_main)                           ; proceed!
  526.         (ai_undo_pop)
  527.      )
  528.   )
  529.  
  530.   (setq *error* old_error)
  531.   (setvar "cmdecho" old_cmd)
  532.   (princ)
  533. )
  534.  
  535. (defun ddvpoint_main()
  536.  
  537.   (if (and (= 0 (getvar "TILEMODE"))
  538.            (= 1 (getvar "CVPORT"))
  539.       )
  540.     (princ "\n** Command not allowed in Paper space **")
  541.     (progn
  542.       (if (not (new_dialog "ddvpoint" dcl_id))
  543.         (exit)
  544.       )
  545.       (setq ai_ddvp_vdir_base (ai_ddvp_fixzero (getvar "VIEWDIR"))
  546.             ai_ddvp_wv (getvar "WORLDVIEW")
  547.             ai_ddvp_init T
  548.       )
  549.       (ai_ddvp_main)
  550.     )
  551.   )
  552. )
  553.  
  554. (princ "  íuDDVPOINTívñw╕ⁿñJíC")
  555. (princ)
  556.