In BimRv SDK you can create and edit grid elements. There are two types of grid elements: linear and arc. Both grid types can be created only on horizontal surfaces, and an arc grid can't be closed. Also, grid creation is supported only for model file types (RVT files).
The following image shows the difference between a linear grid and an arc grid.
Grids are implemented in the OdBmGrid class. To create a linear grid, use the setLine() method:
OdResult setLine(const OdBmGLinePtr& pLine);
To create an arc grid, use the setArc() method:
OdResult setArc(const OdBmGArcPtr& pArc);
Example
To create a grid, create a new grid element and call the corresponding method to create an arc or linear grid. The following is an example of linear grid creation:
OdGePoint3d ptStart = OdGePoint3d::kOrigin;
OdGePoint3d ptEnd = OdGePoint3d(-100.0, 0.0, 0.0);
ODBM_TRANSACTION_BEGIN(t, pDb)
t.start();
OdBmGridPtr pGrid = OdBmGrid::createObject();
OdBmObjectId gridId = pDb->addElement(pGrid);
OdBmGLinePtr pGLine = OdBmGLine::createObject();
pGLine->set(ptStart, ptEnd);
OdResult res = pGrid->setLine(pGLine);
t.commit();
ODBM_TRANSACTION_END();
The following is an example of arc grid creation:
OdGeVector3d vecX = OdGeVector3d::kXAxis;
OdGeVector3d vecZ = OdGeVector3d::kZAxis;
double fRadius = 50.0;
OdGePoint3d ptCenter = OdGePoint3d(10.0, 20.0, 0.0);
ODBM_TRANSACTION_BEGIN(t, pDb)
t.start();
OdBmGridPtr pGrid = OdBmGrid::createObject();
OdBmObjectId gridId = pDb->addElement(pGrid);
OdGeCircArc3d arc;
arc.set(ptCenter, vecZ, vecX, fRadius, 0.0, OdaPI);
OdBmGArcPtr pGArc = OdBmGArc::createObject();
pGArc->set(arc);
OdResult res = pGrid->setArc(pGArc);
t.commit();
ODBM_TRANSACTION_END();
Commands
You can create and edit grids in OdaBimApp using special commands: GridLineCreateCmd, GridArcCreateCmd, GridLineEditCmd, GridArcEditCmd.