<?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: How to make this LISP rectangle positive? in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396920#M41421</link>
    <description>&lt;P&gt;After you've drawn the rotated white square, then do the following:&lt;/P&gt;&lt;P&gt;(setq en(entlast)) ; select last object&lt;/P&gt;&lt;P&gt;(setq ob(vlax-ename-&amp;gt;vla-object en)) ; convert to vla object&lt;/P&gt;&lt;P&gt;(vla-getboundingbox ob 'mn 'mx) ; get coordinates of object's bounding box&lt;/P&gt;&lt;P&gt;(setq llpt (vlax-safearray-&amp;gt;list mn)) ; convert to lower left coordinate point&lt;/P&gt;&lt;P&gt;(setq urpt (vlax-safearray-&amp;gt;list mx)) ; convert to upper right coordinate point&lt;/P&gt;&lt;P&gt;(command"_.Rectang" llpt urpt) ; draw the square&lt;/P&gt;</description>
    <pubDate>Fri, 02 Sep 2022 06:36:19 GMT</pubDate>
    <dc:creator>paullimapa</dc:creator>
    <dc:date>2022-09-02T06:36:19Z</dc:date>
    <item>
      <title>How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396869#M41420</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Hey everyone, I'm in trouble again&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;This LISP is a square made of two triangles&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Can achieve the effect of drawing two points into a rectangle&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;But the rectangle is not in the positive direction&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Can this LISP be changed to a rectangle in the positive direction?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;SPAN&gt;Above the photo is the LISP effect&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;SPAN&gt;I want the effect of red below&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;div class="video-embed-center video-embed"&gt;&lt;iframe class="embedly-embed" src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DK_DdFraN59Q&amp;amp;type=text%2Fhtml&amp;amp;schema=youtube&amp;amp;display_name=YouTube&amp;amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FK_DdFraN59Q" width="200" height="112" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="123.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1110940iB298170ABAAAB404/image-size/large?v=v2&amp;amp;px=999" role="button" title="123.jpg" alt="123.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun :GR (a) (* pi (/ a 180.0)))
