Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Example of Working with the Single-Line Text Object

This example demonstrates working with the single-line text object for displaying and modifying its properties. This example uses a console menu that represents the following operations: getting and setting the text content [L], position [C], normal [N], thickness [T], oblique angle [O], rotation angle [R], width scale factor [W], height scale factor [F], vertical alignment mode [V], horizontal alignment mode [H], alignment point [A], switching the mirror in OCS X-direction [X] and Y-direction [Y], obtaining and associating with a text style [S], binding to a .shx file [B], getting bounding points [Z], recalculating the text geometry [J], displaying the object properties, general properties, and specific properties [P], and modifying the general entity properties [M].

The example uses the following header files, examples, and functions implemented in them:


#include "..\Common\DemoMain.h"
#include "DbText.h"
#include <iostream>
using namespace std;

// Example of Entering and Displaying for Text Alignment Mode
bool EntryTextVerticalMode(OdInt16& refMode);
OdString AboutTextVerticalMode(OdDb::TextVertMode mode);

bool EntryTextHorizontalMode(OdInt16& refMode);
OdString AboutTextHorizontalMode(OdDb::TextHorzMode mode);

// Example of Entering and Displaying 3D Point Objects
bool EntryPoint3d(OdGePoint3d& point);
OdString AboutPoint3d(const OdGePoint3d& point);

// Example of Entering and Displaying 3D Vector Objects
bool EntryVector3d(OdGeVector3d& vector);
OdString AboutVector3d(const OdGeVector3d& vector);

// Example of Binding to a Shape File
OdDbObjectId BindToSHXFile(OdDbDatabase* pDb, OdString shxFileName, bool bStatus);

// Example of Entering Characters for String Objects
OdString EntryTextAs(enum enumCheckText = kArbitrary);

// Example of Using the Record–Table and Dictionary Interfaces for Getting Information about Objects
OdString AboutDbObject(OdDbObjectId idObject);

// Example of Using the Record–Table Interface for Selecting Objects
OdDbObjectId EntryTableRecordObject(OdDbObjectId idTable, OdDbObjectId idRecord = OdDbObjectId::kNull);

OdString AboutEntityPlane(OdDbEntity* pEntity);
void PrintEntityProperties(OdDbEntity* pEntity);
void ModifyEntityProperties(OdDbEntity* pEntity);

The PrintTextBoundingPoints() function requires a pointer to an existing single-line text object and displays its bounding points.The function uses the getBoundingPoints()method which passes coordinates of four bounding points through an argument as an array, and then the function converts each obtained bounding point to a string value using the AboutPoint3d() function.

The PrintTextBoundingPoints() function has the following implementation:


void PrintTextBoundingPoints(OdDbText* pSText)
{
  OdGePoint3dArray points;

  pSText->getBoundingPoints(points);

  wcout << L"\n  Bounding points:"
        << L"\n  Top Left = " << AboutPoint3d(points[0])
        << L"\n  Top Right = " << AboutPoint3d(points[1])
        << L"\n  Bottom Right = " << AboutPoint3d(points[2])
        << L"\n  Bottom Left = " << AboutPoint3d(points[3]);
}

The PrintTextProperties() function requires a pointer to an existing single-line text object and displays its properties.The function gets the specific properties using the textString(), position(), normal(), thickness(), oblique(), rotation(), widthFactor(), height(), isMirroredInX(), isMirroredInY(), verticalMode(), horizontalMode(), alignmentPoint(), isDefaultAlignment(), and textStyle() methods. The function uses the AboutPoint3d() function for converting the position coordinates to a string value and the AboutVector3d() function for converting the coordinates of the normal to a string value. The AboutPoint3d() and AboutVector3d() functions require an instance of the three-dimensional point or three-dimensional vector to be converted as an argument and return a string containing the X,Y,Z coordinates. The single-line text is a planar entity, and the function gets and displays the coefficients of the plane using the AboutEntityPlane() function. To display the text bounding box, the function uses the PrintTextBoundingPoints() function.

