def endSelection(self, area, extract):
     """
     Method used to finalize an interactive selection by providing
     the [ startPointX, startPointY, endPointX, endPointY ] area
     where (0,0) match the lower left corner of the pixel screen.
     """
     if self.active_view:
         self.active_view.InteractionMode = self.previous_interaction
         representations = vtkCollection()
         sources = vtkCollection()
         if self.selection_type == 0:
             self.active_view.SelectSurfacePoints(area, representations, sources, False)
         elif self.selection_type == 1:
             self.active_view.SelectSurfaceCells(area, representations, sources, False)
         elif self.selection_type == 2:
             self.active_view.SelectFrustumPoints(area, representations, sources, False)
         elif self.selection_type == 3:
             self.active_view.SelectFrustumCells(area, representations, sources, False)
         else:
             self.active_view.SelectSurfacePoints(area, representations, sources, False)
         # Don't know what to do if more than one representation/source
         if representations.GetNumberOfItems() == sources.GetNumberOfItems() and sources.GetNumberOfItems() == 1:
             # We are good for selection
             rep = servermanager._getPyProxy(representations.GetItemAsObject(0))
             selection = servermanager._getPyProxy(sources.GetItemAsObject(0))
             if extract:
                 extract = simple.ExtractSelection(Input=rep.Input, Selection=selection)
                 simple.Show(extract)
                 simple.Render()
             else:
                 rep.Input.SMProxy.SetSelectionInput(0, selection.SMProxy, 0)
Exemple #2
0
def CreateProducer(name):
    assert IsInsituInput(name)
    from . import log_level
    from .. import log

    originalname = name
    name = _transform_registration_name(name)
    log(log_level(), "creating producer for simulation input named '%s' (original-name=%s)" \
            % (name, originalname))
    if IsCatalystInSituAPI():
        # Catalyst 2.0
        from paraview import servermanager
        producer = servermanager._getPyProxy(
            vtkInSituInitializationHelper.GetProducer(name))

        # since state file may have arbitrary properties being specified
        # on the original source, we ensure we ignore them
        producer.IgnoreUnknownSetRequests = True
        return producer

    # Legacy Catalyst
    from paraview import servermanager
    helper = _get_active_helper()
    producer = helper.GetTrivialProducer(name)
    producer = servermanager._getPyProxy(producer)

    # since state file may have arbitrary properties being specified
    # on the original source, we ensure we ignore them
    producer.IgnoreUnknownSetRequests = True
    return producer
Exemple #3
0
 def endSelection(self, area, extract):
     """
     Method used to finalize an interactive selection by providing
     the [ startPointX, startPointY, endPointX, endPointY ] area
     where (0,0) match the lower left corner of the pixel screen.
     """
     if self.active_view:
         self.active_view.InteractionMode = self.previous_interaction
         representations = vtkCollection()
         sources = vtkCollection()
         if self.selection_type == 0:
             self.active_view.SelectSurfacePoints(area, representations, sources, False)
         elif self.selection_type == 1:
             self.active_view.SelectSurfaceCells(area, representations, sources, False)
         elif self.selection_type == 2:
             self.active_view.SelectFrustumPoints(area, representations, sources, False)
         elif self.selection_type == 3:
             self.active_view.SelectFrustumCells(area, representations, sources, False)
         else:
             self.active_view.SelectSurfacePoints(area, representations, sources, False)
         # Don't know what to do if more than one representation/source
         if representations.GetNumberOfItems() == sources.GetNumberOfItems() and sources.GetNumberOfItems() == 1:
             # We are good for selection
             rep = servermanager._getPyProxy(representations.GetItemAsObject(0))
             selection = servermanager._getPyProxy(sources.GetItemAsObject(0))
             if extract:
                 extract = simple.ExtractSelection(Input=rep.Input, Selection=selection)
                 simple.Show(extract)
                 simple.Render()
             else:
                 rep.Input.SMProxy.SetSelectionInput(0, selection.SMProxy, 0)
