Where Did Application.AcadApplication Go?

Where Did Application.AcadApplication Go?

Anonymous
Not applicable
1,861 Views
2 Replies
Message 1 of 3

Where Did Application.AcadApplication Go?

Anonymous
Not applicable

I'm trying to write a method to zoom to the extents of a drawing in AutoCAD using C#.NET and the latest version of ObjectARX. I googled for an example of someone doing that and found this post which has the following method:

 

[CommandMethod("zoomExtentTest")]

public static void zoomExtentTest()

{

    //using InvokeMember to support .NET 3.5

    Object acadObject = Application.AcadApplication;

    acadObject.GetType().InvokeMember("ZoomExtents"BindingFlags.InvokeMethod, null, acadObject, null);

}

 

When I tried to copy the code I got an error saying Autodesk.AutoCAD.ApplicationServices.Application has no defintion for AcadApplication so I'm guessing it got replaced with something else but I don't know where I'd find such a replacement or how I'd rewrite the above method to work with the current AutoCAD .NET API.

0 Likes
Accepted solutions (1)
1,862 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor
Accepted solution

With the corrent 'using' statement, it should work.

 

using acApp = Autodesk.AutoCAD. ApplicationServices.Application;

 

I use acApp because if you reference System, you will end up with amibiguous references to 'Application'. So you need to change the following line to:

 

Object acadObject = acApp.AcadApplication;

 

Note that you could search for 'AcadApplication' in the Object Browser (Ctrl + W) to find references.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 3

Anonymous
Not applicable

Figured out what happened, I was referencing

 

Autodesk.AutoCAD.ApplicationServices.Core.Application

 

instead of

 

Autodesk.AutoCAD.ApplicationServices.Application.

 

Thanks for your help!