From c6be54712123b5933a25a8e31283eebe0de6a117 Mon Sep 17 00:00:00 2001 From: Gudni Karl Rosenkjaer Date: Fri, 15 Nov 2013 09:42:06 -0800 Subject: [PATCH] Add vtkView.viewProp to indicate which model to view at any given time. No check wether the name or number exists as an array in the vtkView._vtkobj. --- SimPEG/visulize/vtk/vtkView.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/SimPEG/visulize/vtk/vtkView.py b/SimPEG/visulize/vtk/vtkView.py index f331e1d7..74389e05 100644 --- a/SimPEG/visulize/vtk/vtkView.py +++ b/SimPEG/visulize/vtk/vtkView.py @@ -26,11 +26,14 @@ class vtkView(object): """ """ + # ToDo: Set the properties up so that there are set/get methods self.name = 'VTK figure of SimPEG model' self.extent = [0,mesh.nCx-1,0,mesh.nCy-1,0,mesh.nCz-1] - self.limits = [0, 10000] + self.limits = [0, 1e12] + self.viewProp = 0 # Int or name of the vector. self._mesh = mesh + # Set vtk object containers self._cell = None self._faces = None @@ -99,7 +102,15 @@ class vtkView(object): else: raise Exception("{:s} is not a vailid imageType. Has to be 'cell':'face':'edge'".format(imageType)) - + # Set the active scalar. + if type(self.viewProp) == int: + actScalar = self._vtkobj.GetCellData().GetArrayName(self.viewProp) + elif type(self.viewProp) == str: + actScalar = self.viewProp + else : + raise Exception('The vtkView.viewProp has the wrong format. Has to be interger or a string.') + self._vtkobj.GetCellData().SetActiveScalars(actScalar) + # Set up the plane, clipper and the user interaction. global intPlane, intActor self._clipper, intPlane = vtkSP.makePlaneClipper(self._vtkobj) intActor = vtkSP.makeVTKLODActor(self._vtkobj,self._clipper)