The PrintTextProperties() function has the following implementation:


void PrintTextProperties(OdDbText* pSText)
{
  wcout << L"\n  String = \"" << pSText->textString() << L"\""
        << L"\n  Normal = " << AboutVector3d(pSText->normal())
        << L"\n  Position = " << AboutPoint3d(pSText->position())
        << L"\n  Thickness = " << pSText->thickness()
        << L"\n  Oblique angle = " << pSText->oblique() << L" radians"
        << L"\n  Rotation angle = " << pSText->rotation() << L" radians"
        << L"\n  Width scale factor = " << pSText->widthFactor() 
        << L"\n  Height scale factor = " << pSText->height()
        << L"\n  Alignment = " << ((pSText->isDefaultAlignment()) ? L"Default" : L"Custom")
        << L"\n  Mirror in X = " << ((pSText->isMirroredInX()) ? L"On" : L"Off")
        << L"\n  Mirror in Y = " << ((pSText->isMirroredInY()) ? L"On" : L"Off")
        << L"\n  Vertical mode = " << AboutTextVerticalMode(pSText->verticalMode())
        << L"\n  Horizontal mode = " << AboutTextHorizontalMode(pSText->horizontalMode())
        << L"\n  Alignment point = " << AboutPoint3d(pSText->alignmentPoint())
        << L"\n  Associated Style = " << AboutDbObject(pSText->textStyle())
        << L"\n  " << AboutEntityPlane(pSText);

  PrintTextBoundingPoints(pSText);        
}

The ModifyTextProperties() function requires a pointer to an existing single-line text object and implements the console menu for the listed operations. The function organizes a loop that inquires about the operation code and uses the switch statement to select whether the case must be performed. The function processes user actions in the loop until the user selects the [Q] operation. The function uses EntryPoint3d() function for entering coordinates of a three-dimensional point and the EntryVector3d() function for entering coordinates of a three-dimensional vector. The EntryPoint3d() and EntryVector3d() functions require a reference to an instance of the three-dimensional point or three-dimensional vector to be modified as an argument and return True when the passed instance is modified successfully, or False when the user cancels entry.

When the user selects [P], the function displays the common object properties using the PrintObjectProperties() function, general entity properties using the PrintEntityProperties() function, and specific single-line text properties using the PrintTextProperties() function. When the user selects the [p] operation, the function displays only specific single-line text properties.

When the user selects [L], the function gets the current text content using the textString() method and requests an arbitrary string which is new content for the single-line text entity using the EntryTextAs() function. The EntryTextAs() organizes the entry of the string and returns the entered value as the OdString instance. After entry, the function sets the obtained string as the new text content using the setTextString() method.

When the user selects [C], the function gets the position of the single-line text using the position() method, calls the EntryPoint3d() function for entry of its coordinates, and sets the returned point as the new position using the setPosition() method if entry is successful.

When the user selects [N], the function gets the normal to the plane of the single-line text using the normal() method, calls the EntryVector3d() function for entry of its coordinates, and sets the returned vector as the new normal using the setNormal() method if entry is successful.

When the user selects [T], the function gets the current thickness using the thickness() method and requests a double value. If an entered value is incorrect, the function displays an error message and breaks to the console menu. If an entered value is correct, the function sets the new thickness using the setThickness() method.

When the user selects [O], the function gets the current oblique angle using the oblique() method and requests a double value in the range ±2PI. If an entered value is incorrect, the function displays an error message and breaks to the console menu. If an entered value is correct, the function sets the new oblique angle using the setOblique() method.

When the user selects [R], the function gets the current rotation angle using the rotation() method and requests a double value in the range ±2PI. If an entered value is incorrect, the function displays an error message and breaks to the console menu. If an entered value is correct, the function sets the new rotation angle using the setRotation() method.

When the user selects [W], the function gets the current width scale factor using the widthFactor() method and requests a positive non-zero double value. If an entered value is incorrect or is negative, the function displays an error message and breaks to the console menu. If an entered value is correct, the function sets the new width scale factor using the setWidthFactor() method.

