[mxcad_2d API documentation] (../README. md)/[2d] (../modules/2d. md)/McDbXlsxTable
Class: McDbXlsxTable
2d.McDbXlsxTable
Custom entity.
Example
import { IMcDbDwgFiler, McDbCustomEntity, McDbLine, McDbPolyline, McGePoint3d, McGePoint3dArray, MxCADUiPrPoint, MxCADWorldDraw, MxCpp } from "mxcad";
import { MxFun } from "mxdraw";
//Create a new McDbTestLineCustomizing Entity class to inherit McDbCustomizing Entity
class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define the point object pt1 inside McDbtTestLineCustomizing Entity pt2
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
//Constructor function
constructor(imp?: any) {
super(imp);
}
//Create Function
public create(imp: any) {
return new McDbTestLineCustomEntity(imp)
}
//Get class name
public getTypeName(): string {
return "McDbTestLineCustomEntity";
}
//Read custom entity data pt1 pt2
public dwgInFields(filter: IMcDbDwgFiler): boolean {
this.pt1 = filter.readPoint("pt1").val;
this.pt2 = filter.readPoint("pt2").val;
return true;
}
//Write custom entity data pt1 pt2
public dwgOutFields(filter: IMcDbDwgFiler): boolean {
filter.writePoint("pt1", this.pt1);
filter.writePoint("pt2", this.pt2);
return true;
}
//Processing grip editing effects
public moveGripPointsAt(iIndex: number, dXOffset: number, dYOffset: number, dZOffset: number) {
this.assertWrite();
if (iIndex == 0) {
this.pt1.x += dXOffset;
this.pt1.y += dYOffset;
this.pt1.z += dZOffset;
}
else if (iIndex == 1) {
this.pt2.x += dXOffset;
this.pt2.y += dYOffset;
this.pt2.z += dZOffset;
}
};
//Set object editing point
public getGripPoints(): McGePoint3dArray {
let ret = new McGePoint3dArray()
ret.append(this.pt1);
ret.append(this.pt2);
return ret;
};
//Draw entities
public worldDraw(draw: MxCADWorldDraw): void {
// let tmpline = new McDbLine(this.pt1, this.pt2);
let pl= new McDbPolyline()
pl.addVertexAt(this.pt1)
pl.addVertexAt(this.pt2)
pl.addVertexAt(new McGePoint3d())
draw.drawEntity(pl);
}
//Set PT1
public setPoint1(pt1: McGePoint3d) {
this.assertWrite();
this.pt1 = pt1.clone();
}
//Set PT2
public setPoint2(pt2: McGePoint3d) {
this.assertWrite();
this.pt2 = pt2.clone();
}
//Get pt1
public getPoint1() {
return this.pt1;
}
//Obtain PT2
public getPoint2() {
return this.pt2;
}
}
Hierarchy
↳
McDbXlsxTable
Table of contents
Constructors
Properties
Accessors
- colWidth
- colorIndex
- drawOrder
- dxf0
- layer
- layerId
- linetype
- linetypeId
- linetypeScale
- lineweight
- normal
- objectName
- position
- rowHeight
- styleName
- textStyle
- textStyleId
- trueColor
- visible
- xlsxData
Methods
- IntersectWith
- addSelectedCell
- assertObjectModification
- calculateTableDimensions
- clearSelectedCell
- clone
- create
- createExtensionDictionary
- deleteColumn
- deleteRow
- deleteXData
- disableDisplay
- dwgInFields
- dwgOutFields
- erase
- explode
- getAllAppName
- getAllColumnWidths
- getAllRowHeights
- getArea
- getBoundingBox
- getCellAlignment
- getCellAtPoint
- getCellBackgroundColor
- getCellBorderLineType
- getCellBorderLineWeight
- getCellFromReference
- getCellGeometry
- getCellReference
- getCellStyles
- getCellTextAngle
- getCellTextColor
- getCellTextStyle
- getCellTextValue
- getCellValue
- getCellVerticalAlignment
- getColumnWidth
- getDatabase
- getDatabaseIndexId
- getExtensionDictionary
- getGripPoints
- getHandle
- getImp
- getJson
- getMergeCells
- getName
- getObjectID
- getOwnerID
- getRowHeight
- getSelectCellBackgroundColor
- getSelectCellTextColor
- getSelectedCell
- getSelectedCellCount
- getSelectedCells
- getSelectionRange
- getTypeName
- getxData
- getxDataDouble
- getxDataLong
- getxDataPoint
- getxDataString
- hasUnmergedCellsSelected
- highlight
- initTempObject
- insertColumn
- insertRow
- isCellSelected
- isErased
- isHaveExtensionDictionary
- isKindOf
- isMergedCellSelected
- isNull
- mergeCells
- mirror
- move
- moveGripPointsAt
- resetColumnWidth
- resetRowHeight
- rotate
- rxInit
- scaleEntity
- setAlignment
- setBatchCellAlignment
- setBatchCellBackgroundColor
- setBatchCellBorderLineType
- setBatchCellBorderLineWeight
- setBatchCellTextAngle
- setBatchCellTextColor
- setBatchCellTextStyle
- setBatchCellVerticalAlignment
- setCellAlignment
- setCellAlignmentByRef
- setCellBackgroundColor
- setCellBackgroundColorByRef
- setCellBorderLineType
- setCellBorderLineTypeByRef
- setCellBorderLineWeight
- setCellBorderLineWeightByRef
- setCellTextAngle
- setCellTextAngleByRef
- setCellTextColor
- setCellTextColorByRef
- setCellTextStyle
- setCellTextStyleByRef
- setCellValue
- setCellVerticalAlignment
- setCellVerticalAlignmentByRef
- setColumnWidth
- setFromArray
- setFromJson
- setFromWorkbook
- setJson
- setMergeCells
- setRowHeight
- setSelectCellBackgroundColor
- setSelectCellTextColor
- setSelectedCell
- setSelectedCells
- setVerticalAlignment
- setxData
- setxDataDouble
- setxDataLong
- setxDataPoint
- setxDataString
- syncData
- transformBy
- unErase
- unMergeCells
- updateDisplay
- worldDraw
Constructors
constructor
• new McDbXlsxTable(imp?
)
Parameters
Name | Type |
---|---|
imp? | any |
Overrides
Properties
imp
• imp: any
= 0
Internal implementation object.
Inherited from
Accessors
colWidth
• get
colWidth(): number
Table overall column width
Returns
number
• set
colWidth(val
): void
Parameters
Name | Type |
---|---|
val | number |
Returns
void
colorIndex
• get
colorIndex(): number
Obtain object color index
Example
import { McDbEntity, ColorIndexType } from 'mxcad'
const ent = new McDbEntity();
ent.colorIndex = ColorIndexType.kByblock;
console.log(ent.colorIndex)
Returns
number
Inherited from
McDbCustomEntity.colorIndex
• set
colorIndex(val
): void
Set object color index
Parameters
Name | Type | Description |
---|---|---|
Val | number | ColorIndexType |
Returns
void
Inherited from
McDbCustomEntity.colorIndex
drawOrder
• get
drawOrder(): number
Display order of objects
Example
//Assuming ent is a valid instance object
const order = ent.drawOrder();
Returns
number
Inherited from
McDbCustomEntity.drawOrder
• set
drawOrder(order
): void
Display order of objects
Example
import { MxCpp, MxCADSelectionSet } from "mxcad";
let ss = new MxCADSelectionSet();
If (! Await ss.userSelect) return;
//Obtain the maximum and minimum display order of objects on the current graph
let minmaxOrder = MxCpp.getCurrentDatabase().currentSpace.getMinMaxDrawOrder();
//Place the object at the top.
let lOrder = minmaxOrder.maxDrawOrder + 1;
ss.forEach((id) => {
let ent = id.getMcDbEntity();
if (ent) {
ent.drawOrder = lOrder;
}
})
Parameters
Name | Type | Description |
---|---|---|
Order | number | sequential value |
Returns
void
Inherited from
McDbCustomEntity.drawOrder
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
McDbCustomEntity.dxf0
layer
• get
layer(): string
Obtain the layer name of the object
Returns
string
Inherited from
McDbCustomEntity.layer
• set
layer(val
): void
Set object layer name
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity();
ent.layer = "newLayerName";
console.log(ent.layer)
Parameters
Name | Type | Description |
---|---|---|
Val | string | Layer Name |
Returns
void
Inherited from
McDbCustomEntity.layer
layerId
• get
layerId(): McObjectId
Get layer ID object
Example
//Assuming ent is a valid instance object
const layerId = ent.layerId;
Returns
Inherited from
McDbCustomEntity.layerId
• set
layerId(id
): void
Set Layer Id Object
Example
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
Const layerId=mxcad. addLayer (Test Layer)
ent.layerId = layerId;
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbCustomEntity.layerId
linetype
• get
linetype(): string
Obtain the object line type name
Returns
string
Inherited from
McDbCustomEntity.linetype
• set
linetype(val
): void
Set object line type name
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetype = "MyLineType";
console.log(ent.linetype)
Parameters
Name | Type | Description |
---|---|---|
Val | string | Line type name |
Returns
void
Inherited from
McDbCustomEntity.linetype
linetypeId
• get
linetypeId(): McObjectId
Get entity object line type ID
Example
//Assuming ent is a valid instance object
const linetypeId = ent.linetypeId;
Returns
Inherited from
McDbCustomEntity.linetypeId
• set
linetypeId(id
): void
Set entity object line type ID
Example
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
const lineId = mxcad.addLinetypeEx("TestMyLine", '25,-5');
ent.linetypeId = lineId;
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbCustomEntity.linetypeId
linetypeScale
• get
linetypeScale(): number
Obtain the proportion of object line types
Returns
number
Inherited from
McDbCustomEntity.linetypeScale
• set
linetypeScale(val
): void
Set object line type scale
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.linetypeScale = 0.8;
console.log(ent.linetypeScale)
Parameters
Name | Type | Description |
---|---|---|
Val | number | Line type ratio |
Returns
void
Inherited from
McDbCustomEntity.linetypeScale
lineweight
• get
lineweight(): number
Obtain object line weight
Returns
number
Inherited from
McDbCustomEntity.lineweight
• set
lineweight(val
): void
Set object line weight
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.lineweight = 20;
console.log(ent.lineweight)
Parameters
Name | Type | Description |
---|---|---|
Val | number | line weight |
Returns
void
Inherited from
McDbCustomEntity.lineweight
normal
• get
normal(): McGeVector3d
Return the normal of the object
Example
Returns
Inherited from
McDbCustomEntity.normal
• set
normal(val
): void
Set the normal of the object
Example
Parameters
Name | Type |
---|---|
val | McGeVector3d |
Returns
void
Inherited from
McDbCustomEntity.normal
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
McDbCustomEntity.objectName
position
• get
position(): McGePoint3d
Table Position and Size - Required for Rendering
Returns
• set
position(val
): void
Parameters
Name | Type |
---|---|
val | McGePoint3d |
Returns
void
rowHeight
• get
rowHeight(): number
Table overall row height
Returns
number
• set
rowHeight(val
): void
Parameters
Name | Type |
---|---|
val | number |
Returns
void
styleName
• get
styleName(): string
Table Style Name
Returns
string
• set
styleName(val
): void
Parameters
Name | Type |
---|---|
val | string |
Returns
void
textStyle
• get
textStyle(): string
Obtain the text style of the object
Returns
string
Inherited from
McDbCustomEntity.textStyle
• set
textStyle(val
): void
Set object text style
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.textStyle = "st_style";
Parameters
Name | Type | Description |
---|---|---|
Val | string | Text style name |
Returns
void
Inherited from
McDbCustomEntity.textStyle
textStyleId
• get
textStyleId(): McObjectId
Get entity text style
Example
//Assuming ent is a valid instance object
const textStyleId = ent.textStyleId;
Returns
Inherited from
McDbCustomEntity.textStyleId
• set
textStyleId(id
): void
Set the text style of the entity
Example
//Assuming ent is a valid instance object
const mxcad = MxCpp.getCurrentMxCAD();
const textStyleId = mxcad.addTextStyle("MyLineTypeTextStyle", "txt.shx", "hztxt.shx", 1);
ent.textStyleId = textStyleId;
Parameters
Name | Type |
---|---|
id | McObjectId |
Returns
void
Inherited from
McDbCustomEntity.textStyleId
trueColor
• get
trueColor(): McCmColor
Obtain the color of the object
Example
import { McDbEntity, McCmColor} from 'mxcad'
const ent = new McDbEntity();
ent.trueColor = new McCmColor(255, 0, 0);
console.log(ent.trueColor)
Returns
Inherited from
McDbCustomEntity.trueColor
• set
trueColor(val
): void
Set object color
Parameters
Name | Type |
---|---|
val | McCmColor |
Returns
void
Inherited from
McDbCustomEntity.trueColor
visible
• get
visible(): boolean
Is the object visible
Returns
boolean
Inherited from
McDbCustomEntity.visible
• set
visible(val
): void
Set whether it is visible
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.visible = true;
console.log(ent.visible)
Parameters
Name | Type | Description |
---|---|---|
Val | boolean | Boolean value |
Returns
void
Inherited from
McDbCustomEntity.visible
xlsxData
• get
xlsxData(): string
Returns
string
• set
xlsxData(data
): void
Parameters
Name | Type |
---|---|
data | string |
Returns
void
Methods
IntersectWith
▸ IntersectWith(intersectObject
, exOption
): McGePoint3dArray
Intersection with other entities to obtain the intersection point
Example
import { McDbLine, McDb } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
const line2 = new McDbLine(new McGePoint3d(10,10,0), new McGePoint3d(11,1,0));
const ptArr = line1.IntersectWith(line2, McDb.Intersect.kExtendBoth)
Parameters
Name | Type | Description |
---|---|---|
IntersectObject | [McDbEntity] (2d. McDbEntity. md) | The entity object that needs to intersect is the entity object |
ExOption | Intersection (../enums/2d. McDb. Intersect. md) | Intersection options |
Returns
Obtain all intersection points
Inherited from
McDbCustomEntity.IntersectWith
addSelectedCell
▸ addSelectedCell(row
, col
): void
Add a cell to the selected collection
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
void
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
McDbCustomEntity.assertObjectModification
calculateTableDimensions
▸ calculateTableDimensions(): Object
Calculate table size
Returns
Object
Name | Type |
---|---|
height | number |
width | number |
clearSelectedCell
▸ clearSelectedCell(): void
Clear the currently selected cell
Returns
void
clone
▸ clone(): null
| McDbObject
Copy entity
Example
import { McDbCustomEntity } from "mxcad";
const customEnt = new McDbCustomEntity();// Construct a new custom entity object
const cloneEnt = customEnt.clone();// Copy entity
Returns
null
| McDbObject
Inherited from
create
▸ create(imp
): McDbXlsxTable
Create a new custom object (by default, call its constructor to create a new object)
Parameters
Name | Type |
---|---|
imp | any |
Returns
Overrides
createExtensionDictionary
▸ createExtensionDictionary(): boolean
Create extended dictionary data for objects
Example
//Assuming obj is a database object
const res = obj.createExtensionDictionary();
Returns
boolean
Inherited from
McDbCustomEntity.createExtensionDictionary
deleteColumn
▸ deleteColumn(onSelectionChange?
): void
Delete the selected column
Parameters
Name | Type | Description |
---|---|---|
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
deleteRow
▸ deleteRow(onSelectionChange?
): void
Delete the selected row
Parameters
Name | Type | Description |
---|---|---|
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
deleteXData
▸ deleteXData(appName
): boolean
Delete data related to entity specified application name
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.deleteXData("DataName");
if(res){
//Delete successfully
}else
//Delete failed
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Returns
boolean
Inherited from
disableDisplay
▸ disableDisplay(isDisable
): void
Disable automatic update display of objects
Example
import { McDbLine } from 'mxcad'
const line1 = new McDbLine(new McGePoint3d(0,0,0), new McGePoint3d(20,1,0));
line1.disableDisplay(true)
Parameters
Name | Type | Description |
---|---|---|
IsDisable | boolean | Do you want to disable automatic object update display |
Returns
void
Inherited from
McDbCustomEntity.disableDisplay
dwgInFields
▸ dwgInFields(filter
): boolean
Read custom entity data fields from DWG files
Example
import { McDbCustomEntity, IMcDbDwgFiler } from 'mxcad'
//Create a new McDbTestLineCustomizing Entity class to inherit McDbCustomizing Entity
class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define the point object pt1 inside McDbtTestLineCustomizing Entity pt2
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
//Read the data field pt1 of the custom entity pt2
public dwgInFields(filter: IMcDbDwgFiler): boolean {
this.pt1 = filter.readPoint("pt1").val;
this.pt2 = filter.readPoint("pt2").val;
return true;
}
}
Parameters
Name | Type |
---|---|
filter | IMcDbDwgFiler |
Returns
boolean
Overrides
dwgOutFields
▸ dwgOutFields(filter
): boolean
Write the data fields of custom entities to a DWG file
Example
//Create a new McDbTestLineCustomizing Entity class to inherit McDbCustomizing Entity
import { McDbCustomEntity, IMcDbDwgFiler } from 'mxcad'
class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define the point object pt1 inside McDbtTestLineCustomizing Entity pt2
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
//Write the data field pt1 to the custom entity pt2
public dwgOutFields(filter: IMcDbDwgFiler): boolean {
filter.writePoint("pt1", this.pt1);
filter.writePoint("pt2", this.pt2);
return true;
}
}
Parameters
Name | Type |
---|---|
filter | IMcDbDwgFiler |
Returns
boolean
Overrides
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
explode
▸ explode(): MxCADResbuf
Break the object and return the linked list of the object's data after being broken
Example
import { McDbEntity, MxCADResbuf } from "mxcad";
//Obtain the target object
let getEnt = new MxCADUiPrEntity();
GetEnt.setMessage ("Select object to break: ");
let id = await getEnt.go();
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
//Smash objects
let retExplode: MxCADResbuf = ent.explode();
if (retExplode.GetCount() == 0) return;
let iExplodeConut = retExplode.GetCount();
for (let j = 0; j < iExplodeConut; j++) {
let tmpobj = retExplode.AtObject(j).val;
if(tmpobj instanceof McDbEntity ){
mxcad.drawEntity(tmpobj);
}
}
Returns
Rebuf data
Inherited from
getAllAppName
▸ getAllAppName(): McGeStringArray
Get the application name (AppName) of all XData records contained in the entity
Example
//Assuming ent is a valid instance object
const appNames = ent.getAllAppName();
console.log(appNames);
Returns
Inherited from
McDbCustomEntity.getAllAppName
getAllColumnWidths
▸ getAllColumnWidths(): IColumnWidth
[]
Get all column width settings
Returns
IColumnWidth
[]
getAllRowHeights
▸ getAllRowHeights(): IRowHeight
[]
Get all row height settings
Returns
IRowHeight
[]
getArea
▸ getArea(): Object
Calculate Area
Example
import { McGePoint3d, McDbCircle } from "mxcad"
const center = new McGePoint3d(0,0,0);
const circle = new McDbCircle(center, 20);
const area = circle.getArea();
Console.log ("Circle area: ", area)
Returns
Object
Is the val area value | ret successfully obtained
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
getBoundingBox
▸ getBoundingBox(): Object
Obtain the minimum outsourcing of the object
Returns
Object
Name | Type |
---|---|
maxPt | McGePoint3d |
minPt | McGePoint3d |
ret | boolean |
Inherited from
McDbCustomEntity.getBoundingBox
getCellAlignment
▸ getCellAlignment(row
, col
): undefined
| "center"
| "left"
| "right"
Get the horizontal alignment of cells
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| "center"
| "left"
| "right"
Horizontal alignment method, if not set, returns' left '
getCellAtPoint
▸ getCellAtPoint(point
): null
| { col
: number
; row
: number
}
Convert CAD coordinate points to cell positions in a table
Parameters
Name | Type | Description |
---|---|---|
Point | [McGePoint3d] (2d. McGePoint3d. md) | A 3D point in CAD space |
Returns
null
| { col
: number
; row
: number
}
Cell position {row, col} or null (when the point is not within the table)
getCellBackgroundColor
▸ getCellBackgroundColor(row
, col
): undefined
| null
| number
Get cell background color
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| null
| number
Cell background color, return null if not set
getCellBorderLineType
▸ getCellBorderLineType(row
, col
): undefined
| string
Get cell border line type
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| string
Cell border line type, if not set, returns undefined
getCellBorderLineWeight
▸ getCellBorderLineWeight(row
, col
): undefined
| number
Get cell border line width
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| number
Cell border line width, if not set, returns undefined
getCellFromReference
▸ getCellFromReference(cellRef
): null
| { col
: number
; row
: number
}
Retrieve cell index from A1 format reference
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
Returns
null
| { col
: number
; row
: number
}
Cell index {row, col} or null (when reference is invalid)
getCellGeometry
▸ getCellGeometry(row
, col
): null
| { max
: McGePoint3d
; min
: McGePoint3d
}
Get the geometric range of the specified cell
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
null
| { max
: McGePoint3d
; min
: McGePoint3d
}
The geometric range of the cell {min: McGePoint3d, max: McGePoint3d} or null (when the cell does not exist)
getCellReference
▸ getCellReference(row
, col
): string
Retrieve the A1 format reference of the specified cell
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
string
A1 format cell reference (e.g. "A1", "B2")
getCellStyles
▸ getCellStyles(): CellStyleInfo
Get the style of the cell
Returns
CellStyleInfo
getCellTextAngle
▸ getCellTextAngle(row
, col
): undefined
| number
Get cell text angle
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| number
Cell text angle, if not set, returns undefined
getCellTextColor
▸ getCellTextColor(row
, col
): undefined
| null
| number
Get cell text color
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| null
| number
Cell text color, return null if not set
getCellTextStyle
▸ getCellTextStyle(row
, col
): undefined
| string
Get cell text style
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| string
Cell text style, if not set, returns undefined
getCellTextValue
▸ getCellTextValue(row
, col
): string
Retrieve the plain text value of the cell (extract text if in Slate format)
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
string
The plain text value of a cell
getCellValue
▸ getCellValue(row
, col
): any
Get the value of the specified cell
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
any
cell value
getCellVerticalAlignment
▸ getCellVerticalAlignment(row
, col
): undefined
| "top"
| "bottom"
| "middle"
Get the vertical alignment of cells
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
undefined
| "top"
| "bottom"
| "middle"
Vertical alignment method, if not set, returns' top '
getColumnWidth
▸ getColumnWidth(col
): number
Get the width of the specified column
Parameters
Name | Type | Description |
---|---|---|
Col | number | column index (0-based) |
Returns
number
Column width, if not set, returns to default column width
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
McDbCustomEntity.getDatabaseIndexId
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
McDbCustomEntity.getExtensionDictionary
getGripPoints
▸ getGripPoints(): McGePoint3dArray
Get the grip of the custom object.
Returns
Pinch object array
Overrides
McDbCustomEntity.getGripPoints
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
getMergeCells
▸ getMergeCells(): IMergeCellInfo
[]
Get merged cell information
Returns
IMergeCellInfo
[]
getName
▸ getName(): string
Get custom object name
Returns
string
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
getRowHeight
▸ getRowHeight(row
): number
Get the height of the specified row
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Returns
number
Row height, if not set, returns to default row height
getSelectCellBackgroundColor
▸ getSelectCellBackgroundColor(): undefined
| null
| number
Get the background color of the selected cell
Returns
undefined
| null
| number
getSelectCellTextColor
▸ getSelectCellTextColor(): undefined
| null
| number
Get the text color of the selected cell
Returns
undefined
| null
| number
getSelectedCell
▸ getSelectedCell(): null
| { col
: number
; row
: number
}
Retrieve the currently selected cell
Returns
null
| { col
: number
; row
: number
}
The first selected cell, if not selected, returns null
getSelectedCellCount
▸ getSelectedCellCount(): number
Get the number of selected cells
Returns
number
Number of selected cells
getSelectedCells
▸ getSelectedCells(): { col
: number
; row
: number
}[]
Retrieve all selected cells
Returns
{ col
: number
; row
: number
}[]
All selected cell arrays
getSelectionRange
▸ getSelectionRange(): null
| { maxCol
: number
; maxRow
: number
; minCol
: number
; minRow
: number
}
Get the range of selected cells
Returns
null
| { maxCol
: number
; maxRow
: number
; minCol
: number
; minRow
: number
}
Include the minimum and maximum row and column indexes of the selected range
getTypeName
▸ getTypeName(): string
Get the type name of the custom entity.
Returns
string
Custom entity type name
Overrides
getxData
▸ getxData(appName?
): MxCADResbuf
Obtain the extended data of the object
Example
//Assuming ent is a valid instance object
const xData = ent.getXData();
Parameters
Name | Type | Default value | Description |
---|---|---|---|
AppName | string | "" | Extended Data Name |
Returns
Inherited from
getxDataDouble
▸ getxDataDouble(appName
): Object
Retrieve the double value from the specified XData type of the entity
Example
//Assuming ent is a valid instance object
let data = ent.getxDataDouble("DataName");
if(data.ret){
console.log(data.val)
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Returns
Object
Double value
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
McDbCustomEntity.getxDataDouble
getxDataLong
▸ getxDataLong(appName
): Object
Retrieve the long (integer) value from the specified XData type of the entity
Example
//Assuming ent is a valid instance object
let data = ent.getxDataLong("DataName");
if(data.ret){
console.log(data.val)
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Returns
Object
Long value
Name | Type |
---|---|
ret | boolean |
val | number |
Inherited from
getxDataPoint
▸ getxDataPoint(appName
): Object
Retrieve point objects from the specified XData type of entity
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Returns
Object
Obtain results and 3D point objects
Name | Type |
---|---|
ret | boolean |
val | McGePoint3d |
Inherited from
McDbCustomEntity.getxDataPoint
getxDataString
▸ getxDataString(appName
): Object
Retrieve XData information associated with a specific entity and return it in string form
Example
//Assuming ent is a valid instance object
let data = ent.getxDataString("DataName");
if(data.ret){
console.log(data.val)
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Returns
Object
Val XData information | whether ret returns success
Name | Type |
---|---|
ret | boolean |
val | string |
Inherited from
McDbCustomEntity.getxDataString
hasUnmergedCellsSelected
▸ hasUnmergedCellsSelected(): boolean
Check if any unmerged cells have been selected
Returns
boolean
highlight
▸ highlight(isHighlight
): void
Set whether the object is highlighted
Example
import { McDbEntity } from 'mxcad'
const ent = new McDbEntity()
ent.highlight(true);
Parameters
Name | Type | Description |
---|---|---|
IsHighlight | boolean | Is it highlighted |
Returns
void
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
McDbCustomEntity.initTempObject
insertColumn
▸ insertColumn(position
, onSelectionChange?
): void
Insert a column at the specified location
Parameters
Name | Type | Description |
---|---|---|
Position | "left" \ | "right" |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
insertRow
▸ insertRow(position
, onSelectionChange?
): void
Insert a row at the specified location
Parameters
Name | Type | Description |
---|---|---|
Position | "above" \ | "below" |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
isCellSelected
▸ isCellSelected(row
, col
): boolean
Check if the specified cell is selected
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index |
Col | number | column index |
Returns
boolean
Was it selected
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
McDbCustomEntity.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
isMergedCellSelected
▸ isMergedCellSelected(): boolean
Check if merged cells are selected
Returns
boolean
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
mergeCells
▸ mergeCells(onSelectionChange?
): void
Merge selected cells
Parameters
Name | Type | Description |
---|---|---|
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
mirror
▸ mirror(point1
, point2
): boolean
Mirror oriented object
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.mirror(new McGePoint3d(0,0,0), new McGePoint3d(20,10,0))
Parameters
Name | Type | Description |
---|---|---|
Point1 | [McGePoint3d] (2d. McGePoint3d. md) | Mirror Base Point |
point2 | McGePoint3d | - |
Returns
boolean
Inherited from
move
▸ move(fromPoint
, toPoint
): boolean
move objects
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.move(new McGePoint3d(0,0,0), new McGePoint3d(20,0,0))
Parameters
Name | Type | Description |
---|---|---|
From Point | [McGePoint3d] (2d. McGePoint3d. md) | Move the starting point |
ToPoint | [McGePoint3d] (2d. McGePoint3d. md) | Move End Point |
Returns
boolean
Inherited from
moveGripPointsAt
▸ moveGripPointsAt(iIndex
, dXOffset
, dYOffset
, dZOffset
): void
Move the grip of custom objects.
Example
import { McDbCustomEntity, MxCADWorldDraw, McDbLine } from 'mxcad';
//Create a new McDbTestLineCustomizing Entity class to inherit McDbCustomizing Entity
class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define the point object pt1 inside McDbtTestLineCustomizing Entity pt2
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
//Move the grip of custom objects.
public moveGripPointsAt(iIndex: number, dXOffset: number, dYOffset: number, dZOffset: number) {
this.assertWrite();
if (iIndex == 0) {
this.pt1.x += dXOffset;
this.pt1.y += dYOffset;
this.pt1.z += dZOffset;
}
else if (iIndex == 1) {
this.pt2.x += dXOffset;
this.pt2.y += dYOffset;
this.pt2.z += dZOffset;
}
};
}
Parameters
Name | Type | Description |
---|---|---|
IIndex | Number | Grip Index |
DXOffset | number | X-axis offset |
DYOffset | number | Y-axis offset |
DZOffset | number | Z-axis offset |
Returns
void
Overrides
McDbCustomEntity.moveGripPointsAt
resetColumnWidth
▸ resetColumnWidth(col
): void
Reset the width of the specified column to the default value
Parameters
Name | Type | Description |
---|---|---|
Col | number | column index (0-based) |
Returns
void
resetRowHeight
▸ resetRowHeight(row
): void
Reset the height of the specified row to the default value
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Returns
void
rotate
▸ rotate(basePoint
, dRotationAngle
): boolean
Rotate object
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.rotate(new McGePoint3d(0,0,0), Math.PI)
Parameters
Name | Type | Description |
---|---|---|
BasePoint | [McGePoint3d] (2d. McGePoint3d. md) | Rotate the base point |
DRotationAngle | number | Rotation angle |
Returns
boolean
Inherited from
rxInit
▸ rxInit(): void
Custom Entity Registration
Example
import { MxFun } from 'mxdraw
//MxCAD created successfully
MxFun.on("mxcadApplicationCreatedMxCADObject", (param) => {
//McDbtTestLineCustomizing Entity Custom Entity
new McDbTestLineCustomEntity().rxInit();// Custom Entity Registration
MxFun.addCommand("MxTest_DrawCustomEntity");// Register drawing entity command
})
Returns
void
Inherited from
scaleEntity
▸ scaleEntity(basePoint
, dScaleFactor
): boolean
Scaling objects
Example
import { McDbEntity, McGePoint3d } from 'mxcad'
const ent = new McDbEntity()
ent.scaleEntity(new McGePoint3d(0,0,0), 0.5)
Parameters
Name | Type | Description |
---|---|---|
BasePoint | [McGePoint3d] (2d. McGePoint3d. md) | Scale Base Point |
DScaleFactor | number | scaling factor (<1 zoom out;>1 zoom in) |
Returns
boolean
Inherited from
setAlignment
▸ setAlignment(alignment
, onSelectionChange?
): void
Set the horizontal alignment of the selected cells
Parameters
Name | Type | Description |
---|---|---|
Alignment | "center" \ | "left" \ |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
setBatchCellAlignment
▸ setBatchCellAlignment(cells
, alignment
): void
Batch Set Cell Horizontal Alignment Method
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
Alignment | "center" \ | "left" \ |
Returns
void
setBatchCellBackgroundColor
▸ setBatchCellBackgroundColor(cells
, color
): void
Batch set cell background color
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
color | undefined \ | null \ |
Returns
void
setBatchCellBorderLineType
▸ setBatchCellBorderLineType(cells
, lineType
): void
Batch set cell border line type
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
LineType | string | Border line type (such as "Continuous", "Dashed", "Dotted", etc.) |
Returns
void
setBatchCellBorderLineWeight
▸ setBatchCellBorderLineWeight(cells
, lineWeight
): void
Batch set cell border line width
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
LineWeight | Number | Border Width (in millimeters) |
Returns
void
setBatchCellTextAngle
▸ setBatchCellTextAngle(cells
, textAngle
): void
Batch Set Cell Text Angle
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
TextAngle | number | Text angle (0-360 degrees) |
Returns
void
setBatchCellTextColor
▸ setBatchCellTextColor(cells
, color
): void
Batch set cell text color
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
color | undefined \ | null \ |
Returns
void
setBatchCellTextStyle
▸ setBatchCellTextStyle(cells
, textStyle
): void
Batch set cell text style
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
TextStyle | string | Text Style Name |
Returns
void
setBatchCellVerticalAlignment
▸ setBatchCellVerticalAlignment(cells
, verticalAlignment
): void
Batch set vertical alignment of cells
Parameters
Name | Type | Description |
---|---|---|
Cells | (string \ | {col: number; row: number}) [] |
Vertical Alignment | "top" \ | "bottom" \ |
Returns
void
setCellAlignment
▸ setCellAlignment(row
, col
, alignment
): void
Set the horizontal alignment of cells
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Alignment | "center" \ | "left" \ |
Returns
void
setCellAlignmentByRef
▸ setCellAlignmentByRef(cellRef
, alignment
): boolean
Set the horizontal alignment of cells through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
Alignment | "center" \ | "left" \ |
Returns
boolean
Is the setting successful
setCellBackgroundColor
▸ setCellBackgroundColor(row
, col
, color
): void
Set cell background color
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
color | undefined \ | null \ |
Returns
void
setCellBackgroundColorByRef
▸ setCellBackgroundColorByRef(cellRef
, color
): boolean
Set cell background color through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
color | undefined \ | null \ |
Returns
boolean
Is the setting successful
setCellBorderLineType
▸ setCellBorderLineType(row
, col
, lineType
): void
Set cell border line type
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
LineType | string | Border line type (such as "Continuous", "Dashed", "Dotted", etc.) |
Returns
void
setCellBorderLineTypeByRef
▸ setCellBorderLineTypeByRef(cellRef
, lineType
): boolean
Set cell border line type through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
LineType | string | Border line type (such as "Continuous", "Dashed", "Dotted", etc.) |
Returns
boolean
Is the setting successful
setCellBorderLineWeight
▸ setCellBorderLineWeight(row
, col
, lineWeight
): void
Set cell border line width
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
LineWeight | Number | Border Width (in millimeters) |
Returns
void
setCellBorderLineWeightByRef
▸ setCellBorderLineWeightByRef(cellRef
, lineWeight
): boolean
Set cell border line width through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
LineWeight | Number | Border Width (in millimeters) |
Returns
boolean
Is the setting successful
setCellTextAngle
▸ setCellTextAngle(row
, col
, textAngle
): void
Set cell text angle
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
TextAngle | number | Text angle (0-360 degrees) |
Returns
void
setCellTextAngleByRef
▸ setCellTextAngleByRef(cellRef
, textAngle
): boolean
Set the cell text angle through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
TextAngle | number | Text angle (0-360 degrees) |
Returns
boolean
Is the setting successful
setCellTextColor
▸ setCellTextColor(row
, col
, color
): void
Set cell text color
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
color | undefined \ | null \ |
Returns
void
setCellTextColorByRef
▸ setCellTextColorByRef(cellRef
, color
): boolean
Set cell text color through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
color | undefined \ | null \ |
Returns
boolean
Is the setting successful
setCellTextStyle
▸ setCellTextStyle(row
, col
, textStyle
): void
Set cell text style
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
TextStyle | string | Text Style Name |
Returns
void
setCellTextStyleByRef
▸ setCellTextStyleByRef(cellRef
, textStyle
): boolean
Set cell text style through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
TextStyle | string | Text Style Name |
Returns
boolean
Is the setting successful
setCellValue
▸ setCellValue(row
, col
, value
): void
Set the value of the specified cell
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
value | any | Cell value (Slate format or plain text) |
Returns
void
setCellVerticalAlignment
▸ setCellVerticalAlignment(row
, col
, verticalAlignment
): void
Set the vertical alignment of cells
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Vertical Alignment | "top" \ | "bottom" \ |
Returns
void
setCellVerticalAlignmentByRef
▸ setCellVerticalAlignmentByRef(cellRef
, verticalAlignment
): boolean
Set the vertical alignment of cells through A1 reference format
Parameters
Name | Type | Description |
---|---|---|
CellRef | string | A1 format cell reference (e.g. "A1", "B2") |
Vertical Alignment | "top" \ | "bottom" \ |
Returns
boolean
Is the setting successful
setColumnWidth
▸ setColumnWidth(col
, width
): void
Set the width of the specified column
Parameters
Name | Type | Description |
---|---|---|
Col | number | column index (0-based) |
Width | number | column width (in units consistent with style.colWidth) |
Returns
void
setFromArray
▸ setFromArray(data
): void
Parameters
Name | Type |
---|---|
data | any [][] |
Returns
void
setFromJson
▸ setFromJson(jsonArray
): void
Parameters
Name | Type |
---|---|
jsonArray | any [] |
Returns
void
setFromWorkbook
▸ setFromWorkbook(processedData
): void
Parameters
Name | Type |
---|---|
processedData | ICellStyleInfo |
Returns
void
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
setMergeCells
▸ setMergeCells(mergeCells
): void
Set merged cell information
Parameters
Name | Type |
---|---|
mergeCells | IMergeCellInfo [] |
Returns
void
setRowHeight
▸ setRowHeight(row
, height
): void
Set the height of the specified row
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Height | number | line height (unit consistent with style.rowHeight) |
Returns
void
setSelectCellBackgroundColor
▸ setSelectCellBackgroundColor(color
, onSelectionChange?
): void
Set the background color of the selected cell
Parameters
Name | Type | Description |
---|---|---|
Color | undefined | null |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
setSelectCellTextColor
▸ setSelectCellTextColor(color
, onSelectionChange?
): void
Set the text color of the selected cell
Parameters
Name | Type | Description |
---|---|---|
Color | undefined | null |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
setSelectedCell
▸ setSelectedCell(row
, col
): void
Set the currently selected cell
Parameters
Name | Type | Description |
---|---|---|
Row | number | row index (0-based) |
Col | number | column index (0-based) |
Returns
void
setSelectedCells
▸ setSelectedCells(cells
): void
Set multiple selected cells
Parameters
Name | Type | Description |
---|---|---|
Cells | {col: number; row: number} [] | array of cell positions [{row, col},...] |
Returns
void
setVerticalAlignment
▸ setVerticalAlignment(alignment
, onSelectionChange?
): void
Set the vertical alignment of the selected cells
Parameters
Name | Type | Description |
---|---|---|
Alignment | "top" \ | "bottom" \ |
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
setxData
▸ setxData(xdata
): boolean
Set extended data for objects
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
//Set extended data
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
ent.setxData(new MxCADResbuf([{type:DxfCode.kExDataName,val:"DataName"},{type:DxfCode.kString,val:"yyyyy"}]));
Parameters
Name | Type | Description |
---|---|---|
Xdata | [MxCADResbuf] (2d. MxCADResbuf. md) | Extended data linked list |
Returns
boolean
Inherited from
setxDataDouble
▸ setxDataDouble(appName
, val
): boolean
Set the double value in the specified XData type of the entity
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataDouble("DataName", 0);
if(res){
//Setting successful
}else{
//Setting failed
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Val | number | double value |
Returns
boolean
Boolean value
Inherited from
McDbCustomEntity.setxDataDouble
setxDataLong
▸ setxDataLong(appName
, val
): boolean
Set the long (integer) value in the specified XData type of the entity
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataLong("DataName", 123456);
if(res){
//Setting successful
}else{
//Setting failed
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Val | number | long value |
Returns
boolean
Long value
Inherited from
setxDataPoint
▸ setxDataPoint(appName
, val
): boolean
Set the point object in the specified XData type of the entity
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Val | [McGePoint3d] (2d. McGePoint3d. md) | Point Object |
Returns
boolean
Obtain results and 3D point objects
Inherited from
McDbCustomEntity.setxDataPoint
setxDataString
▸ setxDataString(appName
, val
): boolean
Set XData information associated with a specific entity and set it in string form
Example
import { MxCADUiPrEntity, McDbEntity } from "mxcad";
let selEntity = new MxCADUiPrEntity();
SelEntity. setMessage ("Select Object");
let id = await selEntity.go();
if (!id.isValid()) return;
let ent:McDbEntity = id.getMcDbEntity();
if (ent === null) return;
const res = ent.setxDataString("DataName", "xxxxx");
if(res){
//Setting successful
}else{
//Setting failed
}
Parameters
Name | Type | Description |
---|---|---|
AppName | string | Extended Data Name |
Val | string | string value |
Returns
boolean
Is the setting successful
Inherited from
McDbCustomEntity.setxDataString
syncData
▸ syncData(toCpp?
): boolean
JS object data and McDbCCustoms Entity: Synchronization of m_mapData.
Parameters
Name | Type | Default value |
---|---|---|
toCpp | boolean | true |
Returns
boolean
Inherited from
transformBy
▸ transformBy(_mat
): boolean
Get custom object matrix coordinate transformation
Parameters
Name | Type |
---|---|
_mat | McGeMatrix3d |
Returns
boolean
Overrides
unErase
▸ unErase(): boolean
Anti delete object.
Example
//Assuming obj is a database object
const res = obj.unErase();
console.log(res);
Returns
boolean
Inherited from
unMergeCells
▸ unMergeCells(onSelectionChange?
): void
Cancel merging of selected cells
Parameters
Name | Type | Description |
---|---|---|
onSelectionChange? | (cells : {col : number ; row : number } [])=>void | Optional selection change callback |
Returns
void
updateDisplay
▸ updateDisplay(): void
Display the updated display of the calling object
Example
//Assuming ent is a valid instance object
ent.updateDisplay()
Returns
void
Inherited from
McDbCustomEntity.updateDisplay
worldDraw
▸ worldDraw(draw
): void
Draw custom entities
Example
import { McDbCustomEntity, MxCADWorldDraw, McDbLine } from 'mxcad'
//Create a new McDbTestLineCustomizing Entity class to inherit McDbCustomizing Entity
class McDbTestLineCustomEntity extends McDbCustomEntity {
//Define the point object pt1 inside McDbtTestLineCustomizing Entity pt2
private pt1: McGePoint3d = new McGePoint3d();
private pt2: McGePoint3d = new McGePoint3d();
//Draw entities
public worldDraw(draw: MxCADWorldDraw): void {
let tmpline = new McDbLine(this.pt1, this.pt2);
draw.drawEntity(tmpline);
}
}
Parameters
Name | Type |
---|---|
draw | MxCADWorldDraw |
Returns
void