Criação de uma "Dimension"
Temos então o código:
Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.Runtime
Imports ZwSoft.ZwCAD.EditorInput
Imports ZwSoft.ZwCAD.Geometry
Public Class Dimension
<CommandMethod("NewDimension")> _
Public Sub NewDimension()
Dim ZWDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZWEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim ZWCurDb As Database = ZWDoc.Database
Using ZWTrans As Transaction = ZWCurDb.TransactionManager.StartTransaction()
Dim ZWBlkTbl As BlockTable = ZWTrans.GetObject(ZWCurDb.BlockTableId, OpenMode.ForRead)
Dim ZWBlkTblRec As BlockTableRecord = ZWTrans.GetObject(ZWBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim ZWDimension As New AlignedDimension
ZWDimension.SetDatabaseDefaults()
ZWDimension.XLine1Point = New Point3d(0, 0, 0)
ZWDimension.XLine2Point = New Point3d(5, 5, 0)
ZWDimension.DimLinePoint = New Point3d(0, 10, 0)
ZWBlkTblRec.AppendEntity(ZWDimension)
ZWTrans.AddNewlyCreatedDBObject(ZWDimension, True)
ZWTrans.Commit()
End Using
End Sub
End Class
Após escrever o código, deve-se criar o dll. No ZWCad, na linha de comando: netload carregar o dll criado. na linha de comando chamamos então o comando criado neste caso: NewDimension.
Vamos lá experimentar.
Cumprimentos.
Sem comentários:
Enviar um comentário