Code sample Home

Enumerate entities which make a shape.
User selects shape entity, then calls this function:
void DemoShapeGetEnts (HANDLE hLcWnd)
{
  HANDLE hBlock, hShape, hEnt, hVer, hPnt;
  int    EntType;
  double X, Y;

  // get the block linked with graphics window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_VIEWBLOCK );
  // get selected entity
  hShape = lcBlockGetFirstSel( hBlock );
  if (hShape){
    EntType = lcPropGetInt( hShape, LC_PROP_ENT_TYPE );
    if (EntType == LC_ENT_SHAPE){
      // get first entity of the shape
      hEnt = lcShapeGetFirstEnt( hShape );
      while( hEnt != 0 ){
        EntType = lcPropGetInt( hEnt, LC_PROP_ENT_TYPE );
        if (EntType == LC_ENT_POLYLINE){
          // get first vertex of a polyline
          hVer = lcPlineGetFirstVer( hEnt );
          while( hVer != 0){
            // add a point at polyline vertex
            X = lcPropGetFloat( hVer, LC_PROP_VER_X );
            Y = lcPropGetFloat( hVer, LC_PROP_VER_Y );
            hPnt = lcBlockAddPoint2( hBlock, X, Y, LC_POINT_CIRCLE, -0.75 );
            lcPropPutInt( hPnt, LC_PROP_ENT_COLOR, RGB(100,255,0) );
            // get next vertex of a polyline
            hVer = lcPlineGetNextVer( hEnt, hVer );
          }
        }
        // get next entity of the shape
        hEnt = lcShapeGetNextEnt( hShape, hEnt );
      }
      lcWndRedraw( hLcWnd );
    }
  }
}
The result can be like on the picture: