Skip to content
On this page

mxcad_2d API 文档 / 2d / McDbXrecord

Class: McDbXrecord

2d.McDbXrecord

扩展记录类型,实体可以设置它的扩展记录,用于存放更多的信息。

Example

ts
//写扩展记录
import { MxCpp, McDbDictionary, McDbXrecord, MxCADResbuf } from "mxcad"

let mxcad = MxCpp.getCurrentMxCAD();
let dict = mxcad.getDatabase().getNamedObjectsDictionary();

let sName = "MyDict";
let idDict = dict.getAt(sName);
if (idDict.isNull()) {
   let newDict = new McDbDictionary;
   idDict = dict.addObject(sName, newDict);
}
let myDict = idDict.getMcDbDictionary();
if (myDict) {
   let xrec = new McDbXrecord();
   let data = new MxCADResbuf();
   data.AddString("TestData");
   xrec.setData(data);
   myDict.addObject("MyRecord", xrec);
   console.log("write xrecord ok");
}

// 读取扩展数据。
async function MxTest_ReadxData() {
  let selEntity = new MxCADUiPrEntity();
  selEntity.setMessage("选择对象");
  let id = await selEntity.go();
  if (!id.isValid()) return;

  let ent = id.getMcDbEntity();
  if (ent === null) return;

  let data = ent.getxData();
  data.forEach((val, type, dxf) => {
    console.log(JSON.stringify({ val: val, type: type, dxf: dxf }));
  })
  
  //let data = ent.getxDataString("DataName");
  //MxFun.acutPrintf(data.val + "\n");
}

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McDbXrecord(imp?)

构造函数。

Parameters

NameTypeDescription
imp?any内部实现对象。

Overrides

McDbObject.constructor

Properties

imp

imp: any = 0

内部实现对象。

Inherited from

McDbObject.imp

Accessors

dxf0

get dxf0(): string

获取 DXF 代码 0 的值。

Returns

string

Inherited from

McDbObject.dxf0


objectName

get objectName(): string

获取对象名称。

Returns

string

Inherited from

McDbObject.objectName

Methods

clone

clone(): null | McDbObject

克隆对象。

Returns

null | McDbObject

克隆出的对象。

Inherited from

McDbObject.clone


constructor_MxCADResbuf

Protected constructor_MxCADResbuf(imp): void

Parameters

NameType
impany

Returns

void

Inherited from

McDbObject.constructor_MxCADResbuf


createExtensionDictionary

createExtensionDictionary(): boolean

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

Returns

boolean

Inherited from

McDbObject.createExtensionDictionary


erase

erase(): boolean

删除对象。

Returns

boolean

是否删除成功。

Inherited from

McDbObject.erase


freeTempRelationObject

freeTempRelationObject(): void

释放临时关系对象

Returns

void

Inherited from

McDbObject.freeTempRelationObject


getData

getData(): MxCADResbuf

Returns

MxCADResbuf


getDatabase

getDatabase(): McDbDatabase

得到对象所在的数据库

Returns

McDbDatabase

Inherited from

McDbObject.getDatabase


getDatabaseIndexId

getDatabaseIndexId(): number

获取对象的索引ID

Returns

number

Inherited from

McDbObject.getDatabaseIndexId


getExtensionDictionary

getExtensionDictionary(): McDbDictionary

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

Returns

McDbDictionary

Inherited from

McDbObject.getExtensionDictionary


getGripPoints

getGripPoints(): McGePoint3dArray

获取对象的控制点

Returns

McGePoint3dArray

Inherited from

McDbObject.getGripPoints


getHandle

getHandle(): string

得到对象句柄

Returns

string

Inherited from

McDbObject.getHandle


getImp

getImp(): any

获取内部实现对象。

Returns

any

内部实现对象。

Inherited from

McDbObject.getImp


getJson

getJson(): string

获取 JSON 格式的字符串。

Returns

string

JSON 格式的字符串。

Inherited from

McDbObject.getJson


getObjectID

getObjectID(): McObjectId

获取对象 ID。

Returns

McObjectId

对象 ID。

Inherited from

McDbObject.getObjectID


getOwnerID

getOwnerID(): number

得到对象拥用者的id

Returns

number

Inherited from

McDbObject.getOwnerID


initTempObject

initTempObject(imp): void

初始化临时对象。

Parameters

NameTypeDescription
impany内部实现对象。

Returns

void

Inherited from

McDbObject.initTempObject


isErased

isErased(): boolean

对象是否已经删除

Returns

boolean

Inherited from

McDbObject.isErased


isHaveExtensionDictionary

isHaveExtensionDictionary(): boolean

是否有扩展字典数据.

Returns

boolean

Inherited from

McDbObject.isHaveExtensionDictionary


isKindOf

isKindOf(sObjectName): boolean

判断对象类型

Parameters

NameTypeDescription
sObjectNamestring类型名

Returns

boolean

返回对象是否是目标类型

Inherited from

McDbObject.isKindOf


isNull

isNull(): any

判断是否为空对象

Returns

any

Inherited from

McDbObject.isNull


moveGripPointsAt

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

移动对象的控制点

Parameters

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

Returns

any

Inherited from

McDbObject.moveGripPointsAt


setData

setData(xdata): boolean

设置或获取扩展记录中的数据。

Parameters

NameType
xdataMxCADResbuf

Returns

boolean


setJson

setJson(str): boolean

设置 JSON 格式的字符串。

Parameters

NameTypeDescription
strstringJSON 格式的字符串。

Returns

boolean

是否设置成功。

Inherited from

McDbObject.setJson


tempRelationObject

tempRelationObject(): number

与对象相关的临时关系数

Returns

number

Inherited from

McDbObject.tempRelationObject


unErase

unErase(): boolean

反删除对象。

Returns

boolean

Inherited from

McDbObject.unErase