# trace generated using paraview version 6.0.1
#import paraview
#paraview.compatibility.major = 6
#paraview.compatibility.minor = 0

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# get active view
renderView1 = GetActiveViewOrCreate('RenderView')

# create a new 'Sphere'
sphere1 = Sphere(registrationName='Sphere1')
sphere1.Set(
    Center=[0.0, 0.0, 0.0],
    Radius=0.5,
    ThetaResolution=8,
    StartTheta=0.0,
    EndTheta=360.0,
    PhiResolution=8,
    StartPhi=0.0,
    EndPhi=180.0,
)

# Properties modified on sphere1
sphere1.Set(
    ThetaResolution=180,
    PhiResolution=180,
)

# show data in view
sphere1Display = Show(sphere1, renderView1, 'GeometryRepresentation')

# trace defaults for the display properties.
sphere1Display.Set(
    Selection=None,
    Representation='Surface',
    ColorArrayName=[None, ''],
    LookupTable=None,
    MapScalars=1,
    MultiComponentsMapping=0,
    InterpolateScalarsBeforeMapping=1,
    UseNanColorForMissingArrays=0,
    Opacity=1.0,
    PointSize=2.0,
    LineWidth=1.0,
    RenderLinesAsTubes=0,
    RenderPointsAsSpheres=0,
    DisableLighting=0,
    Diffuse=1.0,
    Interpolation='Gouraud',
    Specular=0.0,
    SpecularColor=[1.0, 1.0, 1.0],
    SpecularPower=100.0,
    Luminosity=0.0,
    Ambient=0.0,
    Roughness=0.3,
    Metallic=0.0,
    EdgeTint=[1.0, 1.0, 1.0],
    Anisotropy=0.0,
    AnisotropyRotation=0.0,
    BaseIOR=1.5,
    CoatStrength=0.0,
    CoatIOR=2.0,
    CoatRoughness=0.0,
    CoatColor=[1.0, 1.0, 1.0],
    SelectNormalArray='Normals',
    SelectTangentArray='None',
    ComputePointNormals=0,
    Splitting=1,
    FeatureAngle=30.0,
    SelectTCoordArray='None',
    Texture=None,
    RepeatTextures=1,
    InterpolateTextures=0,
    SeamlessU=0,
    SeamlessV=0,
    UseMipmapTextures=0,
    ShowTexturesOnBackface=1,
    BaseColorTexture=None,
    NormalTexture=None,
    NormalScale=1.0,
    CoatNormalTexture=None,
    CoatNormalScale=1.0,
    MaterialTexture=None,
    OcclusionStrength=1.0,
    AnisotropyTexture=None,
    EmissiveTexture=None,
    EmissiveFactor=[1.0, 1.0, 1.0],
    TextureTransform='Transform2',
    EdgeOpacity=1.0,
    BackfaceRepresentation='Follow Frontface',
    BackfaceAmbientColor=[1.0, 1.0, 1.0],
    BackfaceOpacity=1.0,
    Translation=[0.0, 0.0, 0.0],
    Scale=[1.0, 1.0, 1.0],
    Orientation=[0.0, 0.0, 0.0],
    Origin=[0.0, 0.0, 0.0],
    CoordinateShiftScaleMethod='Always Auto Shift Scale',
    CoordinateSystem='Navigable',
    Pickable=1,
    Triangulate=0,
    UseShaderReplacements=0,
    ShaderReplacements='',
    NonlinearSubdivisionLevel=1,
    MatchBoundariesIgnoringCellOrder=0,
    UseDataPartitions=0,
    OSPRayUseScaleArray='All Approximate',
    OSPRayScaleArray='Normals',
    OSPRayScaleFunction='Piecewise Function',
    OSPRayMaterial='None',
    Assembly='',
    SelectedBlockSelectors=[''],
    BlockSelectors=['/'],
    BlockColors=[],
    BlockColorArrayNames=[],
    BlockLookupTables=[],
    BlockUseSeparateColorMaps=[],
    BlockMapScalars=[],
    BlockInterpolateScalarsBeforeMappings=[],
    BlockOpacities=[],
    BlockMapScalarsGUI=1,
    BlockInterpolateScalarsBeforeMappingsGUI=1,
    BlockOpacitiesGUI=1.0,
    Orient=0,
    OrientationMode='Direction',
    SelectOrientationVectors='None',
    Scaling=0,
    ScaleMode='No Data Scaling Off',
    ScaleFactor=0.1,
    SelectScaleArray='None',
    GlyphType='Arrow',
    UseGlyphTable=0,
    GlyphTableIndexArray='None',
    UseCompositeGlyphTable=0,
    UseGlyphCullingAndLOD=0,
    LODValues=[],
    ColorByLODIndex=0,
    GaussianRadius=0.005,
    ShaderPreset='Sphere',
    CustomTriangleScale=3,
    Emissive=0,
    ScaleByArray=0,
    SetScaleArray=['POINTS', 'Normals'],
    ScaleArrayComponent='X',
    UseScaleFunction=1,
    ScaleTransferFunction='Piecewise Function',
    OpacityByArray=0,
    OpacityArray=['POINTS', 'Normals'],
    OpacityArrayComponent='X',
    OpacityTransferFunction='Piecewise Function',
    DataAxesGrid='Grid Axes Representation',
    SelectionCellLabelBold=0,
    SelectionCellLabelColor=[0.0, 1.0, 0.0],
    SelectionCellLabelFontFamily='Arial',
    SelectionCellLabelFontFile='',
    SelectionCellLabelFontSize=18,
    SelectionCellLabelItalic=0,
    SelectionCellLabelJustification='Left',
    SelectionCellLabelOpacity=1.0,
    SelectionCellLabelShadow=0,
    SelectionPointLabelBold=0,
    SelectionPointLabelColor=[1.0, 1.0, 0.0],
    SelectionPointLabelFontFamily='Arial',
    SelectionPointLabelFontFile='',
    SelectionPointLabelFontSize=18,
    SelectionPointLabelItalic=0,
    SelectionPointLabelJustification='Left',
    SelectionPointLabelOpacity=1.0,
    SelectionPointLabelShadow=0,
    PolarAxes='Polar Axes Representation',
    SelectInputVectors=['POINTS', 'Normals'],
    NumberOfSteps=40,
    StepSize=0.25,
    NormalizeVectors=1,
    EnhancedLIC=1,
    ColorMode='Blend',
    LICIntensity=0.8,
    MapModeBias=0.0,
    EnhanceContrast='Off',
    LowLICContrastEnhancementFactor=0.0,
    HighLICContrastEnhancementFactor=0.0,
    LowColorContrastEnhancementFactor=0.0,
    HighColorContrastEnhancementFactor=0.0,
    AntiAlias=0,
    MaskOnSurface=1,
    MaskThreshold=0.0,
    MaskIntensity=0.0,
    MaskColor=[0.5, 0.5, 0.5],
    GenerateNoiseTexture=0,
    NoiseType='Gaussian',
    NoiseTextureSize=128,
    NoiseGrainSize=2,
    MinNoiseValue=0.0,
    MaxNoiseValue=0.8,
    NumberOfNoiseLevels=1024,
    ImpulseNoiseProbability=1.0,
    ImpulseNoiseBackgroundValue=0.0,
    NoiseGeneratorSeed=1,
    CompositeStrategy='AUTO',
    UseLICForLOD=0,
    WriteLog='',
    CustomShader=""" // This custom shader code define a gaussian blur
 // Please take a look into vtkSMPointGaussianRepresentation.cxx
 // for other custom shader examples
 //VTK::Color::Impl
   float dist2 = dot(offsetVCVSOutput.xy,offsetVCVSOutput.xy);
   float gaussian = exp(-0.5*dist2);
   opacity = opacity*gaussian;
""",
)

