Iterator

class pyslm.analysis.Iterator(models, layers)

Bases: abc.ABC

Basic Iterator which parses through both Layer and LayerGeometry groups and incrementally goes through the geometry based on time values generated in conjunction with the associated Model.

Attributes Summary

currentLayerGeometryTime

The current start time of the active LayerGeometry

dwellTime

The total layer dwell time [s].

layers

A Layer list to be processed by the iterator

models

A Model list to be processed by the iterator

recoaterTime

The re-coater time [s] added after the layer

time

The current time [s] of the iterator (read only)

tree

A tree of TimeNode for the entire build

Methods Summary

getBuildTime()

Gets the total build-time of the entire list of layers including additional dwell time between layers.

getCurrentLayer()

Gets the current layer of the iterator

getCurrentLayerGeometry()

Gets the current LayerGeometry for the current iteration

getLayerByTime(time)

Gets the current Layer based on the search time

getLayerGeomTime(layerId, layerGeomId)

Gets the total time for each LayerGeometry given a unique a Layer index and a LayerGeometry index.

getLayerGeometryByTime(time)

rtype:

LayerGeometry

getLayerGeometryIdByTime(time)

rtype:

int

getLayerGeometryNodeByTime(time)

Gets the TimeNode for a LayerGeometry given a time

getLayerIdByTime(time)

Gets the current Layer index based on the search time

getLayerNodeByTime(time)

rtype:

Optional[TimeNode]

getLayerTime(layerId)

Gets the total time for a Layer given a unique a Layer index

getTimeByLayerGeometryId(layerId, layerGeomId)

Gets the current time for a LayerGeometry given a unique a Layer index and a LayerGeometry index.

getTimeByLayerId(layerIdx)

Gets the current time in the Build based on the layer index.

seek(time)

Instructs the iterator to seek ahead to a specific time.

seekByLayer(layerId)

Instructs the iterator to seek ahead in time to the specific Layer

seekByLayerGeometry(layerId, layerGeomId)

Instructs the iterator to seek ahead in time to the specific LayerGeometry

Attributes Documentation

currentLayerGeometryTime

The current start time of the active LayerGeometry

Return type:

float

dwellTime

The total layer dwell time [s]. This can be re-implemented in a derived class to be a more complex function or provide additional variables which control the overall dwell time per layers such as the number of re-coats and the re-coating speed, often specified by the machine.

Return type:

float

layers

A Layer list to be processed by the iterator

Return type:

List[Layer]

models

A Model list to be processed by the iterator

Return type:

List[Model]

recoaterTime

The re-coater time [s] added after the layer

Return type:

float

time

The current time [s] of the iterator (read only)

Return type:

float

tree

A tree of TimeNode for the entire build

Return type:

TimeNode

Methods Documentation

getBuildTime()

Gets the total build-time of the entire list of layers including additional dwell time between layers. This function simply parses through the entire TimeNode tree and adds on the dwell time per layer.

Return type:

float

getCurrentLayer()

Gets the current layer of the iterator

Return type:

Layer

Returns:

The current layer

getCurrentLayerGeometry()

Gets the current LayerGeometry for the current iteration

Return type:

LayerGeometry

Returns:

The active LayerGeometry

getLayerByTime(time)

Gets the current Layer based on the search time

Parameters:

time (float) – The time for locating the Layer

Return type:

Layer

Returns:

The Layer at time t

getLayerGeomTime(layerId, layerGeomId)

Gets the total time for each LayerGeometry given a unique a Layer index and a LayerGeometry index.

Parameters:
  • layerId (int) – The layer index in the list

  • layerGeomId (int) – The layer geometry index within the Layer

Return type:

float

Returns:

The time for the LayerGeometry

getLayerGeometryByTime(time)
Return type:

LayerGeometry

getLayerGeometryIdByTime(time)
Return type:

int

getLayerGeometryNodeByTime(time)

Gets the TimeNode for a LayerGeometry given a time

Parameters:

time (float) – The time

Return type:

TimeNode

Returns:

The LayerGeometry TimeNode

getLayerIdByTime(time)

Gets the current Layer index based on the search time

Parameters:

time (float) – The time for finding the layer

Return type:

int

Returns:

The Layer Index in the list if found

getLayerNodeByTime(time)
Return type:

Optional[TimeNode]

getLayerTime(layerId)

Gets the total time for a Layer given a unique a Layer index

Parameters:

layerId (int) – The layer index in the list

Return type:

float

Returns:

The time fo the layer

getTimeByLayerGeometryId(layerId, layerGeomId)

Gets the current time for a LayerGeometry given a unique a Layer index and a LayerGeometry index.

Parameters:
  • layerId (int) – The layer index in the list

  • layerGeomId (int) – The layer geometry index within the Layer

Return type:

float

Returns:

The time for the LayerGeometry

getTimeByLayerId(layerIdx)

Gets the current time in the Build based on the layer index.

Parameters:

layerIdx (int) – The layer index

Return type:

float

Returns:

The time at the start of the Layer

seek(time)

Instructs the iterator to seek ahead to a specific time.

Parameters:

time (float) – The time to seek to

Return type:

None

seekByLayer(layerId)

Instructs the iterator to seek ahead in time to the specific Layer

Parameters:

layerId (int) – The index of the layer within the list of layers provided to the iterator

Return type:

None

seekByLayerGeometry(layerId, layerGeomId)

Instructs the iterator to seek ahead in time to the specific LayerGeometry

Parameters:
  • layerId (int) – The index of the layer within the list of layers provided to the iterator

  • layerGeomId (int) – The index of the layer geometry within the specified layer

Return type:

None