<?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 a Rectangle in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128092#M76199</link>
    <description>&amp;gt;&amp;gt; So, the only way to draw a rectangle is through &lt;BR /&gt;
&amp;gt;&amp;gt; the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
I'll be happy to answer you, if you can first tell me if&lt;BR /&gt;
you're new to AutoCAD and/or AutoCAD development.&lt;BR /&gt;
&lt;BR /&gt;
I think you already know that this is something you&lt;BR /&gt;
should make clear, so that others can give you an &lt;BR /&gt;
answer in terms that you can understand, and not&lt;BR /&gt;
make the mistake of presuming that you already&lt;BR /&gt;
have a grasp of other more basic concepts that any&lt;BR /&gt;
helpful answer would depend on.&lt;BR /&gt;
&lt;BR /&gt;
The fact that you're asking the above question would&lt;BR /&gt;
suggest that you've not done much AutoCAD work,&lt;BR /&gt;
which is fine, so long as you make that clear at the&lt;BR /&gt;
outset.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;SAUMITRA&gt; wrote in message news:5790667@discussion.autodesk.com...&lt;BR /&gt;
Well, I didnt assume that there was the Rectangle3d class.&lt;BR /&gt;
There is a structure at&lt;BR /&gt;
autodesk.AutoCAD.DatabaseServices.Rectangle3d&lt;BR /&gt;
&lt;BR /&gt;
And also a structure called Rectangle...&lt;BR /&gt;
&lt;BR /&gt;
I thought (given the name of the structure, it wasn't very presumptuous to give it a try) it would be the one to draw a rectangle. So, the only way to draw a rectangle is through the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
Saumitra&lt;/SAUMITRA&gt;</description>
    <pubDate>Mon, 03 Dec 2007 15:07:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-12-03T15:07:59Z</dc:date>
    <item>
      <title>Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128087#M76194</link>
      <description>Hi:&lt;BR /&gt;
&lt;BR /&gt;
I am trying to draw a rectangle, given the 4 coordinates of the rectangle. I was basing my code on the lab tutorials for Cad 2007 where there is a description about drawing a circle.&lt;BR /&gt;
&lt;BR /&gt;
bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)&lt;BR /&gt;
btrId = bt.Item(BlockTableRecord.ModelSpace)&lt;BR /&gt;
btr = trans.GetObject(btrId, OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
rect = New Rectangle3d(ptTopLeft, ptTopRight, ptBottomLeft, ptBottomRight)&lt;BR /&gt;
btr.AppendEntity(rect)&lt;BR /&gt;
trans.AddNewlyCreatedDBObject(rect, True)&lt;BR /&gt;
&lt;BR /&gt;
However, I am getting an error in the last 2 lines. The reason I presume is that Rectangle3d is a structure in the library. And the methods take DatabaseServices.Entity types as parameter. The code in the tutorial worked for circle/ellipse coz they are defined as classes.&lt;BR /&gt;
&lt;BR /&gt;
Am I correct in my assumption and how can this be corrected? I have tried type-casting but that does not work either. &lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Saumitra</description>
      <pubDate>Fri, 30 Nov 2007 22:31:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128087#M76194</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-11-30T22:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128088#M76195</link>
      <description>I'm not sure how you came up with the assumption &lt;BR /&gt;
there's a 'Rectangle3d' class, but there's none.&lt;BR /&gt;
&lt;BR /&gt;
There's no 'rectangle' object in AutoCAD, hence&lt;BR /&gt;
there's no corresponding class.&lt;BR /&gt;
&lt;BR /&gt;
The RECTANG command draws a 4-segment &lt;BR /&gt;
polyline, not a 'RECTANGLE' object.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;SAUMITRA&gt; wrote in message news:5789864@discussion.autodesk.com...&lt;BR /&gt;
Hi:&lt;BR /&gt;
&lt;BR /&gt;
I am trying to draw a rectangle, given the 4 coordinates of the rectangle. I was basing my code on the lab tutorials for Cad 2007 where there is a description about drawing a circle.&lt;BR /&gt;
&lt;BR /&gt;
bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)&lt;BR /&gt;
btrId = bt.Item(BlockTableRecord.ModelSpace)&lt;BR /&gt;
btr = trans.GetObject(btrId, OpenMode.ForWrite)&lt;BR /&gt;
&lt;BR /&gt;
rect = New Rectangle3d(ptTopLeft, ptTopRight, ptBottomLeft, ptBottomRight)&lt;BR /&gt;
btr.AppendEntity(rect)&lt;BR /&gt;
trans.AddNewlyCreatedDBObject(rect, True)&lt;BR /&gt;
&lt;BR /&gt;
However, I am getting an error in the last 2 lines. The reason I presume is that Rectangle3d is a structure in the library. And the methods take DatabaseServices.Entity types as parameter. The code in the tutorial worked for circle/ellipse coz they are defined as classes.&lt;BR /&gt;
&lt;BR /&gt;
Am I correct in my assumption and how can this be corrected? I have tried type-casting but that does not work either. &lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Saumitra&lt;/SAUMITRA&gt;</description>
      <pubDate>Sat, 01 Dec 2007 15:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128088#M76195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-01T15:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128089#M76196</link>
      <description>Well, I didnt assume that there was the Rectangle3d class.&lt;BR /&gt;
