Hi csgohjmj ! ?
Here is my old working R14 stuff.
a point is created in the centroid, check the pdmode, DDptype.
If you want Moment, Products, Radii from the centroid, You can run
TP again in that point "Select point for centroid calculation ".
Code:
(defun c:tp(/ ucsic ents osm )
;;; 2000-05-19 kennet
(defun calc (/ org tpfil I Xrad Yrad Ytp Ytp TP )
(setq org (getpoint "Select point for centroid calculation "))
(command "._ucs" "Origin" org )
(setvar "UCSICON" 3 )
(command "._massprop" "l" "" "Y" "C:$$temp$$")
(command "._erase" "l" "")
(setq tpfil (open "C:$$temp$$.mpr" "r"))
(setq I 0 )
(while (< I 8 )
(setq Xrad (read-line tpfil ))
(setq I (1+ I))
)
(setq Yrad (read-line tpfil ))
(close tpfil )
(command "._del" "C:$$temp$$.mpr")
(setq Xtp (float(atof (substr Xrad 26 10 ))))
(setq Ytp (float(atof (substr Yrad 26 10 ))))
(setvar "OSMODE" 0 )
(command "._point" (list Xtp Ytp) )
(setvar "OSMODE" osm )
(setvar "UCSICON" ucsic )
(command "._ucs" "p")
(textscr)
)
(defun not_ok ()
(command "._erase" "p" "")
(princ "!! Cant make a closed are !! ")
)
(setvar "CMDECHO" 0 )
(setq ucsic (getvar "UCSICON"))
(setq osm (getvar "OSMODE"))
(prompt "nSelect objects in a closed area : ")
(setq ents (ssget))
(command "._copy" "p" "" "0,0,0" "0,0,0" )
(command "._region" "p" "")
(if (= (cdr (assoc 0 (entget (entlast)))) "REGION" ) (calc) (not_ok) )
(princ)
)
Happy Computing !
kennet