Skip to content
On this page

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

Class: McDbTextStyleTableRecord

2d.McDbTextStyleTableRecord

Represents a text style sheet that records objects and implements attribute related operation functions for text.

Example

ts
//Add Text Style
   import { McCmColor, MxCpp, McDbTextStyleTableRecord, McDb } from "mxcad"

   const mxcad = MxCpp.getCurrentMxCAD();
//Get the current text style sheet
   const textSyleTable = mxcad.getDatabase().getTextStyleTable();
//Construct a text style sheet to record objects
   let newTextStyleRecord = new McDbTextStyleTableRecord();
//Set object file name
   newTextStyleRecord.fileName = "txt.shx";
//Set the large font name for the object
   newTextStyleRecord.bigFontFileName = "hztxt.shx";
//Set object text size
   newTextStyleRecord.textSize = 10;
//Set object name
   newTextStyleRecord.name = sMyTextStyle;
//Set object width factor
   newTextStyleRecord.xScale = 0.7;
//Add Text Style
   const res = textSyleTable.add(newTextStyleRecord).isValid()
   if (res) {
     console.log("add ok");
   }

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbTextStyleTableRecord(imp?)

Constructor.

Parameters

NameTypeDescription
imp?AnyInternal implementation object

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();

Overrides

McDbObject.constructor

Properties

imp

imp: any = 0

Internal implementation object.

Inherited from

McDbObject.imp

Accessors

bigFontFileName

get bigFontFileName(): string

Large font file name

Returns

string

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
NewTextCtyleRecord. bigFontFileName="Test";
Console.log ("Large font name: ",newTextStyleRecord.bigFontFileName)

set bigFontFileName(val): void

Parameters

NameType
valstring

Returns

void


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


fileName

get fileName(): string

Font file name

Returns

string

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
NewTextCtyleRecord. FileName="Test Font Name";
Console.log (current font file name: ",newTextStyleRecord.fileName)

set fileName(val): void

Parameters

NameType
valstring

Returns

void


flagBits

get flagBits(): number

Get or set a set of flags for a text style sheet record

Returns

number

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
//Get the current value of the flag bit
const currentFlagBits = newTextStyleRecord.flagBits;
Console.log (current flag: ", currentFlagBits);
//Set a new flag value
const newFlagBits = 0b101010; //  For example, using binary literals to represent new flag values
newTextStyleRecord.flagBits = newFlagBits;
Console.log ("flag set: ", newTextStyleRecord.flagBits);

set flagBits(val): void

Parameters

NameType
valnumber

Returns

void


isShapeFile

get isShapeFile(): boolean

Get or set whether to use shape fonts for text styles

Returns

boolean

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
newTextStyleRecord.isShapeFile = false;
console.log(newTextStyleRecord.isShapeFile) // false

set isShapeFile(val): void

Parameters

NameType
valboolean

Returns

void


isVertical

get isVertical(): boolean

Get or set whether to use italics for text style

Returns

boolean

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
newTextStyleRecord.isVertical = false;
console.log(newTextStyleRecord.isVertical) // false

set isVertical(val): void

Parameters

NameType
valboolean

Returns

void


name

get name(): string

Get or set the name of the text style.

Returns

string

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
NewTextCtyleRecord. name="Test Text Style"
Console. log (newTextCtyleRecord. name)//Test text style

set name(val): void

Parameters

NameType
valstring

Returns

void


objectName

get objectName(): string

Get the object name.

Returns

string

Return object name

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.objectName);

Inherited from

McDbObject.objectName


obliquingAngle

get obliquingAngle(): number

Tilt angle

Returns

number

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
newTextStyleRecord.obliquingAngle = Math.PI/4;
console.log(newTextStyleRecord.obliquingAngle) // 45

set obliquingAngle(val): void

Parameters

NameType
valnumber

Returns

void


textSize

get textSize(): number

Text size (height)

Returns

number

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
newTextStyleRecord.textSize = 20;
console.log(newTextStyleRecord.textSize) // 20

set textSize(val): void

Parameters

NameType
valnumber

Returns

void


xScale

get xScale(): number

Returns

number

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
newTextStyleRecord.xScale = 0.8;
console.log(newTextStyleRecord.xScale) // 0.8

set xScale(val): void

Parameters

NameType
valnumber

Returns

void

Methods

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 value
autoUndobooleanfalse

Returns

number

Example

ts
//Assuming obj is a database object
obj.assertObjectModification()

Inherited from

McDbObject.assertObjectModification


clone

clone(): null | McDbObject

Clone objects.

Returns

null | McDbObject

The cloned object.

Example

ts
//Assuming obj is a database object
const obj_clone = obj.clone();

Inherited from

McDbObject.clone


createExtensionDictionary

createExtensionDictionary(): boolean

Create extended dictionary data for objects

Returns

boolean

Example

ts
//Assuming obj is a database object
const res = obj.createExtensionDictionary();

Inherited from

McDbObject.createExtensionDictionary


erase

erase(): boolean

Delete object.

Returns

boolean

Whether the deletion was successful.

Example

ts
//Assuming obj is a database object
const res = obj.erase();
console.log(res);

Inherited from

McDbObject.erase


font

font(): Object

Get font style

Returns

Object

sTypeface: Font Name | bold: bold or not | italic: italic or not | charset: character set | pitchAndFamily: font spacing and style

NameType
boldboolean
charsetnumber
italicboolean
pitchAndFamilynumber
sTypefacestring

getDatabase

getDatabase(): McDbDatabase

Get the database where the object is located

Returns

McDbDatabase

Return to database

Example

ts
//Assuming obj is a database object
const data = obj.getDatabase();

Inherited from

McDbObject.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

Get the index ID of the object

Returns

number

Example

ts
//Assuming obj is a database object
const id = obj.getDatabaseIndexId();

Inherited from

McDbObject.getDatabaseIndexId


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

Obtain the extended dictionary data of the object

Returns

McDbDictionary

Expand dictionary data

Example

ts
//Assuming obj is a database object
const id = obj.getOwnerID();

Inherited from

McDbObject.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

Get the control points of the object

Returns

McGePoint3dArray

Example

ts
//Assuming obj is a database object
const ptArr = obj.getGripPoints();

Inherited from

McDbObject.getGripPoints


getHandle

getHandle(): string

Obtain object handle

Returns

string

Return object handle

Example

ts
//Assuming obj is a database object
const handle = obj.getHandle();

Inherited from

McDbObject.getHandle


getImp

getImp(): any

Retrieve internal implementation objects.

Returns

any

Internal implementation object.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let imp = obj.getImp();

Inherited from

McDbObject.getImp


getJson

getJson(): string

Retrieve a string in JSON format.

Returns

string

A string in JSON format.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
const json = obj.getJson()

Inherited from

McDbObject.getJson


getObjectID

getObjectID(): McObjectId

Get the object ID.

Returns

McObjectId

Object ID.

Example

ts
import { McDbObject } from "mxcad";
const id = obj.getObjectID();

Inherited from

McDbObject.getObjectID


getOwnerID

getOwnerID(): number

Obtain the ID of the object owner

Returns

number

Example

ts
//Assuming obj is a database object
const id = obj.getOwnerID();

Inherited from

McDbObject.getOwnerID


initTempObject

initTempObject(imp): void

Initialize temporary objects.

Parameters

NameTypeDescription
'imp''any'Internal implementation object

Returns

void

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
obj.initTempObject()

Inherited from

McDbObject.initTempObject


isErased

isErased(): boolean

Has the object been deleted

Returns

boolean

Example

ts
//Assuming obj is a database object
const res = obj.isErased();
console.log(res);

Inherited from

McDbObject.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

Is there any extended dictionary data available

Returns

boolean

Example

ts
//Assuming obj is a database object
const res = obj.isHaveExtensionDictionary();

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

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); //  Output: True or false

