[vtkusers] How to set cell visibility off

Jothy jothybasu at gmail.com
Fri May 7 07:35:12 EDT 2010


Its not a vtu file, I manually created it. This not for a cube, its
for hexahedron.

Here is the code

BeamPoints = vtk.vtkPoints()
    BeamPoints.SetNumberOfPoints(8)
    #print -x_Half_Up,-y_Half_Up
    BeamPoints.InsertPoint(0,-50,400, -50)
    BeamPoints.InsertPoint(1, 50, 400, -50)
    BeamPoints.InsertPoint(2, 50, 400, 50)
    BeamPoints.InsertPoint(3, -50,400, 50)
    BeamPoints.InsertPoint(4,-50,1400, 50)
    BeamPoints.InsertPoint(5, 50, 1400, 50)
    BeamPoints.InsertPoint(6, 50, 1400, -50)
    BeamPoints.InsertPoint(7, -50,1400, -50)
    aBeam = vtk.vtkHexahedron()
    aBeam.GetPointIds().SetId(0, 0)
    aBeam.GetPointIds().SetId(1, 1)
    aBeam.GetPointIds().SetId(2, 2)
    aBeam.GetPointIds().SetId(3, 3)
    aBeam.GetPointIds().SetId(4, 7)
    aBeam.GetPointIds().SetId(5, 6)
    aBeam.GetPointIds().SetId(6, 5)
    aBeam.GetPointIds().SetId(7, 4)
    aBeamGrid = vtk.vtkUnstructuredGrid()
    aBeamGrid.Allocate(1, 1)
    aBeamGrid.InsertNextCell(aBeam.GetCellType(),aBeam.GetPointIds())
    aBeamGrid.SetPoints(BeamPoints)
    aBeamMapper = vtk.vtkDataSetMapper()
    aBeamMapper.SetInput(aBeamGrid)
    aBeamActor = vtk.vtkActor()
    aBeamActor.SetMapper(aBeamMapper)
    aBeamActor.AddPosition(0,0,0)
    aBeamActor.GetProperty().SetColor(color)
    aBeamActor.GetProperty().SetOpacity(0.50)
    aBeamActor.SetOrientation(0,0,Angle)
    aBeamActor.GetProperty().EdgeVisibilityOn()
    aBeamActor.GetProperty().SetEdgeColor(1,1,1)
    aBeamActor.GetProperty().SetLineWidth(1.5)


Thanks,

Jothy

On Fri, May 7, 2010 at 12:23 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Fri, May 7, 2010 at 6:33 AM, Jothy <jothybasu at gmail.com> wrote:
>>
>> Hi Guys,
>>
>> I have created a cube with vtkUnstructuredGrid, but when I cut it
>> using vtkCutter it draws a line along the diagonal. Why this happend
>> and is there any way to put it off/hidden?
>>
>> Please see the screenshot.
>>
>> Thanks,
>>
>> Jothy
>>
>
> My first bet is that it is simply triangulated, so the square you are
> expecting is actually 2 triangles. In that case, there would be no way to
> turn off the diagonal line.
> Maybe you can attach the actual vtu file?
> David
>



More information about the vtkusers mailing list