ZWCad+
1: Imports ZwSoft.ZwCAD.ApplicationServices
2: Imports ZwSoft.ZwCAD.Runtime
3: Imports ZwSoft.ZwCAD.DatabaseServices
4: Imports ZwSoft.ZwCAD.Geometry
5:
6: Public Class Class1
7: <CommandMethod("Circulo")> _
8: Public Sub circulo()
9: Dim Doc As Document = Application.DocumentManager.MdiActiveDocument
10: Dim CurDb As Database = Doc.Database
11:
12: Using Trans As Transaction = CurDb.TransactionManager.StartTransaction()
13:
14: Dim BlkTbl As BlockTable = Trans.GetObject(CurDb.BlockTableId, OpenMode.ForRead)
15: Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
16:
17: Dim Circ As Circle = New Circle()
18: Circ.SetDatabaseDefaults()
19: Circ.Center = New Point3d(5, 5, 0)
20: Circ.Radius = 4.25
21: BlkTblRec.AppendEntity(Circ)
22: Trans.AddNewlyCreatedDBObject(Circ, True)
23:
24: Trans.Commit()
25: End Using
26: End Sub
27: End Class
Autocad
1: Imports Autodesk.AutoCAD.Runtime
2: Imports Autodesk.AutoCAD.ApplicationServices
3: Imports Autodesk.AutoCAD.DatabaseServices
4: Imports Autodesk.AutoCAD.Geometry
5:
6: Public Class Class1
7: <CommandMethod("Circulo")> _
8: Public Sub circulo()
9: Dim Doc As Document = Application.DocumentManager.MdiActiveDocument
10: Dim CurDb As Database = Doc.Database
11:
12: Using Trans As Transaction = CurDb.TransactionManager.StartTransaction()
13:
14: Dim BlkTbl As BlockTable = Trans.GetObject(CurDb.BlockTableId, OpenMode.ForRead)
15: Dim BlkTblRec As BlockTableRecord = Trans.GetObject(BlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
16:
17: Dim Circ As Circle = New Circle()
18: Circ.SetDatabaseDefaults()
19: Circ.Center = New Point3d(5, 5, 0)
20: Circ.Radius = 4.25
21: BlkTblRec.AppendEntity(Circ)
22: Trans.AddNewlyCreatedDBObject(Circ, True)
23:
24: Trans.Commit()
25: End Using
26: End Sub
27: End Class
Boa Programação.
Sem comentários:
Enviar um comentário