Skip to content

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

Class: McDbDimStyleTableRecord ​

2d.McDbDimStyleTableRecord

McDbDimStyleTableRecord is a single record in a dimension style sheet, responsible for saving and managing dimension style parameters.

Description

This class is used to describe a set of dimension styles, including text, arrows, dimension lines, and unit related parameters. It can accomplish: -Read and set annotation style names; -Modify the int/double/string/Objectid properties of size variables; -Configure block reference styles (Dimblk, Dimblk1, Dimblk2, etc.); -Participate in dimension style management as a record object in the annotation style sheet.

Usage:

  1. Create an instance of McDbDimStyleTableRecord;
  2. Call getDimVar */setDimVar * to set style parameters;
  3. Add the record to the annotation style sheet;
  4. Apply to specific annotated objects.

The specific style parameter settings can refer to the annotation instructions in 'McObject. addDimStyle'. 'addDimStyle' is ultimately written in groups according to DIM system variables: -Double type parameters: such as dimscale, dimtxt, dimasz, dimexo, dimexe, dimrnd, dimdli, etc; -Int type parameter: such as dimadec、dimalt、dimclrd、dimclre、dimclrt、dimfit、dimjust、dimtol、dimzin Wait; -String type parameters: such as dimpost, dimapost; -Objectid type parameters: such as dimtxsty, dimblk, dimblk1, dimblk2, dimldrblk;

That is to say, the setDimVarDouble (type, value) and setDimVarInt (type, value) in McDbDimStyleTableRecord SetDimVarString (type, value) and setDimVarObjectid (type, value) with addDimStyle (pszName, pszDoubleData, pszIntData, pszStringData, pszIdData) The parameter groups in correspond exactly. When calling, you can directly use the system variable numbers and meanings listed in the comments.

For example: -SetDimVarDouble (40, 200) is equivalent to setting dimscale=200; -SetDimVarDouble (41, 0.18) is equivalent to setting dimasz=0.18; -SetDimVarInt (77,1) is equivalent to setting dimtol=1; -SetDimVarInt (271,3) is equivalent to setting dimdec=3; -SetDimVarString (3, "%% c<>") is equivalent to setting dimpost="%% c<>"; -SetDimVarObjectid (340, textId) is equivalent to setting dimtxsty=textId.

Summary: In practical development, McDbDimStyleTableRecord is the core object for unified management of size styles, suitable for controlling size styles, arrows, and text parameters.

Example

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

//Create and set dimension style records.
async function testDimStyleRecord() {
  const mxcad = MxCpp.getCurrentMxCAD();
  const table = mxcad.getDatabase().getDimStyleTable();
  const rec = new McDbDimStyleTableRecord();
  rec.name = "MyDimStyle";
  rec.setDimVarDouble(40, 200);   // dimscale
  rec.setDimVarDouble(41, 0.18);  // dimasz
  rec.setDimVarInt(77, 1);        // dimtol
  rec.setDimVarInt(271, 3);       // dimdec
  rec.setDimVarString(3, "%%c<>"); // dimpost
  table.add(rec);
}

Hierarchy ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new McDbDimStyleTableRecord(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


name ​

• get name(): string

Get or set the annotation style name.

Returns ​

string

• set name(val): void

Parameters ​

NameType
valstring

Returns ​

void


objectName ​

• get objectName(): string

Get the object name.

Returns ​

string

Return object name

Inherited from ​

McDbObject.objectName

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


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


getDimVarDouble ​

▸ getDimVarDouble(type): number

Obtain the double type property of the annotation style.

Parameters ​

NameType
typenumber

Returns ​

number


getDimVarInt ​

▸ getDimVarInt(type): number

Obtain integer type properties for annotation styles.

Parameters ​

NameType
typenumber

Returns ​

number


getDimVarObjectId ​

▸ getDimVarObjectId(type): McObjectId

Obtain integer type properties for annotation styles.

Parameters ​

NameType
typenumber

Returns ​

McObjectId


getDimVarString ​

▸ getDimVarString(type): string

Obtain the string type attribute of the annotation style.

Parameters ​

NameType
typenumber

Returns ​

string


getDimblk ​

▸ getDimblk(): string

Obtain the Dimblk attribute of the annotation style.

Returns ​

string


getDimblk1 ​

▸ getDimblk1(): string

Obtain the Dimblk1 attribute of the annotation style.

Returns ​

string


getDimblk2 ​

▸ getDimblk2(): string

Obtain the Dimblk2 attribute of the annotation style.

Returns ​

string


getDimldrblk ​

▸ getDimldrblk(): string

Obtain the Dimldrblk attribute of the annotation style.

Returns ​

string


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


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


setDimVarDouble ​

▸ setDimVarDouble(type, value): boolean

Set the double type property of the annotation style.

Parameters ​

NameType
typenumber
valuenumber

Returns ​

boolean


setDimVarInt ​

▸ setDimVarInt(type, value): boolean

Set integer type properties for annotation styles.

Parameters ​

NameType
typenumber
valuenumber

Returns ​

boolean


setDimVarObjectId ​

▸ setDimVarObjectId(type, value): boolean

Set integer type properties for annotation styles.

Parameters ​

NameType
typenumber
valueMcObjectId

Returns ​

boolean


setDimVarString ​

▸ setDimVarString(type, value): boolean

Set string type properties for annotation styles.

Parameters ​

NameType
typenumber
valuestring

Returns ​

boolean


setDimblk ​

▸ setDimblk(value): boolean

Set Dimblk properties for annotation styles.

Parameters ​

NameType
valuestring

Returns ​

boolean


setDimblk1 ​

▸ setDimblk1(value): boolean

Set the Dimblk1 property of the annotation style.

Parameters ​

NameType
valuestring

Returns ​

boolean


setDimblk2 ​

▸ setDimblk2(value): boolean

Set the Dimblk2 property of the annotation style.

Parameters ​

NameType
valuestring

Returns ​

boolean


setDimldrblk ​

▸ setDimldrblk(value): boolean

Set Dimblk properties for annotation styles.

Parameters ​

NameType
valuestring

Returns ​

boolean


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