Gotta question, I stumbled upon Mr Rons Area Field routine. how would I modify the field value to become a formula?
I want to create a formula which would take the value,
i.e. (((([Area Field]+[Calculated Area Field])/2)*4)/43560)
Calculated Area Field
Taking the selected polyline, offsetting it 12' inside and using that value. (Not sure how to make that happen. lol.)
Thanks for any direction!
(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.\">%" ;; I think this is the area to modify
)
(vl-load-com)
(defun c:FOO (/ *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)
)