(defun C:SQR ( / ANG12 ANG1X ANG2X P1 P2 PXL PXR)
   (setq p1 (getpoint "\nfirst point :"))
   (setq p2 (getpoint p1 "\nsecond point :"))
   (setq   ang12   (angle p1 p2)
         ang2x   (+ ang12 (:GR 45.0))
         ang1x   (+ ang12 (:GR 135.0))
   )
   (setq pxl (inters p2 (polar p2 ang2x 1.0) p1 (polar p1 ang1x 1.0) nil))

   (setq pxr (inters p1 (polar p1 (+ ang2x pi) 1.0) p2 (polar p2 (+ ang1x pi) 1.0) nil))

   (vl-cmdf "line" p1 p2 "")
   (vl-cmdf "pline" p1 pxr p2 pxl p1 "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 06:10:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396869#M41420</guid>
      <dc:creator>a22663564</dc:creator>
      <dc:date>2022-09-02T06:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396920#M41421</link>
      <description>&lt;P&gt;After you've drawn the rotated white square, then do the following:&lt;/P&gt;&lt;P&gt;(setq en(entlast)) ; select last object&lt;/P&gt;&lt;P&gt;(setq ob(vlax-ename-&amp;gt;vla-object en)) ; convert to vla object&lt;/P&gt;&lt;P&gt;(vla-getboundingbox ob 'mn 'mx) ; get coordinates of object's bounding box&lt;/P&gt;&lt;P&gt;(setq llpt (vlax-safearray-&amp;gt;list mn)) ; convert to lower left coordinate point&lt;/P&gt;&lt;P&gt;(setq urpt (vlax-safearray-&amp;gt;list mx)) ; convert to upper right coordinate point&lt;/P&gt;&lt;P&gt;(command"_.Rectang" llpt urpt) ; draw the square&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 06:36:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396920#M41421</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2022-09-02T06:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396957#M41422</link>
      <description>It is successful, but the original rectangle is not needed, can it be deleted?</description>
      <pubDate>Fri, 02 Sep 2022 06:51:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396957#M41422</guid>
      <dc:creator>a22663564</dc:creator>
      <dc:date>2022-09-02T06:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396960#M41423</link>
      <description>&lt;P&gt;sure remember the first line of code where I saved the original square as en:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(setq en(entlast)) ; select last object&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;All you have to do is now add this line of code at the end:&lt;/P&gt;&lt;P&gt;(entdel en)&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 06:53:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396960#M41423</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2022-09-02T06:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396974#M41424</link>
      <description>This LISP works very well, thank you very much for your help</description>
      <pubDate>Fri, 02 Sep 2022 07:02:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11396974#M41424</guid>
      <dc:creator>a22663564</dc:creator>
      <dc:date>2022-09-02T07:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397037#M41425</link>
      <description>Glad that worked out for you...cheers!!!</description>
      <pubDate>Fri, 02 Sep 2022 07:34:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397037#M41425</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2022-09-02T07:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397880#M41426</link>
      <description>&lt;P&gt;I would &lt;STRONG&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;/STRONG&gt; do it by drawing the diagonal box, then finding its bounding box, then drawing the box you want &lt;FONT color="#993300"&gt;[&lt;STRONG&gt;EDIT&lt;/STRONG&gt;: if it &lt;EM&gt;is&lt;/EM&gt; really the box you want -- see my next Message]&lt;/FONT&gt;, then deleting the diagonal one.&amp;nbsp; I would do it directly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:SQR (/ ANG12 ANG1X ANG2X P1 P2)
  (setq p1 (getpoint "\nfirst point :"))
  (setq p2 (getpoint p1 "\nsecond point :"))
  (setq
    ang12   (angle p1 p2)
    ang2x   (+ ang12 (/ pi 2))
    ang1x   (- ang12 (/ pi 2))
    rad (/ (distance p1 p2) 2)
  )
  (vl-cmdf "line" p1 p2 ""); if still desired
  (vl-cmdf "pline"
    (polar p1 ang1x rad) (polar p2 ang1x rad)
    (polar p2 ang2x rad) (polar p1 ang2x rad)
    "_close"
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's in simplest terms as yours is, but I would suggest adding control over Object Snap, at least, and other typical enhancements.&lt;/P&gt;
&lt;P&gt;It looks from the end of your video as though maybe you don't want the Line across the middle, but I wasn't sure.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 16:35:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397880#M41426</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-02T16:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397887#M41427</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8770040"&gt;@a22663564&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;It is successful....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... &lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt; the two points are in an &lt;EM&gt;&lt;STRONG&gt;orthogonal relationship&lt;/STRONG&gt;&lt;/EM&gt; to one another, but not if they are at some other angle:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1662130486433.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1111124iE3593AADA249006D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1662130486433.png" alt="Kent1Cooper_0-1662130486433.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My routine in Message 7 works at any angle [as does your original that draws the diagonal box]:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_1-1662130554721.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1111125i89300BDEEEFAC381/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_1-1662130554721.png" alt="Kent1Cooper_1-1662130554721.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 15:01:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11397887#M41427</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-09-02T15:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to make this LISP rectangle positive?</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11398761#M41428</link>
      <description>Yes, paulli's LISP will not work in other angles will not make positive angles&lt;BR /&gt;But the LISP you all changed all gave me very good results, thank you very much&lt;BR /&gt;Need to cross the middle line he is necessary&lt;BR /&gt;Because of the effect of the product&lt;BR /&gt;That is, the rectangle of the blank part of the dotted line needs to be broken&lt;BR /&gt;But CNC programming to process many small straight lines is too troublesome to process&lt;BR /&gt;So choose to draw a long straight line first and then let the rectangular part break it&lt;BR /&gt;So a straight line that will pass in the middle is needed&lt;BR /&gt;But if the result last can be overkill and pe , it will be more perfect&lt;BR /&gt;Because of the multiple small line segments, I will finally do OVERKILL and PE to make it a straight line&lt;BR /&gt;In this way, CNC programming is more convenient</description>
      <pubDate>Sat, 03 Sep 2022 03:08:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-make-this-lisp-rectangle-positive/m-p/11398761#M41428</guid>
      <dc:creator>a22663564</dc:creator>
      <dc:date>2022-09-03T03:08:30Z</dc:date>
    </item>
  </channel>
</rss>

