Skip to content
On this page

[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.

Parameters

NameTypeDescription
imp?AnyInternal implementation object

Example

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

Properties

aryVal

aryVal: McDbObject[] = []

object array

Methods

empty

empty(): boolean

Clear the array

Returns

boolean

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);

forEach

forEach(call): void

Traverse objects

Parameters

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

Returns

void

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); 
 });

length

length(): number

Array length

Returns

number

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);