There is a structure at&lt;BR /&gt;
autodesk.AutoCAD.DatabaseServices.Rectangle3d&lt;BR /&gt;
&lt;BR /&gt;
And also a structure called Rectangle...&lt;BR /&gt;
&lt;BR /&gt;
I thought (given the name of the structure, it wasn't very presumptuous to give it a try) it would be the one to draw a rectangle. So, the only way to draw a rectangle is through the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
Saumitra</description>
      <pubDate>Mon, 03 Dec 2007 14:26:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128089#M76196</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T14:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128090#M76197</link>
      <description>&amp;gt;&amp;gt; Well, I didnt assume that there was the Rectangle3d class.&lt;BR /&gt;
&lt;BR /&gt;
What I meant was that you assumed there was&lt;BR /&gt;
a formal AutoCAD entity type 'rectangle', not that &lt;BR /&gt;
there was a class for it.&lt;BR /&gt;
&lt;BR /&gt;
As I said, there is no entity type corresponding&lt;BR /&gt;
to a rectangle.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;SAUMITRA&gt; wrote in message news:5790667@discussion.autodesk.com...&lt;BR /&gt;
Well, I didnt assume that there was the Rectangle3d class.&lt;BR /&gt;
There is a structure at&lt;BR /&gt;
autodesk.AutoCAD.DatabaseServices.Rectangle3d&lt;BR /&gt;
&lt;BR /&gt;
And also a structure called Rectangle...&lt;BR /&gt;
&lt;BR /&gt;
I thought (given the name of the structure, it wasn't very presumptuous to give it a try) it would be the one to draw a rectangle. So, the only way to draw a rectangle is through the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
Saumitra&lt;/SAUMITRA&gt;</description>
      <pubDate>Mon, 03 Dec 2007 14:38:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128090#M76197</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T14:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128091#M76198</link>
      <description>So, Tony is this a proper way to draw a rectangle then.&lt;BR /&gt;
&lt;BR /&gt;
strCommand = "RECTANG" &amp;amp; ptBottomLeft.ToString &amp;amp; ptTopRight.ToString&lt;BR /&gt;
&lt;BR /&gt;
acadDoc.SendStringToExecute(strCommand, True, False, True)&lt;BR /&gt;
&lt;BR /&gt;
acadDoc is the current document. This one is not working. Am i on the wrong track and just try drawing a rectangle through 4 polylines?&lt;BR /&gt;
&lt;BR /&gt;
Saumitra</description>
      <pubDate>Mon, 03 Dec 2007 14:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128091#M76198</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T14:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128092#M76199</link>
      <description>&amp;gt;&amp;gt; So, the only way to draw a rectangle is through &lt;BR /&gt;
&amp;gt;&amp;gt; the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
I'll be happy to answer you, if you can first tell me if&lt;BR /&gt;
you're new to AutoCAD and/or AutoCAD development.&lt;BR /&gt;
&lt;BR /&gt;
I think you already know that this is something you&lt;BR /&gt;
should make clear, so that others can give you an &lt;BR /&gt;
answer in terms that you can understand, and not&lt;BR /&gt;
make the mistake of presuming that you already&lt;BR /&gt;
have a grasp of other more basic concepts that any&lt;BR /&gt;
helpful answer would depend on.&lt;BR /&gt;
&lt;BR /&gt;
The fact that you're asking the above question would&lt;BR /&gt;
suggest that you've not done much AutoCAD work,&lt;BR /&gt;
which is fine, so long as you make that clear at the&lt;BR /&gt;
outset.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;SAUMITRA&gt; wrote in message news:5790667@discussion.autodesk.com...&lt;BR /&gt;
Well, I didnt assume that there was the Rectangle3d class.&lt;BR /&gt;
There is a structure at&lt;BR /&gt;
autodesk.AutoCAD.DatabaseServices.Rectangle3d&lt;BR /&gt;
&lt;BR /&gt;
And also a structure called Rectangle...&lt;BR /&gt;
&lt;BR /&gt;
I thought (given the name of the structure, it wasn't very presumptuous to give it a try) it would be the one to draw a rectangle. So, the only way to draw a rectangle is through the RECTANG command?&lt;BR /&gt;
&lt;BR /&gt;
Saumitra&lt;/SAUMITRA&gt;</description>
      <pubDate>Mon, 03 Dec 2007 15:07:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128092#M76199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T15:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128093#M76200</link>
      <description>Well, I am extremely new to AutoCAD (let alone autocad development). Anyways, I have managed to create a rectangle through polylines. If for my knowledge purpose, you can answer what I asked earlier, it would be great. Next time onwards, I would specify what is required to mention in the email.</description>
      <pubDate>Mon, 03 Dec 2007 15:40:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128093#M76200</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T15:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128094#M76201</link>
      <description>Here's a few lines that will draw a 3d solid rectangle that might be of help.&lt;BR /&gt;
&lt;BR /&gt;
Dim db As Database = HostApplicationServices.WorkingDatabase&lt;BR /&gt;
Using t As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
Dim bt As BlockTable = CType(t.GetObject(db.BlockTableId, OpenMode.ForRead, False), BlockTable)&lt;BR /&gt;
Dim btr As BlockTableRecord = CType(t.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)&lt;BR /&gt;
Dim r3d As New Solid3d&lt;BR /&gt;
r3d.CreateBox(5.0, 2.0, 10.0)&lt;BR /&gt;
btr.AppendEntity(r3d)&lt;BR /&gt;
t.AddNewlyCreatedDBObject(r3d, True)&lt;BR /&gt;
t.Commit()&lt;BR /&gt;
End Using</description>
      <pubDate>Mon, 03 Dec 2007 17:50:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128094#M76201</guid>
      <dc:creator>Mikko</dc:creator>
      <dc:date>2007-12-03T17:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128095#M76202</link>
      <description>You can create polylines directly, without having to use the command line interface, but of course, that's a bit more involved than the 'easy' way (e.g., using the command line).&lt;BR /&gt;
&lt;BR /&gt;
You use the Polyline class (call the constructor), and then set the properties to what you want and add the vertices, then add it to the database and to the block table record for the space you're drawing in. &lt;BR /&gt;
&lt;BR /&gt;
Doing it that way does require some experience with the API, so if you are writing a real application that needs to draw rectangles, you can use the command line (or the ActiveX API) until you are able to use the more direct method.&lt;BR /&gt;
&lt;BR /&gt;
Look at the code posted here and at the links posted here, for useful examples of using the API directly to create and work with AutoCAD objects.&lt;BR /&gt;
&lt;BR /&gt;
-- &lt;BR /&gt;
http://www.caddzone.com&lt;BR /&gt;
&lt;BR /&gt;
AcadXTabs: MDI Document Tabs for AutoCAD 2008&lt;BR /&gt;
Supporting AutoCAD 2000 through 2008&lt;BR /&gt;
http://www.acadxtabs.com&lt;BR /&gt;
&lt;BR /&gt;
&lt;SAUMITRA&gt; wrote in message news:5790800@discussion.autodesk.com...&lt;BR /&gt;
Well, I am extremely new to AutoCAD (let alone autocad development). Anyways, I have managed to create a rectangle through polylines. If for my knowledge purpose, you can answer what I asked earlier, it would be great. Next time onwards, I would specify what is required to mention in the email.&lt;/SAUMITRA&gt;</description>
      <pubDate>Mon, 03 Dec 2007 20:27:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128095#M76202</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-03T20:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128096#M76203</link>
      <description>Hi, soumitra &lt;BR /&gt;
&lt;BR /&gt;
there is no rectangle class, there is only line, polyline and lwpolyline only. so u try it as polyline are lwpolyline &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
venkatesh&lt;BR /&gt;
venkatesh.chitimilla@regencyinfotech.biz&lt;BR /&gt;
regency infotech</description>
      <pubDate>Tue, 04 Dec 2007 05:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128096#M76203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-04T05:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Drawing a Rectangle</title>
      <link>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128097#M76204</link>
      <description>Thanks everybody for your help. The code for drawing a rectangle through a Solid3d class was also helpful.</description>
      <pubDate>Tue, 04 Dec 2007 15:16:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/drawing-a-rectangle/m-p/2128097#M76204</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-12-04T15:16:52Z</dc:date>
    </item>
  </channel>
</rss>