Exemple #4
0
def CreateProducer(name):
    global ActiveDataDescription, ActivePythonPipelineModule
    assert IsInsituInput(name)

    module = ActivePythonPipelineModule
    if not hasattr(module, "_producer_map"):
        module._producer_map = {}
    if name in module._producer_map:
        return module[name]

    from paraview import servermanager
    dataDesc = ActiveDataDescription
    ipdesc = dataDesc.GetInputDescriptionByName(name)

    # eventually, we want the Catalyst C++ code to give use the vtkAlgorithm to
    # use; e.g.
    # servermanager._getPyProxy(ipdesc.GetProducer())

    pxm = servermanager.ProxyManager()
    producer = servermanager._getPyProxy(
        pxm.NewProxy("sources", "PVTrivialProducer2"))
    controller = servermanager.ParaViewPipelineController()
    controller.InitializeProxy(producer)
    controller.RegisterPipelineProxy(producer, name)

    # since state file may have arbitrary properties being specified
    # on the original source, we ensure we ignore them
    producer.IgnoreUnknownSetRequests = True

    vtkobject = producer.GetClientSideObject()
    assert vtkobject
    vtkobject.SetWholeExtent(ipdesc.GetWholeExtent())
    vtkobject.SetOutput(ipdesc.GetGrid())
    module._producer_map[name] = producer
    return producer
Exemple #5
0
  def applyMaterialToRepresentation(self, name, representation):
    material = self.materials[name] if name in self.materials else {}

    if 'map_Kd' in material:
        if name not in self.textures:
            from paraview import servermanager
            texture = servermanager._getPyProxy(servermanager.CreateProxy('textures', 'ImageTexture'))
            texture.FileName = os.path.join(self.baseDir, material['map_Kd'][0])
            self.textures[name] = texture
            servermanager.Register(texture)

        representation.Texture = self.textures[name]

    if 'Ka' in material:
        representation.AmbientColor = [float(n) for n in material['Ka']]

    if 'Ks' in material:
        representation.SpecularColor = [float(v) for v in material['Ks']]

    if 'Kd' in material:
        representation.DiffuseColor = [float(v) for v in material['Kd']]

    if 'd' in material:
        representation.Opacity = float(material['d'][0])

    if 'Ns' in material:
        representation.SpecularPower = float(material['Ns'][0])

    if 'illum' in material:
        representation.Ambient = 1.0 if 0 <= float(material['illum'][0]) else 0.0
        representation.Diffuse = 1.0 if 1 <= float(material['illum'][0]) else 0.0
        representation.Specular = 1.0 if 2 <= float(material['illum'][0]) else 0.0
Exemple #6
0
def get_producers(proxy, filter, producer_set):
    """Returns the producers for a proxy iteratively. If filter is non-None,
    filter is used to cull producers."""
    for i in xrange(proxy.GetNumberOfProducers()):
        producer = proxy.GetProducerProxy(i)
        producer = producer.GetTrueParentProxy() if producer else None
        producer = sm._getPyProxy(producer)
        if not producer or producer.IsPrototype() or producer in producer_set:
            continue
        if filter(producer):
            producer_set.add(producer)
            get_producers(producer, filter, producer_set)
    # FIXME: LookupTable is missed :/, darn subproxies!
    try:
        if proxy.LookupTable and filter(proxy.LookupTable):
            producer_set.add(proxy.LookupTable)
            get_producers(proxy.LookupTable, filter, producer_set)
    except AttributeError:
        pass
    try:
        if proxy.ScalarOpacityFunction and filter(proxy.ScalarOpacityFunction):
            producer_set.add(proxy.ScalarOpacityFunction)
            get_producers(proxy.ScalarOpacityFunction, filter, producer_set)
    except AttributeError:
        pass
Exemple #7
0
def updateProxyProperties(proxy, properties):
    """
   Loop over the properties object and update the mapping properties
   to the given proxy.
   """
    try:
        allowedProperties = proxy.ListProperties()
        for key in properties:
            validKey = servermanager._make_name_valid(key)
            if validKey in allowedProperties:
                value = removeUnicode(properties[key])
                property = servermanager._wrap_property(
                    proxy, proxy.GetProperty(validKey))
                if property.GetDomain('proxy_list') and len(
                        value) == 1 and type(value[0]) == str:
                    try:
                        idx = property.GetAvailable().index(value[0])
                        proxyToSet = servermanager._getPyProxy(
                            property.GetDomain('proxy_list').GetProxy(idx))
                        property.SetData(proxyToSet)
                    except:
                        traceback.print_stack()
                        pass
                elif value == 'vtkProcessId':
                    property.SetElement(0, value)
                else:
                    property.SetData(value)
    except:
        traceback.print_stack()