When the user selects [F], the function gets the current height scale factor using the height() method and requests a positive non-zero double value. If an entered value is incorrect or is negative, the function displays an error message and breaks to the console menu. If an entered value is correct, the function sets the new height scale factor using the setHeight() method.

When the user selects [V], the function gets the current vertical text alignment mode using the verticalMode() method and displays its number. Then, the function calls the EntryTextVerticalMode() function for selecting a new mode. The EntryTextVerticalMode() function organizes a loop and requests the vertical mode number. If the user selects a mode, this function returns True and the ModifyTextProperties() function sets new mode using the setVerticalMode() method and displays information about it using the AboutTextVerticalMode() function, passing to it the mode number.

When the user selects [H], the function gets the current horizontal text alignment mode using the horizontalMode() method and displays its number. Then, the function calls the EntryTextHorizontalMode() function for selecting a new mode. The EntryTextHorizontalMode() function organizes a loop and requests the horizontal mode number. If the user selects a mode, this function returns True and the ModifyTextProperties() function sets new mode using the setHorizontalMode() method and displays information about it using the AboutTextHorizontalMode() function, passing to it the mode number.

When the user selects [A], the function gets the alignment point of the single-line text using the alignmentPoint() method, calls the EntryPoint3d() function for entry of its coordinates, and sets the returned point as the new alignment point using the setAlignmentPoint() method if entry is successful.

When the user selects [X], the function requests the new mirror in the X-axis and prompts: N-on or F-off. The function calls the mirrorInX() method and passes to it a True value if the user enters 'N' or a False value if the user enters 'F'. After setting, the function checks and displays the current mirror in the X-axis using the isMirroredInX() method.

When the user selects [Y], the function requests the new mirror in the Y-axis and prompts: N-on or F-off. The function calls the mirrorInY() method and passes to it a True value if the user enters 'N' or a False value if the user enters 'F'. After setting, the function checks and displays the current mirror in the Y-axis using the isMirroredInY() method.

When the user selects [S], the function gets the object ID of the current text style assigned for the single-line text entity using the textStyle() method and calls the EntryTableRecordObject() function for selecting another text style. The EntryTableRecordObject() function requires the object ID of the text style table object and the text style record object as arguments, and returns the object ID of the text style record object specified by the user or the same object ID if the user cancels entry. To get the text style table, the function uses the getTextStyleTableId() method of the database object and the database() method of the single-line text object. The EntryTableRecordObject() function organizes its own console menu for selecting the named record object (text style). After selection, the ModifyTextProperties() function checks whether the ID is not kNull, and then, it calls the setTextStyle() method and passes to it the returned object ID to associate the text with the text style.

When the user selects [B], the function request the name of the .shx file using the EntryFileName() function. The EntryFileName() function gets the kMustExist value as the first argument because the .shx file must exist to be associated and gets a False value as the second argument to specify any filename. The EntryFileName() function checks the entered file name and returns the name entered by the user or an empty string if the user cancels entry. If the name is correct, the function calls the BindToSHXFile() function and passes to it the current database as the first argument using the database() method, the obtained file name as the second argument, and False as the third argument which determines whether the file is a font file. The BindToSHXFile() function checks whether the text style already exists for the specified .shx file or creates a new text style and associates it with the specified .shx file. The BindToSHXFile() function returns the object ID to the text style record object which is associated with the .shx file or OdDb::kNull if errors occur. If binding is successful, the function sets the returned ID for the text entity using the setTextStyle() method and displays the result using the textStyle() method and AboutDbObject() function which displays information about the text style.

When the user selects [Z], the function displays the text bounding points using the PrintTextBoundingPoints() function.

When the user selects [J], the function recalculates the text geometry using the adjustAlignment() method. Then, the function displays the position point, alignment point, width scale factor, height scale factor, rotation angle which can be modified, and goes to the [Z] operation for getting and displaying the text bounding points.

When the user selects [M], the function calls the ModifyEntityProperties() function and passes to it the pointer to the text object for modifying its general entity properties. After modification, the function displays all of the text properties using the [P] operation.

