Skip to content
On this page

mxcad_2d API 文档 / 2d / McDbAlignedDimension

Class: McDbAlignedDimension

2d.McDbAlignedDimension

对齐标注尺寸类。

Example

ts
import { McDbAlignedDimension, MxCpp } from "mxcad"

//绘制对齐标注
 const mDimension = new McDbAlignedDimension()
   mDimension.xLine1Point = new McGePoint3d(-1800, 800)
   mDimension.xLine2Point = new McGePoint3d(1800,800)
   mDimension.dimLinePoint = new McGePoint3d(800, 500)
   mDimension.textAttachment = McDb.AttachmentPoint.kTopLeft
   mDimension.trueColor = new McCmColor(200, 255, 0)
   mDimension.oblique = 0
   MxCpp.getCurrentMxCAD().drawEntity(mDimension);

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbAlignedDimension(imp?)

构造函数

Parameters

NameTypeDescription
imp?any内部实现对象

Overrides

McDbDimension.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbDimension.imp

Accessors

colorIndex

get colorIndex(): number

得到对象颜色索引

Example

ts
import { McDbEntity, ColorIndexType } from 'mxcad'
 const ent = new McDbEntity();
 ent.colorIndex = ColorIndexType.kByblock;
 console.log(ent.colorIndex)

Returns

number

Inherited from

McDbDimension.colorIndex

set colorIndex(val): void

设置对象颜色索引

Parameters

NameTypeDescription
valnumber颜色索引(ColorIndexType)

Returns

void

Inherited from

McDbDimension.colorIndex


dimLinePoint

get dimLinePoint(): McGePoint3d

获取标注线的端点

Returns

McGePoint3d

标注线的端点

set dimLinePoint(pt): void

设置标注线的端点

Parameters

NameTypeDescription
ptMcGePoint3d标注线的端点

Returns

void


dimensionStyle

get dimensionStyle(): McObjectId

获取标注样式

Returns

McObjectId

标注样式

Inherited from

McDbDimension.dimensionStyle

set dimensionStyle(val): void

设置标注样式

Parameters

NameTypeDescription
valMcObjectId标注样式

Returns

void

Inherited from

McDbDimension.dimensionStyle


dimensionText

get dimensionText(): string

获取标注文本

Returns

string

标注文本

Inherited from

McDbDimension.dimensionText

set dimensionText(val): void

设置标注文本

Parameters

NameTypeDescription
valstring标注文本

Returns

void

Inherited from

McDbDimension.dimensionText


drawOrder

get drawOrder(): number

对象的显示顺序

Returns

number

Inherited from

McDbDimension.drawOrder

set drawOrder(order): void

对象的显示顺序

Parameters

NameTypeDescription
ordernumber顺序值

Returns

void

Inherited from

McDbDimension.drawOrder


dxf0

get dxf0(): string

获取 DXF 代码 0 的值。

Returns

string

Inherited from

McDbDimension.dxf0


elevation

get elevation(): number

获取高度

Returns

number

高度

Inherited from

McDbDimension.elevation

set elevation(val): void

设置高度

Parameters

NameTypeDescription
valnumber高度

Returns

void

Inherited from

McDbDimension.elevation


horizontalRotation

get horizontalRotation(): number

获取水平旋转角度

Returns

number

水平旋转角度

Inherited from

McDbDimension.horizontalRotation

set horizontalRotation(val): void

设置水平旋转角度

Parameters

NameTypeDescription
valnumber水平旋转角度

Returns

void

Inherited from

McDbDimension.horizontalRotation


layer

get layer(): string

得到对象图层名

Returns

string

Inherited from

McDbDimension.layer

set layer(val): void

设置对象图层名

Example

ts
import { McDbEntity } from 'mxcad'
 const ent = new McDbEntity();
 ent.layer = "newLayerName";
 console.log(ent.layer)

Parameters

NameTypeDescription
valstring图层名

Returns

void

Inherited from

McDbDimension.layer


layerId

get layerId(): McObjectId

图层ID对象

Returns

McObjectId

Inherited from

McDbDimension.layerId

set layerId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbDimension.layerId


linetype

get linetype(): string

得到对象线型名

Returns

string

Inherited from

McDbDimension.linetype

set linetype(val): void

