Skip to content
On this page

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

Class: McRxObject

2d.McRxObject

Represents the base class of an Rx object.

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new McRxObject(imp?)

Constructor.

Example

ts
import { McRxObject } from "mxcad"

  let obj = new McRxObject();

Parameters

NameTypeDescription
imp?AnyInternal implementation object

Properties

imp

imp: any = 0

Internal implementation object.

Accessors

dxf0

get dxf0(): string

Obtain the type name of the object's DXF group code, which is the same as the DXF group code in AutoCAD. For example, the type name of the line is McDbLine, and the group code value for DXF0 is: LINE and DXF0 group code values can be used for type filtering when constructing sets.

Returns

string


objectName

get objectName(): string

Get the object name.

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

string

Return object name

Methods

getImp

getImp(): any

Retrieve internal implementation objects.

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

any

Internal implementation object.


getJson

getJson(): string

Retrieve a string in JSON format.

Example

ts
import { McRxObject } from 'mxcad';

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

Returns

string

A string in JSON format.


initTempObject

initTempObject(imp): void

Initialize temporary objects.

Example

ts
import { McRxObject } from 'mxcad';

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

Parameters

NameTypeDescription
'imp''any'Internal implementation object

Returns

void


isKindOf

isKindOf(sObjectName): boolean

Determine object type

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); //  Output: True or false

Parameters

NameTypeDescription
SOrtNamestringType Name

Returns

boolean

Return whether the object is of the target type


isNull

isNull(): any

Determine if it is an empty object

Example

ts
import { McRxObject } from 'mxcad';

let obj = new McRxObject();
console.log(obj.isNull()); //  Output: True or false

Returns

any


setJson

setJson(str): boolean

Set a string in JSON format.

Example

ts
import { McRxObject } from 'mxcad';

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

Parameters

NameTypeDescription
StrstringJSON formatted string

Returns

boolean

Is the setting successful.