Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Export to a Raster File

ODA BimRv SDK supports exporting an .rvt and .rfa files to a raster image. The export module is the single support module, and it is available in dynamic form for Windows, Linux, and macOS (x64 version). This module is realized in ODA Kernel SDK. To export .rvt/.rfa file next steps should be done:

  1. Creating Raster export module.
  2. Setting raster image parameters.
  3. Calling saveRasterImage() method.

For example:


// Define some service
class MyServices : public OdExBimSystemServices, public OdExBimHostAppServices
{
protected:
  ODRX_USING_HEAP_OPERATORS(OdExBimSystemServices);
};

// Create some service
OdStaticRxObject< MyServices > svcs;

// initialize ODA Platform
odrxInitialize( &svcs );

// Create loader module and raster service module
OdRxModule* pModule = ::odrxDynamicLinker()->loadModule(OdBmLoaderModuleName, false);
OdRxRasterServicesPtr pRasSvcs = ::odrxDynamicLinker()->loadApp(RX_RASTER_SERVICES_APPNAME, false);

// Get the Database from the input file
OdBmDatabasePtr pDb = svcs.readFile(argv[1]);

// Create GsModule and GsDevice
OdGsModulePtr pGsModule = ::odrxDynamicLinker()->loadModule("WinOpenGL_4.3src_10.txv");
OdGsDevicePtr pDevice = pGsModule->createBitmapDevice();

// Create GiContext object and set its parameters
OdGiContextForBmDatabasePtr pDbContext = OdGiContextForBmDatabase::createObject();
pDbContext->setDatabase(pDb);
pDbContext->setPlotGeneration(false);
pDbContext->enableGsModel(true);

// Set GsDevice parameters
pDevice->properties()->putAt(L"BitPerPixel", OdRxVariantValue(OdUInt32(24)));
pDevice->setBackgroundColor(ODRGB(255,255,255));
pDevice->setLogicalPalette((::odcmAcadLightPalette()), 256);
  
OdBmDBDrawingInfoPtr pDBDrawingInfo = pDb->getAppInfo(OdBm::ManagerType::DBDrawingInfo);
pDevice = OdGsBmDBDrawingHelper::setupDBDrawingViews( pDBDrawingInfo->getActiveDBDrawingId(), pDevice, pDbContext );

// Define the size of the image(1000x1000 pixels)
OdGsDCRect gsRect(0, 1000, 1000, 0);  
pDevice->onSize(gsRect);

pDevice->update();

// Export the file to a raster image
OdString sBitmapName = L"pic_test.png";
pRasSvcs->saveRasterImage(OdGiRasterImagePtr(pDevice->properties()->getAt(OD_T("RasterImage"))), sBitmapName);
    

See Also

Interaction with Other Formats

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.