I using following Code to create a property "ThisDrawing". I want to use this to run customised program.
Public Class Class1
Public ReadOnly Property ThisDrawing As AcadDocument
Get
Return _
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.acaddocument
End Get
End Property
End Class
I am getting error message as "acaddocument' is not a member of Autodesk.AutoCAD.ApplicationServices.Document".
Can any one help me to solve this problem.
Please use GetAcadDocument instead AcadDocument
Thanks a lot for answering.
When I type GetAcadDocument it is still not identified.
The code I mentioned below works fine with AutoCad 2011.
For AutoCad 2013 I wrote this code and it worked fine
Module DrawLine2P
<CommandMethod("DrawL")> _
Public Sub DrawL()
Dim acdoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acdoc.Database
Dim PT1 As Point3d = New Point3d(0, 0, 0)
Dim PT2 As Point3d = New Point3d(PT1.X, _
PT1.Y + 10, _
0)
Dim PT1 As DBPoint = New DBPoint(New Point3d(0, 0, 0))
Dim PT2 As DBPoint = New DBPoint(New Point3d(PT1.Position.X, _
PT1.Position.Y + 10, _
0)
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
Dim acBlkTbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
Dim acBlkTblRec As BlockTableRecord = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace),
OpenMode.ForRead)
Dim acLine As Line = New Line(PT1, PT2)
acLine.SetDatabaseDefaults()
acBlkTblRec.AppendEntity(acLine)
acTrans.AddNewlyCreatedDBObject(acLine, True)
acTrans.Commit()
End Using
End Sub
End Module
I understand that there are lot of changes in API for AutoCAD 2013. Is it so.
This code you mention it's not using COM, only .NET API, therefore there is no need for GetAcadDocument....
Can't find what you're looking for? Ask the community or share your knowledge.