ERRO ARC AREA

ERRO ARC AREA

sigmmadesigner
Advocate Advocate
628 Views
10 Replies
Message 1 of 11

ERRO ARC AREA

sigmmadesigner
Advocate
Advocate

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:AA (/)

(IF (NOT ESC) (SETQ ESC 50.0) )
(SETQ XUNIDADE 1000)
(setq HTXT "\nEsc.= 1:")
(setq LAST ESC)
(setq ESC (getreal (strcat HTXT "<" (rtos LAST 2 0) ">")))
(if (= ESC nil) (setq ESC LAST))

(SETQ R-OSMODE (GETVAR "OSMODE"))
(SETVAR "CMDECHO" 0)
(SETVAR "DIMZIN" 0)
(SETVAR "OSMODE" 0)

(COMMAND "_LAYER" "_M" "_LOTE AREA" "_C" "2" "_LOTE AREA" "")
(COMMAND "_STYLE" "ISOCP" "ISOCP" "" "" "" "" "")

(SETQ AREAT 0)
(SETQ PINS (GETPOINT "\n INSERT AREA = "))

(WHILE PINS
(COMMAND "_-BOUNDARY" PINS "")
(COMMAND "_AREA" "_O" "_L")
(ENTDEL (ENTLAST))
(SETQ ATXT (* 1.5 (/ ESC XUNIDADE)))
(SETQ AREAC (GETVAR "AREA"))
(SETQ AREAT (+ AREAT AREAC))
(SETQ HTXT1 (STRCAT "" (RTOS AREAC 2 2) "m²"))
(SETQ HTXT2 (STRCAT "" (RTOS AREAC 2 2) "m² *** TOTAL = " (RTOS AREAT 2 2) "m²"))
(COMMAND "_TEXT" "_M" PINS ATXT "0" HTXT1)
(PRINT HTXT2)
(SETQ PINS (GETPOINT "\n INSERT POINT = ")))

(SETVAR "CLAYER" "0")
(SETVAR "OSMODE" R-OSMODE)
)

0 Likes
Accepted solutions (1)
629 Views
10 Replies
Replies (10)
Message 2 of 11

Sea-Haven
Mentor
Mentor

Ok took a bit to work out what you want M squared m² depending on what font your using the superscript 2 should appear.

 

You will need to use the correct key code for the supercript 2. If you use Mtext you can use "m\\S2". for text may need to use the uni code U+00B2.

 

It looks like Isocp.shx is not supported when using the ², try to use a True Type Font Arial etc. 

Message 3 of 11

paullimapa
Mentor
Mentor

I don't see any errors...

paullimapa_0-1740204888765.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 11

sigmmadesigner
Advocate
Advocate
0 Likes
Message 5 of 11

Sea-Haven
Mentor
Mentor

I am using Bricscad V25 and this is the result using  a text style of Isocp.shx, I copied the shape and change the text style to another and can now see the m². 

I just wondered @paullimapa did you have the text style set to use Isocp.shx ? If ok in Autocad then may be a difference in the Isocp.shx.

 

SeaHaven_0-1740268039510.png

 

0 Likes
Message 6 of 11

paullimapa
Mentor
Mentor

I just changed the STYLE after the fact and also changed the color and PLINE widths just to make the appearance easier to read on the screenshots.

But even when the dwg is as @sigmmadesigner posted, no matter what I try running AA.lsp does NOT error out like @sigmmadesigner or you show.

I'm running this on AutoCAD 2025.1.1 and I've tried with both DirectX11 and DirectX12

I only get the following correct area results:

paullimapa_0-1740280182195.png

paullimapa_1-1740280199109.png

paullimapa_2-1740280240192.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 11

sigmmadesigner
Advocate
Advocate

sigmmadesigner_0-1740289783915.png

in versions higher than 2007, this is the result. Crazy!!!!

0 Likes
Message 8 of 11

paullimapa
Mentor
Mentor
Accepted solution

I wonder if it has to do with the  as mentioned by @Sea-Haven 

To see if that's the issue, I've attached revised code

1. Comments out those lines with and replaces with standard m2.

;(SETQ HTXT1 (STRCAT "" (RTOS AREAC 2 2) "m²"))
;(SETQ HTXT2 (STRCAT "" (RTOS AREAC 2 2) "m² *** TOTAL = " (RTOS AREAT 2 2) "m²"))
(SETQ HTXT1 (STRCAT "" (RTOS AREAC 2 2) "m2"))
(SETQ HTXT2 (STRCAT "" (RTOS AREAC 2 2) "m2 *** TOTAL = " (RTOS AREAT 2 2) "m2"))

2. Replaces variable LAST (which is use by Autolisp) with eLast:

; (setq LAST ESC)
; (setq ESC (getreal (strcat HTXT "<" (rtos LAST 2 0) ">")))
; (if (= ESC nil) (setq ESC LAST))
(setq eLAST ESC)
(setq ESC (getreal (strcat HTXT "<" (rtos eLAST 2 0) ">")))
(if (= ESC nil) (setq ESC eLAST))

3. Localizes all variables used:

(DEFUN C:AA 
  ; localize variables
  (/ ESC XUNIDADE HTXT eLast R-OSMODE AREAT PINS ATXT AREAC HTXT1 HTXT2)

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 11

sigmmadesigner
Advocate
Advocate

TESTED, HIGHER VERSIONS OF LISP WILL RUN VERY WELL

THANK YOU! GREAT SOLUTION

0 Likes
Message 10 of 11

paullimapa
Mentor
Mentor

You are welcome…cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 11

Sea-Haven
Mentor
Mentor

Just another comment.

 

(SETQ PINS (GETPOINT "\n INSERT AREA = "))

(WHILE PINS

Change to 

(WHILE PINS (SETQ PINS (GETPOINT "\n INSERT AREA = Press Enter to exit "))
remove the other (setq PINS as its not needed.
0 Likes