Skip to content

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

Class: McDbDimStyleTable ​

2d.McDbDimStyleTable

McDbDimStyleTable is a annotation style table in the database, responsible for managing all annotation style definitions in the drawings.

Description

This class is used to maintain and access a collection of CAD annotation styles, suitable for unified management of annotation related attributes such as dimension styles, text styles, and unit displays. It can accomplish: -Obtain all annotation style record IDs; -Add and query annotation styles; -Determine whether the style exists by name; -Subsequently, access the specific McDbDimStyleTableRecord through the object ID to continue setting style parameters.

Usage:

  1. Retrieve the current annotation style sheet from the database;
  2. Use getAllRecordId() to list all styles;
  3. Call add()/get()/has() to manage styles;
  4. Apply the style to the current annotation object or newly created annotation.

Summary: In practical development, McDbDimStyleTable is the core entry point for managing annotation styles and controlling size specifications, and is suitable for uniformly setting annotation styles.

Example

ts
import { MxCpp, McDbDimStyleTable } from "mxcad";

//Create a dimension style sheet and add style records.
async function testDimStyleTable() {
  const mxcad = MxCpp.getCurrentMxCAD();
  const table: McDbDimStyleTable = mxcad.getDatabase().getDimStyleTable();
  const ids = table.getAllRecordId();
Console.log ("Number of annotation styles:", ids. length);
}

