.NET

Reply
Active Member
ajoshi1967
Posts: 9
Registered: ‎09-30-2010
Message 1 of 5 (526 Views)

vb.net with AutoCad 2013

526 Views, 4 Replies
06-19-2013 10:43 PM

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.

ADN Support Specialist
augusto.goncalves
Posts: 390
Registered: ‎04-30-2009
Message 2 of 5 (496 Views)

Re: vb.net with AutoCad 2013

06-20-2013 07:29 AM in reply to: ajoshi1967

Please use GetAcadDocument instead AcadDocument

 

Regards,



Augusto Goncalves
Autodesk Developer Network
Active Member
ajoshi1967
Posts: 9
Registered: ‎09-30-2010
Message 3 of 5 (414 Views)

Re: vb.net with AutoCad 2013

07-04-2013 05:02 AM in reply to: augusto.goncalves

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.

ADN Support Specialist
augusto.goncalves
Posts: 390
Registered: ‎04-30-2009
Message 4 of 5 (396 Views)

Re: vb.net with AutoCad 2013

07-04-2013 10:31 AM in reply to: ajoshi1967

This code you mention it's not using COM, only .NET API, therefore there is no need for GetAcadDocument....

Regards,



Augusto Goncalves
Autodesk Developer Network
Active Member
ajoshi1967
Posts: 9
Registered: ‎09-30-2010
Message 5 of 5 (380 Views)

Re: vb.net with AutoCad 2013

07-04-2013 08:53 PM in reply to: ajoshi1967

Thanks a Lot Mr. Augusta for your kind help.

I will do some further study and get back to you.

 

Ajit Joshi

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.