设置对象线型名

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetype = "MyLineType";
console.log(ent.linetype)

Parameters

NameTypeDescription
valstring线型名

Returns

void

Inherited from

McDbDimension.linetype


linetypeId

get linetypeId(): McObjectId

线型ID对象

Returns

McObjectId

Inherited from

McDbDimension.linetypeId

set linetypeId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbDimension.linetypeId


linetypeScale

get linetypeScale(): number

得到对象线型比例

Returns

number

Inherited from

McDbDimension.linetypeScale

set linetypeScale(val): void

设置对象线型比例

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetypeScale = 0.8;
console.log(ent.linetypeScale)

Parameters

NameTypeDescription
valnumber线型比例

Returns

void

Inherited from

McDbDimension.linetypeScale


lineweight

get lineweight(): number

得到对象线重

Returns

number

Inherited from

McDbDimension.lineweight

set lineweight(val): void

设置对象线重

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.lineweight = 20;
console.log(ent.lineweight)

Parameters

NameTypeDescription
valnumber线重

Returns

void

Inherited from

McDbDimension.lineweight


objectName

get objectName(): string

获取对象名称。

Returns

string

Inherited from

McDbDimension.objectName


oblique

get oblique(): number

获取倾斜角度

Returns

number

倾斜角度

set oblique(val): void

设置倾斜角度

Parameters

NameTypeDescription
valnumber倾斜角度

Returns

void


textAttachment

get textAttachment(): AttachmentPoint

获取文本附着点

Returns

AttachmentPoint

文本附着点

Inherited from

McDbDimension.textAttachment

set textAttachment(val): void

设置文本附着点

Parameters

NameTypeDescription
valAttachmentPoint文本附着点

Returns

void

Inherited from

McDbDimension.textAttachment


textPosition

get textPosition(): McGePoint3d

获取文本位置

Returns

McGePoint3d

文本位置

Inherited from

McDbDimension.textPosition

set textPosition(pt): void

设置文本位置

Parameters

NameTypeDescription
ptMcGePoint3d文本位置

Returns

void

Inherited from

McDbDimension.textPosition


textRotation

get textRotation(): number

获取文本旋转角度

Returns

number

文本旋转角度

Inherited from

McDbDimension.textRotation

set textRotation(val): void

设置文本旋转角度

Parameters

NameTypeDescription
valnumber文本旋转角度

Returns

void

Inherited from

McDbDimension.textRotation


textStyle

get textStyle(): string

得到对象文字样式

Returns

string

Inherited from

McDbDimension.textStyle

set textStyle(val): void

设置对象文字样式

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";

Parameters

NameTypeDescription
valstring文字样式名

Returns

void

Inherited from

McDbDimension.textStyle


textStyleId

get textStyleId(): McObjectId

文字样式ID对象

Returns

McObjectId

Inherited from

McDbDimension.textStyleId

set textStyleId(id): void

Parameters

NameType
idMcObjectId

Returns

void

Inherited from

McDbDimension.textStyleId


trueColor

get trueColor(): McCmColor

得到对象颜色

Example

ts
import { McDbEntity, McCmColor} from 'mxcad'
 const ent = new McDbEntity();
 ent.trueColor = new McCmColor(255, 0, 0);
 console.log(ent.trueColor)

Returns

McCmColor

Inherited from

McDbDimension.trueColor

set trueColor(val): void

设置对象颜色

Parameters

NameType
valMcCmColor

Returns

void

Inherited from

McDbDimension.trueColor


visible

get visible(): boolean

对象是否可见

Returns

boolean

Inherited from

McDbDimension.visible

set visible(val): void

设置是否可见

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.visible = true;
console.log(ent.visible)

Parameters

NameTypeDescription
valboolean布尔值

Returns

void

Inherited from

McDbDimension.visible


xLine1Point

get xLine1Point(): McGePoint3d

获取第一条线的端点

Returns

McGePoint3d

第一条线的端点

set xLine1Point(pt): void

设置第一条线的端点

Parameters

NameTypeDescription
ptMcGePoint3d第一条线的端点

Returns

void


xLine2Point

get xLine2Point(): McGePoint3d

获取第二条线的端点

Returns

McGePoint3d

第二条线的端点

set xLine2Point(pt): void

设置第二条线的端点