Hierarchy ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new McDbDimStyleTable(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 annotation style records to the annotation style sheet.

Parameters ​

NameTypeDescription
Rec[McDbDimStyleTableRecord] (2d. McDbDimStyleTableRecord. md)Annotation style record

Returns ​

McObjectId

Add a new line type record object ID.

ts

___

### 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

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
|AutoUndo | boolean | false | Should this modification automatically support undo? Default is false|

#### Returns

`number`

#### Inherited from

[McDbObject](2d.McDbObject.md).[assertObjectModification](2d.McDbObject.md#assertobjectmodification)

___

### clone

▸ **clone**(): ``null`` \| [`McDbObject`](2d.McDbObject.md)

Clone objects.

#### Returns

``null`` \| [`McDbObject`](2d.McDbObject.md)

The cloned object.

#### Inherited from

[McDbObject](2d.McDbObject.md).[clone](2d.McDbObject.md#clone)

___

### createExtensionDictionary

▸ **createExtensionDictionary**(): `boolean`

Create extended dictionary data for objects

#### Returns

`boolean`

#### Inherited from

[McDbObject](2d.McDbObject.md).[createExtensionDictionary](2d.McDbObject.md#createextensiondictionary)

___

### erase

▸ **erase**(): `boolean`

Delete object.

#### Returns

`boolean`

Whether the deletion was successful.

#### Inherited from

[McDbObject](2d.McDbObject.md).[erase](2d.McDbObject.md#erase)

___

### get

▸ **get**(`sName`, `skipDeleted?`): [`McObjectId`](2d.McObjectId.md)

Search for annotation style records in the annotation style sheet.

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
|SName | string | undefined | Label style name|
|SkipDeleted | boolean | true | Do you want to skip deleted annotation styles|

#### Returns

[`McObjectId`](2d.McObjectId.md)

Annotation style records object ID.

___

### getAllRecordId

▸ **getAllRecordId**(`skipDeleted?`): [`McObjectId`](2d.McObjectId.md)[]

Retrieve all annotation styles.

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
|SkipDeleted | boolean | true | Do you want to skip deleted annotation styles|

#### Returns

[`McObjectId`](2d.McObjectId.md)[]

Annotation style ID array

___

### getDatabase

▸ **getDatabase**(): [`McDbDatabase`](2d.McDbDatabase.md)

Get the database where the object is located

#### Returns

[`McDbDatabase`](2d.McDbDatabase.md)

Return to database

#### Inherited from

[McDbObject](2d.McDbObject.md).[getDatabase](2d.McDbObject.md#getdatabase)

___

### getDatabaseIndexId

▸ **getDatabaseIndexId**(): `number`

Get the index ID of the object

#### Returns

`number`

#### Inherited from

[McDbObject](2d.McDbObject.md).[getDatabaseIndexId](2d.McDbObject.md#getdatabaseindexid)

___

### getExtensionDictionary

▸ **getExtensionDictionary**(): [`McDbDictionary`](2d.McDbDictionary.md)

Obtain the extended dictionary data of the object

#### Returns

[`McDbDictionary`](2d.McDbDictionary.md)

Expand dictionary data

#### Inherited from

[McDbObject](2d.McDbObject.md).[getExtensionDictionary](2d.McDbObject.md#getextensiondictionary)

___

### getGripEditBasePointsIndex

▸ **getGripEditBasePointsIndex**(): `number`[]

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

#### Returns

`number`[]

#### Inherited from

[McDbObject](2d.McDbObject.md).[getGripEditBasePointsIndex](2d.McDbObject.md#getgripeditbasepointsindex)

___

### getGripPoints

▸ **getGripPoints**(): [`McGePoint3dArray`](2d.McGePoint3dArray.md)

Get the grip array of the object

#### Returns

[`McGePoint3dArray`](2d.McGePoint3dArray.md)

#### Inherited from

[McDbObject](2d.McDbObject.md).[getGripPoints](2d.McDbObject.md#getgrippoints)

___

### getHandle

▸ **getHandle**(): `string`

Obtain object handle

#### Returns

`string`

Return object handle

#### Inherited from

[McDbObject](2d.McDbObject.md).[getHandle](2d.McDbObject.md#gethandle)

___

### getImp

▸ **getImp**(): `any`

Retrieve internal implementation objects.

#### Returns

`any`

Internal implementation object.

#### Inherited from

[McDbObject](2d.McDbObject.md).[getImp](2d.McDbObject.md#getimp)

___

### getJson

▸ **getJson**(): `string`

Retrieve a string in JSON format.

#### Returns

`string`

A string in JSON format.

#### Inherited from

[McDbObject](2d.McDbObject.md).[getJson](2d.McDbObject.md#getjson)

___

### getObjectID

▸ **getObjectID**(): [`McObjectId`](2d.McObjectId.md)

Get the object ID.

#### Returns

[`McObjectId`](2d.McObjectId.md)

Object ID.

#### Inherited from

[McDbObject](2d.McDbObject.md).[getObjectID](2d.McDbObject.md#getobjectid)

___

### getOwnerID

▸ **getOwnerID**(): `number`

Obtain the ID of the object owner

#### Returns

`number`

#### Inherited from

[McDbObject](2d.McDbObject.md).[getOwnerID](2d.McDbObject.md#getownerid)

___

### has

▸ **has**(`sName`, `skipDeleted?`): `boolean`

Check if there are any annotation style records with the specified name in the annotation style table.

#### Parameters

| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
|SName | string | undefined | Find the annotation style name|
|SkipDeleted | boolean | true | Do you want to skip deleted annotation styles|

#### Returns

`boolean`

Boolean value.

___

### initTempObject

▸ **initTempObject**(`imp`): `void`

Initialize temporary objects.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
|'imp' | 'any' | Internal implementation object|

#### Returns

`void`

#### Inherited from

[McDbObject](2d.McDbObject.md).[initTempObject](2d.McDbObject.md#inittempobject)

___

### isErased

▸ **isErased**(): `boolean`

Has the object been deleted

#### Returns

`boolean`

#### Inherited from

[McDbObject](2d.McDbObject.md).[isErased](2d.McDbObject.md#iserased)

___

### isHaveExtensionDictionary

▸ **isHaveExtensionDictionary**(): `boolean`

Is there any extended dictionary data available

#### Returns

`boolean`

#### Inherited from

[McDbObject](2d.McDbObject.md).[isHaveExtensionDictionary](2d.McDbObject.md#ishaveextensiondictionary)

___

### isKindOf

▸ **isKindOf**(`sObjectName`): `boolean`

Determine object type

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
|SOrtName | string | Type Name|

#### Returns

`boolean`

Return whether the object is of the target type

#### Inherited from

[McDbObject](2d.McDbObject.md).[isKindOf](2d.McDbObject.md#iskindof)

___

### isNull

▸ **isNull**(): `any`

Determine if it is an empty object

#### Returns

`any`

#### Inherited from

[McDbObject](2d.McDbObject.md).[isNull](2d.McDbObject.md#isnull)

___

### moveGripPointsAt

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

Grips for moving objects

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
|IIndex | Number | Index|
|DXOffset | number | X-axis offset|
|DYOffset | number | Y-axis offset|
|DZOffset | number | Z-axis offset|

#### Returns

`any`

#### Inherited from

[McDbObject](2d.McDbObject.md).[moveGripPointsAt](2d.McDbObject.md#movegrippointsat)

___

### setJson

▸ **setJson**(`str`): `boolean`

Set a string in JSON format.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
|Str | string | JSON formatted string|

#### Returns

`boolean`

Is the setting successful.

#### Inherited from

[McDbObject](2d.McDbObject.md).[setJson](2d.McDbObject.md#setjson)

___

### unErase

▸ **unErase**(): `boolean`

Anti delete object.

#### Returns

`boolean`

#### Inherited from

[McDbObject](2d.McDbObject.md).[unErase](2d.McDbObject.md#unerase)