Exemple #8
0
def updateProxyProperties(proxy, properties):
   """
   Loop over the properties object and update the mapping properties
   to the given proxy.
   """
   try:
       allowedProperties = proxy.ListProperties()
       for key in properties:
          validKey = servermanager._make_name_valid(key)
          if validKey in allowedProperties:
             value = removeUnicode(properties[key])
             property = servermanager._wrap_property(proxy, proxy.GetProperty(validKey))
             if property.GetDomain('proxy_list') and len(value) == 1 and type(value[0]) == str:
                 try:
                    idx = property.GetAvailable().index(value[0])
                    proxyToSet = servermanager._getPyProxy(property.GetDomain('proxy_list').GetProxy(idx))
                    property.SetData(proxyToSet)
                 except:
                    traceback.print_stack()
                    pass
             elif value == 'vtkProcessId':
                property.SetElement(0, value)
             else:
                property.SetData(value)
   except:
        traceback.print_stack()
Exemple #9
0
def Options():
    """Creates and returns an options object which is used to configure Catalyst
    specific options such as output directories, live support, etc."""
    # we import simple to ensure that the active connection is created
    from paraview import servermanager, simple
    pxm = servermanager.ProxyManager()
    proxy = pxm.NewProxy("coprocessing", "CatalystOptions")
    return servermanager._getPyProxy(proxy)
Exemple #10
0
def get_consumers(proxy, filter, consumer_set, recursive=True):
    """Returns the consumers for a proxy iteratively. If filter is non-None,
    filter is used to cull consumers."""
    for i in xrange(proxy.GetNumberOfConsumers()):
        consumer = proxy.GetConsumerProxy(i)
        consumer = consumer.GetTrueParentProxy() if consumer else None
        consumer = sm._getPyProxy(consumer)
        if not consumer or consumer.IsPrototype() or consumer in consumer_set:
            continue
        if filter(consumer):
            consumer_set.add(consumer)
            if recursive: get_consumers(consumer, filter, consumer_set)
Exemple #11
0
def get_consumers(proxy, filter, consumer_set, recursive=True):
    """Returns the consumers for a proxy iteratively. If filter is non-None,
    filter is used to cull consumers."""
    for i in xrange(proxy.GetNumberOfConsumers()):
        consumer = proxy.GetConsumerProxy(i)
        consumer = consumer.GetTrueParentProxy() if consumer else None
        consumer = sm._getPyProxy(consumer)
        if not consumer or consumer.IsPrototype() or consumer in consumer_set:
            continue
        if filter(consumer):
            consumer_set.add(consumer)
            if recursive: get_consumers(consumer, filter, consumer_set)
Exemple #12
0
    def CreateTemporalProducer(self, datadescription, inputname):
        """Python access to a temporal cache object associated with a specific
        one simulation product. Much like CreateProducer, only this ends up with
        a temporal cache filter instead of a PVTrivialProducer."""
        if not datadescription.GetInputDescriptionByName(inputname):
            raise RuntimeError ("Simulation input name '%s' does not exist" % inputname)

        idd = datadescription.GetInputDescriptionByName(inputname)

        cache = idd.GetTemporalCache()
        if not cache:
            raise RuntimeError ("I see no cache for '%s'" % inputname)
            return

        return servermanager._getPyProxy(cache)
