malix Posted September 13, 2014 Share Posted September 13, 2014 (edited) I'm writing a project in VB.net where I'm placing some dimensions on each segment of a polyline, and everything was going great until I tried to declare an ArcDimension for the curved segments. So for example I've got : Dim linearDim As New AlignedDimension Dim radDim As New RadialDimension Dim angleDim As New LineAngularDimension2 And these are all working fine, I'm able to create the dimensions and place them where they need to be. But when I do this: Dim arcDim As New ArcDimension It's causing the following error - Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. This is my first time working with dimensions in .net and I'm stumped. I don't see anything in the documentation that would cause an arc length dimension to be handled any differently from the others. Any ideas? Edited September 13, 2014 by malix Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 13, 2014 Share Posted September 13, 2014 ... these are all working fine, I'm able to create the dimensions and place them where they need to be. But when I do this: Dim arcDim As New ArcDimension It's causing the following error - Error 1 Overload resolution failed because no accessible 'New' accepts this number of arguments. This is my first time working with dimensions in .net and I'm stumped. I don't see anything in the documentation that would cause an arc length dimension to be handled any differently from the others. Any ideas? Methinks you're receiving that error, as you've supplied no arguments to the constructor; example: 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 Cheers Quote Link to comment Share on other sites More sharing options...
malix Posted September 13, 2014 Author Share Posted September 13, 2014 Thanks! That worked, although I don't really understand why it's necessary to do it that way for the ArcDimension but not for the others. In all the other dimension types I declared them first and set the values later. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted September 14, 2014 Share Posted September 14, 2014 Thanks! That worked, although I don't really understand why it's necessary to do it that way for the ArcDimension but not for the others. In all the other dimension types I declared them first and set the values later. You're welcome; I'm happy to help. All I can tell you is that consistency of completeness for the AutoCAD .NET API is not what it should be, and Visual Studio's intellisense will display what constructor overloads are available whilst coding... As example, compare the 1 of 2 constructor overloads for AlignedDimension Type. Also, you can place your cursor within any symbol, and hit F12 to view metadata for same. Cheers Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.