When the user selects [Q], the function ends the loop and returns to the calling function.

The ModifyTextProperties() function has the following implementation:


void ModifyTextProperties(OdDbText* pSText)
{
  wchar_t ch = L'\0';
  double value;
  OdInt16 mode;
  OdString name;
  OdGePoint3d point;
  OdGeVector3d vector;
  OdDbObjectId idStyle;

  wcout << L"\n\nStart modifying of the single-line text properties";

  do {
    switch(ch)
    {
      case L'M':          // Modify the general properties
      case L'm':
        ModifyEntityProperties(pSText);


      case L'P':          // Print the whole properties
        wcout << L"\nH=" << pSText->handle().ascii();
        wcout << L"\n  ------ Common Object Properties";
        PrintObjectProperties(pSText);
        wcout << L"\n  ------ General Entity Properties";
        PrintEntityProperties(pSText);


      case L'p':          // Print the specific properties
        wcout << L"\n  ------ Specific Single-Line Text Properties";
        PrintTextProperties(pSText);
        wcout << L"\n";        
        break;


      case L'L':          // Set the text content
      case L'l':
        wcout << L"\nString \"" << pSText->textString() << L"\"\nString:>";

        if((name = EntryTextAs(kArbitrary)).isEmpty()) break;

        pSText->setTextString(name);
        break;


      case L'N':          // Set the normal
      case L'n':
        wcout << L"Entry the normal";
        vector = pSText->normal();

        if(EntryVector3d(vector))
        {
          pSText->setNormal(vector);
          wcout << L"Normal is set to " << AboutVector3d(pSText->normal()) << L"\n";
        }
        break;


      case L'C':          // Set the position
      case L'c':
        wcout << L"Entry the position";
        point = pSText->position();

        if(EntryPoint3d(point))
        {
          pSText->setPosition(point);
          wcout << L"Position is set to " << AboutPoint3d(pSText->position()) << L"\n";
        }
        break;


      case L'A':          // Set the alignment point
      case L'a':
        wcout << L"Entry the alignment point";
        point = pSText->alignmentPoint();

        if(EntryPoint3d(point))
        {
          pSText->setAlignmentPoint(point);
          wcout << L"Alignment point is set to " << AboutPoint3d(pSText->alignmentPoint()) << L"\n";
        }
        break;


      case L'T':          // Set the thickness
      case L't':
        wcout << L"\nCurrent thickness = " << pSText->thickness()
              << L"\nEntry a new thickness [t>0-along normal|t<0-opposite normal]:>";
        wcin >> value;

        if(!wcin.fail() && wcin.peek() == 10)
        {
          pSText->setThickness(value);
          wcout << L"Thickness is set to: " << pSText->thickness() << L"\n";
        }
        else { wcin.clear();  wcin.sync();  wcout << L"Error: Invalid entered value\n"; }
        break;


      case L'O':          // Set the oblique angle
      case L'o':
        wcout << L"\nCurrent oblique angle = " << pSText->oblique()
              << L"\nEntry a new angle [-2PI...2PI]:>";
        wcin >> value;

        if(!wcin.fail() && wcin.peek() == 10)
        {
          pSText->setOblique(value);
          wcout << L"Oblique angle is set to: " << pSText->oblique() << L" radians\n";
        }
        else { wcin.clear();  wcin.sync();  wcout << L"Error: Invalid entered value\n"; }
        break;


      case L'R':          // Set the rotation angle
      case L'r':
        wcout << L"\nCurrent rotation angle = " << pSText->rotation()
              << L"\nEntry a new angle [-2PI...2PI]:>";
        wcin >> value;

        if(!wcin.fail() && wcin.peek() == 10)
        {
          pSText->setRotation(value);
          wcout << L"Rotation angle is set to: " << pSText->rotation() << L" radians\n";
        }
        else { wcin.clear();  wcin.sync();  wcout << L"Error: Invalid entered value\n"; }
        break;


      case L'W':          // Set the width scale factor
      case L'w':
        wcout << L"\nCurrent width scale factor = " << pSText->widthFactor()
              << L"\nEntry a new factor [f > 0]:>";
        wcin >> value;

        if(!wcin.fail() && wcin.peek() == 10)
        {
          if(value > 0)
          {
            pSText->setWidthFactor(value);
            wcout << L"Width scale factor is set to: " << pSText->widthFactor() << L"\n";
          }
          else wcout << L"Error: Width scale factor must be a positive non-zero double value\n";
        }
        else { wcin.clear();  wcin.sync();  wcout << L"Error: Invalid entered value\n"; }
        break;


      case L'F':          // Set the height scale factor
      case L'f':
        wcout << L"\nCurrent height scale factor = " << pSText->height()
              << L"\nEntry a new factor [f > 0]:>";
        wcin >> value;

        if(!wcin.fail() && wcin.peek() == 10)
        {
          if(value > 0)
          {
            pSText->setHeight(value);
            wcout << L"Height scale factor is set to: " << pSText->height() << L"\n";
          }
          else wcout << L"Error: Height scale factor must be a positive non-zero double value\n";
        }
        else { wcin.clear();  wcin.sync();  wcout << L"Error: Invalid entered value\n"; }
        break;


      case L'S':          // Set the text style
      case L's':
        idStyle = EntryTableRecordObject(pSText->database()->getTextStyleTableId(), pSText->textStyle());

        if(!idStyle.isNull())
        {
          pSText->setTextStyle(idStyle);
          wcout << L"Style is set to: " << AboutDbObject(pSText->textStyle()) << L"\n";
        }
        else wcout << L"Entry is canceled\n";
        break;


      case L'B':          // Bind to the .shx file
      case L'b':
        wcout << L"\nEntry a .shx file name:>";
        if((name = EntryFileName(kMustExist, false)).isEmpty()) break; //kDontCheck

        if((idStyle = BindToSHXFile(pSText->database(), name, false)).isNull()) break;

        pSText->setTextStyle(idStyle);
        wcout << L"Text is bound to: " << AboutDbObject(pSText->textStyle()) 
              << L" associated with .shx file\n";
        break;


      case L'V':          // Set the vertical mode
      case L'v':
        wcout << L"\nCurrent vertical mode = " << (mode = pSText->verticalMode());

        if(EntryTextVerticalMode(mode))
        {
          pSText->setVerticalMode((OdDb::TextVertMode) mode);
          wcout << L"Vertical mode is set to: " << AboutTextVerticalMode(pSText->verticalMode()) << L"\n";
        }
        break;


      case L'H':          // Set the horizontal mode
      case L'h':
        wcout << L"\nCurrent horizontal mode = " << (mode = pSText->horizontalMode());

        if(EntryTextHorizontalMode(mode))
        {
          pSText->setHorizontalMode((OdDb::TextHorzMode) mode);
          wcout << L"Horizontal mode is set to: " << AboutTextHorizontalMode(pSText->horizontalMode()) << L"\n";
        }
        break;


      case L'X':          // Switch the mirror in X
      case L'x':
        wcout << "\nSwitch the mirror in X-axis [N-on|F-off]:>";
        wcin >> ch;

        if(ch == L'N' || ch == L'n') pSText->mirrorInX(true);
        else if(ch == L'F' || ch == L'f') pSText->mirrorInX(false);

        wcout << L"X-mirror is set to: " << ((pSText->isMirroredInX()) ? L"On" : L"Off") << L"\n";
        break;


      case L'Y':          // Switch the mirror in Y
      case L'y':
        wcout << "\nSwitch the mirror in Y-axis [N-on|F-off]:>";
        wcin >> ch;

        if(ch == L'N' || ch == L'n') pSText->mirrorInY(true);
        else if(ch == L'F' || ch == L'f') pSText->mirrorInY(false);

        wcout << L"Y-mirror is set to: " << ((pSText->isMirroredInY()) ? L"On" : L"Off") << L"\n";
        break;


      case L'J':          // Recalculate the text geometry
      case L'j':
        pSText->adjustAlignment();

        wcout << L"\n  Position point = " << AboutPoint3d(pSText->position())
              << L"\n  Alignment point = " << AboutPoint3d(pSText->alignmentPoint())
              << L"\n  Rotation angle = " << pSText->rotation() << L" radians"
              << L"\n  Width scale factor = " << pSText->widthFactor() 
              << L"\n  Height scale factor = " << pSText->height();


      case L'Z':          // Print the bounding points
      case L'z':
        PrintTextBoundingPoints(pSText);
        break;


      case L'\0':         // Skip an action
        break;

      default:
        wcout << L"Error: Incorrect operation\n";
    }
    wcout << L"\nN. Set the normal";
    wcout << L"\nC. Set the position";
    wcout << L"\nT. Set the thickness";
    wcout << L"\nS. Set the text style";
    wcout << L"\nL. Set the text content";
    wcout << L"\nB. Bind to the .shx file";
    wcout << L"\nO. Set the oblique angle";
    wcout << L"\nR. Set the rotation angle";
    wcout << L"\nX. Switch the mirror in X";
    wcout << L"\nY. Switch the mirror in Y";
    wcout << L"\nV. Set the vertical mode";
    wcout << L"\nH. Set the horizontal mode";
    wcout << L"\nA. Set the alignment point";
    wcout << L"\nW. Set the width scale factor";
    wcout << L"\nF. Set the height scale factor";
    wcout << L"\nJ. Recalculate the text geometry";
    wcout << L"\nZ. Print the bounding points";
    wcout << L"\nP. Print the whole properties";
    wcout << L"\np. Print the specific properties";
    wcout << L"\nM. Modify the general properties";
    wcout << L"\nQ. Quit";
    wcout << L"\nSelect operation:>";
    wcin >> ch;
  }
  while(ch != L'Q' && ch != L'q');

  wcout << L"Stop modifying of the single-line text properties\n";
}