Exemple #13
0
def get_producers(proxy, filter, producer_set):
    """Returns the producers for a proxy iteratively. If filter is non-None,
    filter is used to cull producers."""
    for i in xrange(proxy.GetNumberOfProducers()):
        producer = proxy.GetProducerProxy(i)
        producer = producer.GetTrueParentProxy() if producer else None
        producer = sm._getPyProxy(producer)
        if not producer or producer.IsPrototype() or producer in producer_set:
            continue
        if filter(producer):
            producer_set.add(producer)
            get_producers(producer, filter, producer_set)
    # FIXME: LookupTable is missed :/, darn subproxies!
    try:
        if proxy.LookupTable and filter(proxy.LookupTable):
            producer_set.add(proxy.LookupTable)
            get_producers(proxy.LookupTable, filter, producer_set)
    except AttributeError: pass
    try:
        if proxy.ScalarOpacityFunction and filter(proxy.ScalarOpacityFunction):
            producer_set.add(proxy.ScalarOpacityFunction)
            get_producers(proxy.ScalarOpacityFunction, filter, producer_set)
    except AttributeError: pass
    def applyMaterialToRepresentation(self, name, representation):
        material = self.materials[name] if name in self.materials else {}

        if 'map_Kd' in material:
            if name not in self.textures:
                from paraview import servermanager
                texture = servermanager._getPyProxy(
                    servermanager.CreateProxy('textures', 'ImageTexture'))
                texture.FileName = os.path.join(self.baseDir,
                                                material['map_Kd'][0])
                self.textures[name] = texture
                servermanager.Register(texture)

            representation.Texture = self.textures[name]

        if 'Ka' in material:
            representation.AmbientColor = [float(n) for n in material['Ka']]

        if 'Ks' in material:
            representation.SpecularColor = [float(v) for v in material['Ks']]

        if 'Kd' in material:
            representation.DiffuseColor = [float(v) for v in material['Kd']]

        if 'd' in material:
            representation.Opacity = float(material['d'][0])

        if 'Ns' in material:
            representation.SpecularPower = float(material['Ns'][0])

        if 'illum' in material:
            representation.Ambient = 1.0 if 0 <= float(
                material['illum'][0]) else 0.0
            representation.Diffuse = 1.0 if 1 <= float(
                material['illum'][0]) else 0.0
            representation.Specular = 1.0 if 2 <= float(
                material['illum'][0]) else 0.0
