Skip to content
On this page

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

Class: McObjectId

2d.McObjectId

The McObjectid class represents a unique identifier for a model object.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new McObjectId(id?, type?)

Create an instance of McObjectid.

Parameters

NameTypeDefault valueDescription
The unique identifier of the 'id''number''0'object
Type[McObject IdType] (../enums/2d. McObject IdType. md)McObject IdType. kInvalidThe type of the object

Properties

id

id: number

Object ID


type

type: McObjectIdType

object type

Methods

clone

clone(): null | McDbObject

Clone object

Returns

null | McDbObject

Return cloned database objects

Example

ts
//Assuming that objectId is an object id
const obj_clone = objectId.clone();

erase

erase(isErase?): void

Delete object.

Parameters

NameTypeDefault valueDescription
IsErasebooleantrueDo you want to delete it

Returns

void

Example

ts
//Assuming objectId is a model object id
objectId.erase();

getMcDbBlockTableRecord

getMcDbBlockTableRecord(): null | McDbBlockTableRecord

Return the MxCAD block table record object.

Returns

null | McDbBlockTableRecord

Example

ts
//Assuming objectId is a block object id
const blkRecord = objectId.getMcDbBlockTableRecord();

getMcDbCurve

getMcDbCurve(): null | McDbCurve

Return the MxCAD McDbCurve object.

Returns

null | McDbCurve

Example

ts
//Assuming objectId is a curve object id
const curve = objectId.getMcDbCurve();

getMcDbCustomEntity

getMcDbCustomEntity(): null | McDbCustomEntity

Get custom entity

Returns

null | McDbCustomEntity

Example

ts
//Assuming objectId is a custom entity id
const customEnt = objectId.getMcDbCustomEntity();

getMcDbDictionary

getMcDbDictionary(): null | McDbDictionary

Retrieve dictionary information from the database

Returns

null | McDbDictionary

Example

ts
//Assuming that objectId is an object id
const dic = objectId.getMcDbDictionary();

getMcDbDimStyleTableRecord

getMcDbDimStyleTableRecord(): null | McDbDimStyleTableRecord

Return the MxCAD annotation sample table record object.

Returns

null | McDbDimStyleTableRecord

Example

ts

getMcDbDimension

getMcDbDimension(): null | McDbDimension

Return the MxCAD McDbDimension object.

Returns

null | McDbDimension

Example

ts
//Assuming objectId is a annotation id
const dim = objectId.getMcDbDimension();

getMcDbEntity

getMcDbEntity(): null | McDbEntity

Return the MxCAD McDbEntity object.

Returns

null | McDbEntity

Example

ts
//Assuming objectId is a graphic object id
const ent = objectId.getMcDbEntity();

getMcDbLayerTableRecord

getMcDbLayerTableRecord(): null | McDbLayerTableRecord

Return the recorded objects in the MxCAD layer table.

Returns

null | McDbLayerTableRecord

Example

ts
//Assuming objectId is a layer object id
const layerRecord = objectId.getMcDbLayerTableRecord();

getMcDbLinetypeTableRecord

getMcDbLinetypeTableRecord(): null | McDbLinetypeTableRecord

Return the MxCAD line type table record object.

Returns

null | McDbLinetypeTableRecord

Example

ts
//Assuming objectId is a linear object id
const lineTypeRecord = objectId.getMcDbLinetypeTableRecord();

getMcDbObject

getMcDbObject(): null | McDbObject

Return the MxCAD McDbObject object.

Returns

null | McDbObject

Return a database object

Example

ts
//Assuming objectId is a model object id
const obj = objectId.getMcDbObject();

getMcDbRasterImageDef

getMcDbRasterImageDef(): null | McDbRasterImageDef

Obtain raster image information

Returns

null | McDbRasterImageDef

Example

ts
//Assuming that objectId is an object id
const def = objectId.getMcDbRasterImageDef();

getMcDbTextStyleTableRecord

getMcDbTextStyleTableRecord(): null | McDbTextStyleTableRecord

Return the MxCAD text style sheet record object.

Returns

null | McDbTextStyleTableRecord

Example

ts
//Assuming objectId is a text style id
const textStyleRecord = objectId.getMcDbTextStyleTableRecord();

getMcDbXrecord

getMcDbXrecord(): null | McDbXrecord

Retrieve extended record information

Returns

null | McDbXrecord

Example

ts
//Assuming that objectId is an object id
const Xrecord = objectId.getMcDbXrecord();

getMxDbEntity

getMxDbEntity(): null | MxDbEntity

Return the MxDraw object.

Returns

null | MxDbEntity

Example

ts
//Assuming that objectId is an object id
const mx_obj = objectId.getMxDbEntity();

getObjectName

getObjectName(): string

Return the name of the object pointed to by the ID

Returns

string

Example

ts
//Assuming that objectId is an object id
const obj_name = objectId.getObjectName();

isErase

isErase(): boolean

Is the ID pointing to the object in a deleted state

Returns

boolean

Boolean value

Example

ts
//Assuming objectId is a model object id
const res = objectId.isErase();
console.log(res)

isKindOf

isKindOf(className): boolean

Determine the type of an object

Parameters

NameTypeDescription
ClassNamestringType Name

Returns

boolean

Example

ts
import { McDbLine, McGePoint3d, MxCpp } from 'mxcad';

const line = new McDbLine(new McGePoint3d(0,0,0),new McGePoint3d(20,20,0) );
const objectId = MxCpp.getCurrentCAD().drawEntity(line);
console.log(objectId.isKindOf('McDbLine'))

isNull

isNull(): boolean

Is the ID NULL

Returns

boolean

Boolean value

Example

ts
//Assuming objectId is a model object id
const res = objectId.isNull();
console.log(res)

isValid

isValid(): boolean

Is the ID valid

Returns

boolean

Boolean value

Example

ts
//Assuming objectId is a model object id
const res = objectId.isValid();
console.log(res)