Testing gives the following results:


Start modifying of the single-line text properties

N. Set the normal
C. Set the position
T. Set the thickness
S. Set the text style
L. Set the text content
B. Bind to the .shx file
O. Set the oblique angle
R. Set the rotation angle
X. Switch the mirror in X
Y. Switch the mirror in Y
V. Set the vertical mode
H. Set the horizontal mode
A. Set the alignment point
W. Set the width scale factor
F. Set the height scale factor
J. Recalculate the text geometry
Z. Print the bounding points
P. Print the whole properties
p. Print the specific properties
M. Modify the general properties
Q. Quit
Select operation:>

When the operation is p-"Print the specific properties":


------ Specific Single-Line Text Properties
String = ""
Normal = (0,0,1)
Position = (0,0,0)
Thickness = 0
Oblique angle = 0 radians
Rotation angle = 0 radians
Width scale factor = 1
Height scale factor = 1
Alignment = Default
Mirror in X = Off
Mirror in Y = Off
Vertical mode = [0-Base]
Horizontal mode = [0-Left]
Alignment point = (0,0,0)
Associated Style = [11-"Standard"-TextStyle]
Entity Plane = (0 * X + 0 * Y + 1 * Z + 0)
Bounding points:
Top Left = (0,0,0)
Top Right = (0,0,0)
Bottom Right = (0,0,0)
Bottom Left = (0,0,0)

