@@ -183,18 +183,26 @@ def update_grid_scale_and_clipping_range(self) -> None:
183183 grid_scale = self .get_grid_scale ()
184184 if grid_scale is not None :
185185 renderer = self .get_renderer ()
186- bounds = vtkBoundingBox ()
187- props = renderer .GetViewProps ()
188- props .InitTraversal ()
189- prop = props .GetNextProp ()
190- while prop :
191- if prop .GetUseBounds () and prop != grid_scale :
192- bounds .AddBounds (prop .GetBounds ())
186+ if not grid_scale .GetVisibility ():
187+ bounds = vtkBoundingBox ()
188+ props = renderer .GetViewProps ()
189+ props .InitTraversal ()
193190 prop = props .GetNextProp ()
194- if bounds .IsValid ():
195- final_bounds = [0.0 ] * 6
196- bounds .GetBounds (final_bounds )
197- grid_scale .SetBounds (final_bounds )
191+ while prop :
192+ if (
193+ prop .GetVisibility ()
194+ and prop .GetUseBounds ()
195+ and prop != grid_scale
196+ ):
197+ bounds .AddBounds (prop .GetBounds ())
198+ prop = props .GetNextProp ()
199+ if bounds .IsValid ():
200+ final_bounds = [0.0 ] * 6
201+ bounds .GetBounds (final_bounds )
202+ grid_scale .SetBounds (final_bounds )
203+
204+ final_bounds = list (grid_scale .GetBounds ())
205+ if final_bounds [0 ] <= final_bounds [1 ]:
198206
199207 def get_dist (axis : int ) -> float :
200208 p1 = [final_bounds [0 ], final_bounds [2 ], final_bounds [4 ]]
0 commit comments