Skip to content
On this page

mxcad_2d API 文档 / 2d / McDb2LineAngularDimension

Class: McDb2LineAngularDimension

2d.McDb2LineAngularDimension

角度标注尺寸类。

Example

ts
import { MxCpp, MxDb2LineAngularDimension, MxCADUiPrPoint } from "mxcad";
 // 下面代码演示了,先选择需要测量角度的两条边,再设置角度标注位置,最后绘制出角度标注对象。
 function BR_AngleMeasure() {
   const angleDim = new McDb2LineAngularDimension();// 构造新角度标注尺寸对象
   // 设置角边1起点
   const getPoint1 = new MxCADUiPrPoint()
   getPoint1.setMessage("\n指定线1起点:");
   const point1 = await getPoint1.go();
   if(!point1) return;
   angleDim.xLine1Start = point1;
   // 设置角边1终点 
   const getPoint2 = new MxCADUiPrPoint()
   getPoint1.setMessage("\n指定线1终点:");
   const point2 = await getPoint2.go();
   if(!point2) return;
   angleDim.xLine1End = point2;
   // 设置角边2起点
   const getPoint3 = new MxCADUiPrPoint()
   getPoint3.setMessage("\n指定线2起点:");
   const point3 = await getPoint3.go();
   if(!point3) return;
   angleDim.xLine2Start = point3;
   // 设置角边2终点 
   const getPoint4 = new MxCADUiPrPoint();
   getPoint4.setMessage("\n指定线2终点:");
   const point4 = await getPoint4.go();
   if(!point4) return;
   angleDim.xLine2End = point4;
   // 设置角度标注位置
   const getArcPoint = new MxCADUiPrPoint()
   getPoint3.setMessage("\n指定标注点:");
   const arcPoint = await getArcPoint.go();
   if(!arcPoint) return;
   angleDim.arcPoint = arcPoint;
   // 绘制角度标注尺寸对象
   MxCpp.getCurrentMxCAD().drawEntity(angleDim);
}

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDb2LineAngularDimension(imp?)

构造函数

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

const angleDim = new McDb2LineAngularDimension()

Parameters

NameTypeDescription
imp?any内部实现对象

Overrides

McDbDimension.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbDimension.imp

Accessors

arcPoint

get arcPoint(): McGePoint3d

获取或设置角度标注在圆弧上的点

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const angleDim = new McDb2LineAngularDimension();
   const getArcPoint = new MxCADUiPrPoint();
   getArcPoint.setMessage("\n指定标注点:");
   const arcPoint = await getArcPoint.go();
   if(!arcPoint) return;
   angleDim.arcPoint = arcPoint;
   console.log("输出文本标注点" , angleDim.arcPoint)

Returns

McGePoint3d

角度标注在圆弧上的点

set arcPoint(pt): void

Parameters

NameType
ptMcGePoint3d

Returns

void


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


dimensionStyle

get dimensionStyle(): McObjectId

设置标注样式id

Example

ts
import { MxCpp } from "mxcad";

//设置 dim 为有效标注实体
const dimStyleId = MxCpp.getCurrentMxCAD().addDimStyle("MyDimStyle2", "41,0.18,141,0.09,40,200", "77,1,271,3", "", "");
dim.dimensionStyle = dimStyleId;
console.log("标注样式id:", dim.dimensionStyle)

Returns

McObjectId

Inherited from

McDbDimension.dimensionStyle

set dimensionStyle(val): void

Parameters

NameType
valMcObjectId

Returns

void

Inherited from

McDbDimension.dimensionStyle


dimensionText

get dimensionText(): string

获取或设置标注文本

Example

ts
//设置 dim 为有效标注实体
dim.dimensionText = "测试文本";
console.log("标注文本:", dim.dimensionText)// 测试文本

Returns

string

Inherited from

McDbDimension.dimensionText

set dimensionText(val): void

Parameters

NameType
valstring

Returns

void

Inherited from

McDbDimension.dimensionText


drawOrder

get drawOrder(): number

对象的显示顺序

Example

ts
// 假设ent为有效实例对象
const order = ent.drawOrder();

Returns

number

Inherited from

McDbDimension.drawOrder

set drawOrder(order): void

对象的显示顺序

Example

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

let ss = new MxCADSelectionSet();
if (!await ss.userSelect("\n选择对象")) return;
//得到当前图上对象的最大,小最显示顺序.
let minmaxOrder = MxCpp.getCurrentDatabase().currentSpace.getMinMaxDrawOrder();
// 把对象放到最上面。
let lOrder = minmaxOrder.maxDrawOrder + 1;
ss.forEach((id) => {
  let ent = id.getMcDbEntity();
  if (ent) {
    ent.drawOrder = lOrder;
  }
})

