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
_______________________________________________
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
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview