Imports ZwSoft.ZwCAD.ApplicationServices
Imports ZwSoft.ZwCAD.DatabaseServices
Imports ZwSoft.ZwCAD.Geometry
Imports ZwSoft.ZwCAD.EditorInput
Public Class ZwApps
<CommandMethod("vbatest")> _
Public Shared Sub CreateTable()
Dim ZwDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim ZwDb As Database = ZwDoc.Database
Using ZcTran As Transaction = ZwDb.TransactionManager.StartTransaction
Dim ZcBLT As BlockTable = ZcTran.GetObject(ZwDb.BlockTableId, OpenMode.ForRead)
Dim ZcBLTR As BlockTableRecord = ZcTran.GetObject(ZcBLT(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
Dim pl As Polyline = New Polyline()
pl.AddVertexAt(0, New Point2d(0, 0), 0, 0, 0)
pl.AddVertexAt(1, New Point2d(10, 10), -2, 0, 0)
pl.AddVertexAt(2, New Point2d(2, -5), 0, 0, 0)
ZcBLTR.AppendEntity(pl)
ZcTran.AddNewlyCreatedDBObject(pl, True)
ZcTran.Commit()
End Using
End Sub
End Class
原型爲:
public void AddVertexAt(Int32 index,Point2d pt,Double
bulge,Double startWidth,Double endWidth);
bulge是弓高的兩倍和絃長的比值,或者是弧所對應圓心角的四分之一的正切值。
另外需要一提的是,凸度爲正時繪製的圓弧都是逆時針方向的,所以在繪圖時一定要規劃好,如果確實需要繪製順時針方向的圓弧,只需將該值變爲負數即可。