|
- AcDbEntity *
- selectEntity( const char *prompt, AcDbObjectId& id, AcGePoint3d& pick,
- AcDb::OpenMode openMode )
- {
- AcDbEntity *ent = NULL;
- ads采用name ename;
- if ( RTNORM == ads采用entsel(prompt, ename, (ads采用real*)&pick )){
- if ( Acad::eOk == acdbGetObjectId( id, ename )){
- if ( Acad::eOk == acdbOpenAcDbEntity( ent, id, openMode ))
- return ent;
- }
- }
- return ent;
- }
- // 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();
- }
复制代码 |
|