Exemple #15
0
def get_state(options=None, source_set=[], filter=None, raw=False):
    """Returns the state string"""
    if options:
        options = sm._getPyProxy(options)
        propertiesToTraceOnCreate = options.PropertiesToTraceOnCreate
        skipHiddenRepresentations = options.SkipHiddenDisplayProperties
        skipRenderingComponents = options.SkipRenderingComponents
    else:
        propertiesToTraceOnCreate = RECORD_MODIFIED_PROPERTIES
        skipHiddenRepresentations = True
        skipRenderingComponents = False

    # essential to ensure any obsolete accessors don't linger - can cause havoc
    # when saving state following a Python trace session
    # (paraview/paraview#18994)
    import gc
    gc.collect()

    if sm.vtkSMTrace.GetActiveTracer():
        raise RuntimeError ("Cannot generate Python state when tracing is active.")

    if filter is None:
        filter = visible_representations() if skipHiddenRepresentations else supported_proxies()

    # build a set of proxies of interest
    if source_set:
        start_set = source_set
    else:
        # if nothing is specified, we save all views and sources.
        start_set = [x for x in simple.GetSources().values()] + simple.GetViews()
    start_set = [x for x in start_set if filter(x)]

    # now, locate dependencies for the start_set, pruning irrelevant branches
    consumers = set(start_set)
    for proxy in start_set:
        get_consumers(proxy, filter, consumers)

    producers = set()
    for proxy in consumers:
        get_producers(proxy, filter, producers)

    # proxies_of_interest is set of all proxies that we should trace.
    proxies_of_interest = producers.union(consumers)
    #print ("proxies_of_interest", proxies_of_interest)

    trace_config = smtrace.start_trace(preamble="")
    # this ensures that lookup tables/scalar bars etc. are fully traced.
    trace_config.SetFullyTraceSupplementalProxies(True)
    trace_config.SetSkipRenderingComponents(skipRenderingComponents)

    trace = smtrace.TraceOutput()
    trace.append("# state file generated using %s" % simple.GetParaViewSourceVersion())
    trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

    #--------------------------------------------------------------------------
    # We trace the views and layouts, if any.
    if skipRenderingComponents:
        views = []
    else:
        views = [x for x in proxies_of_interest if smtrace.Trace.get_registered_name(x, "views")]

    if views:
        # sort views by their names, so the state has some structure to it.
        views = sorted(views, key=lambda x:\
                smtrace.Trace.get_registered_name(x, "views"))
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# setup views used in the visualization",
            "# ----------------------------------------------------------------"])
        for view in views:
            # FIXME: save view camera positions and size.
            traceitem = smtrace.RegisterViewProxy(view)
            traceitem.finalize()
            del traceitem
        trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))
        trace.append_separated(["SetActiveView(None)"])

    # from views,  build the list of layouts of interest.
    layouts = set()
    for aview in views:
        l = simple.GetLayout(aview)
        if l:
            layouts.add(simple.GetLayout(aview))

    # trace create of layouts
    if layouts:
        layouts = sorted(layouts, key=lambda x:\
                  smtrace.Trace.get_registered_name(x, "layouts"))
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# setup view layouts",
            "# ----------------------------------------------------------------"])
        for layout in layouts:
            traceitem = smtrace.RegisterLayoutProxy(layout)
            traceitem.finalize(filter=lambda x: x in views)
            del traceitem
        trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

    if views:
        # restore the active view after the layouts have been created.
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# restore active view",
            "SetActiveView(%s)" % smtrace.Trace.get_accessor(simple.GetActiveView()),
            "# ----------------------------------------------------------------"])

    #--------------------------------------------------------------------------
    # Next, trace data processing pipelines.
    sorted_proxies_of_interest = __toposort(proxies_of_interest)
    sorted_sources = [x for x in sorted_proxies_of_interest \
        if smtrace.Trace.get_registered_name(x, "sources")]
    if sorted_sources:
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# setup the data processing pipelines",
            "# ----------------------------------------------------------------"])
        for source in sorted_sources:
            traceitem = smtrace.RegisterPipelineProxy(source)
            traceitem.finalize()
            del traceitem
        trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

    #--------------------------------------------------------------------------
    # Can't decide if the representations should be saved with the pipeline
    # objects or afterwards, opting for afterwards for now since the topological
    # sort doesn't guarantee that the representations will follow their sources
    # anyways.
    sorted_representations = [x for x in sorted_proxies_of_interest \
        if smtrace.Trace.get_registered_name(x, "representations")]
    scalarbar_representations = [x for x in sorted_proxies_of_interest\
        if smtrace.Trace.get_registered_name(x, "scalar_bars")]
    # print ("sorted_representations", sorted_representations)
    # print ("scalarbar_representations", scalarbar_representations)
    if not skipRenderingComponents and (sorted_representations or scalarbar_representations):
        for view in views:
            view_representations = [x for x in view.Representations if x in sorted_representations]
            view_scalarbars = [x for x in view.Representations if x in scalarbar_representations]
            if view_representations or view_scalarbars:
                trace.append_separated([\
                    "# ----------------------------------------------------------------",
                    "# setup the visualization in view '%s'" % smtrace.Trace.get_accessor(view),
                    "# ----------------------------------------------------------------"])
            for rep in view_representations:
                try:
                    producer = rep.Input
                    port = rep.Input.Port
                    traceitem = smtrace.Show(producer, port, view, rep,
                        comment="show data from %s" % smtrace.Trace.get_accessor(producer))
                    traceitem.finalize()
                    del traceitem
                    trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

                    if rep.UseSeparateColorMap:
                        trace.append_separated([\
                            "# set separate color map",
                            "%s.UseSeparateColorMap = True" % (\
                                smtrace.Trace.get_accessor(rep))])

                except AttributeError: pass
            # save the scalar bar properties themselves.
            if view_scalarbars:
                trace.append_separated("# setup the color legend parameters for each legend in this view")
                for rep in view_scalarbars:
                    smtrace.Trace.get_accessor(rep)
                    trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))
                    trace.append_separated([\
                      "# set color bar visibility", "%s.Visibility = %s" % (\
                    smtrace.Trace.get_accessor(rep), rep.Visibility)])


            for rep in view_representations:
                try:
                    producer = rep.Input
                    port = rep.Input.Port

                    if rep.IsScalarBarVisible(view):
                        # FIXME: this will save this multiple times, right now,
                        # if two representations use the same LUT.
                        trace.append_separated([\
                            "# show color legend",
                            "%s.SetScalarBarVisibility(%s, True)" % (\
                                smtrace.Trace.get_accessor(rep),
                                smtrace.Trace.get_accessor(view))])

                    if not rep.Visibility:
                      traceitem = smtrace.Hide(producer, port, view)
                      traceitem.finalize()
                      del traceitem
                      trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

                except AttributeError: pass

    #--------------------------------------------------------------------------
    # Now, trace the transfer functions (color maps and opacity maps) used.
    ctfs = set([x for x in proxies_of_interest \
        if smtrace.Trace.get_registered_name(x, "lookup_tables")])
    if not skipRenderingComponents and ctfs:
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# setup color maps and opacity mapes used in the visualization",
            "# note: the Get..() functions create a new object, if needed",
            "# ----------------------------------------------------------------"])
        for ctf in ctfs:
            smtrace.Trace.get_accessor(ctf)
            if ctf.ScalarOpacityFunction in proxies_of_interest:
                smtrace.Trace.get_accessor(ctf.ScalarOpacityFunction)
        trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

    # Trace extract generators.
    exgens = set([x for x in proxies_of_interest \
            if smtrace.Trace.get_registered_name(x, "extract_generators")])
    if exgens:
        trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# setup extract generators",
            "# ----------------------------------------------------------------"])
        for exgen in exgens:
            # FIXME: this currently doesn't handle multiple output ports
            # correctly.
            traceitem = smtrace.CreateExtractGenerator(\
                    xmlname=exgen.Writer.GetXMLName(),
                    producer=exgen.Producer,
                    generator=exgen,
                    registrationName=smtrace.Trace.get_registered_name(exgen, "extract_generators"))
            traceitem.finalize()
            del traceitem
        trace.append_separated(smtrace.get_current_trace_output_and_reset(raw=True))

    # restore the active source since the order in which the pipeline is created
    # in the state file can end up changing the active source to be different
    # than what it was when the state is being saved.
    trace.append_separated([\
            "# ----------------------------------------------------------------",
            "# restore active source",
            "SetActiveSource(%s)" % smtrace.Trace.get_accessor(simple.GetActiveSource()),
            "# ----------------------------------------------------------------"])

    if options:
        # add coda about extracts generation.
        trace.append_separated(["",
            "if __name__ == '__main__':",
            "    # generate extracts",
            "    SaveExtracts(ExtractsOutputDirectory='%s')" % options.ExtractsOutputDirectory])
    del trace_config
    smtrace.stop_trace()
    #print (trace)
    return str(trace) if not raw else trace.raw_data()
                                   NumberOfLabels=2,
                                   LookupTable=lutCR,
                                   Position=[0, 0.1],
                                   Position2=[0.2, 0.9],
                                   Visibility=0,
                                   Selectable=1,
                                   AutomaticLabelFormat=0,
                                   LabelFormat='%-#6.3g')

