Author Topic: What is the equivalent namespace for AutoCAD 2013?  (Read 3862 times)

0 Members and 1 Guest are viewing this topic.

cannorth

  • Guest
What is the equivalent namespace for AutoCAD 2013?
« on: November 08, 2012, 10:51:05 AM »
Hello,

  I used this before in AutoCAD R12 as an expression:

Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument

  Now it doesn't seem to work in R13 anymore.  It doesn't recognize AcadDocument.  Does anyone know what
the equivalent form of this is in R13?

Thanks,

cannorth
« Last Edit: November 08, 2012, 02:41:53 PM by cannorth »

BlackBox

  • King Gator
  • Posts: 3770
Re: What is the equivalent namespace for AutoCAD R13?
« Reply #1 on: November 08, 2012, 02:21:38 PM »
I think we had this issue before, where you mention R13, but you actually meant 2013, no?

If so, I believe that this is what you're after:
Code - C#: [Select]
  1. Autodesk.AutoCAD.Interop.AcadDocument
  2.  
"How we think determines what we do, and what we do determines what we get."

cannorth

  • Guest
Re: What is the equivalent namespace for AutoCAD 2013?
« Reply #2 on: November 08, 2012, 02:42:47 PM »
That didn't seem to work for me.

This is my code snippet from before:

Code: [Select]
            Dim doc As AutoCAD.AcadDocument = CType(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.AcadDocument, AcadDocument)

BlackBox

  • King Gator
  • Posts: 3770
Re: What is the equivalent namespace for AutoCAD 2013?
« Reply #3 on: November 08, 2012, 02:49:03 PM »
That didn't seem to work for me.

Did you add the necessary Interop assembly reference?
"How we think determines what we do, and what we do determines what we get."

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: What is the equivalent namespace for AutoCAD 2013?
« Reply #4 on: November 08, 2012, 03:04:45 PM »
Hi,

In the 2013 .NET API the AcadDocument property have been replaced by a GetAcadDocument() extension method.
Try:
Code - vb.net: [Select]
  1. Imports Autodesk.AutoCAD.ApplicationServices.DocumentExtension
  2. ...
  3.     Dim doc As AutoCAD.AcadDocument = _
  4.         CType(Application.DocumentManager.MdiActiveDocument.GetAcadDocument(), AcadDocument)
« Last Edit: July 28, 2013, 04:01:03 AM by gile »
Speaking English as a French Frog

BlackBox

  • King Gator
  • Posts: 3770
Re: What is the equivalent namespace for AutoCAD 2013?
« Reply #5 on: November 08, 2012, 03:19:22 PM »
I do not have 2013 software - Thanks for the correction, Gile.  :-)
"How we think determines what we do, and what we do determines what we get."