Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Main Classes for Work with Fill Patterns

To work with ODA BimRv SDK fill patterns, use the following classes.

OdBmFillPattern Class

OdBmFillPattern resides in the OdBmFillPatternElem object and represents a set of fill grids that form a pattern.

OdBmFillPattern has the following members:

  • OdString Name — Name of the pattern. It must be unique inside the database.
  • OdDouble WindowSize — Window size. It is calculated automatically.
  • OdUInt16 Target — Type of pattern. The "0" value is for drafting patterns, and "1" is for model patterns.
  • OdUInt16 Orientation — Orientation type. It is used only for drafting patterns. For model patterns, the value is always "0".
  • OdArray< OdBmFillGridPtr > FillGrids — Array of fill grids that form the pattern.

To get this data, use the appropriate methods. For example:


// Get FillPattern data
name = pFillPat->getName();
orientation = pFillPat->getOrientation();
target = pFillPat->getTarget();
windowSize = pFillPat->getWindowSize();
  

OdBmFillPatternElem Class

OdBmFillPatternElem is an element wrapper for the OdBmFillPattern class. It does not contain any specific data and it is used only to access OdBmFillPattern. References to OdBmFillPatternElem can be found in the OdBmMaterial and OdBmFilledRegionAttributes classes.

To get the fill pattern, use the getFillPattern() method. For example:


OdBmFillPatternPtr pFillPat = pFillPatEl->getFillPattern();
  

OdBmFillGrid Class

OdBmFillGrid is a minimal element of which a fill pattern is formed. It defines a set of angled lines with spacing that starts with an offset and can have a pattern. There are two types of grids: simple and custom.

OdBmFillGrid is controlled by following attributes (they are shown in the picture below):

  • OdDouble Angle — Defines an angle that is calculated from a horizontal line in counterclockwise direction, such as angle "a" in the picture below.
  • OdDoubleArray Deltas — Defines spacing between grid lines. If Deltas[0] is set to 0.0, the grid is simple and spacing is calculated as line "d" (in the picture below) with value of Deltas[1]. Simple grids are not allowed to have a pattern and starting point; they are used for simple patterns such as diagonal or cross-hatch patterns which only have angle and spacing. If Deltas[0] is non-zero, the grid is considered custom and all its attributes are used. In this case, spacing is defined separately in the horizontal and vertical directions, such as lines X and Y (in the picture below), with values of Deltas[0] and Deltas[1] respectively.
  • OdGePoint2d Origin — Defines an offset from the starting position. It is set to (0, 0) for simple grids.
  • OdDoubleArray Segments — Defines a length of segments if it is not empty. Only positive values are allowed. Segment types (space/dash) in this array are alternating, so an array of two elements (1.0, 1.0) is a dashed line with dash size of 1.0 and space size of 1.0.

To get this data, use the appropriate methods. For example:


pFillPat->getFillGrids(fillGridArr);
if (!fillGridArr.getAt(1).isNull())
  pFillGrid = fillGridArr.getAt(1);
// Get OdBmFillGrid data
angle = pFillGrid->getAngle();
originGrid = pFillGrid->getOrigin();
deltas[0] = pFillGrid->getDeltasItem(0);
deltas[1] = pFillGrid->getDeltasItem(1);
pFillGrid->getSegments(segments);
  

OdBmFillPatternTable Class

OdBmFillPatternTable resides in StyleSettings and exists as a dummy table. There are no specific attributes.

OdBmFillPatternTracking Class

OdBmLinePatternTracking is the manager that stores default fill patterns.

OdBmGFilling Class

OdBmGFilling is an OdBmFace attribute that controls fill pattern application to the face. As faces are processed by BRepRenderer, fill patterns are also applied by BRepRenderer with help from OdBmGFilling.

OdBmGFilling has the following important attributes:

  • OdBmCmColor FillColor — Controls the pattern color. It is supplied to GI through entity traits.
  • OdBmObjectId PatternId — Contains the ID of the OdBmFillPatternElem that is used to fill the face. If it is "-1", no fill is used. It is supplied as OdGFill of the entity traits to pass it to the GI subsystem.
  • OdBmFillPatternDataPtr Data — Contains secondary attributes that can be computed from the OdBmFillPattern data and current view scale.
  • OdBmFillPatternPlacerPtr Placer — Controls fill pattern application attributes.

To get this data, use the appropriate methods. For example:


// Get OdBmGFilling data
OdBmCmColor color = pGFilling->getFillColor();
OdBmObjectId parentId = pGFilling->getPatternId();
//OdBmFillPatternDataPtr pFillPatData = pGFilling->getData();
OdBmFillPatternPlacerPtr pFillPatPlacer = pGFilling->getPlacer();
  

OdBmFillPatternPlacer class

OdBmFillPatternPlacer is an important face attribute that should be taken into account when a fill pattern is applied to a face. It controls the start point and orientation of the pattern application. ODA BimRv SDK uses a 2D coordinate system for FillPatterns that lies on the plane of the face. So, every face has its own coordinate system. This coordinate system is saved as XVector, YVector and Origin of the corresponding OdBmPlane.

OdBmFillPatternPlacer has the following important attributes:

  • double Scale — Controls the pattern scale. It is a fixed value.
  • OdGePoint2d Origin — Controls the start point from which the pattern application begins. This point is calculated in relation to the view.
  • OdGeVector2d Direction — Contains secondary attributes that can be computed from the OdBmFillPattern data and current view scale.

To get this data, use the appropriate methods. For example:


// Get OdBmFillPatternPlacer data
double scale = pFillPatPlacer->getScale();
OdGePoint2d originPatPlacer = pFillPatPlacer->getOrigin();
OdGeVector2d direction = pFillPatPlacer->getDirection();
  

The hierarchy of the Fill pattern classes is shown on picture below:

To see the full sample find Examples/TB_DevGuideCommands/BmDocFillPatternsCmd sample command inside your ODA BimRv SDK installation folder.

See Also

Work with Fill Patterns

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