INSERT AREA

INSERT AREA

rolisonfelipe
Collaborator Collaborator
577 Views
9 Replies
Message 1 of 10

INSERT AREA

rolisonfelipe
Collaborator
Collaborator

 

; FROM THE DESK OF PAUL STANDING
; AREA TEXT COMBINED () ATXT.LSP V.1.0
; Nov 9th, 1994

(defun C:ATXT (/ e th val unit fmt pt )
(setvar "cmdecho" 0)

(setq ESCALA (getreal "\n INFORME UMA ESCALA 1:"))
(setq HTEXTO (* 0.1 (/ ESCALA 50 )))

(setq e (entsel "\nPlease select an entity..."))
(command "area" "e" e)(setq th (* 0.18 (getvar "dimscale")))
(setq VAL (getvar "area" ))
(setq unit (getvar "lunits"))


(command "style" "AREALOTE" "ARIAL" "" "" "" "" "" "")
(if (= (tblsearch "LAYER" "TOP AREA LOTE"))
(command "-LAYER" "M" "TOP AREA LOTE" "c" "004" "" "LT" "Continuous" "" "LW" "0.00" "" ""))

(if (or(= unit 4)(= unit 5))
(progn
(setq val (/ val 144))
(setq fmt (strcat "AREA= "(rtos val 2 2 ) " M2"))
(command "text" PT TH "0" Fmt)
(princ "Place Text")
(command "move" "SI" "L" PT Pause)
);ends progn
); Ends if statement
(setvar "cmdecho" 1)
(princ)
); ends atxt.lsp
(prompt "\nType ATXT to envoke the command")

0 Likes
Accepted solutions (1)
578 Views
9 Replies
Replies (9)
Message 2 of 10

Sea-Haven
Mentor
Mentor

What is question ?

0 Likes
Message 3 of 10

calderg1000
Mentor
Mentor
Accepted solution

Regards @rolisonfelipe 

Try this code with a few minor changes to the one posted, to get the area in m2.

(defun C:ATXT (/ e th val unit fmt pt)
  (setvar "cmdecho" 0)
  (setq ESCALA (getreal "\n INFORME UNA ESCALA 1:")
        HTEXTO (* 0.1 (/ ESCALA 50))
        e      (entsel "\nPlease select an entity...")
  )
  (command "area" "o" (car e))
  (setq VAL  (getvar "area")
        unit (getvar "lunits")
        pt   (cadr e)
  )
  (command "style" "AREALOTE" "ARIAL" "" "" "" "" "")
  (if (= (tblsearch "LAYER" "TOP AREA LOTE"))
    (command "-LAYER" "M" "TOP AREA LOTE" "c" "004" "" "LT" "Continuous" "" "LW"
             "0.00" "" ""
            )
  )
  (setq fmt (strcat "AREA= " (rtos val 2 2) " M2"))
  (command "text" PT HTEXTO 0 Fmt)
  (command "move" "SI" "L" PT Pause)
  (setvar "cmdecho" 1)
  (princ)
)                                                 ; ends atxt.lsp
(prompt "\nType ATXT to envoke the command")

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 4 of 10

paullimapa
Mentor
Mentor

have you tried my free Area Object Link App?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 5 of 10

Kent1Cooper
Consultant
Consultant

If this was posted because it doesn't work and you want to know why, I see there is no setting of the PT variable for the Text insertion point.

 

Also, I notice that it will make the Text only if LUNITS = 4 or 5 [Architectural or Fractional], but 3 [Engineering] is also an inches-based setting, so it should be included.  But though it takes the area and divides it by 144 to convert square inches to square feet, it keeps the square-meters ending in the text content.

 

It does nothing if LUNITS is set for metric -- there is no 'else' argument if LUNITS is not 4 or 5.

Kent Cooper, AIA
Message 6 of 10

Kent1Cooper
Consultant
Consultant

By the way, you can get the "squared" part as superscript even in plain Text --  [which I think is more "standard" than with a capital M], or if you still want an option for imperial units, ft².  It works inside AutoLisp functions.  You can copy/paste it from here, or type it in by holding the Alt key down while pressing, on the numeric keypad [not the number keys across the top], 253 [without Enter to conclude] and then releasing the Alt key.

Kent Cooper, AIA
0 Likes
Message 7 of 10

Sea-Haven
Mentor
Mentor

Have a look at (strcat "m" (chr  178))

0 Likes
Message 8 of 10

calderg1000
Mentor
Mentor

Dear @rolisonfelipe 

I agree with kent, the suffix m2, looks better with the superscript m².
You can make the change here:

(setq fmt (strcat "AREA= " (rtos val 2 2) " m²"))

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 9 of 10

rolisonfelipe
Collaborator
Collaborator

I have several problems with accented characters, and this is one of them.

0 Likes
Message 10 of 10

rolisonfelipe
Collaborator
Collaborator

hello my noble, unfortunately when I put this formatting when the command is executed the text is inserted with one more acacterie

0 Likes