Iterator¶
- class pyslm.analysis.Iterator(models, layers)¶
Bases:
objectBasic Iterator which parses through both a list of
LayerandLayerGeometrygroups and incrementally goes through the geometry based on time values generated in conjunction with the associatedModel. 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:Build time via
getBuildTime(),Specific layer time via
getLayerTime(),Specific layer geometry time via
getLayerGeomTime()
Additional information can be included for the iterator to account for additional dwell time between layers and in
dwellTimeand the layer dwell timerecoaterTime.Attributes Summary
The current start time of the active
LayerGeometryThe total layer dwell time [s].
A
Layerlist to be processed by the iteratorA
Modellist to be processed by the iteratorThe re-coater time [s] added after the layer
The current time [s] of the iterator (read only)
A tree of
TimeNodefor the entire buildMethods Summary
Gets the total buildtime of the entire list of layers including additional dwell time between layers.
Gets the current layer of the iterator
Gets the current
LayerGeometryfor the current iteration.getLayerByTime(time)Gets the current
Layerbased on the search time.getLayerGeomTime(layerId, layerGeomId)Gets the total time for each
LayerGeometrygiven a unique aLayerindex and aLayerGeometryindex.getLayerGeometryByTime(time)Gets the
LayerGeometryfor a given time in a build.getLayerGeometryIdByTime(time)Gets the
LayerGeometryid for a given time in a build.Gets the
TimeNodefor aLayerGeometrygiven a time.getLayerIdByTime(time)Gets the current
Layerindex based on the search timegetLayerNodeByTime(time)Get the
TimeNodefor a given time in a build.getLayerTime(layerId)Gets the total time for a
Layergiven a unique aLayerindexgetTimeByLayerGeometryId(layerId, layerGeomId)Gets the current time for a
LayerGeometrygiven a unique aLayerindex and aLayerGeometryindex.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
LayerseekByLayerGeometry(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.
- recoaterTime¶
The re-coater time [s] added after the layer
- time¶
The current time [s] of the iterator (read only)
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
TimeNodetree and takes into account the additional dwell time included.- Return type:
float
- getCurrentLayer()¶
Gets the current layer of the iterator
- Return type:
- Returns:
The current layer
- getCurrentLayerGeometry()¶
Gets the current
LayerGeometryfor the current iteration.- Return type:
- Returns:
The active LayerGeometry
- getLayerByTime(time)¶
Gets the current
Layerbased on the search time.- Parameters:
time (
float) – The time for locating the layer- Return type:
- Returns:
The layer at time t
- getLayerGeomTime(layerId, layerGeomId)¶
Gets the total time for each
LayerGeometrygiven a unique aLayerindex and aLayerGeometryindex.- Parameters:
layerId (
int) – The layer index in the listlayerGeomId (
int) – The layer geometry index within theLayer
- Return type:
float- Returns:
The time for the LayerGeometry
- getLayerGeometryByTime(time)¶
Gets the
LayerGeometryfor a given time in a build.- Parameters:
time (
float) – The time for locating theLayerGeometry- Return type:
- Returns:
The LayerGeometry
- getLayerGeometryIdByTime(time)¶
Gets the
LayerGeometryid 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
TimeNodefor aLayerGeometrygiven a time.- Parameters:
time (
float) – The time- Return type:
Optional[TimeNode]- Returns:
The LayerGeometry TimeNode
- getLayerIdByTime(time)¶
Gets the current
Layerindex 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
TimeNodefor 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
Layergiven a unique aLayerindex- 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
LayerGeometrygiven a unique aLayerindex and aLayerGeometryindex.- Parameters:
layerId (
int) – The layer index in the listlayerGeomId (
int) – The layer geometry index within theLayer
- 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 iteratorlayerGeomId (
int) – The index of the layer geometry within the specified layer
- Return type:
None