I found this lisp online that will snap to the center of a rectangle but after I load it, I can't get it to work, would someone please take a look and see why it won't work?
Thanks!
defun c:SnapToCenter (/ a1 cen d1 ent p1 p2 RecObj)
(vl-load-com)
(setq ent (car (entsel "\nSelect Rectangle: <> "))
RecObj (vlax-ename->vla-object ent)
p1 (safearray-value (variant-value (vla-get-Coordinate RecObj 0)))
p2 (safearray-value (variant-value (vla-get-Coordinate RecObj 2)))
a1 (angle p1 p2)
d1 (distance p1 p2)
cen (polar p1 a1 (* d1 0.5))
)
(vl-cmdf ".move" ent "" cen pause)
(princ)
)
David
Jacobs Tech.