home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / SUPPORT / DDATTDEF.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1995-02-08  |  20.4 KB  |  629 lines

  1. ; Next available MSG number is    34 
  2. ; MODULE_ID DDATTDEF_LSP_
  3. ;;;
  4. ;;;    ddattdef.lsp
  5. ;;;    
  6. ;;;    Copyright (C) 1990, 1992, 1994 by Autodesk, Inc.
  7. ;;;
  8. ;;;    Permission to use, copy, modify, and distribute this software
  9. ;;;    for any purpose and without fee is hereby granted, provided
  10. ;;;    that the above copyright notice appears in all copies and
  11. ;;;    that both that copyright notice and the limited warranty and
  12. ;;;    restricted rights notice below appear in all supporting
  13. ;;;    documentation.
  14. ;;;
  15. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
  16. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  17. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  18. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
  19. ;;;    UNINTERRUPTED OR ERROR FREE.
  20. ;;;
  21. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
  22. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
  23. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  24. ;;;    (Rights in Technical Data and Computer Software), as applicable.
  25. ;;;
  26. ;;;.
  27. ;;;  DESCRIPTION
  28. ;;;
  29. ;;;  This is an enhancement to the ATTDEF command. It loads up a dialogue box
  30. ;;;  which presents the user the set of options for attribute definition.
  31. ;;;
  32. ;;;------------------------------------------------------------------------
  33. ;;;   Prefixes in command and keyword strings: 
  34. ;;;      "."  specifies the built-in AutoCAD command in case it has been        
  35. ;;;           redefined.
  36. ;;;      "_"  denotes an AutoCAD command or keyword in the native language
  37. ;;;           version, English.
  38. ;;;------------------------------------------------------------------------
  39. ;;;
  40. ;;; ===================== load-time error checking ========================
  41.  
  42.   (defun ai_abort (app msg)
  43.      (defun *error* (s)
  44.         (if old_error (setq *error* old_error))
  45.         (princ)
  46.      )
  47.      (if msg
  48.        (alert (strcat " Error en la aplicaci≤n: "
  49.                       app
  50.                       " \n\n  "
  51.                       msg
  52.                       "  \n"
  53.               )
  54.        )
  55.      )
  56.      (exit)
  57.   )
  58.  
  59. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  60. ;;; and then try to load it.
  61. ;;;
  62. ;;; If it can't be found or it can't be loaded, then abort the
  63. ;;; loading of this file immediately, preserving the (autoload)
  64. ;;; stub function.
  65.  
  66.   (cond
  67.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  68.  
  69.      (  (not (findfile ;|MSG0|;"ai_utils.lsp"))                     ; find it
  70.         (ai_abort "DDATTDEF"
  71.                   (strcat "Imposible localizar el archivo AI_UTILS.LSP."
  72.                           "\n Compruebe el directorio de soporte.")))
  73.  
  74.      (  (eq ;|MSG0|;"failed" (load "ai_utils" ;|MSG0|;"failed"))            ; load it
  75.         (ai_abort "DDATTDEF" "Imposible cargar el archivo AI_UTILS.LSP"))
  76.   )
  77.  
  78.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  79.       (ai_abort "DDATTDEF" nil)         ; a Nil <msg> supresses
  80.   )                                    ; ai_abort's alert box dialog.
  81.  
  82. ;;; ==================== end load-time operations =========================
  83.  
  84. (defun c:ddattdef ( /
  85.                    aflags       def_val      pt2          x_temp
  86.                    align_prev   height       rot          y_pt
  87.                    att_exist    i            style_list   y_temp
  88.                    att_prompt   justif_list  tag          z_pt
  89.                    att_tag      old_cmd      tstyle p     z_temp
  90.                    c            old_error    v            update_rot
  91.                    cjustif      p            what_next
  92.                    dcl_id       pt             x_pt         undo_init
  93.                   )
  94.  
  95.   (setq aflags (getvar "aflags"))  ; Get attribute mode system variable
  96.  
  97.   ;;
  98.   ;;  This function creates 2 lists. The first one: style_list is a list of 
  99.   ;;  available text styles. The second one: justif_list is a list of text 
  100.   ;;  justifications.
  101.   ;;
  102.   (defun load_list ()
  103.     
  104.     (setq style_list (ai_table ;|MSG0|;"style" 4))
  105.     (if (>= (getvar "maxsort") (length style_list))
  106.       (setq style_list (acad_strlsort style_list))
  107.     )
  108.     (setq justif_list (list "Izquierda"
  109.            "Alinear" "Ajustar"
  110.       "Centro" "Medio"
  111.       "Derecha" "Superior Izquierda"
  112.       "Superior Centro" "Superior Derecha" 
  113.           "Medio Izquierda" "Medio Centro"
  114.       "Medio Derecha" "Inferior Izquierda"
  115.       "Inferior Centro" "Inferior Derecho"
  116.                       )
  117.     )
  118.   )
  119.   ;;
  120.   ;;  Initilization of variables.
  121.   ;;
  122.   (defun init_variables (/ rot_temp)
  123.     (setq tstyle
  124.             (itoa (- (length style_list)
  125.                   (length (member (strcase (getvar "textstyle")) style_list))
  126.                   ))
  127.           cjustif    "0"
  128.           height     (rtos (getvar "textsize"))
  129.           att_exist  (ssget ;|MSG0|;"_x" (list (cons 0 "attdef")))
  130.           what_next  5
  131.           align_prev "0"
  132.     )
  133.     (if (not pt) (setq pt (list 0.0 0.0 0.0)))
  134.  
  135.     (setq x_pt (rtos (car pt))
  136.           y_pt (rtos (cadr pt))
  137.           z_pt (rtos (caddr pt))
  138.     )
  139.     (if (= 4 (logand 4 (cdr (assoc '70 (tblsearch "style" (getvar "textstyle"))))))
  140.       (setq rot_temp (/ (* 3 pi) 2))
  141.       (setq rot_temp 0.0)
  142.     )
  143.     (if (not rot) (setq rot (angtos rot_temp)))
  144.   )
  145.   ;;
  146.   ;;  Initialization of tiles. Called in main program loop.
  147.   ;;
  148.   (defun init_tiles ()
  149.     (if att_tag (set_tile ;|MSG0|;"att_tag" att_tag))
  150.     (if att_prompt (set_tile ;|MSG0|;"att_prompt" att_prompt))
  151.     (if def_val (set_tile ;|MSG0|;"def_val" def_val))
  152.     (if (not att_exist)
  153.       (mode_tile ;|MSG0|;"align_prev" 1)
  154.       (set_tile ;|MSG0|;"align_prev" align_prev)
  155.     )
  156.  
  157.     ;parse attribute mode local variable "aflags" in case it changed,
  158.     ;for setting state of mode radio buttons.
  159.     (if (/= 0 (logand 1 aflags))
  160.       (setq i "1") 
  161.       (setq i "0")
  162.     )
  163.     (if (/= 0 (logand 2 aflags)) 
  164.       (progn (setq c "1") (prompt_set))
  165.       (setq c "0")
  166.     )
  167.     (if (/= 0 (logand 4 aflags)) 
  168.       (setq v "1") 
  169.       (setq v "0")
  170.     )
  171.     (if (/= 0 (logand 8 aflags)) 
  172.       (setq p "1") 
  173.       (setq p "0")
  174.     )
  175.  
  176.     (set_tile ;|MSG0|;"invisible" i)
  177.     (set_tile ;|MSG0|;"constant" c)
  178.     (set_tile ;|MSG0|;"verify" v)
  179.     (set_tile ;|MSG0|;"preset" p)
  180.  
  181.     (set_tile ;|MSG0|;"x_pt" x_pt)
  182.     (set_tile ;|MSG0|;"y_pt" y_pt)
  183.     (set_tile ;|MSG0|;"z_pt" z_pt)
  184.  
  185.     (start_list ;|MSG0|;"tstyle")
  186.     (mapcar 'add_list style_list)
  187.     (end_list)
  188.     (set_tile ;|MSG0|;"tstyle" tstyle)
  189.  
  190.     (start_list ;|MSG0|;"cjustif")
  191.     (mapcar 'add_list justif_list)
  192.     (end_list)
  193.     (set_tile ;|MSG0|;"cjustif" cjustif)
  194.  
  195.     (set_tile ;|MSG0|;"height" height)
  196.  
  197.     (set_tile ;|MSG0|;"rot" rot)
  198.  
  199.     (cond                                      ; set focus
  200.       ((= 2 what_next)(mode_tile ;|MSG0|;"x_pt" 2))
  201.       ((= 3 what_next)(mode_tile ;|MSG0|;"height" 2))
  202.       ((= 4 what_next)(mode_tile ;|MSG0|;"rot" 2))
  203.       ((= 5 what_next)(mode_tile ;|MSG0|;"att_tag" 2))
  204.     )
  205.   )
  206.   ;;
  207.   ;; If the current justification is aligned or if the current text style has
  208.   ;; a non zero height, disable the height button and edit box.  Also 
  209.   ;; disable/enable rotation if justification is fit or align.
  210.   ;;
  211.   (defun grey_height()
  212.     (if (or (= 1 (atoi cjustif))
  213.             (/= 0.0 (cdr (cadddr 
  214.                            (tblsearch ;|MSG0|;"style" (nth (atoi tstyle) style_list))
  215.             )))
  216.         )
  217.       (progn 
  218.         (mode_tile ;|MSG0|;"height" 1)
  219.         (mode_tile ;|MSG0|;"bheight" 1)
  220.       )
  221.       (progn 
  222.         (mode_tile ;|MSG0|;"height" 0)
  223.         (mode_tile ;|MSG0|;"bheight" 0)
  224.       )
  225.     )
  226.     (if (or (= 1 (atoi cjustif)) 
  227.             (= 2 (atoi cjustif))
  228.         )
  229.       (progn
  230.         (mode_tile ;|MSG0|;"rot" 1)
  231.         (mode_tile ;|MSG0|;"brot" 1)
  232.       )
  233.       (progn
  234.         (mode_tile ;|MSG0|;"rot" 0)
  235.         (mode_tile ;|MSG0|;"brot" 0)
  236.       )
  237.     )
  238.   )
  239.   (defun update_rot()
  240.     (if (= 4 (logand 4 (cdr (assoc '70 (tblsearch "style" (nth (atoi tstyle) style_list))))))
  241.       (set_tile "rot" (setq rot (angtos (/ (* 3 pi) 2))))
  242.       (set_tile "rot" (setq rot (angtos 0.0)))
  243.     )
  244.   )
  245.   ;;
  246.   ;; Update the local aflags variable (attribute mode).
  247.   ;;
  248.   (defun update_aflags()
  249.     (setq aflags 0)
  250.     (if (= "1" i) (setq aflags (+ 1 aflags)))
  251.     (if (= "1" c) (setq aflags (+ 2 aflags))) 
  252.     (if (= "1" v) (setq aflags (+ 4 aflags))) 
  253.     (if (= "1" p) (setq aflags (+ 8 aflags))) 
  254.   )
  255.   ;;
  256.   ;; Reset the error tile to nil.
  257.   ;;
  258.   (defun rs_error()
  259.     (set_tile ;|MSG0|;"error" "")
  260.   )
  261.   ;;
  262.   ;;  Get all the actions associated with each tile.
  263.   ;;
  264.   (defun get_actions ()
  265.     (action_tile ;|MSG0|;"invisible"  "(setq i $value)(update_aflags)")
  266.     (action_tile ;|MSG0|;"constant"   "(setq c $value)(prompt_set)(update_aflags)")
  267.     (action_tile ;|MSG0|;"verify"     "(setq v $value)(update_aflags)")
  268.     (action_tile ;|MSG0|;"preset"     "(setq p $value)(update_aflags)")
  269.     (action_tile ;|MSG0|;"att_tag"    "(rs_error)(tag_check (setq att_tag $value))")
  270.     (action_tile ;|MSG0|;"att_prompt" "(rs_error)(setq att_prompt $value)")
  271.     (action_tile ;|MSG0|;"def_val"    "(rs_error)(setq def_val $value)")
  272.     (action_tile ;|MSG0|;"pick_pt" "(get_tag)(done_dialog 2)")
  273.  
  274.     (action_tile ;|MSG0|;"align_prev" 
  275.                  "(rs_error)(setq align_prev $value)(en_dis_able)")
  276.     (setq cmd_coor (strcat "(rs_error)(ai_num (setq x_pt $value) \""
  277.                    "Coordenada X no vßlida."
  278.                "\" 0)"))
  279.     (action_tile ;|MSG0|;"x_pt" cmd_coor)
  280.     (setq cmd_coor (strcat "(rs_error)(ai_num (setq y_pt $value) \""
  281.                    "Coordenada Y no vßlida."
  282.                "\" 0)"))
  283.     (action_tile ;|MSG0|;"y_pt" cmd_coor)
  284.     (setq cmd_coor (strcat "(rs_error)(ai_num (setq z_pt $value) \""
  285.                "Coordenada Z no vßlida."
  286.                "\" 0)"))
  287.     (action_tile ;|MSG0|;"z_pt" cmd_coor)
  288.  
  289.     (action_tile ;|MSG0|;"cjustif" "(rs_error)(setq cjustif $value) (grey_height)")
  290.     (action_tile ;|MSG0|;"tstyle"  "(rs_error)(setq tstyle $value)(grey_height)(update_rot)")
  291.     (setq cmd_coor (strcat "(rs_error)(ai_num (setq height $value) \""
  292.                    "Altura no vßlida."
  293.                    "\" 6)"))
  294.     (action_tile ;|MSG0|;"height" cmd_coor)
  295.     (action_tile ;|MSG0|;"bheight" "(get_tag)(done_dialog 3)")
  296.     (setq cmd_coor (strcat "(rs_error)(ai_angle (setq rot $value) \""
  297.                    "Angulo de rotaci≤n no vßlido."
  298.                "\")"))
  299.     (action_tile ;|MSG0|;"rot" cmd_coor)
  300.     (action_tile ;|MSG0|;"brot" "(get_tag)(done_dialog 4)")
  301.     (action_tile ;|MSG0|;"accept"  "(check_input)")
  302.     (action_tile ;|MSG0|;"cancel"  "(done_dialog 0)")
  303.     (action_tile ;|MSG0|;"help"    "(help \"\" \"ddattdef\")")
  304.  
  305.     (setq what_next (start_dialog))
  306.     (cond
  307.       ; Drops dialogue box temporarily and lets user pick a point.
  308.       ((= 2 what_next) 
  309.         (initget 1)
  310.         (setq pt (getpoint "\nPunto inicial: ")
  311.               x_pt (rtos (car pt))
  312.               y_pt (rtos (cadr pt))
  313.               z_pt (rtos (caddr pt))
  314.         )
  315.       )
  316.       ; Drops dialogue box temporarily and lets user pick a height.
  317.       ((= 3 what_next)
  318.         (temp_pt)
  319.         (initget 1)
  320.         (setq height (rtos (getdist pt "\nAltura: ")))
  321.       )
  322.       ; Drops dialogue box temporarily and lets user pick an angle.
  323.       ((= 4 what_next)
  324.         (temp_pt)
  325.         (initget 1)
  326.         (setq rot (angtos (getangle pt "\nAngulo de rotaci≤n: ")))
  327.       )
  328.     )
  329.   )
  330.   (defun get_tag ()
  331.     (setq att_tag (get_tile ;|MSG0|;"att_tag"))
  332.     (setq att_prompt (get_tile ;|MSG0|;"att_prompt"))
  333.     (setq def_val (get_tile ;|MSG0|;"def_val"))
  334.   )
  335.   ;;
  336.   ;; When picking height and rotation from the graphics screen a base point
  337.   ;; of the Start Point is used.  However, the X, Y or Z fields could 
  338.   ;; contain invalid information, so these fields have to be checked and
  339.   ;; if the data is invalid, a coordinate of 0.0 is used.
  340.   ;;
  341.   (defun temp_pt()
  342.     (if (and (= 'STR (type x_pt))
  343.              (not (setq x_temp (distof x_pt))) 
  344.         )
  345.       (setq x_temp 0.0)
  346.     )
  347.     (if (and (= 'STR (type y_pt))
  348.              (not (setq y_temp (distof y_pt))) 
  349.         )
  350.       (setq y_temp 0.0)
  351.     )
  352.     (if (and (= 'STR (type z_pt))
  353.              (not (setq z_temp (distof z_pt))) 
  354.         )
  355.       (setq z_temp 0.0)
  356.     )
  357.  
  358.     (setq pt (list x_temp y_temp z_temp))
  359.   )
  360.   ;;
  361.   ;;  Enables and disables the pick point feature if action_tile
  362.   ;;  "next" is picked. The "next" action tile is enabled only if
  363.   ;;  an attribute has been previously defined. The function of
  364.   ;;  "next" is to place the attribute right under the previously
  365.   ;;  defined attribute.
  366.   ;;
  367.   (defun en_dis_able ()
  368.     (if (= 1 (atoi align_prev))
  369.       (progn
  370.         (mode_tile ;|MSG0|;"pick_pt" 1)
  371.         (mode_tile ;|MSG0|;"x_pt" 1)
  372.         (mode_tile ;|MSG0|;"y_pt" 1)
  373.         (mode_tile ;|MSG0|;"z_pt" 1)
  374.         (mode_tile ;|MSG0|;"cjustif" 1)
  375.         (mode_tile ;|MSG0|;"tstyle" 1)
  376.         (mode_tile ;|MSG0|;"height" 1)
  377.         (mode_tile ;|MSG0|;"bheight" 1)
  378.         (mode_tile ;|MSG0|;"rot" 1)
  379.         (mode_tile ;|MSG0|;"brot" 1)
  380.       )
  381.       (progn
  382.         (mode_tile ;|MSG0|;"pick_pt" 0)
  383.         (mode_tile ;|MSG0|;"x_pt" 0)
  384.         (mode_tile ;|MSG0|;"y_pt" 0)
  385.         (mode_tile ;|MSG0|;"z_pt" 0)
  386.         (mode_tile ;|MSG0|;"cjustif" 0)
  387.         (mode_tile ;|MSG0|;"tstyle" 0)
  388.         (mode_tile ;|MSG0|;"height" 0)
  389.         (mode_tile ;|MSG0|;"bheight" 0)
  390.         (mode_tile ;|MSG0|;"rot" 0)
  391.         (mode_tile ;|MSG0|;"brot" 0)
  392.         (grey_height)                ; Height could still be disabled.
  393.         (update_rot)
  394.       )
  395.     )
  396.   ) 
  397.   ;;
  398.   ;;  Enables or disables the attribute prompt tile. If constant is turned on
  399.   ;;  then attribute prompt is disabled. If not, attribute prompt is enabled.
  400.   ;;
  401.   (defun prompt_set ()
  402.     (if (= c "1")
  403.       (progn 
  404.         (mode_tile ;|MSG0|;"att_prompt" 1)
  405.         (mode_tile ;|MSG0|;"verify" 1)
  406.         (mode_tile ;|MSG0|;"preset" 1)
  407.       )
  408.       (progn
  409.         (mode_tile ;|MSG0|;"att_prompt" 0)
  410.         (mode_tile ;|MSG0|;"verify" 0)
  411.         (mode_tile ;|MSG0|;"preset" 0)
  412.       )
  413.     )
  414.   )
  415.   ;;
  416.   ;;  Checks the validity of a tag and return the tag name if correct
  417.   ;;  and nil otherwise.  
  418.   ;;
  419.   (defun tag_check (tag)
  420.     (cond 
  421.       ((= "" tag)
  422.         (set_tile "error" "Identificador en blanco no permitido.")
  423.         nil
  424.       )
  425.       ((wcmatch tag "* *")
  426.         (set_tile "error" "Espacios en blanco no vßlidos en el identificador.")
  427.         nil
  428.       )
  429.       (T tag)
  430.     )
  431.   )
  432.   ;;
  433.   ;;  check_input is called when Ok button is picked. Uses tag_check to check 
  434.   ;;  the tag for invalid values such as a space or an empty string.  Convert
  435.   ;;  strings to reals where necessary.
  436.   ;;
  437.   (defun check_input()
  438.     (setq att_tag (get_tile ;|MSG0|;"att_tag"))
  439.     (cond 
  440.       ((not (tag_check (get_tile ;|MSG0|;"att_tag")))(mode_tile ;|MSG0|;"att_tag" 2))
  441.       ((and (= 0 (atoi align_prev))
  442.             (not 
  443.               (ai_num (get_tile ;|MSG0|;"x_pt") "Coordenada X no vßlida." 0)
  444.             )
  445.        )
  446.         (mode_tile ;|MSG0|;"x_pt" 2)
  447.       )
  448.       ((and (= 0 (atoi align_prev))
  449.             (not 
  450.               (ai_num (get_tile ;|MSG0|;"y_pt") "Coordenada Y no vßlida." 0)
  451.             )
  452.        )
  453.         (mode_tile ;|MSG0|;"y_pt" 2)
  454.       )
  455.       ((and (= 0 (atoi align_prev))
  456.             (not 
  457.               (ai_num (get_tile ;|MSG0|;"z_pt") "Coordenada Z no vßlida." 0)
  458.             )
  459.        )
  460.         (mode_tile ;|MSG0|;"z_pt" 2)
  461.       )
  462.       ((and (= 0 (atoi align_prev))
  463.             (not (or (= 1 (atoi cjustif))
  464.                      (/= 0.0 (cdr (cadddr (tblsearch ;|MSG0|;"style" (nth (atoi tstyle) style_list)))))
  465.                  )
  466.             )
  467.             (not 
  468.               (ai_num (get_tile ;|MSG0|;"height") "Altura no vßlida." 6)
  469.             )
  470.        )(mode_tile ;|MSG0|;"height" 2)
  471.       )
  472.       ((and (= 0 (atoi align_prev))
  473.             (not (or (= 1 (atoi cjustif))
  474.                      (= 2 (atoi cjustif))
  475.             ))
  476.             (not 
  477.               (ai_angle (get_tile ;|MSG0|;"rot") "Angulo de rotaci≤n no vßlido.")
  478.             )
  479.        )
  480.         (mode_tile ;|MSG0|;"rot" 2)
  481.       )
  482.  
  483.       (T (setq pt (list (distof x_pt) (distof y_pt) (distof z_pt)))(done_dialog 1))
  484.     )
  485.   )   
  486.   ;;
  487.   ;;  Function actually starts the attribute definition command.
  488.   ;;
  489.   (defun start_command ()
  490.     (setvar "aflags" aflags)
  491.     (setvar "textstyle" (nth (atoi tstyle) style_list))
  492.  
  493.     (command "_.attdef" "")
  494.     (command att_tag)
  495.     (if (= c "0") 
  496.       (progn 
  497.         (if att_prompt       
  498.           (command att_prompt)
  499.           (command "")
  500.         )
  501.       )
  502.     )
  503.     (if def_val 
  504.       (command def_val)
  505.       (command "")
  506.     )
  507.     (if (= 0 (atoi align_prev))
  508.       (progn
  509.         (cond 
  510.           ((= (atoi cjustif) 0)  ;  left
  511.             (command (list (distof x_pt) (distof y_pt) (distof z_pt)))
  512.           )
  513.           ((= (atoi cjustif) 1)  ;  aligned
  514.             (setq pt (getpoint "\nPunto para la primera lφnea de texto: ")
  515.                   pt2 (getpoint pt "\nPunto para la segunda lφnea de texto: ")
  516.             )
  517.             (command "_j" "_a" pt pt2)
  518.           )
  519.           ((= (atoi cjustif) 2)  ;  fit
  520.             (setq pt (getpoint "\nPunto para la primera lφnea de texto: ")
  521.                   pt2 (getpoint pt "\nPunto para la segunda lφnea de texto: ")
  522.             )
  523.             (command "_j" "_f" pt pt2)
  524.           )
  525.           ((= (atoi cjustif) 3)  ;  center
  526.             (command "_j" "_c" pt)
  527.           )
  528.           ((= (atoi cjustif) 4)  ;  middle
  529.             (command "_j" "_m" "1,1,1")  ;;pt
  530.           )
  531.           ((= (atoi cjustif) 5)  ;  right
  532.             (command "_j" "_r" pt)
  533.           )
  534.           ((= (atoi cjustif) 6)  ;  top left
  535.             (command "_j" "_tl" pt)
  536.           )
  537.           ((= (atoi cjustif) 7)  ;  top center
  538.             (command "_j" "_tc" pt)
  539.           )
  540.           ((= (atoi cjustif) 8)  ;  top right
  541.             (command "_j" "_tr" pt)
  542.           )
  543.           ((= (atoi cjustif) 9)  ;  middle left
  544.             (command "_j" "_ml" pt)
  545.           )
  546.           ((= (atoi cjustif) 10)  ;  middle center
  547.             (command "_j" "_mc" pt)
  548.           )
  549.           ((= (atoi cjustif) 11)  ;  middle right
  550.             (command "_j" "_mr" pt)
  551.           )
  552.           ((= (atoi cjustif) 12)  ;  bottom left
  553.             (command "_j" "_bl" pt)
  554.           )
  555.           ((= (atoi cjustif) 13)  ;  bottom center
  556.             (command "_j" "_bc" pt)
  557.           )
  558.           ((= (atoi cjustif) 14)  ;  bottom right
  559.             (command "_j" "_br" pt)
  560.           )
  561.         )
  562.         (if (not (or (= 1 (atoi cjustif))
  563.                      (/= 0.0 (cdr (assoc 40 (tblsearch ;|MSG0|;"style" 
  564.                                             (nth (atoi tstyle) style_list)))
  565.                              )
  566.                      )
  567.                  )
  568.             )
  569.           (command height)
  570.         )
  571.         (if (not (or (= 1 (atoi cjustif))
  572.                      (= 2 (atoi cjustif))
  573.                  )
  574.             )
  575.           (command (distof rot))
  576.         )
  577.       )
  578.       (command "") ; if user picks next for start point then the
  579.                    ; attribute tag goes to the line below the
  580.                    ; previous tag.
  581.     )
  582.   )
  583.   ;;
  584.   ;; Pop up the dialogue.
  585.   ;;
  586.   (defun ddattdef_main()
  587.  
  588.     (setq height (rtos (getvar "textsize")))
  589.     (load_list)
  590.     (init_variables)
  591.     (while (> what_next 1)
  592.       (if (not (new_dialog ;|MSG0|;"ddattdef" dcl_id))
  593.         (exit)
  594.       )
  595.       (init_tiles)
  596.       (grey_height)
  597.       (get_actions)
  598.     )
  599.     (if (= 1 what_next) (start_command))
  600.   )
  601.  
  602.   ;; Set up error function.
  603.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
  604.         old_error  *error*            ; save current error function
  605.         *error* ai_error              ; new error function
  606.   )
  607.  
  608.   (setvar "cmdecho" 0)
  609.  
  610.   (cond
  611.      (  (not (ai_notrans)))                        ; transparent not OK
  612.      (  (not (ai_acadapp)))                        ; ACADAPP.EXP xloaded?
  613.      (  (not (setq dcl_id (ai_dcl ;|MSG0|;"ddattdef"))))   ; is .DCL file loaded?
  614.      (T (ai_undo_push)
  615.         (ddattdef_main)                            ; proceed!
  616.         (ai_undo_pop)
  617.      )                          
  618.   )
  619.  
  620.   (setq *error* old_error) 
  621.   (setvar "cmdecho" old_cmd)
  622.   (princ)
  623. )
  624.  
  625. ;;;---------------------------------------------------------------------------;
  626. (princ "  DDATTDEF cargada.")
  627. (princ)
  628.  
  629.