Parameters

NameTypeDescription
ordernumber顺序值

Returns

void

Inherited from

McDbDimension.drawOrder


dxf0

get dxf0(): string

得到对象的DXF组码的类型名,这个和AutoCAD中的DXF组码是一样。 比如直线的类型名为:McDbLine,DXF0组码值: LINE,DXF0组码值可以用来构造集时的类型过滤。

Returns

string

Inherited from

McDbDimension.dxf0


elevation

get elevation(): number

获取或设置高度

Example

ts
//设置 dim 为有效标注实体
dim.elevation = 10;
console.log("获取高度:", dim.elevation)

Returns

number

Inherited from

McDbDimension.elevation

set elevation(val): void

Parameters

NameType
valnumber

Returns

void

Inherited from

McDbDimension.elevation


horizontalRotation

get horizontalRotation(): number

获取或设置水平旋转角度

Example

ts
//设置 dim 为有效标注实体
dim.horizontalRotation = Math.PI/4
console.log("水平旋转角度:", dim.horizontalRotation)// 45

Returns

number

水平旋转角度

Inherited from

McDbDimension.horizontalRotation

set horizontalRotation(val): void

Parameters

NameType
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对象

Example

ts
// 假设ent为有效实例对象
const layerId = ent.layerId;

Returns

McObjectId

Inherited from

McDbDimension.layerId

set layerId(id): void

设置图层Id对象

Example

ts
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const layerId = mxcad.addLayer("测试图层")
ent.layerId = layerId;

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

Example

ts
// 假设ent为有效实例对象
const linetypeId = ent.linetypeId;

Returns

McObjectId

Inherited from

McDbDimension.linetypeId

set linetypeId(id): void

设置实体对象线型ID

Example

ts
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const lineId = mxcad.addLinetypeEx("TestMyLine", '25,-5');
ent.linetypeId = lineId;

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


normal

get normal(): McGeVector3d

返回对象的normal

Example

ts

Returns

McGeVector3d

Inherited from

McDbDimension.normal

set normal(val): void

设置对象的normal

Example

ts

Parameters

NameType
valMcGeVector3d

Returns

void

Inherited from

McDbDimension.normal


objectName

get objectName(): string

获取对象名称。

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

string

返回对象名

Inherited from

McDbDimension.objectName


textAttachment

get textAttachment(): AttachmentPoint

获取或设置文本附着点

Example

ts
import { McDb } from "mxcad";

//设置 dim 为有效标注实体
dim.textAttachment = McDb.AttachmentPoin.kMiddleCenter//设置中心点对齐
console.log("文本附着点:", dim.textAttachment)// 5

Returns

AttachmentPoint

文本附着点

Inherited from

McDbDimension.textAttachment

set textAttachment(val): void

Parameters

NameType
valAttachmentPoint

Returns

void

Inherited from

McDbDimension.textAttachment


textPosition

get textPosition(): McGePoint3d

获取文本位置

Example

ts
//设置 dim 为有效标注实体
const position = dim.textPosition;
console.log(position);

Returns

McGePoint3d

文本位置

Inherited from

McDbDimension.textPosition

set textPosition(pt): void

设置文本位置

Example

ts
//设置 dim 为有效标注实体
dim.textPosition = new McGePoint3(0,0,0);

Parameters

NameTypeDescription
ptMcGePoint3d文本位置

Returns

void

Inherited from

McDbDimension.textPosition


textRotation

get textRotation(): number

获取或设置文本旋转角度

Example

ts
//设置 dim 为有效标注实体
dim.textRotation = Math.PI/4;
console.log("旋转角度:", dim.textRotation)

Returns

number

Inherited from

McDbDimension.textRotation

set textRotation(val): void

Parameters

NameType
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

获取实体文字样式

Example

ts
// 假设ent为有效实例对象
const textStyleId = ent.textStyleId;

Returns

McObjectId

Inherited from

McDbDimension.textStyleId

set textStyleId(id): void

设置实体的文字样式

Example

ts
// 假设ent为有效实例对象
const mxcad = MxCpp.getCurrentMxCAD();
const textStyleId = mxcad.addTextStyle("MyLineTypeTextStyle", "txt.shx", "hztxt.shx", 1);
ent.textStyleId = textStyleId;

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


xLine1End

get xLine1End(): McGePoint3d

获取或设置角度标注第一个参考线的结束点

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const angleDim = new McDb2LineAngularDimension()
   const getPoint2 = new MxCADUiPrPoint()
   getPoint2.setMessage("\n指定线1终点:");
   const point2 = await getPoint2.go();
   if(!point2) return;
   angleDim.xLine1End = point2;
   console.log(angleDim.xLine1End)

