Public Sub AddCircle(ByVal X, ByVal Y, ByVal R)
'' Get the current document and database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Block table for read
Dim acBlkTbl As BlockTable
acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, DatabaseServices.OpenMode.ForRead)
'' Open the Block table record Model space for write
Dim acBlkTblRec As BlockTableRecord
acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), DatabaseServices.OpenMode.ForWrite)
Dim DT As Circle = New Circle()
DT.SetDatabaseDefaults()
DT.Center = New Point3d(X, Y, 0)
DT.Radius = R
'' Add the new object to the block table record and the transaction
acBlkTblRec.AppendEntity(DT)
acTrans.AddNewlyCreatedDBObject(DT, True)
'' Save the new object to the database
acTrans.Commit()
End Using
End Sub
Trang blog cá nhân
Tạo Đường Tròn trong AutoCAD bằng VB.Net
Chuyên mục:
AutoCAD.Net,
Tạo và Chỉnh sửa đối tượng AutoCAD
Đăng ký:
Đăng Nhận xét (Atom)
Không có nhận xét nào:
Đăng nhận xét