When the operation is L-"Set the text content":


String ""
String:>Single text

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (0.152,1,0)
Top Right = (9.674,1,0)
Bottom Right = (0.152,-0.344,0)
Bottom Left = (9.674,-0.344,0)

When the operation is W-"Set the width scale factor":


Current width scale factor = 1
Entry a new factor [f > 0]:>0.75
Width scale factor is set to: 0.75

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (0.114,1.011,0)
Top Right = (7.2555,1.011,0)
Bottom Right = (0.114,-0.344,0)
Bottom Left = (7.2555,-0.344,0)

When the operation is F-"Set the height scale factor":


Current height scale factor = 1
Entry a new factor [f > 0]:>2.0
Height scale factor is set to: 2.0

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (0.228,2.022,0)
Top Right = (14.511,2.022,0)
Bottom Right = (0.228,-0.688,0)
Bottom Left = (14.511,-0.688,0)

When the operation is O-"Set the oblique angle":


Current oblique angle = 0
Entry a new angle [-2PI...2PI]:>0.202
Oblique angle is set to: 0.202 radians

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (0.223904,2.022,0)
Top Right = (14.9206,2.022,0)
Bottom Right = (0.223904,-0.688,0)
Bottom Left = (14.9206,-0.688,0)

When the operation is R-"Set the rotation angle":


