Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
(defun C:CENTROID (/ ent vla_poly vla_region centroid)
(vl-load-com)
(if
(and (setq ent (car (entsel "\nSelect a polyline: ")))
(eq (cdadr (entget ent)) "LWPOLYLINE")
(eq (vla-get-closed
(setq vla_poly (vlax-ename->vla-object ent))
)
:vlax-true
)
)
(progn
(setq vla_region
(car (vlax-safearray->list
(vlax-variant-value
(vla-addregion
(vla-objectidtoobject
(vla-get-document
vla_poly
)
(vla-get-ownerid
vla_poly
)
)
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbobject
(cons 0 (1- (length (list vla_poly))))
)
(list vla_poly)
)
)
)
)
)
)
(setq centroid (vlax-safearray->list
(vlax-variant-value
(vla-get-centroid vla_region)
)
)
)
(vla-delete vla_region)
)
)
centroid
)
(princ)