コード例 #1
0
    def view(self, cam=None):
        """
        Description
        -----------
        Use this method to update the camera to the saved location

        Parameters
        ----------
        `cam` : vtkRenderingOpenGL2Python.vtkOpenGLCamera, optional
        - The camera you wish to view/update in the current render view

        """
        if cam is None:
            # This allows use to dynamicly select cameras
            cam = GetActiveCamera()
        orientation = self._getOrientation()
        position = self._getPosition()
        focus = self._getFocalPoint()
        viewup = self._getViewUp()

        # set the camera position and orientation
        cam.SetPosition(position)
        cam.SetViewUp(viewup)
        cam.SetFocalPoint(focus)
        RenderAllViews()
コード例 #2
0
def customAxisTicks(rng, axis=0, uniform=False):
    from paraview.simple import GetActiveViewOrCreate, RenderAllViews
    # note that third parameter is the step size
    # get the active view
    rv = GetActiveViewOrCreate('RenderView')
    if axis is 0 or uniform:
        rv.AxesGrid.XAxisUseCustomLabels = 1
        rv.AxesGrid.XAxisLabels = rng
    if axis is 1 or uniform:
        rv.AxesGrid.YAxisUseCustomLabels = 1
        rv.AxesGrid.YAxisLabels = rng
    if axis is 2 or uniform:
        rv.AxesGrid.ZAxisUseCustomLabels = 1
        rv.AxesGrid.ZAxisLabels = rng
    RenderAllViews()
    return None
コード例 #3
0
ファイル: axes.py プロジェクト: lijielife/PVGeo
def resetAxisTicks(axis):
    """Use to reset the axis ticks in the render view for any given axii

    Args:
        axis (int or list(int)): The axis to set (X=0, Y=1, or Z=2)
    """
    from paraview.simple import GetActiveViewOrCreate, RenderAllViews
    rv = GetActiveViewOrCreate('RenderView')
    if not isinstance(axis, (list, tuple)):
        axis = [axis]
    for ax in axis:
        if ax is 0:
            rv.AxesGrid.XAxisLabels = []
            rv.AxesGrid.XAxisUseCustomLabels = 0
        if ax is 1:
            rv.AxesGrid.YAxisLabels = []
            rv.AxesGrid.YAxisUseCustomLabels = 0
        if ax is 2:
            rv.AxesGrid.ZAxisLabels = []
            rv.AxesGrid.ZAxisUseCustomLabels = 0
        RenderAllViews()
    return None
コード例 #4
0
ファイル: axes.py プロジェクト: lijielife/PVGeo
def customAxisTicks(rng, axis=0, uniform=False):
    """Use to set custom axis ticks in the render view

    Args:
        rng (list(float)): A list or tuple of floats for the axis ticks
        axis (int): The axis to set (X=0, Y=1, or Z=2)
        uniform (bool): An optional flag to use the given range on all axii
    """
    from paraview.simple import GetActiveViewOrCreate, RenderAllViews
    # note that third parameter is the step size
    # get the active view
    rv = GetActiveViewOrCreate('RenderView')
    if axis is 0 or uniform:
        rv.AxesGrid.XAxisUseCustomLabels = 1
        rv.AxesGrid.XAxisLabels = rng
    if axis is 1 or uniform:
        rv.AxesGrid.YAxisUseCustomLabels = 1
        rv.AxesGrid.YAxisLabels = rng
    if axis is 2 or uniform:
        rv.AxesGrid.ZAxisUseCustomLabels = 1
        rv.AxesGrid.ZAxisLabels = rng
    RenderAllViews()
    return None
コード例 #5
0
    if args["legendComponentTitle"] != "none":
        legend.ComponentTitle = args["legendComponentTitle"]

    # set a white background color and black color for fonts and the grid
    if args["whiteBackground"]:
        renderView1.Background = [255, 255, 255]
        legend.TitleColor = [0.0, 0.0, 0.0]
        legend.LabelColor = [0.0, 0.0, 0.0]
        if args["showAxesGrid"]:
            renderView1.AxesGrid.GridColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.XTitleColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.YTitleColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.ZTitleColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.XLabelColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.YLabelColor = [0.0, 0.0, 0.0]
            renderView1.AxesGrid.ZLabelColor = [0.0, 0.0, 0.0]

    # current camera placement for renderView1
    renderView1.InteractionMode = "2D"
    # renderView1.CameraPosition = [5.0, 0.12345, 0.0]
    # renderView1.CameraFocalPoint = [5.0, 0.12345, 0.0]

    # uncomment the following to render all views
    RenderAllViews()
    UseOffscreenRenderingForScreenshots = 1

    # save screenshot
    if not args["outFile"] == "":
        basename = args["outFile"]
    SaveScreenshot(outDirectory + basename + ".png")