[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McRxObject
Class: McRxObject
2d.McRxObject
McRxObject is the base class for all Rx objects in MxCAD, responsible for bridging the underlying C++/native objects with TypeScript.
Description
This class is used to encapsulate the general capabilities of underlying objects and provide a unified access point for various CAD objects. It can accomplish: -Obtain the underlying implementation object (imp); -Read/set JSON data of objects; -Determine whether the object is empty or belongs to a certain type; -As the parent class of other entity objects, it manages the lifecycle and object references uniformly for derived classes.
Usage:
- Inherit this class through specific subclasses and hold the underlying native object instance;
- Call methods such as getImp(), getJson(), setJson(), isKindOf() to access common capabilities;
- When needed, coordinate sub class objects to continue finer grained CAD data operations.
Summary: In practical development, McRxObject is usually not directly used for business drawing, but serves as a unified abstraction layer for underlying objects, allowing various CAD objects to inherit and extend, simplifying object lifecycle management and accessing general capabilities.
Hierarchy
McRxObject
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new McRxObject(imp?)
Constructor.
Parameters
| Name | Type | Description |
|---|---|---|
imp? | Any | Internal 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.
Returns
string
Return object name
Methods
getImp
▸ getImp(): any
Retrieve internal implementation objects.
Returns
any
Internal implementation object.
getJson
▸ getJson(): string
Retrieve a string in JSON format.
Returns
string
A string in JSON format.
initTempObject
▸ initTempObject(imp): void
Initialize temporary objects.
Parameters
| Name | Type | Description |
|---|---|---|
| 'imp' | 'any' | Internal implementation object |
Returns
void
isKindOf
▸ isKindOf(sObjectName): boolean
Determine object type
Parameters
| Name | Type | Description |
|---|---|---|
| SOrtName | string | Type Name |
Returns
boolean
Return whether the object is of the target type
isNull
▸ isNull(): any
Determine if it is an empty object
Returns
any
setJson
▸ setJson(str): boolean
Set a string in JSON format.
Parameters
| Name | Type | Description |
|---|---|---|
| Str | string | JSON formatted string |
Returns
boolean
Is the setting successful.