Parameters

NameTypeDescription
ptMcGePoint3d第二条线的端点

Returns

void

Methods

GetAllText

GetAllText(): McGeStringArray

得到标注对象中的所有文字内容

Returns

McGeStringArray

Inherited from

McDbDimension.GetAllText


IntersectWith

IntersectWith(intersectObject, exOption): McGePoint3dArray

与其他实体相交, 得到交点

Example

ts
import { McDbLine, McDb } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
const line2 = new McDbLine(new McGePoint3d(10,10,0), new McGePoint3d(11,1,0));
const ptArr = line1.IntersectWith(line2, McDb.Intersect.kExtendBoth)

Parameters

NameTypeDescription
intersectObjectMcDbEntity需要相交的是实体对象
exOptionIntersect相交的选项

Returns

McGePoint3dArray

得到所有交点

Inherited from

McDbDimension.IntersectWith


clone

clone(): null | McDbObject

克隆对象。

Returns

null | McDbObject

克隆出的对象。

Inherited from

McDbDimension.clone


constructor_MxCADResbuf

Protected constructor_MxCADResbuf(imp): void

Parameters

NameType
impany

Returns

void

Inherited from

McDbDimension.constructor_MxCADResbuf


createExtensionDictionary

createExtensionDictionary(): boolean

创建对象的扩展字典数据.

Returns

boolean

Inherited from

McDbDimension.createExtensionDictionary


deleteXData

deleteXData(appName): boolean

删除实体的指定 XData 类型中的点(McGePoint3d)值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

boolean

Inherited from

McDbDimension.deleteXData


disableDisplay

disableDisplay(isDisable): void

禁用对象的自动更新显示.

Example

ts
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)

Parameters

NameTypeDescription
isDisableboolean是否禁用对象自动更新显示

Returns

void

Inherited from

McDbDimension.disableDisplay


erase

erase(): boolean

删除对象。

Returns

boolean

是否删除成功。

Inherited from

McDbDimension.erase


explode

explode(): MxCADResbuf

打碎对象,返回打后对象数据链表

Returns

MxCADResbuf

Inherited from

McDbDimension.explode


freeTempRelationObject

freeTempRelationObject(): void

释放临时关系对象

Returns

void

Inherited from

McDbDimension.freeTempRelationObject


getAllAppName

getAllAppName(): McGeStringArray

获取实体中包含的所有 XData 记录的应用程序名(AppName)

Returns

McGeStringArray

Inherited from

McDbDimension.getAllAppName


getArea

getArea(): Object

计算面积

Returns

Object

val 面积值 | ret 是否获取成功

NameType
retboolean
valnumber

Inherited from

McDbDimension.getArea


getBoundingBox

getBoundingBox(): Object

得到对象的最小外包

Example

ts
import { McDbText, McGePoint3d } from 'mxcad'
const text = new McDbText();
text.textString = "测试Test";
  text.height = 20;
  text.position = text.alignmentPoint = new McGePoint3d(0,0,0);
const { minPt, maxPt, ret } = text.getBoundingBox()

Returns

Object

NameType
maxPtMcGePoint3d
minPtMcGePoint3d
retboolean

Inherited from

McDbDimension.getBoundingBox


getDatabase

getDatabase(): McDbDatabase

得到对象所在的数据库

Returns

McDbDatabase

Inherited from

McDbDimension.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Returns

number

Inherited from

McDbDimension.getDatabaseIndexId


getDimVarDouble

getDimVarDouble(iType): number

获取标注变量浮点数值

Parameters

NameTypeDescription
iTypenumber标注变量类型

Returns

number

标注变量浮点数值

Inherited from

McDbDimension.getDimVarDouble


getDimVarInt

getDimVarInt(iType): number

获取标注变量整数值

Parameters

NameTypeDescription
iTypenumber标注变量类型

Returns

number

标注变量整数值

Inherited from

McDbDimension.getDimVarInt


getDimVarObjectId

getDimVarObjectId(iType): McObjectId

获取标注变量对象 ID

Parameters

NameTypeDescription
iTypenumber标注变量类型

Returns

McObjectId

标注变量对象 ID

Inherited from

McDbDimension.getDimVarObjectId


getDimVarString

getDimVarString(iType): string

获取标注变量字符串值

