#4549 Add python method to get selected cells.

Equivalent to GetSelectedCells in Octave.
This commit is contained in:
Kristian Bendiksen
2020-02-19 15:20:34 +01:00
parent c64281c525
commit 8a1fa38435
6 changed files with 248 additions and 2 deletions

View File

@@ -895,3 +895,24 @@ class Case(PdmObject):
for value in chunk.cells:
cell_corners.append(value)
return cell_corners
def selected_cells_async(self):
"""Get the selected cells. Async, so returns an iterator.
Returns:
An iterator to a chunk object containing an array of cells.
Loop through the chunks and then the cells within the chunk to get all cells.
"""
return self.__case_stub.GetSelectedCells(self.__request)
def selected_cells(self):
"""Get the selected cells. Synchronous, so returns a list.
Returns:
A list of Cells.
"""
cells = []
generator = self.selected_cells_async()
for chunk in generator:
for value in chunk.cells:
cells.append(value)
return cells