view.Representations.append(scalarbar)

# Update camera manipulator
manipulatorsProperty = view.GetProperty('Camera3DManipulators')
newList = []
for index in xrange(manipulatorsProperty.GetNumberOfProxies()):
    manipulator = servermanager._getPyProxy(
        manipulatorsProperty.GetProxy(index))
    if manipulator.ManipulatorName != 'Rotation':
        if manipulator.ManipulatorName == 'Pan2':
            manipulator.Shift = 0
        newList.append(manipulator)

manipulatorsProperty.RemoveAllProxies()
for manipulator in newList:
    manipulatorsProperty.AddProxy(manipulator.SMProxy)

view.CameraParallelProjection = 1
view.CameraParallelScale = 2000000
simple.Render()
scalarbar.Visibility = True
legend.Text = "123"
simple.Render()
                                   RGBPoints=[0,0.9,0.9,0.9,\
                                              25,0.55,0.75,0.5,50,0.1,0.58,0.2,\
                                              75,0.54,0.31,0.17,100,0.78,0.2,0.15])
lutYGB = simple.CreateLookupTable( ColorSpace='RGB', \
                                   NumberOfTableValues=256, \
                                   RGBPoints=[0,1,1,0.8,25,0.63,0.86,0.71,50,0.26,0.71,0.77,75,0.17,0.5,0.72,100,0.15,0.2,0.58])

scalarbar = simple.CreateScalarBar( Title='', LabelFontSize=8, Enabled=0, TitleFontSize=10, NumberOfLabels=2, LookupTable=lutCR, Position=[0,0.1], Position2=[0.2, 0.9], Visibility=0, Selectable=1, AutomaticLabelFormat=0, LabelFormat='%-#6.3g')

view.Representations.append(scalarbar)

# Update camera manipulator
manipulatorsProperty = view.GetProperty('Camera3DManipulators');
newList = [];
for index in xrange(manipulatorsProperty.GetNumberOfProxies()):
   manipulator = servermanager._getPyProxy(manipulatorsProperty.GetProxy(index))
   if manipulator.ManipulatorName != 'Rotation':
      if manipulator.ManipulatorName == 'Pan2':
         manipulator.Shift = 0
      newList.append(manipulator)

manipulatorsProperty.RemoveAllProxies()
for manipulator in newList:
   manipulatorsProperty.AddProxy(manipulator.SMProxy)


view.CameraParallelProjection = 1
view.CameraParallelScale = 2000000
simple.Render()
scalarbar.Visibility = True
legend.Text = "123"