Code sample Home

Read coordinates of lines and polylines and save it in a file.
void DemoPlineVers (HANDLE hLcWnd)
{
  HANDLE hBlock, hEnt, hVer;
  double X, Y;
  int    EntType;
  BOOL   bClosed;
  char*  szFileName = "d:/PlinesVers.txt";

  FILE*  df = fopen( szFileName, "wt" ); 
  if (df){
    // get a block, linked with CAD window
    hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );
    // enumerate all entities of the block
    hEnt = lcBlockGetFirstEnt( hBlock );
    while( hEnt ){
      EntType = lcPropGetInt( hEnt, LC_PROP_ENT_TYPE );
      if (EntType == LC_ENT_POLYLINE){
        // enumerate all vertices of the polyline
        hVer = lcPlineGetFirstVer( hEnt );
        while( hVer ){
          X = lcPropGetFloat( hVer, LC_PROP_VER_X );
          Y = lcPropGetFloat( hVer, LC_PROP_VER_Y );
          fprintf( df, "%.3f, %.3f\n", X, Y );
          hVer = lcPlineGetNextVer( hEnt, hVer );
        }
        bClosed = lcPropGetBool( hEnt, LC_PROP_PLINE_CLOSED );
        if (bClosed){
          fprintf( df, "end closed\n" );
        }else{
          fprintf( df, "end\n" );
        }
      }else
      if (EntType == LC_ENT_LINE){
	    // save line points
        X = lcPropGetFloat( hEnt, LC_PROP_LINE_X0 );
        Y = lcPropGetFloat( hEnt, LC_PROP_LINE_Y0 );
        fprintf( df, "%.3f, %.3f\n", X, Y );
        X = lcPropGetFloat( hEnt, LC_PROP_LINE_X1 );
        Y = lcPropGetFloat( hEnt, LC_PROP_LINE_Y1 );
        fprintf( df, "%.3f, %.3f\nend\n", X, Y );
      }
      hEnt = lcBlockGetNextEnt( hBlock, hEnt );
    }
    fclose( df );
  }
}
See Also:

Retrieve coordinates of Point entities (placed in active block)
Get an array of coordinates of point entities on specific layer
Load a drawing file and retrieve coordinates of Point entities