Skip to content

[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McDbTextCtyleTable

Class: McDbTextStyleTable ​

2d.McDbTextStyleTable

McDbTextCtyleTable is a text style table in the database used to manage all text style definitions in the current drawing.

Description

This class is used to maintain and access a collection of text styles, supporting the viewing, creation, and name retrieval of text styles. It can accomplish: -Obtain all text style record IDs; -Add new text styles; -Search for the specified style by name; -Determine whether the style exists; -Subsequently, obtain the McDbTextCtyleTableRecord through the object ID for parameter setting.

Usage:

  1. Retrieve the text style sheet 'MxCpp. getCurrentMxCAD()' from the database. getDB2(). getTextCtyleTable() ';
  2. Call getAllRecordId() to retrieve all styles;
  3. Use add()/get()/has() to manage styles;
  4. Use the selected style for text objects or annotation objects.

Summary: In practical development, McDbTextCtyleTable is mainly used for unified management of text styles and serves as the basic entry point for font, size, and layout control of text objects.

Example

ts
//Get all text styles
import { MxCpp, McDbTextStyleTable } from "mxcad"
//Retrieve the current CAD object
  let mxcad = MxCpp.getCurrentMxCAD();
//Retrieve database text style sheet
  let textSyleTable: McDbTextStyleTable = mxcad.getDatabase().getTextStyleTable();
//Retrieve all text style sheet record object IDs from the text style sheet
  let aryId = textSyleTable.getAllRecordId();
//Traverse the text style sheet to record objects
  aryId.forEach((id) => {
      let textSyleRec = id.getMcDbTextStyleTableRecord();
      if (textSyleRec === null) return;
      console.log(textSyleRec);
      console.log("textSyleRec.fileName:" + textSyleRec.fileName);
      console.log("textSyleRec.name:" + textSyleRec.name);
  });

Hierarchy ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new McDbTextStyleTable(imp?)

Constructor.

Parameters ​

NameTypeDescription
imp?AnyInternal implementation object

Overrides ​

McDbObject.constructor

Properties ​

imp ​

• imp: any = 0

Internal implementation object.

Inherited from ​

McDbObject.imp

Accessors ​

dxf0 ​

• get dxf0(): string

Obtain the type name of the object's DXF group code, which is the same as the DXF group code in AutoCAD. For example, the type name of the line is McDbLine, and the group code value for DXF0 is: LINE and DXF0 group code values can be used for type filtering when constructing sets.

Returns ​

string

Inherited from ​

McDbObject.dxf0


objectName ​

• get objectName(): string

Get the object name.

Returns ​

string

Return object name

Inherited from ​

McDbObject.objectName

Methods ​

add ​

▸ add(rec): McObjectId

Add text style records to the text style sheet.

Parameters ​

NameTypeDescription
'rec '['DcDbTextCtyleTableRecord'] (2d. McDbTextCtyleTableRecord. md)Text style sheet record object

Returns ​

McObjectId

Add a new text style record object ID.

Example

ts
import { MxCpp, McDbTextStyleTable } from "mxcad"

let mxcad = MxCpp.getCurrentMxCAD();
let textSyleTable: McDbTextStyleTable = mxcad.getDatabase().getTextStyleTable();

const newTextStyleRecord = new McDbTextStyleTableRecord();
const id = textSyleTable.add(newTextStyleRecord);
console.log(id)

assertObjectModification ​

▸ assertObjectModification(autoUndo?): number

Setting the state of the object to be changed can automatically trigger the update display function to update the display. For example, if the block table record is updated and the block reference needs to be notified to update the display, this function can be called.

Parameters ​

NameTypeDefault valueDescription
AutoUndobooleanfalseShould this modification automatically support undo? Default is false

Returns ​

number

Inherited from ​

McDbObject.assertObjectModification


clone ​

▸ clone(): null | McDbObject

Clone objects.

Returns ​

null | McDbObject

The cloned object.

Inherited from ​

McDbObject.clone


createExtensionDictionary ​

▸ createExtensionDictionary(): boolean

Create extended dictionary data for objects

Returns ​

boolean

Inherited from ​

McDbObject.createExtensionDictionary


erase ​

▸ erase(): boolean

Delete object.

Returns ​

boolean

Whether the deletion was successful.

Inherited from ​

McDbObject.erase


get ​

▸ get(sName, skipDeleted?): McObjectId

Search for text style records in the text style sheet.

Parameters ​

NameTypeDefault valueDescription
SNamestringundefinedText style name
SkipDeletedbooleantrueDo you want to skip deleted text styles

Returns ​

McObjectId

Text style records object ID.


getAllRecordId ​

▸ getAllRecordId(skipDeleted?): McObjectId[]

Retrieve the IDs of all text style records in the text style sheet.

Parameters ​

NameTypeDefault valueDescription
SkipDeletedbooleantrueDo you want to skip deleted text styles

Returns ​

McObjectId[]

Ret text style ID array.


getDatabase ​

▸ getDatabase(): McDbDatabase

Get the database where the object is located

Returns ​

McDbDatabase

Return to database

Inherited from ​

McDbObject.getDatabase


getDatabaseIndexId ​

▸ getDatabaseIndexId(): number

Get the index ID of the object

Returns ​

number

Inherited from ​

McDbObject.getDatabaseIndexId


getExtensionDictionary ​

▸ getExtensionDictionary(): McDbDictionary

Obtain the extended dictionary data of the object

Returns ​

McDbDictionary

Expand dictionary data

Inherited from ​

McDbObject.getExtensionDictionary


getGripEditBasePointsIndex ​

▸ getGripEditBasePointsIndex(): number[]

Retrieve the edit base point index corresponding to the grip of the object.

Returns ​

number[]

Inherited from ​

McDbObject.getGripEditBasePointsIndex


getGripPoints ​

▸ getGripPoints(): McGePoint3dArray

Get the grip array of the object

Returns ​

McGePoint3dArray

Inherited from ​

McDbObject.getGripPoints


getHandle ​

▸ getHandle(): string

Obtain object handle

Returns ​

string

Return object handle

Inherited from ​

McDbObject.getHandle


getImp ​

▸ getImp(): any

Retrieve internal implementation objects.

Returns ​

any

Internal implementation object.

Inherited from ​

McDbObject.getImp


getJson ​

▸ getJson(): string

Retrieve a string in JSON format.

Returns ​

string

A string in JSON format.

Inherited from ​

McDbObject.getJson


getObjectID ​

▸ getObjectID(): McObjectId

Get the object ID.

Returns ​

McObjectId

Object ID.

Inherited from ​

McDbObject.getObjectID


getOwnerID ​

▸ getOwnerID(): number

Obtain the ID of the object owner

Returns ​

number

Inherited from ​

McDbObject.getOwnerID


has ​

▸ has(sName, skipDeleted?): boolean

Check if there is a text style record with the specified name in the text style sheet.

Parameters ​

NameTypeDefault valueDescription
SNamestringundefinedText style name
SkipDeletedbooleantrueDo you want to skip deleted text styles

Returns ​

boolean

Boolean value.


initTempObject ​

▸ initTempObject(imp): void

Initialize temporary objects.

Parameters ​

NameTypeDescription
'imp''any'Internal implementation object

Returns ​

void

Inherited from ​

McDbObject.initTempObject


isErased ​

▸ isErased(): boolean

Has the object been deleted

Returns ​

boolean

Inherited from ​

McDbObject.isErased


isHaveExtensionDictionary ​

▸ isHaveExtensionDictionary(): boolean

Is there any extended dictionary data available

Returns ​

boolean

Inherited from ​

McDbObject.isHaveExtensionDictionary


isKindOf ​

▸ isKindOf(sObjectName): boolean

Determine object type

Parameters ​

NameTypeDescription
SOrtNamestringType Name

Returns ​

boolean

Return whether the object is of the target type

Inherited from ​

McDbObject.isKindOf


isNull ​

▸ isNull(): any

Determine if it is an empty object

Returns ​

any

Inherited from ​

McDbObject.isNull


moveGripPointsAt ​

▸ moveGripPointsAt(iIndex, dXOffset, dYOffset, dZOffset): any

Grips for moving objects

Parameters ​

NameTypeDescription
IIndexNumberIndex
DXOffsetnumberX-axis offset
DYOffsetnumberY-axis offset
DZOffsetnumberZ-axis offset

Returns ​

any

Inherited from ​

McDbObject.moveGripPointsAt


setJson ​

▸ setJson(str): boolean

Set a string in JSON format.

Parameters ​

NameTypeDescription
StrstringJSON formatted string

Returns ​

boolean

Is the setting successful.

Inherited from ​

McDbObject.setJson


unErase ​

▸ unErase(): boolean

Anti delete object.

Returns ​

boolean

Inherited from ​

McDbObject.unErase