DrawRect(acBlkTblRec, acTrans, 0, 0, 5, 5)
Public Sub DrawRect(ByRef acBlkTblRec As BlockTableRecord, ByRef actrans As Transaction,
ByVal origPtx As Double, ByVal origPty As Double, ByVal Base As Double, ByVal Haut As Double)
Dim acDoc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim acLyrTbl As LayerTable
acLyrTbl = actrans.GetObject(acCurDb.LayerTableId,
OpenMode.ForRead)
Dim LCadre As String = "Armat"
Dim bt As BlockTable = DirectCast(actrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead), BlockTable)
If Not bt.Has("Ceramic") Then
bt.UpgradeOpen()
Dim btr As BlockTableRecord = New BlockTableRecord()
btr.Name = "Ceramic"
bt.Add(btr)
actrans.AddNewlyCreatedDBObject(btr, True)
Dim acPoly As Polyline = New Polyline()
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.15, origPty + Haut - 0.1), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.12, origPty + Haut + 0.05), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + Base + 0.1, origPty + Haut - 0.05), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + Base, origPty), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx, origPty), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx, origPty + Haut), 0, 0.005, 0.005)
acPoly.AddVertexAt(0, New Point2d(origPtx + 0.1, origPty + Haut - 0.1), 0, 0.005, 0.005)
acPoly.Layer = LCadre
btr.AppendEntity(acPoly)
actrans.AddNewlyCreatedDBObject(acPoly, True)
End If
End Sub