Current rotation angle = 0
Entry a new angle [-2PI...2PI]:>0.707
Rotation angle is set to: 0.707 radians

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (-1.14316,1.68279,0)
Top Right = (10.0309,11.2291,0)
Bottom Right = (0.617132,-0.377658,0)
Bottom Left = (11.7912,9.16866,0)

When the operation is C-"Set the position":


Entry the position
Current coordinates: (0,0,0)
Entry X-coordinate:>1.1
Entry Y-coordinate:>0.8
Entry Z-coordinate:>0.2
Position is set to (1.1,0.8,0.2)

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (-0.0431643,2.48279,0.2)
Top Right = (11.1309,12.0291,0.2)
Bottom Right = (1.71713,0.422342,0.2)
Bottom Left = (12.8912,9.96866,0.2)

When the operation is H-"Set the horizontal mode":


Current horizontal mode = 0
0. Text Left
1. Text Center
2. Text Right
3. Text Align
4. Text Middle
5. Text Fit
6. Quit
Entry the horizontal mode:>2
Horizontal mode is set to: [2-Right]

When the operation is V-"Set the vertical mode":


Current vertical mode = 0
0. Text Base
1. Text Bottom
2. Text Middle
3. Text Top
4. Quit
Entry the vertical mode:>1
Vertical mode is set to: [1-Bottom]

When the operation is J-"Recalculate the text geometry":


Position point = (-11.8862,-8.79405,0.2)
Alignment point = (0,0,0.2)
Rotation angle = 0.707 radians
Width scale factor = 0.75
Height scale factor = 2
Bounding points:
Top Left = (-13.0294,-7.11126,0.2)
Top Right = (-1.85531,2.43506,0.2)
Bottom Right = (-11.2691,-9.17171,0.2)
Bottom Left = (-0.095015,0.374606,0.2)

When the operation is A-"Set the alignment point":


Entry the alignment point
Current coordinates: (0,0,0.2)
Entry X-coordinate:>4.5
Entry Y-coordinate:>3.5
Entry Z-coordinate:>0.8
Alignment point is set to (4.5,3.5,0.8)

When the operation is H-"Set the horizontal mode":


Current horizontal mode = 2
0. Text Left
1. Text Center
2. Text Right
3. Text Align
4. Text Middle
5. Text Fit
6. Quit
Entry the horizontal mode:>3
Horizontal mode is set to: [3-Align]

When the operation is J-"Recalculate the text geometry":


Position point = (-11.8862,-8.79405,0.8)
Alignment point = (4.5,3.5,0.8)
Rotation angle = 0.643672 radians
Width scale factor = 1
Height scale factor = 2.08333
Bounding points:
Top Left = (-12.9004,-6.92178,0.8)
Top Right = (3.31227,5.24204,0.8)
Bottom Right = (-11.2063,-9.17983,0.8)
Bottom Left = (5.00641,2.98399,0.8)

When the operation is T-"Set the thickness":


Current thickness = 0
Entry a new thickness [t>0-along normal|t<0-opposite normal]:>1.8
Thickness is set to: 1.8

When the operation is X-"Switch the mirror in X":


Switch the mirror in X-axis [N-on|F-off]:>N
X-mirror is set to: On

When the operation is Y-"Switch the mirror in Y":


Switch the mirror in Y-axis [N-on|F-off]:>N
Y-mirror is set to: On