Returns

McGePoint3d

角度标注第一个参考线的结束点

set xLine1End(pt): void

Parameters

NameType
ptMcGePoint3d

Returns

void


xLine1Start

get xLine1Start(): McGePoint3d

获取或设置角度标注第一个参考线的开始点

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const angleDim = new McDb2LineAngularDimension()
   const getPoint1 = new MxCADUiPrPoint()
   getPoint1.setMessage("\n指定线1起点:");
   const point1 = await getPoint1.go();
   if(!point1) return;
   angleDim.xLine1Start = point1;
   console.log(angleDim.xLine1Start)

Returns

McGePoint3d

角度标注第一个参考线的开始点

set xLine1Start(pt): void

Parameters

NameType
ptMcGePoint3d

Returns

void


xLine2End

get xLine2End(): McGePoint3d

获取或设置角度标注第二个参考线的结束点

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const angleDim = new McDb2LineAngularDimension()
   const getPoint4 = new MxCADUiPrPoint()
   getPoint4.setMessage("\n指定线2终点:");
   const point4 = await getPoint4.go();
   if(!point4) return;
   angleDim.xLine2End = point4;
   console.log(angleDim.xLine2End)

Returns

McGePoint3d

角度标注第二个参考线的结束点

set xLine2End(pt): void

Parameters

NameType
ptMcGePoint3d

Returns

void


xLine2Start

get xLine2Start(): McGePoint3d

获取或设置角度标注第二个参考线的开始点

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const angleDim = new McDb2LineAngularDimension()
   const getPoint3 = new MxCADUiPrPoint()
   getPoint3.setMessage("\n指定线2起点:");
   const point3 = await getPoint3.go();
   if(!point3) return;
   angleDim.xLine2Start = point3;
   console.log(angleDim.xLine2Start);

Returns

McGePoint3d

角度标注第二个参考线的开始点

set xLine2Start(pt): void

Parameters

NameType
ptMcGePoint3d

Returns

void

Methods

GetAllText

GetAllText(): McGeStringArray

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

Example

ts
//遍历dim中的所有文字
//设置 dim 为有效标注实体
let txts = dim.GetAllText();
txts.forEach((val, index) => {
  console.log(val)
});

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


assertObjectModification

assertObjectModification(autoUndo?): number

设置对象被改变的状态,可自动触发更新显示函数,更新显示。 比如块表记录更新了,需要通知块引用更新显示,可以调用该函数。

Example

ts
//假设obj为一个数据库对象
obj.assertObjectModification()

Parameters

NameTypeDefault value
autoUndobooleanfalse

Returns

number

Inherited from

McDbDimension.assertObjectModification


clone

clone(): null | McDbObject

克隆对象。

Example

ts
//假设obj为一个数据库对象
const obj_clone = obj.clone();

Returns

null | McDbObject

克隆出的对象。

Inherited from

McDbDimension.clone


compute

compute(dAngleVertexX, dAngleVertexY, dFirstEndPointX, dFirstEndPointY, dSecondEndPointX, dSecondEndPointY, dTextPointX, dTextPointY): boolean

通过参数计算角度标注

Example

ts
import { McDb2LineAngularDimension } from "mxcad";

   const dimension = new McDb2LineAngularDimension()
   // 设置计算维度所需的参数
   const dAngleVertexX = 0;
   const dAngleVertexY = 0;
   const dFirstEndPointX = 1;
   const dFirstEndPointY = 2;
   const dSecondEndPointX = 3;
   const dSecondEndPointY = 4;
   const dTextPointX = 5;
   const dTextPointY = 6;

   // 调用 compute 方法计算维度
   const result = dimension.compute(
       dAngleVertexX,
       dAngleVertexY,
       dFirstEndPointX,
       dFirstEndPointY,
       dSecondEndPointX,
       dSecondEndPointY,
       dTextPointX,
       dTextPointY
   );
   if (result) {
       console.log("计算成功");
   } else {
       console.error("计算失败");
   }

Parameters

NameTypeDescription
dAngleVertexXnumber角度向量X轴值
dAngleVertexYnumber角度向量Y轴值
dFirstEndPointXnumber标注线1结束点X轴值
dFirstEndPointYnumber标注线1结束点Y轴值
dSecondEndPointXnumber标注线2结束点X轴值
dSecondEndPointYnumber标注线2结束点Y轴值
dTextPointXnumber标注文字X轴值
dTextPointYnumber标注文字Y轴值

Returns

boolean

返回布尔值


