To snap proportional along a line try: http://forums.augi.com/showthread.ph...icrostation#16
For middle of an object:
Code:
; Middle Object Osnap
; Macro: ^P(or midobj (load "midobj.lsp")(princ))(midobj)
(defun midobj (/ ll ur selection pntlist pnts adoc)
(setq selection (car (entsel))
adoc (vla-get-activedocument (vlax-get-acad-object))
)
(vla-getboundingbox (vlax-ename->vla-object selection) 'll 'ur)
(setq pntlist (mapcar 'vlax-safearray->list (list ll ur)))
(list(/(+(caar pntlist)(caadr pntlist))2.0)(/(+(cadar pntlist)(cadadr pntlist))2.0))
)
For Centroid of closed polygon try:
Code:
;Center of closed polygon
;^P(or C:pc1 (load "pc1.lsp"))(pc1)
; (load "pc1.lsp")(pc1)
(defun pc1 ( / acdoc acspc acsel reg pt) (vl-load-com) ;; © Lee Mac 2011
(setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))
acspc (vlax-get-property acdoc (if (= 1 (getvar 'CVPORT)) 'Paperspace 'Modelspace))
)
; (if (ssget "+.:E:S")
(if (ssget "+.:E:S" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))
(progn
(vlax-for obj (setq acsel (vla-get-ActiveSelectionSet acdoc))
(setq pt(trans (vlax-get (setq reg (car (vlax-invoke acspc 'addregion (list obj)))) 'Centroid) 1 0))
(vla-delete reg)
)
(vla-delete acsel)
)
)
pt
)