[Paraview] ClipType position in case of box type
livia.barazzetti at istb.unibe.ch
livia.barazzetti at istb.unibe.ch
Tue Jun 17 11:48:01 EDT 2014
Dear users,
I am creating a macro for automatically clipping a polydata. I would like to have cubic boxes as implicit function for clipping (that is to say, clipping along x,y,z at fixed distances)
Unfortunately I was not able to find the documentation for clip type properties in case of box. In particular, I don't understand how the position is computed (is it absolute or relative? is it the position of the center or of the corner of the clip box?) . If I understood correctly, the scale is relative to the bounding box (of the object being clipped).
This is what I have so far:
s = paraview.simple.GetActiveSource()
b = s.GetDataInformation().GetBounds()
dims = [b[1] -b[0], b[3] - b[2],b[5] -b[4]]
#l is the side of the cube that will used for clipping (fixed, measure in absolute terms)
l=0.2
scale = numpy.divide(cube_edge,dims)
#i compute how many times the cube is included in the object
times=[1/scale[0],1/scale[1], 1/scale[2] ]
#start creating clips
for x in range(int(ceil(times[0]))) :
for y in range(int(ceil(times[1]))) :
for z in range(int(ceil(times[2]))) :
paraview.simple.SetActiveSource(s)
c = paraview.simple.Clip()
c.ClipType = "Box"
c.InsideOut = 1
c.ClipType.Bounds = b
c.ClipType.Scale = scale
c.Crinkleclip = 1
c.ClipType.Rotation = [0,0,0]
c.ClipType.Position = [x/times[0] * dims[0], y/times[1] * dims[1], z/times[2] * dims[2]]
paraview.simple.Show()
The macro works if the cube is bigger than the bounding box of the objects, in other cases I see that the position of the clip box is not where I expect it to be (it looks dependent on the scale, especially when the bounding box is not centered in the origin)
How can I handle correctly the position?
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20140617/5f5b900c/attachment.html>
More information about the ParaView
mailing list