I'm having trouble trying to get the GetAcadDocument method to work.
ThisDrawing = DocumentManager.MdiActiveDocument.AcadDocument
ThisDrawing = DocumentExtension.GetAcadDocument(Application.Docu
Produces a run time error. I know just enough .net to brute force my app to do what I want and would appreciate any help.
for me it's running (it used time to find the alternative to .AcadDocument but with the method same to yours it's working for me. How is ThisDrawing declared at your code, what runtime-error do you get exactly?
- alfred -
Greetings, I have the same problem you had, I would like you to help me solve mine, with some questions
. How did you fix it?
- Versiond and vb.net What did you use?
- What version of AutoCAD are you?
- What references did you use?
I await your reply, thanks.
Just a little precision about GetAcadDocument() method.
Extension methods can be called both way (assuming doc = MdiActivedocument):
- as static (Shared) methods as shown upper:
ThisDrawing = DocumentExension.GetAcadDocument(doc)
- as instance methods of the extended type:
ThisDrawing = doc.GetAcadDocument():
The second one will directly work with C# because DocumentExtension is a class of the ApplicationServices namespace.
But with VB extension methods have to be defined in a Module, so, the DocumentExtension module have to be imported for this behavior to be available.