Area in mm2, m2 and feet2

Area in mm2, m2 and feet2

Anonymous
Not applicable
3,993 Views
12 Replies
Message 1 of 13

Area in mm2, m2 and feet2

Anonymous
Not applicable

I NEED A RECTANGLE AREA in 3 unit mm2, m2 and feet2Capture.JPG

0 Likes
Accepted solutions (2)
3,994 Views
12 Replies
Replies (12)
Message 2 of 13

injineri
Advocate
Advocate

Think it can be done by inserting FIELDS>object>area>>Format>additional Format and you must play with conversion factor. For feets you can choose architectural in Format section of fields window.

0 Likes
Message 3 of 13

Anonymous
Not applicable

I NEED LISP

0 Likes
Message 4 of 13

_gile
Consultant
Consultant

Hi,

 

You should show what you have tried to code so far for this purpose so that someone can help you effectively.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 5 of 13

Anonymous
Not applicable

I dont know how to make lisp.

but actually i need if i command like 'areamm'

it should ask select closed poly line,

then click  anywhere

the result should be in 3 unit like mm2, m2 and feet2

 

is it possible

0 Likes
Message 6 of 13

devitg
Advisor
Advisor
Accepted solution

Try it 

 

 

;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
;;;    Copyleft 1995-2018 by Gabriel Calos De Vit 
;; [email protected]    



(DEFUN C:PUT-AREA-TEXTS  (/
                          ACAD-OBJ
                          ADOC
                          AREA
                          AREA-FT^2
                          AREA-MM^2
                          AREA-M^2
                          AREA-TEXT
                          INSERT
                          LWPOLY
                          LWPOLY-OBJ
                          MODEL
                          SELECTIONSETS
                          TEXT-AREAS
                          TEXTSIZE)


  (VL-LOAD-COM)
  (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ el programa ACAD 
  (SETQ ADOC (VLA-GET-ACTIVEDOCUMENT ACAD-OBJ)) ;_ el DWG que esta abierto-
  (SETQ MODEL (VLA-GET-MODELSPACE ADOC))
  (SETQ SELECTIONSETS (VLA-GET-SELECTIONSETS ADOC))
  (VLA-GET-ACTIVESELECTIONSET ADOC)
  (SETQ LWPOLY (SSGET ":s" '((0 . "LWPOLY*"))))
  (SETQ LWPOLY-OBJ (VLA-ITEM (VLA-GET-ACTIVESELECTIONSET ADOC) 0))
  (SETQ INSERT (GETVAR 'INSUNITS))
  (SETVAR 'INSUNITS 4) ; units in mm
  (SETQ AREA (VLA-GET-AREA LWPOLY-OBJ))
  (SETQ AREA-MM^2 (RTOS AREA 2 0))
  (SETQ AREA-M^2 (RTOS (/ AREA 1000.0 1000.0) 2 2))
  (SETQ AREA-FT^2 (RTOS (/ AREA (* 12 25.4) (* 12 25.4)) 2 3))
  (SETQ AREA-TEXT (STRCAT AREA-MM^2 " mm2, " AREA-M^2 " m2, " AREA-FT^2 " ft2"))
  (SETQ TEXTSIZE (GETVAR 'DIMTXT))
  (SETQ OSMODE (GETVAR 'OSMODE))
  (SETVAR 'OSMODE 0)
  (SETQ TEXT-AREAS (VLA-ADDTEXT MODEL AREA-TEXT (VLAX-3D-POINT (GETPOINT "\ pick place to text")) TEXTSIZE))
  )



;|«Visual LISP© Format Options»
(180 2 1 0 nil "end of " 100 20 2 2 nil nil T nil T)
;*** DO NOT add text below the comment! ***|;
Message 7 of 13

Anonymous
Not applicable

AWESOME

THANKYOU SO MUCH

0 Likes
Message 8 of 13

devitg
Advisor
Advisor

To be command AREAMM

 

Change 

 

C:PUT-AREA-TEXTS

by 

 

C:areamm

 

 

 

 

 

 

Text size is the same as the DIM text size .

 

You can set any other at this line 

 

(SETQ TEXTSIZE (GETVAR 'DIMTXT))

Maybe as a relation to the area size, or whatever you need  

Message 9 of 13

injineri
Advocate
Advocate

respect, very nice lisp, I don't know programing but dared and added \U+00B2 beside "mm" to show squared in final text and it worked. 

 

(SETQ AREA-TEXT (STRCAT AREA-MM^2 " mm\U+00B2, " AREA-M^2 " m\U+00B2, " AREA-FT^2 " ft\U+00B2"))

0 Likes
Message 10 of 13

devitg
Advisor
Advisor

To set so

 

 

 

(SETQ AREA-TEXT (STRCAT AREA-MM^2 " mm\U+00B2, " AREA-M^2 " m\U+00B2, " AREA-FT^2 " ft\U+00B2"))

It need to use a TEXT FONT that allow such  \U+00B2  , 

 

no 2 as square.PNG

 

 

 

 

 

All it would be simple and done in a good way , if the OP , would upload a SAMPLE. DWG

 

It is a common way to ask , showing an IMAGE, and it is need to say , that up to day ACAD , can NOT edit IMAGES, maybe it can be on the ACAD USERS'S wish-list.  

Message 11 of 13

Anonymous
Not applicable

I HAVE PROBLEM FOR THE LISP

AFTER I RUN THE PROGRAM, OSNAP IS AUTOMATICALLY OFFED

 

0 Likes
Message 12 of 13

devitg
Advisor
Advisor
Accepted solution

add this line) 

 

 

 (SETQ OSMODE (GETVAR 'OSMODE))
(SETVAR 'OSMODE 0)
(SETQ TEXT-AREAS (VLA-ADDTEXT MODEL AREA-TEXT (VLAX-3D-POINT (GETPOINT "\ pick place to text")) TEXTSIZE))
(setvar 'OSMODE OSMODE) ;; add

 

Message 13 of 13

Anonymous
Not applicable

same as it after add the last command

osnap is offed

0 Likes