In the following examples, the pFcf variable stores a pointer to the feature control frame object.
To set a string of text to a feature control frame object, use the setText() method, which requires one OdString parameter to specify the text that should be added to the feature control frame object. For example:
pFcf->setText(L"Some text");
To get the text of a feature control frame object, use the text() method, which returns the text of this object as an object of the OdString class. For example:
odPrintConsoleString(L"\nText of fcf object is %s", pFcf->text().c_str());
You can call the letters for its text from the font files. To do so, use this
sequence of symbols: {\\Fname_of_font_file;letters_from_font_file}
. For
example:
// Write text "Some text" by using the letters from "gothicg" font file
pFcf->setText(L"{\\Fgothicg;Some text}");
Note: You can find the font files in the "C:\Windows\Fonts" directory (for Windows) or in the "/usr/share/fonts" directory (for Linux).
Special symbols can also be used for feature control frame text. They can be called from the "gdt" font file. For example:
pFcf->setText(L"{\\Fgdt;k}%%v{\\Fgdt;o}%%v{\\Fgdt;p}%%v%%v%%v%%v");
The list of special symbols is shown in the picture below.
To get the size of text, use the dimtxt() method, which returns the text size as a double value. For example:
odPrintConsoleString(L"\nFcf text size is %g", pFcf->dimtxt());
To set a new text size, use the setDimtxt() method, which requires one double parameter to specify the new text size. This method overrides the DIMTXT dimension variable for this object. For example:
pFcf->setDimtxt(3.2);
To set the color of a whole feature control frame object, use setColor() method, which requires one parameter: object of the OdCmColor class. For example:
OdCmColor colFcf;
colFcf.setRGB(255, 0, 0);
pFcf->setColor(colFcf);
To get the color of a feature control frame object, use the color() method, which returns the color as an object of the OdCmColor class. For example:
odPrintConsoleString(L"\nFcf color is(RGB) (%x %x %x)", pFcf->color().red(), pFcf->color().green(), pFcf->color().blue());
To set the color of the lines and borders of a feature control frame object, use the setDimclrd() method. To set the color of the text of a feature control frame object, use the setDimclrt() method. These methods override the DIMCLRD and DIMCLRT dimension variables for the object and require one OdCmColor parameter to specify the color. For example:
OdCmColor colFcf;
colFcf.setRGB(0, 255, 0);
pFcf->setDimclrd(colFcf);
colFcf.setRGB(0, 0, 255);
pFcf->setDimclrt(colFcf);
To get the color of the lines and borders, use the dimclrd() method. To get the color of the text, use the dimclrt() method. These methods return the colors as objects of the OdCmColor class. For example:
odPrintConsoleString(L"\nFcf lines color is(RGB) (%x %x %x)", pFcf->dimclrd().red(), pFcf->dimclrd().green(), pFcf->dimclrd().blue());
odPrintConsoleString(L"\nFcf text color is(RGB) (%x %x %x)", pFcf->dimclrt().red(), pFcf->dimclrt().green(), pFcf->dimclrt().blue());
The normal defines the orientation of a feature control frame plane in world space. The direction defines the vector from the left side of a feature control frame to the right side. To get the normal of the feature control frame, use the normal() method, which returns the WCS unit vector that is the normal to the plane as an object of the OdGeVector3d class. To get the direction of the feature control frame, use the direction() method, which returns the WCS X-axis direction vector of this feature control frame. For example:
odPrintConsoleString(L"\nFcf normal is (%g * X + %g * Y + %g * Z)", pFcf->normal().x, pFcf->normal().y, pFcf->normal().z);
odPrintConsoleString(L"\nFcf direction is (%g * X + %g * Y + %g * Z)", pFcf->direction().x, pFcf->direction().y, pFcf->direction().z);
To set the normal and direction to the feature control frame, use the setOrientation() method, which requires two parameters: two objects of the OdGeVector3d class to specify vectors of the normal and direction. For example:
OdGeVector3d normal(0, 1, 2);
OdGeVector3d dir(1, 3, 0);
pFcf->setOrientation(normal, dir);
The scale factor scales a feature control frame entity. The scale factor influences text size and the size of borders.
To get the scale factor, use the dimscale() method, which requires no parameters and returns the scale factor as a double value. For example:
odPrintConsoleString(L"\nScale factor is %f",pFcf->dimscale());
To set the scale factor for a feature control frame object, use the setDimscale() method, which requires one double parameter to specify the new scale factor. This method overrides the value of the DIMSCALE dimension variable for this object. For example:
pFcf->setDimscale(0.5);
Note: The scale factor does not modify actual values of other properties. The scale factor changes the visual elements relative to the actual values of properties; properties are not changed.
The location of a feature control frame object is its insertion point and is the point in the middle of the left border.
To get the location of a feature control frame object, use the location() method, which returns the insertion point as an object of the OdGePoint3d class. For example:
odPrintConsoleString(L"\nFcf location is (%g %g %g)", pFcf->location().x, pFcf->location().y, pFcf->location().z);
To set a new location of a feature control frame object, use the setLocation() method, which requires one OdGePoint3d parameter to specify the new insertion point. For example:
OdGePoint3d point = OdGePoint3d(5,6,2);
pFcf->setLocation(point);
To get the bounding points, use the getBoundingPoints() method, which requires one OdGePoint3dArray parameter to return the bounding points. The points are returned as follows:
For example:
OdGePoint3dArray pntArr;
pFcf->getBoundingPoints(pntArr);
odPrintConsoleString(L"\nPoint 0: (%g %g %g)", pntArr[0].x,pntArr[0].y, pntArr[0].z);
odPrintConsoleString(L"\nPoint 1: (%g %g %g)", pntArr[1].x,pntArr[1].y, pntArr[1].z);
odPrintConsoleString(L"\nPoint 2: (%g %g %g)", pntArr[2].x,pntArr[2].y, pntArr[2].z);
odPrintConsoleString(L"\nPoint 3: (%g %g %g)", pntArr[3].x,pntArr[3].y, pntArr[3].z);
Note: Bounding points are calculated automatically based on text size and scale value. You can't set these values.
To get the bounding polyline, use the getBoundingPline() method, which requires one OdGePoint3dArray parameter to return all the consecutive distinct corner points of the Fcf object. Used in order, these points can be used to define a polyline that overlays the border of the complete Fcf object. The points start with the top left corner of the Fcf object and run clockwise around the Fcf object's boundary, with the lower left corner as the last point. For example:
OdGePoint3dArray pntArr;
pFcf->getBoundingPline(pntArr);
odPrintConsoleString(L"\nPoint 0: (%g %g %g)", pntArr[0].x,pntArr[0].y, pntArr[0].z);
odPrintConsoleString(L"\nPoint 1: (%g %g %g)", pntArr[1].x,pntArr[1].y, pntArr[1].z);
odPrintConsoleString(L"\nPoint 2: (%g %g %g)", pntArr[2].x,pntArr[2].y, pntArr[2].z);
odPrintConsoleString(L"\nPoint 3: (%g %g %g)", pntArr[3].x,pntArr[3].y, pntArr[3].z);
Working with Feature Control Frames
Overview of Feature Control Frames
Example of Working with Feature Control Frames
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|