AcMapSession class

Land Desktop Development ARX CPP SDK

 

AcMapSession class

Header file: MapSession.h.

An instance of the AcMapSession class represents a Map session, which is a single instance of AutoCADMap that is currently running.

An AcMapSession contains the session's error stack (AcMapErrorStack class), its aliases (AcMapAliases class), its projects (AcMapProject class) and its project iterator (AcMapProjectIterator class).

Do not subclass from this class.

To get an AcMapGetSession pointer, call AcMapGetSession, which is declared an extern C function in MapSession.h. AutoCAD Map releases the memory allocated for AcMapGetSession, so do not attempt to delete it yourself.

The following example implements a command that declares a pointer to an AutoCAD Map session, and immediately sets the pointer to NULL. The example calls AcMapGetSession to get the AcMapSession pointer. For simplicity, the code does not show routine error checking.

#include "StdAfx.h"
#include "StdArx.h"
#include <MapArxApi.h>
 
void asdkhelpcreatesession()
{
AcMapSession *mapApi = NULL;
mapApi = AcMapGetSession();
   if (mapApi == NULL) { 
   acutPrintf ("\nCan't connect to MAP"); 
   return;} 
else{
   acutPrintf("\nCreated AcMapSession");} 
   acedRetVoid(); 
}