[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McDbRasterImageDef
Class: McDbRasterImageDef
2d.McDbRasterImageDef
Grating image class, which is used to display raster graphics in CAD
Hierarchy
↳
McDbRasterImageDef
Table of contents
Constructors
Properties
Accessors
Methods
- assertObjectModification
- clone
- createExtensionDictionary
- erase
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getObjectID
- getOwnerID
- initTempObject
- isErased
- isHaveExtensionDictionary
- isKindOf
- isNull
- moveGripPointsAt
- saveToBase64
- setJson
- unErase
Constructors
constructor
• new McDbRasterImageDef(imp?
)
Constructor.
Example
import { McDbRasterImageDef } from "mxcad";
const imageDef = new McDbRasterImageDef()
Parameters
Name | Type | Description |
---|---|---|
imp? | Any | Internal implementation object |
Overrides
Properties
imp
• imp: any
= 0
Internal implementation object.
Inherited from
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
Inherited from
McDbObject.dxf0
objectName
• get
objectName(): string
Get the object name.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.objectName);
Returns
string
Return object name
Inherited from
McDbObject.objectName
sourceFileName
• get
sourceFileName(): string
Returns
string
• set
sourceFileName(sPathName
): void
Get or set the path of the raster image file.
Example
import { McDbRasterImageDef } from "mxcad";
const imageDef = new McDbRasterImageDef();
imageDef.sourceFileName = "../example.jpg";
const pathName = imageDef.sourceFileName;
Console.log (file path: ", pathName);
Parameters
Name | Type | Description |
---|---|---|
The path of the 'sPathName' | 'string' | file |
Returns
void
Methods
assertObjectModification
▸ assertObjectModification(autoUndo?
): number
Setting the state of the object to be changed can automatically trigger the update display function to update the display. For example, if the block table record is updated and the block reference needs to be notified to update the display, this function can be called.
Example
//Assuming obj is a database object
obj.assertObjectModification()
Parameters
Name | Type | Default value |
---|---|---|
autoUndo | boolean | false |
Returns
number
Inherited from
McDbObject.assertObjectModification
clone
▸ clone(): null
| McDbObject
Clone objects.
Example
//Assuming obj is a database object
const obj_clone = obj.clone();
Returns
null
| McDbObject
The cloned object.
Inherited from
createExtensionDictionary
▸ createExtensionDictionary(): boolean
Create extended dictionary data for objects
Example
//Assuming obj is a database object
const res = obj.createExtensionDictionary();
Returns
boolean
Inherited from
McDbObject.createExtensionDictionary
erase
▸ erase(): boolean
Delete object.
Example
//Assuming obj is a database object
const res = obj.erase();
console.log(res);
Returns
boolean
Whether the deletion was successful.
Inherited from
getDatabase
▸ getDatabase(): McDbDatabase
Get the database where the object is located
Example
//Assuming obj is a database object
const data = obj.getDatabase();
Returns
Return to database
Inherited from
getDatabaseIndexId
▸ getDatabaseIndexId(): number
Get the index ID of the object
Example
//Assuming obj is a database object
const id = obj.getDatabaseIndexId();
Returns
number
Inherited from
getExtensionDictionary
▸ getExtensionDictionary(): McDbDictionary
Obtain the extended dictionary data of the object
Example
//Assuming obj is a database object
const id = obj.getOwnerID();
Returns
Expand dictionary data
Inherited from
McDbObject.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
Get the control points of the object
Example
//Assuming obj is a database object
const ptArr = obj.getGripPoints();
Returns
Inherited from
getHandle
▸ getHandle(): string
Obtain object handle
Example
//Assuming obj is a database object
const handle = obj.getHandle();
Returns
string
Return object handle
Inherited from
getImp
▸ getImp(): any
Retrieve internal implementation objects.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let imp = obj.getImp();
Returns
any
Internal implementation object.
Inherited from
getJson
▸ getJson(): string
Retrieve a string in JSON format.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const json = obj.getJson()
Returns
string
A string in JSON format.
Inherited from
getObjectID
▸ getObjectID(): McObjectId
Get the object ID.
Example
import { McDbObject } from "mxcad";
const id = obj.getObjectID();
Returns
Object ID.
Inherited from
getOwnerID
▸ getOwnerID(): number
Obtain the ID of the object owner
Example
//Assuming obj is a database object
const id = obj.getOwnerID();
Returns
number
Inherited from
initTempObject
▸ initTempObject(imp
): void
Initialize temporary objects.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
obj.initTempObject()
Parameters
Name | Type | Description |
---|---|---|
'imp' | 'any' | Internal implementation object |
Returns
void
Inherited from
isErased
▸ isErased(): boolean
Has the object been deleted
Example
//Assuming obj is a database object
const res = obj.isErased();
console.log(res);
Returns
boolean
Inherited from
isHaveExtensionDictionary
▸ isHaveExtensionDictionary(): boolean
Is there any extended dictionary data available
Example
//Assuming obj is a database object
const res = obj.isHaveExtensionDictionary();
Returns
boolean
Inherited from
McDbObject.isHaveExtensionDictionary
isKindOf
▸ isKindOf(sObjectName
): boolean
Determine object type
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
let isKind = obj.isKindOf('SomeObjectType');
console.log(isKind); // Output: True or false
Parameters
Name | Type | Description |
---|---|---|
SOrtName | string | Type Name |
Returns
boolean
Return whether the object is of the target type
Inherited from
isNull
▸ isNull(): any
Determine if it is an empty object
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
console.log(obj.isNull()); // Output: True or false
Returns
any
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex
, dXOffset
, dYOffset
, dZOffset
): any
Control points for moving objects
Example
//Assuming obj is a database object
obj.moveGripPointsAt(1,10,10,10);
Parameters
Name | Type | Description |
---|---|---|
IIndex | Number | Index |
DXOffset | number | X-axis offset |
DYOffset | number | Y-axis offset |
DZOffset | number | Z-axis offset |
Returns
any
Inherited from
saveToBase64
▸ saveToBase64(sUrl
): boolean
Save raster image as a Base64 encoded string
Example
import { McDbRasterImageDef } from "mxcad";
const imageDef = new McDbRasterImageDef();
const res = imageDef.saveToBase64("../example.jpg");
if(res){
//Preserving Success
}else{
//Save failed
}
Parameters
Name | Type | Description |
---|---|---|
SURL | string | Grid image path |
Returns
boolean
Boolean value
setJson
▸ setJson(str
): boolean
Set a string in JSON format.
Example
import { McRxObject } from 'mxcad';
let obj = new McRxObject();
const res = obj.setJson('{"key": "value"}');
console.log(res)
Parameters
Name | Type | Description |
---|---|---|
Str | string | JSON formatted string |
Returns
boolean
Is the setting successful.
Inherited from
unErase
▸ unErase(): boolean
Anti delete object.
Example
//Assuming obj is a database object
const res = obj.unErase();
console.log(res);
Returns
boolean