<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Changing Polyline Shape in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846310#M124161</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/999523"&gt;@BSA-Dean&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I select the shape it comes up in the command line 'nil' as attached. Same for the multiple one. Must be doing something daft.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Zoom to the Extents, and you should see it. &amp;nbsp;In your image, you're not in the World Coordinate System. &amp;nbsp;The routine could be made to account for that, if necessary [and also to suppress the display of that nil when it's done, which is just the return from any (command) function]. &amp;nbsp;But you already have another solution&amp;nbsp;that does what it seems&amp;nbsp;you're after, including [not the one you name in Post 11, but another in Post 9] selecting a lot of them at once [which DBB doesn't do, though it could also be adjusted to allow that], so I won't rush to edit it.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 15:26:09 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2017-02-01T15:26:09Z</dc:date>
    <item>
      <title>Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843174#M124150</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bit of a strange one, but here goes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some contours which have come from Orion in .dwg format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Over these Contour extents additional Reinforcement bars have to be placed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As there are hundreds of patches, I'm looking for a LISP that could take an irregular polyline and square it off using the outermost extremities of the polyline (contour shape).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody seen anything that could do this job. Any help much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 13:46:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843174#M124150</guid>
      <dc:creator>BSA-Dean</dc:creator>
      <dc:date>2017-01-31T13:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843192#M124151</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/999523"&gt;@BSA-Dean&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp;I'm looking for a LISP that could take an irregular polyline and square it off using the outermost extremities of the polyline (contour shape).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anybody seen anything that could do this job. Any help much appreciated.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Try these.&amp;nbsp; One does it upon selection of an individual object; the other lets you choose Multiple objects at once, and then does it [one collective bounding box] around all of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They originate from &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-rectangle-by-sides/m-p/6679627/highlight/true#M346768" target="_self"&gt;this thread&lt;/A&gt;, if you're interested in&amp;nbsp;related considerations.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 13:57:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843192#M124151</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-01-31T13:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843494#M124152</link>
      <description>&lt;P&gt;Is your rebar polyline polygonal (without arcs) and do you need minimal enclosing bounding box, or just orthogonal one from current UCS orientation and current orientation of rebar polyline?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 15:28:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843494#M124152</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2017-01-31T15:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843978#M124153</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/940934"&gt;@marko_ribar&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;do you need minimal enclosing bounding box, or just orthogonal one ...?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If&amp;nbsp;what's wanted is a minimal, not necessarily orthogonal, surrounding rectangle, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/the-smallest-rectangle-enclosing-selected-set-of-objects/m-p/3795624#M309506" target="_self"&gt;here&lt;/A&gt; is my take on that, but look through the rest of that thread for other possibilities.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 18:02:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6843978#M124153</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-01-31T18:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6844063#M124154</link>
      <description>&lt;P&gt;If rebar polyline is polygonal (without arcs), minimal bounding box could be found without rotational increments... The solution can be exact bounding box - it is necessary to be used Graham scan through point list...&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 18:28:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6844063#M124154</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2017-01-31T18:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6844704#M124155</link>
      <description>&lt;P&gt;That's very interesting. &amp;nbsp;Sounds like he is building a wall or maybe slabs sized for a truckload of rebars already bent up. &amp;nbsp;He should have asked for an outline that provides the minimum clearance. &amp;nbsp;:]&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 22:37:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6844704#M124155</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2017-01-31T22:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845373#M124156</link>
      <description>&lt;P&gt;Thanks for your reply. The lisp you have sounds ideal for what I need. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately I can't get it to work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I select the shape it comes up in the command line 'nil' as attached. Same for the multiple one. Must be doing something daft.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any more help very much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 08:38:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845373#M124156</guid>
      <dc:creator>BSA-Dean</dc:creator>
      <dc:date>2017-02-01T08:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845499#M124157</link>
      <description>&lt;P&gt;Can you answer on questions I posted in post #3? I already have routines, if the answers are Yes to both questions...&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 10:26:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845499#M124157</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2017-02-01T10:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845942#M124158</link>
      <description>&lt;P&gt;Here are 2 lisp I had in mind... :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First one for WCS bounding box(es) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:bboxpolygon ( / pl p1 p2 p3 p4 r1 r2 r3 r4 )
  (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (car (entsel "\nPick closed POLYGON...")))))))
  (setq p1 (car (vl-sort pl (function (lambda ( a b ) (&amp;lt; (cadr a) (cadr b)))))))
  (setq p2 (car (vl-sort pl (function (lambda ( a b ) (&amp;lt; (car a) (car b)))))))
  (setq p3 (car (vl-sort pl (function (lambda ( a b ) (&amp;gt; (car a) (car b)))))))
  (setq p4 (car (vl-sort pl (function (lambda ( a b ) (&amp;gt; (cadr a) (cadr b)))))))
  (setq r1 (inters p1 (polar p1 0.0 1.0) p2 (polar p2 (* 0.5 pi) 1.0) nil))
  (setq r2 (inters p1 (polar p1 0.0 1.0) p3 (polar p3 (* 0.5 pi) 1.0) nil))
  (setq r3 (inters r1 (polar r1 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
  (setq r4 (inters r2 (polar r2 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
  (entmake
    (list
      '(0 . "LWPOLYLINE")
      '(100 . "AcDbEntity")
      '(100 . "AcDbPolyline")
      '(90 . 4)
      (cons 70 (1+ (* 128 (getvar 'plinegen))))
      '(38 . 0.0)
      (cons 10 r1)
      (cons 10 r2)
      (cons 10 r4)
      (cons 10 r3)
      '(210 0.0 0.0 1.0)
      '(62 . 3)
    )
  )
  (prompt "\nArea : ") (princ (rtos (* (distance r1 r2) (distance r1 r3)) 2 20))
  (princ)
)

(defun c:bboxpolygons ( / ss i pl p1 p2 p3 p4 r1 r2 r3 r4 )
  (prompt "\nSelect closed POLYGONS...")
  (setq ss (ssget (list '(0 . "LWPOLYLINE") '(-4 . "&amp;amp;=") '(70 . 1) '(-4 . "&amp;lt;not") '(-4 . "&amp;lt;&amp;gt;") '(42 . 0.0) '(-4 . "not&amp;gt;"))))
  (if ss
    (repeat (setq i (sslength ss))
      (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (ssname ss (setq i (1- i))))))))
      (setq p1 (car (vl-sort pl (function (lambda ( a b ) (&amp;lt; (cadr a) (cadr b)))))))
      (setq p2 (car (vl-sort pl (function (lambda ( a b ) (&amp;lt; (car a) (car b)))))))
      (setq p3 (car (vl-sort pl (function (lambda ( a b ) (&amp;gt; (car a) (car b)))))))
      (setq p4 (car (vl-sort pl (function (lambda ( a b ) (&amp;gt; (cadr a) (cadr b)))))))
      (setq r1 (inters p1 (polar p1 0.0 1.0) p2 (polar p2 (* 0.5 pi) 1.0) nil))
      (setq r2 (inters p1 (polar p1 0.0 1.0) p3 (polar p3 (* 0.5 pi) 1.0) nil))
      (setq r3 (inters r1 (polar r1 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
      (setq r4 (inters r2 (polar r2 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
      (entmake
        (list
          '(0 . "LWPOLYLINE")
          '(100 . "AcDbEntity")
          '(100 . "AcDbPolyline")
          '(90 . 4)
          (cons 70 (1+ (* 128 (getvar 'plinegen))))
          '(38 . 0.0)
          (cons 10 r1)
          (cons 10 r2)
          (cons 10 r4)
          (cons 10 r3)
          '(210 0.0 0.0 1.0)
          '(62 . 3)
        )
      )
    )
  )
  (princ)
)

(defun c:bboxpolygons-global ( / ss i pl pll p1 p2 p3 p4 r1 r2 r3 r4 )
  (prompt "\nSelect closed POLYGONS...")
  (setq ss (ssget (list '(0 . "LWPOLYLINE") '(-4 . "&amp;amp;=") '(70 . 1) '(-4 . "&amp;lt;not") '(-4 . "&amp;lt;&amp;gt;") '(42 . 0.0) '(-4 . "not&amp;gt;"))))
  (if ss
    (repeat (setq i (sslength ss))
      (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (ssname ss (setq i (1- i))))))))
      (setq pll (append pl pll))
    )
  )
  (if pll
    (progn
      (setq p1 (car (vl-sort pll (function (lambda ( a b ) (&amp;lt; (cadr a) (cadr b)))))))
      (setq p2 (car (vl-sort pll (function (lambda ( a b ) (&amp;lt; (car a) (car b)))))))
      (setq p3 (car (vl-sort pll (function (lambda ( a b ) (&amp;gt; (car a) (car b)))))))
      (setq p4 (car (vl-sort pll (function (lambda ( a b ) (&amp;gt; (cadr a) (cadr b)))))))
      (setq r1 (inters p1 (polar p1 0.0 1.0) p2 (polar p2 (* 0.5 pi) 1.0) nil))
      (setq r2 (inters p1 (polar p1 0.0 1.0) p3 (polar p3 (* 0.5 pi) 1.0) nil))
      (setq r3 (inters r1 (polar r1 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
      (setq r4 (inters r2 (polar r2 (* 0.5 pi) 1.0) p4 (polar p4 0.0 1.0) nil))
      (entmake
        (list
          '(0 . "LWPOLYLINE")
          '(100 . "AcDbEntity")
          '(100 . "AcDbPolyline")
          '(90 . 4)
          (cons 70 (1+ (* 128 (getvar 'plinegen))))
          '(38 . 0.0)
          (cons 10 r1)
          (cons 10 r2)
          (cons 10 r4)
          (cons 10 r3)
          '(210 0.0 0.0 1.0)
          '(62 . 3)
        )
      )
      (prompt "\nArea global : ") (princ (rtos (* (distance r1 r2) (distance r1 r3)) 2 20))
    )
  )
  (princ)
)

(prompt "\nInvoke with : (c:bboxpolygon) for single closed POLYGON input, or with : (C:bboxpolygons) for multiple closed POLYGONS input, or with : (C:bboxpolygons-global) for multiple closed POLYGONS input and single bbox output...")
(princ)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The second one is for calculation of minimal bounding box(es) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;; transptucs &amp;amp; transptwcs by M.R. (Marko Ribar, d.i.a.)
; arguments : 
; pt - point to be transformed from WCS to imaginary UCS with transptucs and from imaginary UCS to WCS with transptwcs
; pt1 - origin of imaginary UCS
; pt2 - point to define X axis of imaginary UCS (vector pt1-pt2 represents X axis)
; pt3 - point to define Y axis of imaginary UCS (vector pt1-pt3 represents Y axis)
; important note : angle between X and Y axises of imaginary UCS must always be 90 degree for correct transformation calculation

;; Unit Vector - M.R.
;; Args: v - vector in R^n

(defun unit ( v / d )
  (mapcar '(lambda ( x y ) (/ x y)) v (list (setq d (distance '(0.0 0.0 0.0) v)) d d))
)

;; Matrix x Vector - Vladimir Nesterovsky
;; Args: m - nxn matrix, v - vector in R^n

(defun mxv ( m v )
  (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m)
)

;; Vector Cross Product - Lee Mac
;; Args: u,v - vectors in R^3

(defun v^v ( u v )
  (list
    (- (* (cadr u) (caddr v)) (* (caddr u) (cadr v)))
    (- (* (caddr u) (car v)) (* (car u) (caddr v)))
    (- (* (car u) (cadr v)) (* (cadr u) (car v)))
  )
)

(defun transptucs ( pt p1 p2 p3 / ux uy uz )
  (setq uz (unit (v^v (mapcar '- p2 p1) (mapcar '- p3 p1))))
  (setq ux (unit (mapcar '- p2 p1)))
  (setq uy (unit (mapcar '- p3 p1)))
  
  (mxv (list ux uy uz) (mapcar '- pt p1))
)

(defun transptwcs ( pt pt1 pt2 pt3 / pt1n pt2n pt3n )
  (setq pt1n (transptucs '(0.0 0.0 0.0) pt1 pt2 pt3))
  (setq pt2n (transptucs '(1.0 0.0 0.0) pt1 pt2 pt3))
  (setq pt3n (transptucs '(0.0 1.0 0.0) pt1 pt2 pt3))
  (transptucs pt pt1n pt2n pt3n)
)

;; Convex Hull  -  Lee Mac
;; Implements the Graham Scan Algorithm to return the Convex Hull of a list of points.
 
(defun LM:ConvexHull ( lst / ch p0 )
    (cond
        (   (&amp;lt; (length lst) 4) lst)
        (   (setq p0 (car lst))
            (foreach p1 (cdr lst)
                (if (or (&amp;lt; (cadr p1) (cadr p0))
                        (and (equal (cadr p1) (cadr p0) 1e-8) (&amp;lt; (car p1) (car p0)))
                    )
                    (setq p0 p1)
                )
            )
            (setq lst (vl-remove p0 lst))
            (setq lst (append (list p0) lst))
            (setq lst
                (vl-sort lst
                    (function
                        (lambda ( a b / c d )
                            (if (equal (setq c (angle p0 a)) (setq d (angle p0 b)) 1e-8)
                                (&amp;lt; (distance p0 a) (distance p0 b))
                                (&amp;lt; (if (equal c (* 2.0 pi) 1e-8) 0.0 c) (if (equal d (* 2.0 pi) 1e-8) 0.0 d))
                            )
                        )
                    )
                )
            )
            (setq ch (list (caddr lst) (cadr lst) (car lst)))
            (foreach pt (cdddr lst)
                (setq ch (cons pt ch))
                (while (and (caddr ch) (LM:Clockwise-p (caddr ch) (cadr ch) pt))
                    (setq ch (cons pt (cddr ch)))
                )
            )
            (reverse ch)
        )
    )
)
 
;; Clockwise-p  -  Lee Mac
;; Returns T if p1,p2,p3 are clockwise oriented or collinear
                 
(defun LM:Clockwise-p ( p1 p2 p3 )
    (&amp;lt;  (-  (* (- (car  p2) (car  p1)) (- (cadr p3) (cadr p1)))
            (* (- (cadr p2) (cadr p1)) (- (car  p3) (car  p1)))
        )
        1e-8
    )
)

(defun minarearec ( ccwchullpts / edges p1 p2 pts r1 r2 pp r3 r4 ar arlst rtn )
  (setq edges (mapcar (function (lambda ( a b ) (list a b))) ccwchullpts (cdr (reverse (cons (car ccwchullpts) (reverse ccwchullpts))))))
  (foreach edge edges
    (setq p1 (car edge) p2 (cadr edge))
    (setq pts (mapcar (function (lambda ( x ) (transptucs x p1 p2 (polar p1 (+ (angle p1 p2) (* 0.5 pi)) 1.0)))) ccwchullpts))
    (setq r1 (transptwcs (list (car (car (vl-sort pts (function (lambda ( a b ) (&amp;lt; (car a) (car b))))))) 0.0 0.0) p1 p2 (polar p1 (+ (angle p1 p2) (* 0.5 pi)) 1.0)))
    (setq r2 (transptwcs (list (car (car (vl-sort pts (function (lambda ( a b ) (&amp;gt; (car a) (car b))))))) 0.0 0.0) p1 p2 (polar p1 (+ (angle p1 p2) (* 0.5 pi)) 1.0)))
    (setq pp (transptwcs (car (vl-sort pts (function (lambda ( a b ) (&amp;gt; (abs (cadr a)) (abs (cadr b))))))) p1 p2 (polar p1 (+ (angle p1 p2) (* 0.5 pi)) 1.0)))
    (setq r3 (inters r1 (polar r1 (+ (angle r1 r2) (* 0.5 pi)) 1.0) pp (polar pp (angle r1 r2) 1.0) nil))
    (setq r4 (inters r2 (polar r2 (+ (angle r1 r2) (* 0.5 pi)) 1.0) pp (polar pp (angle r1 r2) 1.0) nil))
    (setq ar (* (distance r1 r2) (distance r1 r3)))
    (setq arlst (cons (cons (list r1 r2 r4 r3) ar) arlst))
  )
  (setq rtn (car (vl-sort arlst (function (lambda ( a b ) (&amp;lt; (cdr a) (cdr b)))))))
  rtn
)

(defun c:minbboxpolygon ( / pl rtn )
  (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (car (entsel "\nPick closed POLYGON...")))))))
  (setq rtn (minarearec (LM:ConvexHull pl)))
  (entmake
    (list
      '(0 . "LWPOLYLINE")
      '(100 . "AcDbEntity")
      '(100 . "AcDbPolyline")
      '(90 . 4)
      (cons 70 (1+ (* 128 (getvar 'plinegen))))
      '(38 . 0.0)
      (cons 10 (car (car rtn)))
      (cons 10 (cadr (car rtn)))
      (cons 10 (caddr (car rtn)))
      (cons 10 (cadddr (car rtn)))
      '(210 0.0 0.0 1.0)
      '(62 . 3)
    )
  )
  (prompt "\nMinimal area : ") (princ (rtos (cdr rtn) 2 20))
  (princ)
)

(defun c:minbboxpolygons ( / ss i pl rtn )
  (prompt "\nSlect closed POLYGONS...")
  (setq ss (ssget (list '(0 . "LWPOLYLINE") '(-4 . "&amp;amp;=") '(70 . 1) '(-4 . "&amp;lt;not") '(-4 . "&amp;lt;&amp;gt;") '(42 . 0.0) '(-4 . "not&amp;gt;"))))
  (if ss
    (repeat (setq i (sslength ss))
      (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (ssname ss (setq i (1- i))))))))
      (setq rtn (minarearec (LM:ConvexHull pl)))
      (entmake
        (list
          '(0 . "LWPOLYLINE")
          '(100 . "AcDbEntity")
          '(100 . "AcDbPolyline")
          '(90 . 4)
          (cons 70 (1+ (* 128 (getvar 'plinegen))))
          '(38 . 0.0)
          (cons 10 (car (car rtn)))
          (cons 10 (cadr (car rtn)))
          (cons 10 (caddr (car rtn)))
          (cons 10 (cadddr (car rtn)))
          '(210 0.0 0.0 1.0)
          '(62 . 3)
        )
      )
    )
  )
  (princ)
)

(defun c:minbboxpolygons-global ( / ss i pl pll rtn )
  (prompt "\nSlect closed POLYGONS...")
  (setq ss (ssget (list '(0 . "LWPOLYLINE") '(-4 . "&amp;amp;=") '(70 . 1) '(-4 . "&amp;lt;not") '(-4 . "&amp;lt;&amp;gt;") '(42 . 0.0) '(-4 . "not&amp;gt;"))))
  (if ss
    (repeat (setq i (sslength ss))
      (setq pl (mapcar 'cdr (mapcar (function (lambda ( x ) (append x (list 0.0)))) (vl-remove-if (function (lambda ( x ) (/= (car x) 10))) (entget (ssname ss (setq i (1- i))))))))
      (setq pll (append pl pll))
    )
  )
  (if pll
    (progn
      (setq rtn (minarearec (LM:ConvexHull pll)))
      (entmake
        (list
          '(0 . "LWPOLYLINE")
          '(100 . "AcDbEntity")
          '(100 . "AcDbPolyline")
          '(90 . 4)
          (cons 70 (1+ (* 128 (getvar 'plinegen))))
          '(38 . 0.0)
          (cons 10 (car (car rtn)))
          (cons 10 (cadr (car rtn)))
          (cons 10 (caddr (car rtn)))
          (cons 10 (cadddr (car rtn)))
          '(210 0.0 0.0 1.0)
          '(62 . 3)
        )
      )
      (prompt "\nMinimal global area : ") (princ (rtos (cdr rtn) 2 20))
    )
  )
  (princ)
)

(prompt "\nInvoke with : (c:minbboxpolygon) for single closed POLYGON input, or with : (C:minbboxpolygons) for multiple closed POLYGONS input, or with : (C:minbboxpolygons-global) for multiple closed POLYGONS input and single bbox output...")
(princ)&lt;/PRE&gt;&lt;P&gt;HTH., M.R.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If answer satisfies your requirements, mark the answer as solution to your question...&lt;/P&gt;&lt;P&gt;Regards...&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 13:34:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845942#M124158</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2017-02-01T13:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845969#M124159</link>
      <description>&lt;P&gt;Marko,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yeah the polyline has no arcs, and looking to put bounding box ortho to the world UCS.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 13:42:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6845969#M124159</guid>
      <dc:creator>BSA-Dean</dc:creator>
      <dc:date>2017-02-01T13:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846028#M124160</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Marko!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BBOXPOLYGON!!!! You my friend are a frickin' &lt;STRONG&gt;LEGEND!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Saved me hours as I have a 150x45m Plan area with loads&amp;nbsp;of contours!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 14:03:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846028#M124160</guid>
      <dc:creator>BSA-Dean</dc:creator>
      <dc:date>2017-02-01T14:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846310#M124161</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/999523"&gt;@BSA-Dean&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I select the shape it comes up in the command line 'nil' as attached. Same for the multiple one. Must be doing something daft.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Zoom to the Extents, and you should see it. &amp;nbsp;In your image, you're not in the World Coordinate System. &amp;nbsp;The routine could be made to account for that, if necessary [and also to suppress the display of that nil when it's done, which is just the return from any (command) function]. &amp;nbsp;But you already have another solution&amp;nbsp;that does what it seems&amp;nbsp;you're after, including [not the one you name in Post 11, but another in Post 9] selecting a lot of them at once [which DBB doesn't do, though it could also be adjusted to allow that], so I won't rush to edit it.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 15:26:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846310#M124161</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-02-01T15:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Changing Polyline Shape</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846671#M124162</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;I won't rush to edit it.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But I did anyway. &amp;nbsp;The attached contains both DBB and DBBM commands in the two functions I attached earlier, but DBB now allows selecting &lt;EM&gt;multiple&lt;/EM&gt; objects [for individual rectangles around each]. &amp;nbsp;Compared to marko's&amp;nbsp;routines, they don't report the collective area for the DBBM multiple-object collective-box one, and they don't make them green [unless the current Layer and entity-properties settings do so]. &amp;nbsp;But they work on &lt;EM&gt;all&lt;/EM&gt; entity types, and Polylines&amp;nbsp;&lt;EM&gt;don't&lt;/EM&gt;&amp;nbsp;need to be either of only line segments or closed. &amp;nbsp;[And it's a heck of a lot less code.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And they work in a non-World UCS with an &lt;EM&gt;origin&lt;/EM&gt; different from 0,0,0, as long as its &lt;EM&gt;orientation&lt;/EM&gt; is the same, so the problem you had with DBB before shouldn't occur. &amp;nbsp;[I may fiddle with how to compensate for other orientations, but it's going to complicated, if it's achievable at all.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I think was mentioned on the other thread I linked to earlier, Splines and Mtext and &lt;EM&gt;rotated&lt;/EM&gt; Blocks can have bounding boxes that go beyond their visible extents -- I don't think that can easily be compensated for, either, just because of the nature of the get-bounding-box operation relative to&amp;nbsp;the characteristics of those objects.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 16:56:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/changing-polyline-shape/m-p/6846671#M124162</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2017-02-01T16:56:25Z</dc:date>
    </item>
  </channel>
</rss>

