[Paraview] python changes 4.0/4.1 to 4.3?
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Tue Jun 9 08:57:07 EDT 2015
Anton,
DiffuseColor still exists. Can you post the full error message that you're
getting? If you can share the dataset you're using to test this script,
that'll be even better!
Utkarsh
On Mon, Jun 8, 2015 at 7:39 PM Anton Shterenlikht <mexas at bris.ac.uk> wrote:
> I've a script that used to work ok on 4.0 and 4.1,
> but now something is wrong with the colours.
> Has anything changed between 4.0/4.1 to 4.3 to make
>
> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]
>
> not understood?
>
>
> The full script:
>
> ######################################################################72
> # Adjust these parameters
> ext1 = 220 # data extent along 1
> ext2 = 220 # data extent along 2
> ext3 = 220 # data extent along 3
> ffile = "zf5.raw" # fracture file
> gfile = "zg0.raw" # grain file
> imsize1 = 1000 # size, in pixels, of the resulting image along 1
> imsize2 = 1000 # size, in pixels, of the resulting image along 2
>
> # End of adjustable parameters
> ######################################################################72
>
> # define the centre of rotation (cor)
> cor1 = 0.5 * ext1
> cor2 = 0.5 * ext2
> cor3 = 0.5 * ext3
>
> from paraview.simple import *
>
> # the extents start from zero, so need to lower
> # the upper extents by 1
> cracks = ImageReader( FilePrefix= ffile )
> cracks.DataExtent=[ 0, ext1-1, 0, ext2-1, 0, ext3-1 ]
> cracks.DataByteOrder = 'LittleEndian'
> cracks.DataScalarType = 'int'
>
> RenderView1 = GetRenderView()
> DataRepresentation1 = Show()
>
> DataRepresentation1.Representation = 'Outline'
> DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5]
>
> # grain boundaries, cell state 2
>
> Threshold1 = Threshold()
> Threshold1.Scalars = ['POINTS', 'ImageFile']
> Threshold1.ThresholdRange = [ 2, 2 ]
> Threshold1.AllScalars = 0
>
> DataRepresentation2 = Show()
> DataRepresentation2.ScalarOpacityUnitDistance = 1.0
> DataRepresentation2.SelectionPointFieldDataArrayName = 'ImageFile'
> DataRepresentation2.DiffuseColor = [ 1, 0, 1 ]
>
> camera = GetActiveCamera()
> camera.SetViewUp(-1,0,0)
> camera.Azimuth(30)
> camera.Elevation(30)
>
> RenderView1.ResetCamera()
>
> # gradient background colour
> RenderView1.UseGradientBackground = 1
> RenderView1.Background2 = [0.0, 0.0, 0.16470588235294117]
> RenderView1.Background = [0.3215686274509804, 0.3411764705882353,
> 0.43137254901960786]
>
> RenderView1.CenterAxesVisibility = 0
> RenderView1.OrientationAxesVisibility = 1
> RenderView1.CenterOfRotation = [ cor1, cor2, cor3 ]
> RenderView1.CameraFocalPoint = [ cor1, cor2, cor3 ]
> RenderView1.ViewSize = [ imsize1, imsize2 ]
> RenderView1.CameraViewAngle = 30
>
> # do all crack states from the main dataset
> SetActiveSource( cracks )
>
> # (100) cracks
> cracks100 = Threshold()
> cracks100.Scalars = ['POINTS', 'ImageFile']
> cracks100.ThresholdRange = [ 0, 0 ]
> cracks100.AllScalars = 0
>
> DataRepresentation3 = Show()
> DataRepresentation3.ScalarOpacityUnitDistance = 1.0
> DataRepresentation3.SelectionPointFieldDataArrayName = 'ImageFile'
> DataRepresentation3.DiffuseColor = [1.0, 1.0, 0.0]
>
> # (110) cracks
> SetActiveSource( cracks )
> cracks110 = Threshold()
> cracks110.Scalars = ['POINTS', 'ImageFile']
> cracks110.ThresholdRange = [ -1, -1 ]
> cracks110.AllScalars = 0
>
> DataRepresentation4 = Show()
> DataRepresentation4.ScalarOpacityUnitDistance = 1.0
> DataRepresentation4.SelectionPointFieldDataArrayName = 'ImageFile'
> DataRepresentation4.DiffuseColor = [0.0, 1.0, 0.5]
>
> # 1 is to show, 0 not to show
> # data2 is GB
> # data3 is cracks
> # data4 is grains microstructure
>
> DataRepresentation2.Opacity = 0.1
> WriteImage( "crgb.png" )
>
> DataRepresentation2.Opacity = 1
> DataRepresentation3.Visibility = 0
> WriteImage( "gb.png" )
>
> DataRepresentation2.Visibility = 0
> DataRepresentation3.Visibility = 1
> WriteImage( "cr.png" )
>
> RenderView1.ResetCamera()
>
> Render()
>
>
> ****
>
> Is there anything wrong in this script for 4.3?
>
> Many thanks
>
> Anton
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/paraview
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150609/7cad45a2/attachment.html>
More information about the ParaView
mailing list