Another version of Evgeny's Test routine.
Works only with objects for which the Normal property is available (2D objects as arcs, ellipses, lwpolylines, texts or mtexts, block references, and so on...) or planar splines.
The result is returned about object plane.
Note: ang<2pi, Clockwisep, Norm_3pts, GetSplineNormal and OCS-Bbox have to be loaded (see upper replies)
(defun c:test (/ E LST MA MI NO BB)
(if (setq e (car (entsel "\n Select object: ")))
(progn
(setq e (vla-copy (vlax-ename->vla-object e))
lst nil
) ;_ setq
(if (vlax-property-available-p e 'Normal)
(setq no (vlax-get e 'Normal))
(if (and (= (vla-get-ObjectName e) "AcDbSpline")
(= (vla-get-IsPlanar e) :vlax-true)
) ;_ and
(setq no (getSplineNormal e))
) ;_ if
) ;_ if
(if no
(progn
(repeat 1000
(setq bb (ocs-bbox e no)
lst (cons (mapcar (function -) (cadr bb) (car bb)) lst)
) ;_ setq
(vla-rotate3d
e
(vlax-3d-point 0. 0.)
(vlax-3d-point no)
(/ pi 1000.)
)
) ;_ repeat
(princ "\n Bounding box object with minimal length: ")
(princ (assoc (car (apply 'mapcar (cons 'min lst))) lst))
)
(princ "\n No Normal property for this object.")
) ;_ if
(vla-Delete e)
(princ)
) ;_ progn
) ;_ if
) ;_ defun