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

构造函数。

Example

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

Parameters

NameTypeDescription
imp?any内部实现对象。

Properties

aryVal

aryVal: McDbObject[] = []

对象数组

Methods

empty

empty(): boolean

清空数组

Example

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

Returns

boolean


forEach

forEach(call): 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); 
 });

Parameters

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

Returns

void


length

length(): number

数组长度

Example

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

Returns

number