In ODA Drawings SDK, an OdDbRegion entity is a wrapper for a Spatial® ACIS® model that represents geometry of a region entity. OdDbRegion::createFromCurves сreates OdDbRegion entities from the closed loops that are defined by the specified curve segments. OdDbHatch entities also usually consist of closed loops, which means that you can create an OdDbRegion from an OdDbHatch.
Use OdDbRegionPtr OdDbHatch::getRegionArea() const; to create a region from the boundary loops of a hatch. The method returns a null pointer if the hatch boundary doesn't have closed loops, if self intersection occurs, or if the modeler can't create it.
Let’s look at creating a region from a hatch using ODA’s geometry modeler and Spatial’s modeler.
The next picture shows a hatch with two loops. The inner loop is a hole.
The ODA geometry modeler can create regions with only one loop, and as a result OdDbHatch::getRegionArea() returns a region with only the outer loop from the hatch as shown below. The picture also shows the perimeter of the region and that the region is created correctly.
The next picture shows the region created by Spatial’s modeler. This region has an inner loop because the Spatial modeler can create a region with many loops. The picture also shows the perimeter of the region and that the region is created correctly.
The next picture shows a hatch with two loops, but the edges of the inner loop go outside of the outer loop, which creates intersection loops. In this case Spartial’s modeler and the ODA geometry modeler can’t create a region.