Code sample Home

Retrieve block attribute value by Tag
void DemoBlockAtt1 (HANDLE hLcWnd)
{
  HANDLE hBlock, hEnt, hAtt;
  int    EntType;
  BOOL   bHasAtt;
  WCHAR* szTag = L"INFO";
  WCHAR  szValue[512];

  // clear text buffer
  memset( szValue, 0, sizeof(szValue) );
  // get a block, linked with CAD window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_VIEWBLOCK );
  // enumerate block's entities
  hEnt = lcBlockGetFirstEnt( hBlock );
  while( hEnt ){
    EntType = lcPropGetInt( hEnt, LC_PROP_ENT_TYPE );
    if (EntType == LC_ENT_BLOCKREF){
      bHasAtt = lcPropGetBool( hEnt, LC_PROP_BLKREF_ATTRIBS );
      if (bHasAtt){
        // get attribute by tag
        hAtt = lcBlkRefGetAtt( hEnt, szTag );
        if (hAtt != 0){
          // get attribute value
          wcsncpy( szValue, lcPropGetStr( hAtt, LC_PROP_ATT_VALUE ), 510 );
        }
      }
    }
    hEnt = lcBlockGetNextEnt( hBlock, hEnt );
  }
}
See Also:

Code sample 2,   Code sample 3