[Back to Blog](/blog) # Working with Topography Surfaces in BimRv SDK (Part 2 of 3)

Evgeniy Tikhonov March 05, 2020 [\#rfa](/blog/tag/rfa) [\#rvt](/blog/tag/rvt)

<a class="a2a_button_facebook"></a><a class="a2a_button_twitter"></a><a class="a2a_button_linkedin"></a>

This article provides code examples for creating and modifying topography surfaces. For the first article in this series and more introductory information, click [here](https://www.opendesign.com/blog/2019/december/working-topography-surfaces-bimrv-sdk-part-1-3).

##### Example using Points and Facets

The following code demonstrates using the OdBmSiteSurfaceHelper class to set a surface with points and facets.

```
#include "Database/BmTransaction.h"
#include "Main/BmSiteSurfaceHelper.h"

OdGePoint3dArray points;
points.push_back(OdGePoint3d(19857.25, 20260.45, 100.30));
points.push_back(OdGePoint3d(20249.13, 19884.37, 101.09));
points.push_back(OdGePoint3d(21330.37, 20345.12, 87.97));
points.push_back(OdGePoint3d(19657.43, 21044.29, 97.83));
points.push_back(OdGePoint3d(19917.07, 21296.76, 98.19));
points.push_back(OdGePoint3d(20257.67, 21004.94, 97.36));
points.push_back(OdGePoint3d(20567.17, 21652.50, 98.46));
points.push_back(OdGePoint3d(21403.69, 21134.81, 90.62));

OdArray<OdUInt16Array> facets;
OdUInt16Array facet;

#define MAKE_FACET(V1, V2, V3) \
facet.clear();               \
        	facet.push_back(V1); facet.push_back(V2); facet.push_back(V3); \
        	facets.push_back(facet);
      MAKE_FACET( 5, 3, 0 )
      MAKE_FACET( 5, 4, 3 )
      MAKE_FACET( 0, 1, 5 )
      MAKE_FACET( 5, 2, 7 )
      MAKE_FACET( 2, 5, 1 )
      MAKE_FACET( 7, 6, 5 )
      MAKE_FACET( 5, 6, 4 )
      #undef MAKE_FACET

OdBmDatabasePtr pDb = app->readFile(L"empty_project.rvt");
OdBmSiteSurfacePtr pSurf = OdBmSiteSurface::createObject();
ODBM_TRANSACTION_BEGIN(t, pDb)
        t.start();
        pDb->addElement(pSurf);
        OdBmSiteSurfaceHelper helper(pSurf);
        // sets the surface using points and faces, the surface prohibits modifications
        helper.setSurface(points, facets);
        OdGePoint3dArray deleted;
        deleted.push_back(points[3]);
        OdResult res;
        res = helper.deletePoints(deleted); // res == eNotApplicable
        res = helper.movePoints(helper.getPoints(), moveVector); // res == eNotApplicable
        res = helper.changePointElevation(OdGePoint3d(points.first().x, points.first().y, 10.), pt.z);  // res == eNotApplicable
        res = helper.changePointElevation(OdGePoint3d(points.last().x, points.last().y, 10.), pt.z + 10.);  // res == eNotApplicable
        helper.applyToSurface();

        t.commit();
ODBM_TRANSACTION_END()
```

A picture of a topography surface constructed by these points and facets:

![A picture of a topography surface constructed by points and facets](/files/inline-images/A%20picture%20of%20a%20topography%20surface%20constructed%20by%20these%20points%20and%20facets.jpg)##### Example using Only Points

The next example demonstrates setting a surface only with points.

```
#include "Database/BmTransaction.h"
#include "Main/BmSiteSurfaceHelper.h"
  
OdGePoint3dArray points;
      points.push_back(OdGePoint3d(19857.25, 20260.45, 100.30));
      points.push_back(OdGePoint3d(20249.13, 19884.37, 101.09));
      points.push_back(OdGePoint3d(21330.37, 20345.12, 87.97));
      points.push_back(OdGePoint3d(19657.43, 21044.29, 97.83));
      points.push_back(OdGePoint3d(19917.07, 21296.76, 98.19));
      points.push_back(OdGePoint3d(20257.67, 21004.94, 97.36));
      points.push_back(OdGePoint3d(20567.17, 21652.50, 98.46));
      points.push_back(OdGePoint3d(21403.69, 21134.81, 90.62));

      OdBmDatabasePtr pDb = app->readFile(L"empty_project.rvt");
      OdBmSiteSurfacePtr pSurf = OdBmSiteSurface::createObject();
      ODBM_TRANSACTION_BEGIN(t, pDb)
      	t.start();
      	pDb->addElement(pSurf);
      	OdBmSiteSurfaceHelper helper(pSurf);
	// sets the surface using only points, the surface allows modifications
      	helper.setSurface(points);
        	OdGePoint3dArray deleted;
        	deleted.push_back(points[3]);
OdResult res;
res = helper.deletePoints(deleted); // res == eOk
       	res = helper.movePoints(helper.getPoints(), moveVector); // res == eOk
        	res = helper.changePointElevation(OdGePoint3d(points.first().x, points.first().y, 10.), pt.z); // res == eOk
        	res = helper.changePointElevation(OdGePoint3d(points.last().x, points.last().y, 10.), pt.z + 10.); // res == eOk
        	helper.applyToSurface();
        	t.commit();
      ODBM_TRANSACTION_END()
```

A picture of a topography surface constructed by these points and the results of applying changes to the surface.

![A picture of a topography surface constructed by points](/files/inline-images/Example%20using%20Only%20Points.jpg)The next article in this series will show an example of how to load a surface from a .Json file.

## Get started today

**Try ODA software free for 60 days.  
No risk, no credit card required.**

[Try for Free](https://staging.opendesign.com/free-trial)