Parameters

NameTypeDescription
iTypenumber标注变量类型

Returns

string

标注变量字符串值

Inherited from

McDbDimension.getDimVarString


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

得到对象的扩展字典数据.

Returns

McDbDictionary

Inherited from

McDbDimension.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的控制点

Returns

McGePoint3dArray

Inherited from

McDbDimension.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Returns

string

Inherited from

McDbDimension.getHandle


getImp

getImp(): any

获取内部实现对象。

Returns

any

内部实现对象。

Inherited from

McDbDimension.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Returns

string

JSON 格式的字符串。

Inherited from

McDbDimension.getJson


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Returns

McObjectId

对象 ID。

Inherited from

McDbDimension.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Returns

number

Inherited from

McDbDimension.getOwnerID


getxData

getxData(appName?): MxCADResbuf

得到对象的扩展数据

Parameters

NameTypeDefault valueDescription
appNamestring""XData 类型

Returns

MxCADResbuf

Inherited from

McDbDimension.getxData


getxDataDouble

getxDataDouble(appName): Object

获取或设置实体的指定 XData 类型中的 double 值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

double 值

NameType
retboolean
valnumber

Inherited from

McDbDimension.getxDataDouble


getxDataLong

getxDataLong(appName): Object

获取或设置实体的指定 XData 类型中的 long(整数)值

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

long 值

NameType
retboolean
valnumber

Inherited from

McDbDimension.getxDataLong


getxDataPoint

getxDataPoint(appName): Object

获取或设置实体的指定 XData 类型中的点对象

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

NameType
retboolean
valMcGePoint3d

Inherited from

McDbDimension.getxDataPoint


getxDataString

getxDataString(appName): Object

获取与特定实体关联的 XData 信息,并以字符串形式返回

Parameters

NameTypeDescription
appNamestringXData 类型

Returns

Object

val XData信息 | ret 是否返回成功

NameType
retboolean
valstring

Inherited from

McDbDimension.getxDataString


highlight

highlight(isHighlight): void

设置对象是否高亮

Example

ts
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.isHighlight(true);

Parameters

NameTypeDescription
isHighlightboolean是否高亮

Returns

void

Inherited from

McDbDimension.highlight


initTempObject

initTempObject(imp): void

初始化临时对象。

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Inherited from

McDbDimension.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Returns

boolean

Inherited from

McDbDimension.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Returns

boolean

Inherited from

McDbDimension.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

判断对象类型

Parameters

NameTypeDescription
sObjectNamestring类型名

Returns

boolean

返回对象是否是目标类型

Inherited from

McDbDimension.isKindOf


isNull

isNull(): any

判断是否为空对象

Returns

any

Inherited from

McDbDimension.isNull


isUsingDefaultTextPosition

isUsingDefaultTextPosition(): boolean

是否使用默认文本位置

Returns

boolean

是否使用默认文本位置

Inherited from

McDbDimension.isUsingDefaultTextPosition


mirror

mirror(point1, point2): boolean

镜向对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.mirror(new McGePoint3d(0,0,0), new McGePoint3d(20,10,0))

Parameters

NameTypeDescription
point1McGePoint3d镜像基点
point2McGePoint3d-

Returns

boolean

Inherited from

McDbDimension.mirror


move

move(fromPoint, toPoint): boolean

移动对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))

Parameters

NameTypeDescription
fromPointMcGePoint3d移动开始点
toPointMcGePoint3d移动结束点

Returns

boolean

Inherited from

McDbDimension.move


moveGripPointsAt

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

移动对象的控制点

Parameters

NameTypeDescription
iIndexnumber索引
dXOffsetnumberX轴偏移量
dYOffsetnumberY轴偏移量
dZOffsetnumberZ轴偏移量

Returns

any

Inherited from

McDbDimension.moveGripPointsAt


recomputeDimBlock

recomputeDimBlock(): void

重新计算标注块

Returns

void

Inherited from

McDbDimension.recomputeDimBlock


rotate

rotate(basePoint, dRotationAngle): boolean

旋转对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)

Parameters

NameTypeDescription
basePointMcGePoint3d旋转基点
dRotationAnglenumber旋转角度

Returns

boolean

Inherited from

McDbDimension.rotate


scaleEntity

