Message 1 of 11
Drawing a Rectangle
Not applicable
11-30-2007
02:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi:
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.
bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
btrId = bt.Item(BlockTableRecord.ModelSpace)
btr = trans.GetObject(btrId, OpenMode.ForWrite)
rect = New Rectangle3d(ptTopLeft, ptTopRight, ptBottomLeft, ptBottomRight)
btr.AppendEntity(rect)
trans.AddNewlyCreatedDBObject(rect, True)
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.
Am I correct in my assumption and how can this be corrected? I have tried type-casting but that does not work either.
Thanks
Saumitra
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.
bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite)
btrId = bt.Item(BlockTableRecord.ModelSpace)
btr = trans.GetObject(btrId, OpenMode.ForWrite)
rect = New Rectangle3d(ptTopLeft, ptTopRight, ptBottomLeft, ptBottomRight)
btr.AppendEntity(rect)
trans.AddNewlyCreatedDBObject(rect, True)
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.
Am I correct in my assumption and how can this be corrected? I have tried type-casting but that does not work either.
Thanks
Saumitra