Bonjour,
je voudrais savoir si il est possible de créer un rectangle capable le plus petit possible par rapport à un poligone
rectangle_capable.pdf
Bonjour,
je voudrais savoir si il est possible de créer un rectangle capable le plus petit possible par rapport à un poligone
Bonjour,
Pas de solution automatique à ma connaissance, il suffit de mettre les côtés coïncidents avec les sommets du polygone.
En fait j'ai trouvé un programme LISP qui le fait :
;; 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 UR 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)
(princ)
); defun -- C:SR
Source :
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/the-smallest-rectangle-enclosing-selected-set-of-objects/td-p/3791519
Edition : pour l'utilisation des LISP, voir ce tutoriels :
http://cadxp.com/topic/14323-charger-un-lisp/