imperial to metric

imperial to metric

NERDASORUS
Advocate Advocate
964 Views
2 Replies
Message 1 of 3

imperial to metric

NERDASORUS
Advocate
Advocate

hi 

i have this lisp that gives the areas of each closed poly line at the center of the area ( each shape show its area at the center of the shape) the thing is , this lisp gives the area in squared feet (divides by 144) , is there away to stop it from doing that ?? 


(vl-load-com)

(defun c:F00 (/ *error* acDoc oSpace origin insertionPoint oUtil oMText)

(defun *error* (msg)
(if acDoc
(vla-endundomark acDoc)
)
(cond ((not msg)) ; Normal exit
((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit)
((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it
)
(princ)
)

(if (ssget "_:L" '((0 . "CIRCLE,*POLYLINE")))
(progn
(vla-startundomark
(setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
)
(setq oSpace
(vlax-get
acDoc
(if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)
)
)
(setq origin (vlax-3d-point '(0 0 0)))
(vlax-for x (vla-get-activeselectionset acDoc)

;; Calculate the centroid
(vla-getboundingbox x 'mn 'mx)
(setq insertionPoint
(vlax-3d-point
(mapcar '*
(mapcar '+
(vlax-safearray->list mn)
(vlax-safearray->list mx)
)
'(0.5 0.5 0.5)
)
)
)


;; Add mtext
(setq oMText
(vla-addmtext
oSpace
origin
0.0
(strcat
"%<\\AcObjProp Object(%<\\_ObjId "
(if (> (vl-string-search "x64" (getvar 'platform)) 0)
(vlax-invoke-method
(cond (oUtil)
((setq oUtil (vla-get-utility acDoc)))
)
'getobjectidstring
x
:vlax-False
)
(rtos (vla-get-objectid x) 2 0)
)
">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. ft.\">%"
)
)
)
(vla-put-attachmentpoint oMText acmiddlecenter)
(vla-move oMText origin insertionPoint)

;;<-- Set MText height, style, etc. here... Example:
(vla-put-height oMText (/ 1. (getvar 'cannoscalevalue)))
;; ... others.
)
)
)
(*error* nil)
)

0 Likes
Accepted solutions (1)
965 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant

Just about the tenth line from the bottom is a field definition.

 

Go to the field dialog and copy-paste the value you want. Make sure to add a backslash before existing backslash and quotation mark.

 

Message 3 of 3

roland.r71
Collaborator
Collaborator
Accepted solution

Like BeeKeeCZ said,

 

change the line:

">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. ft.\">%"

 

into:

">%).Area \\f \"%lu2%pr2 mm²\">%"

 

That should do the trick.

0 Likes