Skip to content
On this page

mxcad_2d API 文档 / 2d / McDbObjectArray

Class: McDbObjectArray

2d.McDbObjectArray

McDbObject 的一个数组,该数组存储了多个 McDbObject 对象的引用。

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new McDbObjectArray(imp?)

构造函数。

Parameters

NameTypeDescription
imp?any内部实现对象。

Example

ts
import { McDbObjectArray } from "mxcad";
 // 创建一个 McDbObjectArray 实例
 const objectArray = new McDbObjectArray();

Properties

aryVal

aryVal: McDbObject[] = []

对象数组

Methods

empty

empty(): boolean

清空数组

Returns

boolean

Example

ts
import { McDbObjectArray } from "mxcad";
 // 创建一个 McDbObjectArray 实例
 const objectArray = new McDbObjectArray();
 const isEmpty = objectArray.empty();
 console.log("Is the array empty?", isEmpty);

forEach

forEach(call): void

遍历对象

Parameters

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

Returns

void

Example

ts
import { McDbObjectArray } from "mxcad";
 // 创建一个 McDbObjectArray 实例
 const objectArray = new McDbObjectArray();
 objectArray.forEach((val: McDbObject, index: number) => {
   console.log(`Object at index ${index}:`, val); 
 });

length

length(): number

数组长度

Returns

number

Example

ts
import { McDbObjectArray } from "mxcad";
 // 创建一个 McDbObjectArray 实例
 const objectArray = new McDbObjectArray();
 const length = objectArray.length();
 console.log("Length of the array:", length);