Hello
I would like to know if it is possible to create a rectangle capable of the smallest possible compared to a poligone
rectangle_capable.pdf
Hello
I would like to know if it is possible to create a rectangle capable of the smallest possible compared to a poligone
Hello
No automatic solution to my knowledge, just put the sides coinciding with the vertices of the polygon.
In fact, I found a LISP program that does it:
;; SmallestRectangle.lsp [command name: SR]
;; To draw the Smallest orthogonal Rectangle around a User-
;; selected group of objects. Draws on the current Layer.
;; Kent Cooper, 27 February 2013
(defun C:SR (/obb oLL oUR ss LL UR); = Smallest Rectangle
(defun obb (ent); = Object's Bounding Box corners
(vla-getboundingbox (vlax-ename->vla-object ent) 'minpt 'maxpt)
(setq
oLL (vlax-safearray->list minpt); Object's Lower Left
oUR (vlax-safearray->list maxpt); Object's Upper Right
); setq
); defun -- obb
(vl-load-com)
(prompt "\nTo draw the Smallest Rectangle around them,")
(setq ss (ssget))
(obb (ssname ss 0))
(setq LL oLL YOUR oUR); initial overall LL&UR [of first object]
(ssdel (ssname ss 0) ss)
(repeat (sslength ss)
(obb (ssname ss 0))
(setq
LL (mapcar 'min oLL LL); least of each component
UR (mapcar 'max oUR UR); greatest of each component
); setq
(ssdel (ssname ss 0) ss)
); Repeat
(command "_.rectangle" "_none" LL "_none" UR)
(prinç)
); defun -- C:SR
Spring:
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/the-smallest-rectangle-enclosing-selected-set-of-objects/td-p/3791519
Editing: for the use of LISPs, see this tutorial:
http://cadxp.com/topic/14323-charger-un-lisp/