[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
- clone
- erase
- getMcDbBlockTableRecord
- getMcDbCurve
- getMcDbCustomEntity
- getMcDbDictionary
- getMcDbDimStyleTableRecord
- getMcDbDimension
- getMcDbEntity
- getMcDbLayerTableRecord
- getMcDbLinetypeTableRecord
- getMcDbObject
- getMcDbRasterImageDef
- getMcDbTextStyleTableRecord
- getMcDbXrecord
- getMxDbEntity
- getObjectName
- isErase
- isKindOf
- isNull
- isValid
Constructors
constructor
• new McObjectId(id?
, type?
)
Create an instance of McObjectid.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
The unique identifier of the 'id' | 'number' | '0' | object |
Type | [McObject IdType] (../enums/2d. McObject IdType. md) | McObject IdType. kInvalid | The 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
//Assuming that objectId is an object id
const obj_clone = objectId.clone();
erase
▸ erase(isErase?
): void
Delete object.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
IsErase | boolean | true | Do you want to delete it |
Returns
void
Example
//Assuming objectId is a model object id
objectId.erase();
getMcDbBlockTableRecord
▸ getMcDbBlockTableRecord(): null
| McDbBlockTableRecord
Return the MxCAD block table record object.
Returns
null
| McDbBlockTableRecord
Example
//Assuming objectId is a block object id
const blkRecord = objectId.getMcDbBlockTableRecord();
getMcDbCurve
▸ getMcDbCurve(): null
| McDbCurve
Return the MxCAD McDbCurve object.
Returns
null
| McDbCurve
Example
//Assuming objectId is a curve object id
const curve = objectId.getMcDbCurve();
getMcDbCustomEntity
▸ getMcDbCustomEntity(): null
| McDbCustomEntity
Get custom entity
Returns
null
| McDbCustomEntity
Example
//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
//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
getMcDbDimension
▸ getMcDbDimension(): null
| McDbDimension
Return the MxCAD McDbDimension object.
Returns
null
| McDbDimension
Example
//Assuming objectId is a annotation id
const dim = objectId.getMcDbDimension();
getMcDbEntity
▸ getMcDbEntity(): null
| McDbEntity
Return the MxCAD McDbEntity object.
Returns
null
| McDbEntity
Example
//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
//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
//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
//Assuming objectId is a model object id
const obj = objectId.getMcDbObject();
getMcDbRasterImageDef
▸ getMcDbRasterImageDef(): null
| McDbRasterImageDef
Obtain raster image information
Returns
null
| McDbRasterImageDef
Example
//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
//Assuming objectId is a text style id
const textStyleRecord = objectId.getMcDbTextStyleTableRecord();
getMcDbXrecord
▸ getMcDbXrecord(): null
| McDbXrecord
Retrieve extended record information
Returns
null
| McDbXrecord
Example
//Assuming that objectId is an object id
const Xrecord = objectId.getMcDbXrecord();
getMxDbEntity
▸ getMxDbEntity(): null
| MxDbEntity
Return the MxDraw object.
Returns
null
| MxDbEntity
Example
//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
//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
//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
Name | Type | Description |
---|---|---|
ClassName | string | Type Name |
Returns
boolean
Example
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
//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
//Assuming objectId is a model object id
const res = objectId.isValid();
console.log(res)