# init the 'Transform2' selected for 'TextureTransform'
sphere1Display.TextureTransform.Set(
    Translate=[0.0, 0.0, 0.0],
    Rotate=[0.0, 0.0, 0.0],
    Scale=[1.0, 1.0, 1.0],
)

# init the 'Piecewise Function' selected for 'OSPRayScaleFunction'
sphere1Display.OSPRayScaleFunction.Set(
    Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0],
    UseLogScale=0,
)

# init the 'Arrow' selected for 'GlyphType'
sphere1Display.GlyphType.Set(
    TipResolution=6,
    TipRadius=0.1,
    TipLength=0.35,
    ShaftResolution=6,
    ShaftRadius=0.03,
    Invert=0,
)

# init the 'Piecewise Function' selected for 'ScaleTransferFunction'
sphere1Display.ScaleTransferFunction.Set(
    Points=[-0.9999614953994751, 0.0, 0.5, 0.0, 0.9999614953994751, 1.0, 0.5, 0.0],
    UseLogScale=0,
)

# init the 'Piecewise Function' selected for 'OpacityTransferFunction'
sphere1Display.OpacityTransferFunction.Set(
    Points=[-0.9999614953994751, 0.0, 0.5, 0.0, 0.9999614953994751, 1.0, 0.5, 0.0],
    UseLogScale=0,
)

