mxcad API 文档 / McDbDimension
Class: McDbDimension
表示AutoCAD中所有标注实体类型的类的基类
Hierarchy
↳
McDbDimension
Table of contents
Constructors
Properties
Accessors
- colorIndex
- dimensionStyle
- dimensionText
- drawOrder
- dxf0
- elevation
- horizontalRotation
- layer
- layerId
- linetype
- linetypeId
- linetypeScale
- lineweight
- objectName
- textAttachment
- textPosition
- textRotation
- textStyle
- textStyleId
- trueColor
- visible
Methods
- GetAllText
- IntersectWith
- clone
- constructor_MxCADResbuf
- createExtensionDictionary
- deleteXData
- disableDisplay
- erase
- explode
- freeTempRelationObject
- getAllAppName
- getArea
- getBoundingBox
- getDatabase
- getDatabaseIndexId
- getDimVarDouble
- getDimVarInt
- getDimVarObjectId
- getDimVarString
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getObjectID
- getOwnerID
- getxData
- getxDataDouble
- getxDataLong
- getxDataPoint
- getxDataString
- highlight
- initTempObject
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- isUsingDefaultTextPosition
- mirror
- move
- moveGripPointsAt
- recomputeDimBlock
- rotate
- scaleEntity
- setDimVarDouble
- setDimVarInt
- setDimVarObjectId
- setDimVarString
- setJson
- setxData
- setxDataDouble
- setxDataLong
- setxDataPoint
- setxDataString
- syncData
- tempRelationObject
- transformBy
- unErase
- updateDisplay
- useDefaultTextPosition
- useSetTextPosition
Constructors
constructor
• new McDbDimension(imp?
)
构造函数
Parameters
Name | Type | Description |
---|---|---|
imp? | any | 实现对象 |
Overrides
Properties
imp
• imp: any
= 0
内部实现对象。
Inherited from
Accessors
colorIndex
• get
colorIndex(): number
得到对象颜色索引
Example
import { McDbEntity, ColorIndexType } from 'mxcad'
const ent = new McDbEntity();
ent.colorIndex = ColorIndexType.kByblock;
console.log(ent.colorIndex)
Returns
number
Inherited from
McDbEntity.colorIndex
• set
colorIndex(val
): void
设置对象颜色索引
Parameters
Name | Type | Description |
---|---|---|
val | number | 颜色索引(ColorIndexType) |
Returns
void
Inherited from
McDbEntity.colorIndex
dimensionStyle
• get
dimensionStyle(): McObjectId
获取标注样式
Returns
标注样式
• set
dimensionStyle(val
): void
设置标注样式
Parameters
Name | Type | Description |
---|---|---|
val | McObjectId | 标注样式 |
Returns
void
dimensionText
• get
dimensionText(): string
获取标注文本
Returns
string
标注文本
• set
dimensionText(val
): void
设置标注文本
Parameters
Name | Type | Description |
---|---|---|
val | string | 标注文本 |
Returns
void
drawOrder
• get
drawOrder(): number
对象的显示顺序
Returns
number
Inherited from
McDbEntity.drawOrder
• set
drawOrder(order
): void
对象的显示顺序
Parameters
Name | Type | Description |
---|---|---|
order | number | 顺序值 |
Returns
void
Inherited from
McDbEntity.drawOrder
dxf0
• get
dxf0(): string
获取 DXF 代码 0 的值。
Returns
string
Inherited from
McDbEntity.dxf0
elevation
• get
elevation(): number
获取高度
Returns
number
高度
• set
elevation(val
): void
设置高度
Parameters
Name | Type | Description |
---|---|---|
val | number | 高度 |
Returns
void
horizontalRotation
• get
horizontalRotation(): number
获取水平旋转角度
Returns
number
水平旋转角度
• set
horizontalRotation(val
): void
设置水平旋转角度
Parameters
Name | Type | Description |
---|---|---|
val | number | 水平旋转角度 |
Returns
void
layer
• get
layer(): string
得到对象图层名
Returns
string
Inherited from
McDbEntity.layer
• set
layer(val
): void
设置对象图层名
Parameters
Name | Type | Description |
---|---|---|
val | string | 图层名 |
Returns
void
Inherited from
McDbEntity.layer
layerId
• get
layerId(): McObjectId
图层ID对象
Returns
Inherited from
McDbEntity.layerId
• set
layerId(id
): void
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbEntity.layerId
linetype
• get
linetype(): string
得到对象线型名
Returns
string
Inherited from
McDbEntity.linetype
• set
linetype(val
): void
设置对象线型名
Parameters
Name | Type | Description |
---|---|---|
val | string | 线型名 |
Returns
void
Inherited from
McDbEntity.linetype
linetypeId
• get
linetypeId(): McObjectId
线型ID对象
Returns
Inherited from
McDbEntity.linetypeId
• set
linetypeId(id
): void
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbEntity.linetypeId
linetypeScale
• get
linetypeScale(): number
得到对象线型比例
Returns
number
Inherited from
McDbEntity.linetypeScale
• set
linetypeScale(val
): void
设置对象线型比例
Parameters
Name | Type | Description |
---|---|---|
val | number | 线型比例 |
Returns
void
Inherited from
McDbEntity.linetypeScale
lineweight
• get
lineweight(): number
得到对象线重
Returns
number
Inherited from
McDbEntity.lineweight
• set
lineweight(val
): void
设置对象线重
Parameters
Name | Type | Description |
---|---|---|
val | number | 线重 |
Returns
void
Inherited from
McDbEntity.lineweight
objectName
• get
objectName(): string
获取对象名称。
Returns
string
Inherited from
McDbEntity.objectName
textAttachment
• get
textAttachment(): AttachmentPoint
获取文本附着点
Returns
文本附着点
• set
textAttachment(val
): void
设置文本附着点
Parameters
Name | Type | Description |
---|---|---|
val | AttachmentPoint | 文本附着点 |
Returns
void
textPosition
• get
textPosition(): McGePoint3d
获取文本位置
Returns
文本位置
• set
textPosition(pt
): void
设置文本位置
Parameters
Name | Type | Description |
---|---|---|
pt | McGePoint3d | 文本位置 |
Returns
void
textRotation
• get
textRotation(): number
获取文本旋转角度
Returns
number
文本旋转角度
• set
textRotation(val
): void
设置文本旋转角度
Parameters
Name | Type | Description |
---|---|---|
val | number | 文本旋转角度 |
Returns
void
textStyle
• get
textStyle(): string
得到对象文字样式
Returns
string
Inherited from
McDbEntity.textStyle
• set
textStyle(val
): void
设置对象文字样式
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";
Parameters
Name | Type | Description |
---|---|---|
val | string | 文字样式名 |
Returns
void
Inherited from
McDbEntity.textStyle
textStyleId
• get
textStyleId(): McObjectId
文字样式ID对象
Returns
Inherited from
McDbEntity.textStyleId
• set
textStyleId(id
): void
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbEntity.textStyleId
trueColor
• get
trueColor(): McCmColor
得到对象颜色
Example
import { McDbEntity, McCmColor} from 'mxcad'
const ent = new McDbEntity();
ent.trueColor = new McCmColor(255, 0, 0);
console.log(ent.trueColor)
Returns
Inherited from
McDbEntity.trueColor
• set
trueColor(val
): void
设置对象颜色
Parameters
Name | Type |
---|---|
val | McCmColor |
Returns
void
Inherited from
McDbEntity.trueColor
visible
• get
visible(): boolean
对象是否可见
Returns
boolean
Inherited from
McDbEntity.visible
• set
visible(val
): void
设置是否可见
Parameters
Name | Type | Description |
---|---|---|
val | boolean | 布尔值 |
Returns
void
Inherited from
McDbEntity.visible
Methods
GetAllText
▸ GetAllText(): McGeStringArray
得到标注对象中的所有文字内容
Returns
IntersectWith
▸ IntersectWith(intersectObject
, exOption
): McGePoint3dArray
与其他实体相交, 得到交点
Example
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
Name | Type | Description |
---|---|---|
intersectObject | McDbEntity | 需要相交的是实体对象 |
exOption | Intersect | 相交的选项 |
Returns
得到所有交点
Inherited from
clone
▸ clone(): null
| McDbObject
克隆对象。
Returns
null
| McDbObject
克隆出的对象。
Inherited from
constructor_MxCADResbuf
▸ Protected
constructor_MxCADResbuf(imp
): void
Parameters
Name | Type |
---|---|
imp | any |
Returns
void
Inherited from
McDbEntity.constructor_MxCADResbuf
createExtensionDictionary
▸ createExtensionDictionary(): boolean
创建对象的扩展字典数据.
Returns
boolean
Inherited from
McDbEntity.createExtensionDictionary
deleteXData
▸ deleteXData(appName
): boolean
删除实体的指定 XData 类型中的点(McGePoint3d)值
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
Returns
boolean
Inherited from
disableDisplay
▸ disableDisplay(isDisable
): void
禁用对象的自动更新显示.
Example
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)
Parameters
Name | Type | Description |
---|---|---|
isDisable | boolean | 是否禁用对象自动更新显示 |
Returns
void
Inherited from
erase
▸ erase(): boolean
删除对象。
Returns
boolean
是否删除成功。
Inherited from
explode
▸ explode(): MxCADResbuf
打碎对象,返回打后对象数据链表
Returns
Inherited from
freeTempRelationObject
▸ freeTempRelationObject(): void
释放临时关系对象
Returns
void
Inherited from
McDbEntity.freeTempRelationObject
getAllAppName
▸ getAllAppName(): McGeStringArray
获取实体中包含的所有 XData 记录的应用程序名(AppName)
Returns
Inherited from
getArea
▸ getArea(): Object
计算面积
Returns
Object
val 面积值 | ret 是否获取成功
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
getBoundingBox
▸ getBoundingBox(): Object
得到对象的最小外包
Example
import { McDbText, McGePoint3d } from 'mxcad'
const text = new McDbText();
text.textString = "测试Test";
text.height = 20;
line.startPoint = new McGePoint3d(0,0,0);
const { minPt, maxPt, ret } = text.getBoundingBox()
Returns
Object
Name | Type |
---|---|
maxPt | McGePoint3d |
minPt | McGePoint3d |
ret | boolean |
Inherited from
getDatabase
▸ getDatabase(): McDbDatabase
得到对象所在的数据库
Returns
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
获取对象的索引ID
Returns
number
Inherited from
getDimVarDouble
▸ getDimVarDouble(iType
): number
获取标注变量浮点数值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
Returns
number
标注变量浮点数值
getDimVarInt
▸ getDimVarInt(iType
): number
获取标注变量整数值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
Returns
number
标注变量整数值
getDimVarObjectId
▸ getDimVarObjectId(iType
): McObjectId
获取标注变量对象 ID
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
Returns
标注变量对象 ID
getDimVarString
▸ getDimVarString(iType
): string
获取标注变量字符串值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
Returns
string
标注变量字符串值
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
得到对象的扩展字典数据.
Returns
Inherited from
McDbEntity.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
获取对象的控制点
Returns
Inherited from
getHandle
▸ getHandle(): string
得到对象句柄
Returns
string
Inherited from
getImp
▸ getImp(): any
获取内部实现对象。
Returns
any
内部实现对象。
Inherited from
getJson
▸ getJson(): string
获取 JSON 格式的字符串。
Returns
string
JSON 格式的字符串。
Inherited from
getObjectID
▸ getObjectID(): McObjectId
获取对象 ID。
Returns
对象 ID。
Inherited from
getOwnerID
▸ getOwnerID(): number
得到对象拥用者的id
Returns
number
Inherited from
getxData
▸ getxData(appName?
): MxCADResbuf
得到对象的扩展数据
Parameters
Name | Type | Default value | Description |
---|---|---|---|
appName | string | "" | XData 类型 |
Returns
Inherited from
getxDataDouble
▸ getxDataDouble(appName
): Object
获取或设置实体的指定 XData 类型中的 double 值
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
Returns
Object
double 值
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
getxDataLong
▸ getxDataLong(appName
): Object
获取或设置实体的指定 XData 类型中的 long(整数)值
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
Returns
Object
long 值
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
getxDataPoint
▸ getxDataPoint(appName
): Object
获取或设置实体的指定 XData 类型中的点对象
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
Returns
Object
Name | Type |
---|---|
ret | boolean |
val | McGePoint3d |
Inherited from
getxDataString
▸ getxDataString(appName
): Object
获取与特定实体关联的 XData 信息,并以字符串形式返回
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
Returns
Object
val XData信息 | ret 是否返回成功
Name | Type |
---|---|
ret | boolean |
val | string |
Inherited from
highlight
▸ highlight(isHighlight
): void
设置对象是否高亮
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.isHighlight(true);
Parameters
Name | Type | Description |
---|---|---|
isHighlight | boolean | 是否高亮 |
Returns
void
Inherited from
initTempObject
▸ initTempObject(imp
): void
初始化临时对象。
Parameters
Name | Type | Description |
---|---|---|
imp | any | 内部实现对象。 |
Returns
void
Inherited from
isErased
▸ isErased(): boolean
对象是否已经删除
Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
是否有扩展字典数据.
Returns
boolean
Inherited from
McDbEntity.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName
): boolean
Parameters
Name | Type |
---|---|
sObjectName | string |
Returns
boolean
Inherited from
isNull
▸ isNull(): any
Returns
any
Inherited from
isUsingDefaultTextPosition
▸ isUsingDefaultTextPosition(): boolean
是否使用默认文本位置
Returns
boolean
是否使用默认文本位置
mirror
▸ mirror(point1
, point2
): boolean
镜向对象
Parameters
Name | Type | Description |
---|---|---|
point1 | McGePoint3d | 镜像基点 |
point2 | McGePoint3d | 镜像点 |
Returns
boolean
Inherited from
move
▸ move(fromPoint
, toPoint
): boolean
移动对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))
Parameters
Name | Type | Description |
---|---|---|
fromPoint | McGePoint3d | 移动开始点 |
toPoint | McGePoint3d | 移动结束点 |
Returns
boolean
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex
, dXOffset
, dYOffset
, dZOffset
): any
移动对象的控制点
Parameters
Name | Type | Description |
---|---|---|
iIndex | number | 索引 |
dXOffset | number | X轴偏移量 |
dYOffset | number | Y轴偏移量 |
dZOffset | number | Z轴偏移量 |
Returns
any
Inherited from
recomputeDimBlock
▸ recomputeDimBlock(): void
重新计算标注块
Returns
void
rotate
▸ rotate(basePoint
, dRotationAngle
): boolean
旋转对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)
Parameters
Name | Type | Description |
---|---|---|
basePoint | McGePoint3d | 旋转基点 |
dRotationAngle | number | 旋转角度 |
Returns
boolean
Inherited from
scaleEntity
▸ scaleEntity(basePoint
, dScaleFactor
): boolean
缩放对象
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)
Parameters
Name | Type | Description |
---|---|---|
basePoint | McGePoint3d | 缩放基点 |
dScaleFactor | number | 缩放因子(<1 缩小; >1 放大) |
Returns
boolean
Inherited from
setDimVarDouble
▸ setDimVarDouble(iType
, val
): void
设置标注变量浮点数值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
val | number | 标注变量浮点数值 |
Returns
void
setDimVarInt
▸ setDimVarInt(iType
, val
): void
设置标注变量整数值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
val | number | 标注变量整数值 |
Returns
void
setDimVarObjectId
▸ setDimVarObjectId(iType
, val
): void
设置标注变量对象 ID
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
val | McObjectId | 标注变量对象 ID |
Returns
void
setDimVarString
▸ setDimVarString(iType
, val
): void
设置标注变量字符串值
Parameters
Name | Type | Description |
---|---|---|
iType | number | 标注变量类型 |
val | string | 标注变量字符串值 |
Returns
void
setJson
▸ setJson(str
): boolean
设置 JSON 格式的字符串。
Parameters
Name | Type | Description |
---|---|---|
str | string | JSON 格式的字符串。 |
Returns
boolean
是否设置成功。
Inherited from
setxData
▸ setxData(xdata
): boolean
设置对象的扩展数据
Parameters
Name | Type | Description |
---|---|---|
xdata | MxCADResbuf | resbuf 数据 |
Returns
boolean
Inherited from
setxDataDouble
▸ setxDataDouble(appName
, val
): boolean
Parameters
Name | Type |
---|---|
appName | string |
val | number |
Returns
boolean
Inherited from
setxDataLong
▸ setxDataLong(appName
, val
): boolean
Parameters
Name | Type |
---|---|
appName | string |
val | number |
Returns
boolean
Inherited from
setxDataPoint
▸ setxDataPoint(appName
, val
): boolean
Parameters
Name | Type |
---|---|
appName | string |
val | McGePoint3d |
Returns
boolean
Inherited from
setxDataString
▸ setxDataString(appName
, val
): boolean
设置与特定实体关联的 XData 信息,并以字符串形式设置
Parameters
Name | Type | Description |
---|---|---|
appName | string | XData 类型 |
val | string | XData信息 |
Returns
boolean
是否设置成功
Inherited from
syncData
▸ syncData(_toCpp?
): boolean
同步实体的数据。这个方法可能是在修改了实体的属性或者附加了新的数据之后调用的,以确保所有的改变都被正确地保存到实体的数据库记录中。
Parameters
Name | Type | Default value | Description |
---|---|---|---|
_toCpp | boolean | true | 是否同步数据 |
Returns
boolean
Inherited from
tempRelationObject
▸ tempRelationObject(): number
与对象相关的临时关系数
Returns
number
Inherited from
transformBy
▸ transformBy(transformationMatrix
): boolean
变换对象
Example
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
Name | Type | Description |
---|---|---|
transformationMatrix | McGeMatrix3d | 变换矩阵 |
Returns
boolean
Inherited from
unErase
▸ unErase(): boolean
反删除对象。
Returns
boolean
Inherited from
updateDisplay
▸ updateDisplay(): void
显示调用对象更新显示.
Returns
void
Inherited from
useDefaultTextPosition
▸ useDefaultTextPosition(): void
使用默认文本位置
Returns
void
useSetTextPosition
▸ useSetTextPosition(): void
使用设置的文本位置
Returns
void