Code sample Home

Retrieve boundary entities of hatch entity

void DemoGetHatchEnts (HANDLE hLcWnd)
{
  int    Key = 123;   // required hatch entity is marked with this key value
  int    NumEnts;
  HANDLE hBlock, hEnt, hEntHatch;
  BOOL   bAssoc;

  // get a block, linked with CAD window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_VIEWBLOCK );
  // find required hatch by user-defined key
  hEntHatch = lcBlockGetEntByKey( hBlock, Key );
  if (hEntHatch){
    // check if the hatch is associative
    bAssoc = lcPropGetBool( hEntHatch, LC_PROP_HATCH_ASSOC );
    if (bAssoc){
      // get number of boundary entities
      NumEnts = lcPropGetInt( hEntHatch, LC_PROP_HATCH_NENTS );
      // get first entity of hatch boundary
      hEnt = lcHatchGetEnt( hEntHatch, 0 );  
      while( hEnt ){
        // set red color for the entity
        lcPropPutInt( hEnt, LC_PROP_ENT_COLOR, RGB(255,0,0) );
        // get next entity of hatch boundary
        hEnt = lcHatchGetEnt( hEntHatch, 1 );  
      }
      lcWndRedraw( hLcWnd );
    }
  }
}
See Also:

Retrieve outlines of hatch entity
Retrieve vertices of entity's hatch lines (barcode)