|
[code]// This is command 'GETLT'
void asdktestergetlt()
{
AcDbObjectId objId;
AcGePoint3d pick;
AcDbEntity *pEnt = selectEntity( "\nSelect entity: ", objId, pick,
AcDb::kForRead );
if ( NULL == pEnt )
return;
if ( pEnt->linetypeId() == pEnt->database()->byLayerLinetype() )
{
AcDbObject *pObj;
if ( Acad::eOk == acdbOpenAcDbObject( pObj, pEnt->layerId(),
AcDb::kForRead ))
{
AcDbLayerTableRecord *pLayer =
AcDbLayerTableRecord::cast( pObj );
if ( NULL != pLayer )
{
AcDbObject *pObj2;
if ( Acad::eOk == acdbOpenAcDbObject( pObj2,
pLayer->linetypeObjectId(), AcDb::kForRead ))
{
AcDbLinetypeTableRecord *pLinetype =
AcDbLinetypeTableRecord::cast( pObj2 );
if ( NULL != pLinetype )
{
char *layerName, *linetypeName;
pLayer->getName( layerName );
pLinetype->getName( linetypeName
);
acutPrintf( "\nEntity lives on
layer %s which uses linetype %s.", layerName, linetypeName );
delete [] layerName;
delete [] linetypeName;
}
pObj2->close();
}
}
pObj->close();
}
}
pEnt->close();
}[/code] |
|