createExtensionDictionary

createExtensionDictionary(): boolean

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

Example

ts
//假设obj为一个数据库对象
const res = obj.createExtensionDictionary();

Returns

boolean

Inherited from

McDbDimension.createExtensionDictionary


deleteXData

deleteXData(appName): boolean

删除实体指定应用程序名称相关的数据

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.deleteXData("DataName");
if(res){
  //删除成功
}else
  //删除失败
}

Parameters

NameTypeDescription
appNamestring扩展数据名称

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

删除对象。

Example

ts
//假设obj为一个数据库对象
const res = obj.erase();
console.log(res);

Returns

boolean

是否删除成功。

Inherited from

McDbDimension.erase


explode

explode(): MxCADResbuf

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

Example

ts
import { McDbEntity, MxCADResbuf } from "mxcad";
// 获取目标对象
let getEnt = new MxCADUiPrEntity();
getEnt.setMessage("选择打碎对象:");
let id = await getEnt.go();
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
// 打碎对象
let retExplode: MxCADResbuf = ent.explode();

Returns

MxCADResbuf

resbuf 数据

Inherited from

McDbDimension.explode


getAllAppName

getAllAppName(): McGeStringArray

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

Example

ts
// 假设ent为有效实例对象
const appNames = ent.getAllAppName();
console.log(appNames);

Returns

McGeStringArray

Inherited from

McDbDimension.getAllAppName


getArea

getArea(): Object

计算面积

Example

ts
import { McGePoint3d, McDbCircle } from "mxcad"

const center = new McGePoint3d(0,0,0);
const circle = new McDbCircle(center, 20);
const area = circle.getArea();
console.log("圆面积:", area)

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

得到对象所在的数据库

Example

ts
//假设obj为一个数据库对象
const data = obj.getDatabase();

Returns

McDbDatabase

返回数据库

Inherited from

McDbDimension.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Example

ts
//假设obj为一个数据库对象
const id = obj.getDatabaseIndexId();

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

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

Example

ts
//假设obj为一个数据库对象
const id = obj.getOwnerID();

Returns

McDbDictionary

扩展字典数据

Inherited from

McDbDimension.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的控制点

Example

ts
//假设obj为一个数据库对象
const ptArr = obj.getGripPoints();

Returns

McGePoint3dArray

Inherited from

McDbDimension.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Example

ts
//假设obj为一个数据库对象
const handle = obj.getHandle();

Returns

string

返回对象句柄

Inherited from

McDbDimension.getHandle


getImp

getImp(): any

获取内部实现对象。

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

any

内部实现对象。

Inherited from

McDbDimension.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

string

JSON 格式的字符串。

Inherited from

McDbDimension.getJson


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Example

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

Returns

McObjectId

对象 ID。

Inherited from

McDbDimension.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Example

ts
//假设obj为一个数据库对象
const id = obj.getOwnerID();

Returns

number

Inherited from

McDbDimension.getOwnerID


getxData

getxData(appName?): MxCADResbuf

得到对象的扩展数据

Example

ts
// 假设ent为有效实例对象
const xData = ent.getXData();

Parameters

NameTypeDefault valueDescription
appNamestring""扩展数据名

Returns

MxCADResbuf

Inherited from

McDbDimension.getxData


getxDataDouble

getxDataDouble(appName): Object

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

Example

ts
// 假设ent为有效实例对象
let data = ent.getxDataDouble("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
appNamestring扩展数据名称

Returns

Object

double 值

NameType
retboolean
valnumber

Inherited from

McDbDimension.getxDataDouble


getxDataLong

getxDataLong(appName): Object

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

Example

ts
// 假设ent为有效实例对象
let data = ent.getxDataLong("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
appNamestring扩展数据名称

Returns

Object

long 值

NameType
retboolean
valnumber

Inherited from

McDbDimension.getxDataLong


getxDataPoint

getxDataPoint(appName): Object

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

Parameters

NameTypeDescription
appNamestring扩展数据名称

Returns

Object

获取结果及三维点对象

NameType
retboolean
valMcGePoint3d

Inherited from

McDbDimension.getxDataPoint


getxDataString

getxDataString(appName): Object

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

Example

ts
// 假设ent为有效实例对象
let data = ent.getxDataString("DataName");
if(data.ret){
  console.log(data.val)
}

Parameters

NameTypeDescription
appNamestring扩展数据名称

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.highlight(true);

Parameters

NameTypeDescription
isHighlightboolean是否高亮

Returns

void

Inherited from

McDbDimension.highlight


initTempObject

initTempObject(imp): void

初始化临时对象。

Example

ts
import { McRxObject } from 'mxcad';

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

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Inherited from

McDbDimension.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Example

ts
//假设obj为一个数据库对象
const res = obj.isErased();
console.log(res);

Returns

boolean

Inherited from

McDbDimension.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Example

ts
//假设obj为一个数据库对象
const res = obj.isHaveExtensionDictionary();

Returns

boolean

Inherited from

McDbDimension.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

判断对象类型

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); // 输出: true 或 false

Parameters

NameTypeDescription
sObjectNamestring类型名

Returns

boolean

返回对象是否是目标类型

Inherited from

McDbDimension.isKindOf


isNull

isNull(): any

判断是否为空对象

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.isNull()); // 输出: true 或 false