When the operation is Z-"Print the bounding points":


Bounding points:
Top Left = (-10.8721,-10.6663,0.8)
Top Right = (-27.0848,-22.8301,0.8)
Bottom Right = (-12.5662,-8.40827,0.8)
Bottom Left = (-28.7789,-20.5721,0.8)

When the operation is B-"Bind to the .shx file":


Entry a .shx file name:>Times.shx
Text is bound to: [41-"Times"-TextStyle] associated with .shx file

When the operation is N-"Set the normal":


Entry the normal
Current directions: (0,0,1)
Entry X-direction:>0.4
Entry Y-direction:>0.5
Entry Z-direction:>0.3
Normal is set to (0.565685,0.707107,0.424264)

When the operation is p-"Print the specific properties":


------ Specific Single-Line Text Properties
String = "Single text"
Normal = (0.565685,0.707107,0.424264)
Position = (12.0649,-3.94617,-7.62394)
Thickness = 1.8
Oblique angle = 0.202 radians
Rotation angle = 0.643672 radians
Width scale factor = 1
Height scale factor = 2.08333
Alignment = Custom
Mirror in X = On
Mirror in Y = On
Vertical mode = [1-Bottom]
Horizontal mode = [3-Align]
Alignment point = (-3.98899,2.21728,3.5088)
Associated Style = [41-"Times"-TextStyle]
Entity Plane = (0.565685 * X + 0.707107 * Y + 0.424264 * Z + -0.8)
Bounding points:
Top Left = (11.5955,-2.63808,-9.17822)
Top Right = (21.0671,-6.27446,-15.7464)
Bottom Right = (12.1346,-3.98232,-7.65661)
Bottom Left = (21.6062,-7.6187,-14.2248)

When the operation is L-"Set the text content":


String "Single text"
String:>Single-line text

When the operation is S-"Set the text style":


Select the TextStyle object:
11-"Standard"
21-"Complex"
41-"Times"
Current: [41-"times"-TextStyle]
Entry the name to be selected (or [?]-null/[:]-quit):>Complex
Style is set to: [21-"Complex"-TextStyle]

When the operation is P-"Print all properties":


H=40
  ------ Common Object Properties
  Type: AcDbText
  Status: unerased,resident,modified,forRead,forWrite
  Database: c:\test.dwg
  ------ General Entity Properties
  Block: [1F-"*Model_Space"-Block]
  Layer: [10-"0"-Layer]
  Material: [3C-"ByLayer"-Material]
  Linetype: [15-"ByLayer"-Linetype]
  Lineweight: [kLnWtByLayer]
  Transparency: [byLayer]
  Visual style: [Db:kNull]
  PlotStyleName: ByLayer
  Linetype scale: 1
  Color: [byLayer], Index = 256
  State: Planar, Visible, Cast Shadows, Receive Shadows
  ------ Specific Single-Line Text Properties
  String = "Single-line text"
  Normal = (0.565685,0.707107,0.424264)
  Position = (12.0649,-3.94617,-7.62394)
  Thickness = 1.8
  Oblique angle = 0.202 radians
  Rotation angle = 0.643672 radians
  Width scale factor = 1.0
  Height scale factor = 2.08333
  Alignment = Custom
  Mirror in X = On
  Mirror in Y = On
  Vertical mode = [1-Bottom]
  Horizontal mode = [3-Align]
  Alignment point = (-3.98899,2.21728,3.5088)
  Associated Style = [21-"complex"-TextStyle]
  Entity Plane = (0.565685 * X + 0.707107 * Y + 0.424264 * Z + -0.8)
  Bounding points:
  Top Left = (11.5302,-2.61303,-9.13298)
  Top Right = (33.4001,-11.0094,-24.2988)
  Bottom Right = (12.2431,-4.39055,-7.12093)
  Bottom Left = (34.1129,-12.7869,-22.2868)

Use the Q-"Quit" operation to exit:


Stop modifying of the single-line text properties

See Also

Working with Single-Line Text

Single-Line Text Special Codes

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