Code sample Home

Save active block into raster image file

void DemoBlockToRaster (HANDLE hLcWnd)
{
  HANDLE hBlock;
  double Xmin, Ymin, Xmax, Ymax;
  int    ImgW;
  WCHAR* szRasterFile = L"d:/Image.png";

  // get the block, linked with CAD window
  hBlock = lcPropGetHandle( hLcWnd, LC_PROP_WND_BLOCK );

  // get extents of the block
  Xmin = lcPropGetFloat( hBlock, LC_PROP_BLOCK_XMIN );
  Ymin = lcPropGetFloat( hBlock, LC_PROP_BLOCK_YMIN );
  Xmax = lcPropGetFloat( hBlock, LC_PROP_BLOCK_XMAX );
  Ymax = lcPropGetFloat( hBlock, LC_PROP_BLOCK_YMAX );

  // rasterize the block
  ImgW = 2000;  // destination width of the image
  lcBlockRasterize( hBlock, szRasterFile, Xmin, Ymin, Xmax, Ymax, ImgW, 0 );
}

Used functions:

lcBlockRasterize
lcPropGetHandle
lcPropGetFloat