Returns

any

Inherited from

McDbDimension.isNull


isUsingDefaultTextPosition

isUsingDefaultTextPosition(): boolean

是否使用默认文本位置

Example

ts
//设置 dim 为有效标注实体
const isUsing = dim.isUsingDefaultTextPosition;
if(isUsing){
   //使用默认文本位置
}else{
   //未使用默认文本位置
}

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

移动对象的控制点

Example

ts
//假设obj为一个数据库对象
obj.moveGripPointsAt(1,10,10,10);

Parameters

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

Returns

any

Inherited from

McDbDimension.moveGripPointsAt


recomputeDimBlock

recomputeDimBlock(): void

重新计算标注块

Example

ts
dim.recomputeDimBlock()

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 格式的字符串。

Example

ts
import { McRxObject } from 'mxcad';

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

Parameters

NameTypeDescription
strstringJSON 格式的字符串。

Returns

boolean

是否设置成功。

Inherited from

McDbDimension.setJson


setxData

setxData(xdata): boolean

设置对象的扩展数据

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

//设置扩展数据
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
ent.setxData(new MxCADResbuf([{type:DxfCode.kExDataName,val:"DataName"},{type:DxfCode.kString,val:"yyyyy"}]));

Parameters

NameTypeDescription
xdataMxCADResbuf扩展数据链表

Returns

boolean

Inherited from

McDbDimension.setxData


setxDataDouble

setxDataDouble(appName, val): boolean

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

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataDouble("DataName", 0);
if(res){
  //设置成功
}else{
  //设置失败
}

Parameters

NameTypeDescription
appNamestring扩展数据名称
valnumberdouble 值

Returns

boolean

布尔值

Inherited from

McDbDimension.setxDataDouble


setxDataLong

setxDataLong(appName, val): boolean

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

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";

let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataLong("DataName", 123456);
if(res){
  //设置成功
}else{
  //设置失败
}

Parameters

NameTypeDescription
appNamestring扩展数据名称
valnumberlong 值

Returns

boolean

long 值

Inherited from

McDbDimension.setxDataLong


setxDataPoint

setxDataPoint(appName, val): boolean

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

Parameters

NameTypeDescription
appNamestring扩展数据名称
valMcGePoint3d点对象

Returns

boolean

获取结果及三维点对象

Inherited from

McDbDimension.setxDataPoint


setxDataString

setxDataString(appName, val): boolean

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

Example

ts
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
selEntity.setMessage("选择对象");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataString("DataName", "xxxxx");
if(res){
  //设置成功
}else{
  //设置失败
}

Parameters

NameTypeDescription
appNamestring扩展数据名称
valstring字符串值

Returns

boolean

是否设置成功

Inherited from

McDbDimension.setxDataString


syncData

syncData(_toCpp?): boolean

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

Example

ts
// 假设ent为有效实例对象
const res = ent.syncData(true);
if(res){
  //同步成功
}else{
  //同步失败
}

Parameters

NameTypeDefault valueDescription
_toCppbooleantrue是否同步数据

Returns

boolean

Inherited from

McDbDimension.syncData


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

反删除对象。

Example

ts
//假设obj为一个数据库对象
const res = obj.unErase();
console.log(res);

Returns

boolean

Inherited from

McDbDimension.unErase


updateDisplay

updateDisplay(): void

显示调用对象更新显示.

Example

ts
// 假设ent为有效实例对象
ent.updateDisplay()

Returns

void

Inherited from

McDbDimension.updateDisplay


useDefaultTextPosition

useDefaultTextPosition(): void

使用默认文本位

Example

ts
//设置 dim 为有效标注实体
dim.useDefaultTextPosition();

Returns

void

Inherited from

McDbDimension.useDefaultTextPosition


useSetTextPosition

useSetTextPosition(): void

使用设置的文本位置

Example

ts
//设置 dim 为有效标注实体
dim.useSetTextPosition();

Returns

void

Inherited from

McDbDimension.useSetTextPosition