# init the 'Grid Axes Representation' selected for 'DataAxesGrid'
sphere1Display.DataAxesGrid.Set(
    XTitle='X Axis',
    YTitle='Y Axis',
    ZTitle='Z Axis',
    XTitleFontFamily='Arial',
    XTitleFontFile='',
    XTitleBold=0,
    XTitleItalic=0,
    XTitleFontSize=12,
    XTitleShadow=0,
    XTitleOpacity=1.0,
    YTitleFontFamily='Arial',
    YTitleFontFile='',
    YTitleBold=0,
    YTitleItalic=0,
    YTitleFontSize=12,
    YTitleShadow=0,
    YTitleOpacity=1.0,
    ZTitleFontFamily='Arial',
    ZTitleFontFile='',
    ZTitleBold=0,
    ZTitleItalic=0,
    ZTitleFontSize=12,
    ZTitleShadow=0,
    ZTitleOpacity=1.0,
    FacesToRender=63,
    CullBackface=0,
    CullFrontface=1,
    ShowGrid=0,
    ShowEdges=1,
    ShowTicks=1,
    LabelUniqueEdgesOnly=1,
    AxesToLabel=63,
    XLabelFontFamily='Arial',
    XLabelFontFile='',
    XLabelBold=0,
    XLabelItalic=0,
    XLabelFontSize=12,
    XLabelShadow=0,
    XLabelOpacity=1.0,
    YLabelFontFamily='Arial',
    YLabelFontFile='',
    YLabelBold=0,
    YLabelItalic=0,
    YLabelFontSize=12,
    YLabelShadow=0,
    YLabelOpacity=1.0,
    ZLabelFontFamily='Arial',
    ZLabelFontFile='',
    ZLabelBold=0,
    ZLabelItalic=0,
    ZLabelFontSize=12,
    ZLabelShadow=0,
    ZLabelOpacity=1.0,
    XAxisNotation='Mixed',
    XAxisPrecision=2,
    XAxisUseCustomLabels=0,
    XAxisLabels=[],
    YAxisNotation='Mixed',
    YAxisPrecision=2,
    YAxisUseCustomLabels=0,
    YAxisLabels=[],
    ZAxisNotation='Mixed',
    ZAxisPrecision=2,
    ZAxisUseCustomLabels=0,
    ZAxisLabels=[],
    UseCustomBounds=0,
    CustomBounds=[0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
)

# init the 'Polar Axes Representation' selected for 'PolarAxes'
sphere1Display.PolarAxes.Set(
    Visibility=0,
    Translation=[0.0, 0.0, 0.0],
    Scale=[1.0, 1.0, 1.0],
    Orientation=[0.0, 0.0, 0.0],
    EnableCustomBounds=[0, 0, 0],
    CustomBounds=[0.0, 1.0, 0.0, 1.0, 0.0, 1.0],
    EnableCustomRange=0,
    CustomRange=[0.0, 1.0],
    AutoPole=1,
    PolarAxisVisibility=1,
    RadialAxesVisibility=1,
    DrawRadialGridlines=1,
    PolarArcsVisibility=1,
    DrawPolarArcsGridlines=1,
    NumberOfRadialAxes=0,
    DeltaAngleRadialAxes=45.0,
    NumberOfArcs=5,
    DeltaRangeArcs=0.0,
    CustomMinRadius=1,
    MinimumRadius=0.0,
    CustomMaxRadius=0,
    MaximumRadius=1.0,
    CustomAngles=1,
    MinimumAngle=0.0,
    MaximumAngle=90.0,
    RadialAxesOriginToPolarAxis=1,
    PolarArcResolutionPerDegree=0.2,
    Ratio=1.0,
    EnableOverallColor=1,
    OverallColor=[1.0, 1.0, 1.0],
    PolarAxisColor=[1.0, 1.0, 1.0],
    PolarArcsColor=[1.0, 1.0, 1.0],
    LastRadialAxisColor=[1.0, 1.0, 1.0],
    SecondaryPolarArcsColor=[1.0, 1.0, 1.0],
    SecondaryRadialAxesColor=[1.0, 1.0, 1.0],
    PolarAxisTitleVisibility=1,
    PolarAxisTitle='Radial Distance',
    PolarAxisTitleLocation='Bottom',
    PolarTitleOffset=[20.0, 20.0],
    PolarLabelVisibility=1,
    PolarLabelFormat='%-#6.3g',
    PolarLabelExponentLocation='Labels',
    PolarLabelOffset=10.0,
    PolarExponentOffset=5.0,
    RadialLabelVisibility=1,
    RadialLabelFormat='%-#3.1f',
    RadialLabelLocation='Bottom',
    RadialLabelOffset=[20.0, 0.0],
    RadialUnitsVisibility=1,
    ScreenSize=10.0,
    PolarAxisTitleOpacity=1.0,
    PolarAxisTitleFontFamily='Arial',
    PolarAxisTitleFontFile='',
    PolarAxisTitleBold=0,
    PolarAxisTitleItalic=0,
    PolarAxisTitleShadow=0,
    PolarAxisTitleFontSize=12,
    PolarAxisLabelOpacity=1.0,
    PolarAxisLabelFontFamily='Arial',
    PolarAxisLabelFontFile='',
    PolarAxisLabelBold=0,
    PolarAxisLabelItalic=0,
    PolarAxisLabelShadow=0,
    PolarAxisLabelFontSize=12,
    LastRadialAxisTextOpacity=1.0,
    LastRadialAxisTextFontFamily='Arial',
    LastRadialAxisTextFontFile='',
    LastRadialAxisTextBold=0,
    LastRadialAxisTextItalic=0,
    LastRadialAxisTextShadow=0,
    LastRadialAxisTextFontSize=12,
    SecondaryRadialAxesTextOpacity=1.0,
    SecondaryRadialAxesTextFontFamily='Arial',
    SecondaryRadialAxesTextFontFile='',
    SecondaryRadialAxesTextBold=0,
    SecondaryRadialAxesTextItalic=0,
    SecondaryRadialAxesTextShadow=0,
    SecondaryRadialAxesTextFontSize=12,
    EnableDistanceLOD=1,
    DistanceLODThreshold=0.7,
    EnableViewAngleLOD=1,
    ViewAngleLODThreshold=0.7,
    SmallestVisiblePolarAngle=0.5,
    AllTicksVisibility=1,
    ArcTicksOriginToPolarAxis=1,
    TickLocation='Both',
    AxisTickVisibility=1,
    AxisMinorTickVisibility=0,
    AxisTickMatchesPolarAxes=1,
    DeltaRangeMajor=1.0,
    DeltaRangeMinor=0.5,
    ArcTickVisibility=1,
    ArcMinorTickVisibility=0,
    ArcTickMatchesRadialAxes=1,
    DeltaAngleMajor=10.0,
    DeltaAngleMinor=5.0,
    TickRatioRadiusSize=0.02,
    PolarAxisMajorTickSize=0.0,
    PolarAxisTickRatioSize=0.3,
    PolarAxisMajorTickThickness=1.0,
    PolarAxisTickRatioThickness=0.5,
    LastRadialAxisMajorTickSize=0.0,
    LastRadialAxisTickRatioSize=0.3,
    LastRadialAxisMajorTickThickness=1.0,
    LastRadialAxisTickRatioThickness=0.5,
    ArcMajorTickSize=0.0,
    ArcTickRatioSize=0.3,
    ArcMajorTickThickness=1.0,
    ArcTickRatioThickness=0.5,
    Use2DMode=0,
    UseLogAxis=0,
)

# reset view to fit data
renderView1.ResetCamera(False, 0.9)

# get the material library
materialLibrary1 = GetMaterialLibrary()

# update the view to ensure updated data information
renderView1.Update()

# Properties modified on renderView1
renderView1.EnableRayTracing = 1

# Properties modified on renderView1
renderView1.BackEnd = 'OptiX pathtracer'

# Properties modified on sphere1Display
sphere1Display.OSPRayMaterial = 'Metal_Aluminium_flat'

# Properties modified on renderView1
renderView1.SamplesPerPixel = 2
Render()

# Crashes if I uncomment the next line
# renderView1.SamplesPerPixel = 40
# Render()







