Code sample Home

Load a drawing file and retrieve coordinates of Point entities.
void DemoGetFilePoints ()
{
  HANDLE hDrw, hBlock, hEnt;
  int    EntType;
  double X, Y;
  WCHAR  szLayerName[256];
  WCHAR* szFileName = L"d:/drawing.lcd";

  hDrw = lcCreateDrawing();
  if (lcDrwLoad( hDrw, szFileName, 0 )){
    // get Model block
    hBlock = lcPropGetHandle( hDrw, LC_PROP_DRW_BLOCK_MODEL );
    // enumerate entities of the block
    hEnt = lcBlockGetFirstEnt( hBlock );
    while( hEnt != 0 ){
      // get entity's type
      EntType = lcPropGetInt( hEnt, LC_PROP_ENT_TYPE );
      if (EntType == LC_ENT_POINT){
        // get point coordinates
        X = lcPropGetFloat( hEnt, LC_PROP_POINT_X );
        Y = lcPropGetFloat( hEnt, LC_PROP_POINT_Y );
        // get point layer (name)
        wcscpy( szLayerName, lcPropGetStr( hEnt, LC_PROP_ENT_LAYER ));
      }
      // get next entity of the block
      hEnt = lcBlockGetNextEnt( hBlock, hEnt );
    }
  }
  lcDeleteDrawing( hDrw );
}
Used functions:

lcCreateDrawing
lcDrwLoad
lcDeleteDrawing

lcBlockGetFirstEnt
lcBlockGetNextEnt

lcPropGetFloat
lcPropGetHandle