Inherited from

McDbObject.isKindOf


isNull

isNull(): any

Determine if it is an empty object

Returns

any

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.isNull()); //  Output: True or false

Inherited from

McDbObject.isNull


moveGripPointsAt

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

Control points for moving objects

Parameters

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

Returns

any

Example

ts
//Assuming obj is a database object
obj.moveGripPointsAt(1,10,10,10);

Inherited from

McDbObject.moveGripPointsAt


setFont

setFont(sTypeface, bold, italic, charset, pitchAndFamily): boolean

Set font style

Parameters

NameTypeDescription
STypefacestringFont Name
BoldbooleanIs it bold
Italicbooleanitalic or not
Charsetnumbercharacter set
PitchAndFamilynumberFont spacing and style

Returns

boolean

Is the setting successful

Example

ts
import { McDbTextStyleTableRecord } from 'mxcad';

const newTextStyleRecord = new McDbTextStyleTableRecord();
//Set font
const typeface = "Arial"; //  Font Name
const isBold = true; //  Is it bold
const isItalic = false; //  Is it italicized
const charset = 0; //  character set
const pitchAndFamily = 0; //  Font spacing and style
const isSetFontSuccessful = newTextStyleRecord.setFont(typeface, isBold, isItalic, charset, pitchAndFamily);
//Check if the settings are successful
if (isSetFontSuccessful) {
 console.log("Font set successfully.");
} else {
 console.log("Failed to set font.");
}

setJson

setJson(str): boolean

Set a string in JSON format.

Parameters

NameTypeDescription
StrstringJSON formatted string

Returns

boolean

Is the setting successful.

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)

Inherited from

McDbObject.setJson


unErase

unErase(): boolean

Anti delete object.

Returns

boolean

Example

ts
//Assuming obj is a database object
const res = obj.unErase();
console.log(res);

Inherited from

McDbObject.unErase