- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
)
Solved! Go to Solution.