Iterator

class pyslm.analysis.Iterator(models, layers)

Bases: object

Basic Iterator which parses through both a list of Layer and LayerGeometry groups and incrementally goes through the geometry based on time values generated in conjunction with the associated Model. By parsing through each geometry definition in the build, a cached time tree is constructed based on the specified laser parameters defined in the model. There are several functions can be used for calculating the time across the build such as:

Additional information can be included for the iterator to account for additional dwell time between layers and in dwellTime and the layer dwell time recoaterTime.

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

Gets the LayerGeometry for a given time in a build.

getLayerGeometryIdByTime(time)

Gets the LayerGeometry id for a given time in a build.

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)

Get the TimeNode for a given time in a build.

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

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.

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 Documentation

getBuildTime()

Gets the total buildtime of the entire list of layers including additional dwell time between layers. This function parses through the entire TimeNode tree and takes into account the additional dwell time included.

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)

Gets the LayerGeometry for a given time in a build.

Parameters:

time (float) – The time for locating the LayerGeometry

Return type:

LayerGeometry

Returns:

The LayerGeometry

getLayerGeometryIdByTime(time)

Gets the LayerGeometry id for a given time in a build.

Parameters:

time (float) – The time for locating the LayerGeometry

Return type:

Optional[int]

Returns:

Node Index if available else None

getLayerGeometryNodeByTime(time)

Gets the TimeNode for a LayerGeometry given a time.

Parameters:

time (float) – The time

Return type:

Optional[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)

Get the TimeNode for a given time in a build.

Parameters:

time (float) – The time for locating the layer node in the build

Return type:

Optional[TimeNode]

Returns:

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