Code sample Home

Retrieve vertices of entity's outlines (of a text)
void DemoExpFilledText (HANDLE hLcWnd)
{
  HANDLE hDrw, hBlock, hEnt;
  int nPlines, i, nVers, iVer;
  double X, Y, X2, Y2;

  DemoFilledText( hLcWnd );

  // get drawing and block, linked with CAD window
  hDrw = lcPropGetHandle( hLcWnd, LC_PROP_WND_DRW );
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );
  
  hEnt = lcBlockGetFirstEnt( hBlock );
  if (hEnt){
    lcPropPutInt( hDrw, LC_PROP_DRW_COLORT, lcColorRGB(255,150,150) );
    nPlines = lcExpEntity( hEnt, -1, LC_EXP_OUTLINE, false );
    if (nPlines > 0){
      for (i=0; i<nPlines; ++i){
        nVers = lcExpGetPline( 0.0 );
        for (iVer=0; iVer<nVers; ++iVer){
          lcExpGetVertex( &X, &Y );
          // add a point to indicate the vertex
          Y = Y + 5.0 + 0.5;
          lcBlockAddPoint2( hBlock, X, Y, LC_POINT_PIXEL|LC_POINT_CIRCLE, -0.5 );
        }
      }
    }
    nPlines = lcExpEntity( hEnt, -1, LC_EXP_HATCH, false );
    if (nPlines > 0){
      for (i=0; i<nPlines; ++i){
        nVers = lcExpGetPline( 0.0 );
        if (nVers == 2){
          lcExpGetVertex( &X, &Y );
          lcExpGetVertex( &X2, &Y2 );
          Y = Y + 5.0 + 0.5;
          Y2 = Y2 + 5.0 + 0.5;
          lcBlockAddLine( hBlock, X, Y, X2, Y2 );
        }
      }
    }
    // zoom extents
    lcWndZoomRect( hLcWnd, 0, 0, 0, 0 );
  }
}
This will create a drawing as shown on the picture below:



See Also:

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