How to add your knowledge

Managed Wrapper Classes Detail

    The following discussion assumes that you are familiar with managed C++ and managed wrapper classes in AutoCAD ObjectARX. Refer to the managed wrapper sections in AutoCAD ObjectARX Help.

    Get and Set Functions and Properties

    If you are using C# or VB.NET to address the managed wrapper classes API, note that get_xx and set_xx functions are addressed as properties, and the property name is the xx part of the corresponding function names. If there are matching get_xx and set_xx functions, the property is read-write. If there is only a get_xx function, the property is read-only. In a few cases, where there is only a set_xx function, the property is write-only.

    Option Strings Option Properties

    Getting and setting project or session options is not the same with managed wrapper classes as it is with ObjectARX.

    To get or set a session or project option using ObjectARX, use a GetOptionValue or SetOptionValue function. Specify the target option by passing the option name. For example, to set the log file name for a session (AcMapSession object, which corresponds to the MapApplication object, or the application, in managed wrapper context), you pass the option name and a file name:

    pSession->SetOptionValue("LogFileName", "filename.ext");
    

    To get or set the same option in managed wrapper context, first use the MapApplication::Options property to get the SystemOptions object, and then use an option-specific SystemOptions property:

    oSysOptions.LogFileName = "filename.ext";
    strLogFile = oSysOptions.LogFileName;
    

    Getting Application and Project Objects

    Autodesk Map objects are related in a containment hierarchy, with the Application object at the root. To access AutoCAD Map 3D objects, first get the Application object, and then use the Application::ActiveProject property to get the current project (a ProjectModel object).

    NAMESPACE_MAP3D::MapApplication* mapApi = Autodesk::HostMapApplicationServices::Application;
    NAMESPACE_MAP3D_PROJECT::ProjectModel* pProj = mapApi->ActiveProject;
    

    With a project in hand, use ProjectModel properties to get objects that it contains. For example, its drawing set (DrawingSet object).

    NAMESPACE_MAP3D_PROJECT::DrawingSet* pDSet = pProj->DrawingSet;
    

    Sample Code

    To get managed-wrapper samples, open MapSamples\DotNet in an AutoCAD Map 3D ObjectARX installation.