|
[code]#define IMAX 2
#define JMAX 3
static void AdskTestCommand(void)
{
AcDbEntity *pEnt = NULL;
AcDbObjectId entId;
AcGePoint3d pick;
AcDbObjectIdArray idArray[IMAX];
int i, j;
for ( i = 0; i < IMAX; i++ )
{
idArray[i].setPhysicalLength( JMAX );
for ( j = 0; j < JMAX; j++ )
{
pEnt = SelectEntity
(
ACRX_T("\nSelect entity: "),
entId,
pick,
AcDb::kForRead
);
if ( NULL == pEnt)
entId = AcDbObjectId::kNull;
else
pEnt->close();
idArray[i].insertAt( j, entId );
acutPrintf
(
ACRX_T("\nObjectID %d inserted at [%d][%d]"),
entId,
i,
j
);
}
}
for ( i = 0; i < IMAX; i++ )
{
for ( j = 0; j < JMAX; j++ )
{
acutPrintf
(
ACRX_T("\nObjectID at [%d][%d] is %d"),
i,
j,
idArray[i][j]
);
}
}
}
static AcDbEntity * SelectEntity
(
const ACHAR *prompt,
AcDbObjectId& id,
AcGePoint3d& pick,
AcDb::OpenMode openMode
)
{
AcDbEntity *ent = NULL;
ads_name ename;
if ( RTNORM == acedEntSel(prompt, ename, (ads_real*)&pick ))
{
if ( Acad::eOk == acdbGetObjectId( id, ename ))
{
if ( Acad::eOk == acdbOpenAcDbEntity( ent, id, openMode ))
return ent;
}
}
return ent;
}[/code] |
|