Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions geos-trame/src/geos/trame/app/ui/viewer/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,20 @@ def _update_perforation( self, perforation: Perforation, show: bool, path: str )
if not show:
if path in self._perforations:
self._remove_perforation( path )
self._make_mesh_transparent( False )
return

distance_from_head = float( perforation.distance_from_head )
self._add_perforation( distance_from_head, path )
self._make_mesh_transparent( True )

def _make_mesh_transparent( self, isTransparent: bool ) -> None:
opacity: float = 0.2 if isTransparent else 1.
if self._mesh_actor is not None:
prop = self._mesh_actor.GetProperty()
prop.SetOpacity( opacity )
self.plotter.renderer.Modified()
return

def _remove_perforation( self, path: str ) -> None:
"""Remove all actor related to the given path and clean the stored perforation."""
Expand Down Expand Up @@ -361,6 +371,7 @@ def _update_box( self, active_block: Box, show_obj: bool ) -> None:
self.plotter.remove_actor( extracted_cell_actor )

if not show_obj:
self._make_mesh_transparent( False )
return

box: Box = active_block
Expand All @@ -370,6 +381,7 @@ def _update_box( self, active_block: Box, show_obj: bool ) -> None:
extracted_cell: pv.UnstructuredGrid = self.box_engine.get_extracted_cells()

if box_polydata is not None and extracted_cell is not None:
self._make_mesh_transparent( True )
_box_polydata_actor = self.plotter.add_mesh( box_polydata, opacity=0.2 )
_extracted_cells_actor = self.plotter.add_mesh( extracted_cell, show_edges=True )
self.box_engine.set_box_polydata_actor( _box_polydata_actor )
Expand Down