Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Create Your First Application Based on BimRv SDK: Source Code

BimRv SDK First Application Source Code

Return to the main guide

Below is the full content of the BimRvFirstApp.cpp source file from the BimRv SDK first application project.


#include "BimCommon.h"
#include "StaticRxObject.h"
#include "ExBimHostAppServices.h"
#include "Database/BmDatabase.h"
#include "DynamicLinker.h"
#include "RxInit.h"
#include "RxDynamicModule.h"

class MyServices : public ExSystemServices, public OdExBimHostAppServices
{
protected:
  ODRX_USING_HEAP_OPERATORS(ExSystemServices);
};

int main()
{
  OdString inFile(L"test.rvt");
  OdString outFile(L"test_copy.rvt");

  // Create a custom Services object
  OdStaticRxObject < MyServices > svcs;

  // Initialize Runtime Extension environment
  odrxInitialize(&svcs);

  try
  {
    // Load dynamic module for BimRv
    ::odrxDynamicLinker()->loadModule(OdBmLoaderModuleName, false);

    // Create a BimRv database and fills it with input file content
    OdBmDatabasePtr pDb = svcs.readFile(inFile);

    // Writes database to the output file
    svcs.writeFile(outFile, pDb);

  }
  catch (OdError& err)
  {
    odPrintConsoleString(L"Error during copy test.rvt file: %ls\n", err.description().c_str());
  }
  // Uninitializes Runtime Extension environment
  odrxUninitialize();

  return 0;
}
    

Return to the main guide

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