<?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: drawing rectangle in autocad via choosing 2 points in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344145#M27033</link>
    <description>&lt;P&gt;I work in the granite industry. How would I create a custom tab that makes a rectangle 4" inches in height from the length of a line and offset it 25" above the line?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Feb 2025 22:37:40 GMT</pubDate>
    <dc:creator>jsucheckiM6JVK</dc:creator>
    <dc:date>2025-02-27T22:37:40Z</dc:date>
    <item>
      <title>drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/7827195#M27031</link>
      <description>&lt;P&gt;how do i draw a rectangle like it draws the autocad. i mean choose 1st point and then choose 2nd point. i know how to get points coordinates but i dont know how to draw all 4 lines at the right angle when i picked 2nd point&lt;/P&gt;&lt;P&gt;any suggestions?&lt;/P&gt;&lt;P&gt;upd. am i right to use Editor.GetCorner() method?&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 11:39:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/7827195#M27031</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-05T11:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/7827327#M27032</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Editor.GetCorner displays a rectangular rubberband which is always parallel to the window sides.&lt;/P&gt;
&lt;P&gt;AutoCAD draws the rectangles parallel to the X and Y axis of the current UCS.&lt;/P&gt;
&lt;P&gt;So, with an UCS which X and Y axis are not parallel to the window, the rubberband will be different from the rectangle.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("DRAWRECT")]
        public void DrawRectangle()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;

            var ppr = ed.GetPoint("\nFirst corner: ");
            if (ppr.Status != PromptStatus.OK)
                return;
            var pt1 = ppr.Value;

            ppr = ed.GetCorner("\nOpposite corner: ", pt1);
            if (ppr.Status != PromptStatus.OK)
                return;
            var pt2 = ppr.Value;

            double x1 = pt1.X;
            double y1 = pt1.Y;
            double x2 = pt2.X;
            double y2 = pt2.Y;
            using (var tr = db.TransactionManager.StartTransaction())
            {
                var pline = new Polyline(4);
                pline.AddVertexAt(0, new Point2d(x1, y1), 0.0, 0.0, 0.0);
                pline.AddVertexAt(1, new Point2d(x2, y1), 0.0, 0.0, 0.0);
                pline.AddVertexAt(2, new Point2d(x2, y2), 0.0, 0.0, 0.0);
                pline.AddVertexAt(3, new Point2d(x1, y2), 0.0, 0.0, 0.0);
                pline.Closed = true;
                pline.TransformBy(ed.CurrentUserCoordinateSystem);
                var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                curSpace.AppendEntity(pline);
                tr.AddNewlyCreatedDBObject(pline, true);
                tr.Commit();
            }
        }&lt;/PRE&gt;
&lt;P&gt;To be closer to the AutoCAD RECTANG command, you should use a Jig, but it is a more complex task.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 12:16:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/7827327#M27032</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2018-03-05T12:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344145#M27033</link>
      <description>&lt;P&gt;I work in the granite industry. How would I create a custom tab that makes a rectangle 4" inches in height from the length of a line and offset it 25" above the line?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 22:37:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344145#M27033</guid>
      <dc:creator>jsucheckiM6JVK</dc:creator>
      <dc:date>2025-02-27T22:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344191#M27034</link>
      <description>&lt;P&gt;You're asking this question in a discussion group focused on programming, but your question could be more about simple customization using macros or scripting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you asking how to write a program to do this, or a macro or script that does it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 23:25:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344191#M27034</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-02-27T23:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344227#M27035</link>
      <description>&lt;P&gt;How can I learn where to make a macro or script that could do it? I have two or three other things id like to ask about that could make my job easier &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 00:06:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344227#M27035</guid>
      <dc:creator>jsucheckiM6JVK</dc:creator>
      <dc:date>2025-02-28T00:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: drawing rectangle in autocad via choosing 2 points</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344230#M27036</link>
      <description>&lt;P&gt;The &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130" target="_blank" rel="noopener"&gt;general customization&lt;/A&gt; discussion forum would be a good place to ask.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 00:08:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-rectangle-in-autocad-via-choosing-2-points/m-p/13344230#M27036</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-02-28T00:08:52Z</dc:date>
    </item>
  </channel>
</rss>

