Working with Topography Surfaces in BimRv SDK (Part 3 of 3)

Evgeniy Tikhonov

April 02, 2020

If surface points and facets are stored in a JSON format file, the command BmSiteSurfaceCreate can be used to load and set data for the specified surface.

This is the last article in a series about working with topography surfaces. For the previous article, click here.

Example of Loading Data from a JSON Format File

The following example demonstrates how to load points and facets from a JSON format file.

#include "Database/BmTransaction.h"
#include "Main/BmSiteSurfaceHelper.h"
#include "Ed/EdCommandStack.h"
#include "Ed/EdCommandContext.h"
#include "ExBimCommandContext.h"
#include "ExStringIO.h"

OdBmDatabasePtr pDb = app->readFile(L"empty_project.rvt");

OdString sDataFile = app->findFile("TrianglesData_simple.json");
OdSmartPtr<ExStringIO> pStringIO = ExStringIO::create(sDataFile);
OdBmCommandContextPtr pDbCmdCtx = ExBimCommandContext::createObject(pStringIO, pDb);
::odedRegCmds()->executeCommand("BmSiteSurfaceCreate", pDbCmdCtx);

pSurf = pDbCmdCtx->funcIO()->result();
OdBmSiteSurfaceHelper helper(pSurf);
//… next, use the helper

Listing of TrianglesData_simple.json:


The look of the constructed surface is the same as the first picture in the second article of the series for creating a surface using points and facets.


BimRv creating surfaces using points and facets