我认为您收到了这个错误,因为您没有向构造函数提供任何参数;例子:
- Imports Autodesk.AutoCAD.Runtime
- Imports Autodesk.AutoCAD.ApplicationServices
- Imports Autodesk.AutoCAD.DatabaseServices
- Imports Autodesk.AutoCAD.Geometry
- <CommandMethod("CreateArcLengthDimension")> _
- Public Sub CreateArcLengthDimension()
- '' Get the current 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, _
- OpenMode.ForRead)
- '' Open the Block table record Model space for write
- Dim acBlkTblRec As BlockTableRecord
- acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), _
- OpenMode.ForWrite)
- '' Create an arc length dimension
- Using acArcDim As ArcDimension = New ArcDimension([color="red"]New Point3d(4.5, 1.5, 0), _
- New Point3d(8, 4.25, 0), _
- New Point3d(0, 2, 0), _
- New Point3d(5, 7, 0), _
- "<>", _
- acCurDb.Dimstyle[/color])
- '' Add the new object to Model space and the transaction
- acBlkTblRec.AppendEntity(acArcDim)
- acTrans.AddNewlyCreatedDBObject(acArcDim, True)
- End Using
- '' Commit the changes and dispose of the transaction
- acTrans.Commit()
- End Using
- End Sub
干杯 |