scaleEntity(basePoint, dScaleFactor): boolean

缩放对象

Example

ts
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)

Parameters

NameTypeDescription
basePointMcGePoint3d缩放基点
dScaleFactornumber缩放因子(<1 缩小; >1 放大)

Returns

boolean

Inherited from

McDbDimension.scaleEntity


setDimVarDouble

setDimVarDouble(iType, val): void

设置标注变量浮点数值

Parameters

NameTypeDescription
iTypenumber标注变量类型
valnumber标注变量浮点数值

Returns

void

Inherited from

McDbDimension.setDimVarDouble


setDimVarInt

setDimVarInt(iType, val): void

设置标注变量整数值

Parameters

NameTypeDescription
iTypenumber标注变量类型
valnumber标注变量整数值

Returns

void

Inherited from

McDbDimension.setDimVarInt


setDimVarObjectId

setDimVarObjectId(iType, val): void

设置标注变量对象 ID

Parameters

NameTypeDescription
iTypenumber标注变量类型
valMcObjectId标注变量对象 ID

Returns

void

Inherited from

McDbDimension.setDimVarObjectId


setDimVarString

setDimVarString(iType, val): void

设置标注变量字符串值

Parameters

NameTypeDescription
iTypenumber标注变量类型
valstring标注变量字符串值

Returns

void

Inherited from

McDbDimension.setDimVarString


setJson

setJson(str): boolean

设置 JSON 格式的字符串。

Parameters

NameTypeDescription
strstringJSON 格式的字符串。

Returns

boolean

是否设置成功。

Inherited from

McDbDimension.setJson


setxData

setxData(xdata): boolean

设置对象的扩展数据

Parameters

NameTypeDescription
xdataMxCADResbufresbuf 数据

Returns

boolean

Inherited from

McDbDimension.setxData


setxDataDouble

setxDataDouble(appName, val): boolean

Parameters

NameType
appNamestring
valnumber

Returns

boolean

Inherited from

McDbDimension.setxDataDouble


setxDataLong

setxDataLong(appName, val): boolean

Parameters

NameType
appNamestring
valnumber

Returns

boolean

Inherited from

McDbDimension.setxDataLong


setxDataPoint

setxDataPoint(appName, val): boolean

Parameters

NameType
appNamestring
valMcGePoint3d

Returns

boolean

Inherited from

McDbDimension.setxDataPoint


setxDataString

setxDataString(appName, val): boolean

设置与特定实体关联的 XData 信息,并以字符串形式设置

Parameters

NameTypeDescription
appNamestringXData 类型
valstringXData信息

Returns

boolean

是否设置成功

Inherited from

McDbDimension.setxDataString


syncData

syncData(_toCpp?): boolean

同步实体的数据。这个方法可能是在修改了实体的属性或者附加了新的数据之后调用的,以确保所有的改变都被正确地保存到实体的数据库记录中。

Parameters

NameTypeDefault valueDescription
_toCppbooleantrue是否同步数据

Returns

boolean

Inherited from

McDbDimension.syncData


tempRelationObject

tempRelationObject(): number

与对象相关的临时关系数

Returns

number

Inherited from

McDbDimension.tempRelationObject


transformBy

transformBy(transformationMatrix): boolean

变换对象

Example

ts
import { McGeMatrix3d, McDbEntity, McGeVector3d} from 'mxcad'
 const ent = new McDbEntity()
   let matrix = new McGeMatrix3d();
   matrix.setToTranslation(new McGeVector3d(20,0,0));//平移
   ent.transformBy(matrix);

Parameters

NameTypeDescription
transformationMatrixMcGeMatrix3d变换矩阵

Returns

boolean

Inherited from

McDbDimension.transformBy


unErase

unErase(): boolean

反删除对象。

Returns

boolean

Inherited from

McDbDimension.unErase


updateDisplay

updateDisplay(): void

显示调用对象更新显示.

Returns

void

Inherited from

McDbDimension.updateDisplay


useDefaultTextPosition

useDefaultTextPosition(): void

使用默认文本位置

Returns

void

Inherited from

McDbDimension.useDefaultTextPosition


useSetTextPosition

useSetTextPosition(): void

使用设置的文本位置

Returns

void

Inherited from

McDbDimension.useSetTextPosition