<?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: Simple Bounding Box Code in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10017049#M65250</link>
    <description>Thanks for your respone! I would appreciate if you could share your routine with me! My last question now is the RECTANG command. I wrote the following and I am getting the bad function error:&lt;BR /&gt;(command "rectangle" (car(minExt) (cadr(minExt) (caddr(minExt)) ((car(maxExt) (cadr(maxExt) (caddr(maxExt)) "")</description>
    <pubDate>Wed, 20 Jan 2021 18:49:11 GMT</pubDate>
    <dc:creator>kotropol</dc:creator>
    <dc:date>2021-01-20T18:49:11Z</dc:date>
    <item>
      <title>Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10016874#M65248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am fairly new to AutoLisp, but I tried to make my onw Bounding Box lisp. I am aware of Lee Mac's Bounding Box lisp but it is too complex for my current understanding of AutoLisp and plus I want to make my own. So, I wrote my code but I have 2 problems.&lt;/P&gt;&lt;P&gt;1) I am getting the following eror:&lt;/P&gt;&lt;P&gt;; error; bad argument type: lentityp&lt;/P&gt;&lt;P&gt;In order to fix this I tried to change the (ssget) with (car(entsel)) but then I lost the ability to multi-select objects.&lt;/P&gt;&lt;P&gt;2) I can't figure out how to draw the rectangle. With RECTANG command I need only 2 points to draw a rectangle (first corner point and other corner point). So why my code is wrong?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:BoundingBox()&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(setq SelectionSet (vlax-ename-&amp;gt;vla-object (ssget)))&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(vla-GetBoundingBox SelectionSet 'minExt 'maxExt)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq minExt (vlax-safearray-&amp;gt;list minExt)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; maxExt (vlax-safearray-&amp;gt;list maxExt))&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(princ minExt)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(princ maxExt)&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(princ)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(setq StartPoint (vlax-3D-point (car(minExt)) (cadr(minExt)) (caddr(minEnt))))&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq EndPoint (vlax-3D-point (car(maxExt)) (cadr(maxExt)) (caddr(maxEnt))))&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(setq ModelSpace (vla-get-ModelSpace doc))&lt;BR /&gt;&amp;nbsp; &amp;nbsp;(vla-AddPolyline ModelSpace StartPoint EndPoint)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If possible I don't wath the code to be&amp;nbsp;more complicated than this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 17:55:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10016874#M65248</guid>
      <dc:creator>kotropol</dc:creator>
      <dc:date>2021-01-20T17:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10016926#M65249</link>
      <description>&lt;P&gt;The &lt;FONT color="#000000"&gt;(ssget)&lt;/FONT&gt; function returns a &lt;EM&gt;selection set&lt;/EM&gt; [which could potentially have multiple objects in it], but the &lt;FONT color="#000000"&gt;(vlax-ename-&amp;gt;vla-object)&lt;/FONT&gt; function requires an &lt;EM&gt;entity name&lt;/EM&gt; [of a &lt;EM&gt;single&lt;/EM&gt; entity].&amp;nbsp; You could just replace the &lt;FONT color="#000000"&gt;&lt;STRONG&gt;(ssget)&lt;/STRONG&gt;&lt;/FONT&gt; with &lt;FONT color="#000000"&gt;&lt;STRONG&gt;(car (entsel))&lt;/STRONG&gt;&lt;/FONT&gt;, or you could get more sophisticated about it.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;EDIT:&lt;/FONT&gt;&amp;nbsp; Also, what if you're in Paper Space when you run it?&amp;nbsp; Do you want the result in Model space even then?&amp;nbsp; You're already in the appropriate space if you're selecting an object to draw the box around, and you already have the opposite corner points [your minExt and maxExt variables], so I would just use a RECTANG &lt;EM&gt;command&lt;/EM&gt; and give it those.&amp;nbsp; I see no need for the last three variables that are set.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;Further EDIT:&lt;/FONT&gt;&amp;nbsp; Now I notice your reference to multiple object selection [wasn't paying close enough attention at first].&amp;nbsp; You would need to get the bounding box for every object in a selection set, and compare them to each other to find the overall extents of all of them.&amp;nbsp; I have a routine to draw the bounding box around multiple objects, if you want to see how I did that comparison.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 18:31:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10016926#M65249</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-01-20T18:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10017049#M65250</link>
      <description>Thanks for your respone! I would appreciate if you could share your routine with me! My last question now is the RECTANG command. I wrote the following and I am getting the bad function error:&lt;BR /&gt;(command "rectangle" (car(minExt) (cadr(minExt) (caddr(minExt)) ((car(maxExt) (cadr(maxExt) (caddr(maxExt)) "")</description>
      <pubDate>Wed, 20 Jan 2021 18:49:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10017049#M65250</guid>
      <dc:creator>kotropol</dc:creator>
      <dc:date>2021-01-20T18:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10017075#M65251</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8481733"&gt;@kotropol&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;.... I wrote the following and I am getting the bad function error:&lt;BR /&gt;(command "rectangle" (car(minExt) (cadr(minExt) (caddr(minExt)) ((car(maxExt) (cadr(maxExt) (caddr(maxExt)) "")&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You would need to wrap a &lt;FONT color="#000000"&gt;(list)&lt;/FONT&gt; function around those sets of coordinates, and fix some parentheses problems.&amp;nbsp; But you don't need those -- you already have the points &lt;EM&gt;as points&lt;/EM&gt; in the minExt and maxExt variables.&amp;nbsp; Just use those [and the correct command name]:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;(command "_.rectang" "_non" minExt "_non" maxExt)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#333333"&gt;See my approach in the attached.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 18:56:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/10017075#M65251</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-01-20T18:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13108003#M65252</link>
      <description>&lt;P&gt;and if the original set of lines to be rectangle is somewhat rotated?&lt;/P&gt;&lt;P&gt;haven't meant to post it here)&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 11:23:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13108003#M65252</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-10-25T11:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13108170#M65253</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13423916"&gt;@komondormrex&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;and if the original set of lines to be rectangle is somewhat rotated?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The bounding box approach won't follow the rotation, but will be orthogonal to the furthest extent of the object(s) [dashed green here].&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1729859531213.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1425872i66A12031B1D66F6D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1729859531213.png" alt="Kent1Cooper_0-1729859531213.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;BUT you could at least get close with the &lt;STRONG&gt;SR&lt;/STRONG&gt; command in &lt;STRONG&gt;SmallestRectangle.lsp&lt;/STRONG&gt;, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/the-smallest-rectangle-enclosing-selected-set-of-objects/m-p/3795624/highlight/true#M309506" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;.&amp;nbsp; It checks at 1° intervals of rotation [though that increment could be reduced], so it may not land exactly on your source object's rotation.&amp;nbsp; Look at other offerings in that same Topic.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 12:41:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13108170#M65253</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-10-25T12:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13113091#M65254</link>
      <description>&lt;P&gt;as a matter of a sort of interest. and it is not a bounding box whatsoever but rather an apparent outlining rectangle or quadrangle formed by 2 vertices plines or lines...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="komondormrex_0-1730127462783.gif" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1426607iE69FE891F437FCBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="komondormrex_0-1730127462783.gif" alt="komondormrex_0-1730127462783.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 14:58:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13113091#M65254</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-10-28T14:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Bounding Box Code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13126825#M65255</link>
      <description>&lt;P&gt;Hi can I get this lisp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2024 07:53:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/simple-bounding-box-code/m-p/13126825#M65255</guid>
      <dc:creator>miralisibtain110</dc:creator>
      <dc:date>2024-11-03T07:53:33Z</dc:date>
    </item>
  </channel>
</rss>

