Hide menu
Loading...
Searching...
No Matches
ShapeIterator

Iterates over children in a shape.

Iterator supports two usage scenario:

  • iteration over direct children;
  • iteration over shapes of a specified type.

To retrieve direct children of a shape, ShapeIterator should be used as follows:

const face = ...;
for (let child of new ShapeIterator (face)) {
const type = child.type;
}

To retrieve children of a particular type, ShapeIterator should be used by specifying a type of interest as follows:

const solid = ...;
for (let child of new ShapeIterator (solid, ShapeType.FACE)) {
// "child" has Face type
}

When using the latter approach exploration is done traversing the graph of subshapes in a depth-first manner. Each subshape will be found as many times as it is registered in the parent subshape. For instance, a seam-edge will be encountered twice, with forward and reversed orientations.

The order of returned subshapes is deterministic and corresponds to the order in which the subshapes were added during construction.

Extends

Implements

Constructors

new ShapeIterator()

new ShapeIterator(shape, type?): ShapeIterator

Parameters

shape

Shape

Parent BRep shape.

type?

ShapeType

Type of iterated shape.

Returns

ShapeIterator

Param

Parent body or shape.

Param

Type of iterated shape.

Overrides

BaseObject.constructor

new ShapeIterator()

new ShapeIterator(body, shapeType?): ShapeIterator

Parameters

body

Parent body.

SheetBody | SolidBody | WireframeBody

shapeType?

ShapeType

Type of iterated shape.

Returns

ShapeIterator

Param

Parent body or shape.

Param

Type of iterated shape.

Overrides

BaseObject.constructor

Accessors

id

Get Signature

get id(): bigint

Returns object id.

Returns

bigint

Inherited from

BaseObject.id

Methods

[iterator]()

‍**[iterator]**(): Iterator<Shape, Shape, any>

Returns

Iterator<Shape, Shape, any>

Implementation of

Iterable.[iterator]


next()

next(): IteratorResult<Shape, Shape>

Returns

IteratorResult<Shape, Shape>