Skip to content

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

Class: McDbObjectArray ​

2d.McDbObjectArray

An array of McDbObject that stores references to multiple McDbObject objects.

Table of contents ​

Constructors ​

Properties ​

Methods ​

Constructors ​

constructor ​

• new McDbObjectArray(imp?)

Constructor.

Example

ts
 import { McDbObjectArray } from "mxcad";
//Create an instance of McDbObject Array
 const objectArray = new McDbObjectArray();

Parameters ​

NameTypeDescription
imp?AnyInternal implementation object

Properties ​

aryVal ​

• aryVal: McDbObject[] = []

object array

Methods ​

empty ​

▸ empty(): boolean

Clear the array

Example

ts
 import { McDbObjectArray } from "mxcad";
//Create an instance of McDbObject Array
 const objectArray = new McDbObjectArray();
 const isEmpty = objectArray.empty();
 console.log("Is the array empty?", isEmpty);

Returns ​

boolean


forEach ​

▸ forEach(call): void

Traverse objects

Example

ts
 import { McDbObjectArray } from "mxcad";
//Create an instance of McDbObject Array
 const objectArray = new McDbObjectArray();
 objectArray.forEach((val: McDbObject, index: number) => {
   console.log(`Object at index ${index}:`, val); 
 });

Parameters ​

NameType
call(val: McDbObject, index: number) => void

Returns ​

void


length ​

▸ length(): number

Array length

Example

ts
 import { McDbObjectArray } from "mxcad";
//Create an instance of McDbObject Array
 const objectArray = new McDbObjectArray();
 const length = objectArray.length();
 console.log("Length of the array:", length);

Returns ​

number