Skip to content

Commit 3c3a934

Browse files
committed
Fix VTK export dialog
1 parent 297c2cb commit 3c3a934

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

openmc_plotter/tools.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,33 +168,36 @@ def populate(self):
168168
mesh = mesh_filter.mesh
169169
assert(mesh.n_dimension == 3)
170170

171-
llc = mesh.lower_left
171+
bbox = mesh.bounding_box
172+
173+
llc = bbox.lower_left
172174
self.xminBox.setValue(llc[0])
173175
self.yminBox.setValue(llc[1])
174176
self.zminBox.setValue(llc[2])
175177

176-
urc = mesh.upper_right
178+
urc = bbox.upper_right
177179
self.xmaxBox.setValue(urc[0])
178180
self.ymaxBox.setValue(urc[1])
179181
self.zmaxBox.setValue(urc[2])
180182

181-
dims = mesh.dimension
182-
self.xResBox.setValue(dims[0])
183-
self.yResBox.setValue(dims[1])
184-
self.zResBox.setValue(dims[2])
185-
186183
bounds_msg = "Using MeshFilter to set bounds automatically."
187184
for box in self.bounds_spin_boxes:
188185
box.setEnabled(False)
189186
box.setToolTip(bounds_msg)
190187

191-
resolution_msg = "Using MeshFilter to set resolution automatically."
192-
self.xResBox.setEnabled(False)
193-
self.xResBox.setToolTip(resolution_msg)
194-
self.yResBox.setEnabled(False)
195-
self.yResBox.setToolTip(resolution_msg)
196-
self.zResBox.setEnabled(False)
197-
self.zResBox.setToolTip(resolution_msg)
188+
dims = mesh.dimension
189+
if len(dims) == 3:
190+
self.xResBox.setValue(dims[0])
191+
self.yResBox.setValue(dims[1])
192+
self.zResBox.setValue(dims[2])
193+
194+
resolution_msg = "Using MeshFilter to set resolution automatically."
195+
self.xResBox.setEnabled(False)
196+
self.xResBox.setToolTip(resolution_msg)
197+
self.yResBox.setEnabled(False)
198+
self.yResBox.setToolTip(resolution_msg)
199+
self.zResBox.setEnabled(False)
200+
self.zResBox.setToolTip(resolution_msg)
198201

199202
else:
200203
# initialize using the bounds of the current view
@@ -214,14 +217,12 @@ def populate(self):
214217

215218
def export_data(self):
216219
# cache current and active views
217-
cv = self.model.currentView
218220
av = self.model.activeView
219221
try:
220222
# export the tally data
221223
self._export_data()
222224
finally:
223-
#always reset to the original view
224-
self.model.currentView = cv
225+
# always reset to the original view
225226
self.model.activeView = av
226227
self.model.makePlot()
227228

0 commit comments

Comments
 (0)