[MayaVi-users] VTK
Status: Beta
Brought to you by:
prabhu_r
|
From: Miguel A. C. A. <mac...@es...> - 2009-03-28 07:03:47
|
Hi people I'm working in a project to graph using VTK. I'm using the class XYPlotActor and I need to graph 2 or more points inside of XYPlotActor actor. I was trying with vtkPoints. With this code I see that I can draw a point but I can't put its inside of my XYPlotActor actor.
How I can draw 2 or more points inside my XYPlotActor actor?
the image attached represent my program using XYPlotActor
The main idea is graph the X and the Y grids in a vtkXYPlotActor figure like the image With Grid X and Y.png
PD: I'm a Cuban student
I don't speak English very good I speak Spanish excuse the mistakes.
thanks.
**************************************************************************
This is the code that draw the points
#!/usr/bin/env python
import vtk
# Create several unstructured grids each containing a cell of a
# different type.
polyVertexPoints = vtk.vtkPoints()
polyVertexPoints.SetNumberOfPoints(3)
polyVertexPoints.InsertPoint(0, 0, 0, 0)
polyVertexPoints.InsertPoint(1, 0.1, 0, 0)
polyVertexPoints.InsertPoint(2, 0.1, 0.1, 0)
aPolyVertex = vtk.vtkPolyVertex()
aPolyVertex.GetPointIds().SetNumberOfIds(3)
aPolyVertex.GetPointIds().SetId(0, 0)
aPolyVertex.GetPointIds().SetId(1, 1)
aPolyVertex.GetPointIds().SetId(2, 2)
aPolyVertexGrid = vtk.vtkUnstructuredGrid()
aPolyVertexGrid.Allocate(1, 1)
aPolyVertexGrid.InsertNextCell(aPolyVertex.GetCellType(),
aPolyVertex.GetPointIds())
aPolyVertexGrid.SetPoints(polyVertexPoints)
aPolyVertexMapper = vtk.vtkDataSetMapper()
aPolyVertexMapper.SetInput(aPolyVertexGrid)
aPolyVertexActor = vtk.vtkActor()
aPolyVertexActor.SetMapper(aPolyVertexMapper)
aPolyVertexActor.AddPosition(1, 0, 6)
aPolyVertexActor.GetProperty().SetDiffuseColor(1, 1, 1)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(500, 500)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.SetBackground(.1, .2, .4)
ren.AddActor(aPolyVertexActor)
ren.ResetCamera()
#ren.GetActiveCamera().Azimuth(100)
#ren.GetActiveCamera().Elevation(200)
#ren.GetActiveCamera().Dolly(2.8)
ren.ResetCameraClippingRange()
# Render the scene and start interaction.
iren.Initialize()
renWin.Render()
iren.Start()
#how I can put this points in a XYPlotActor
#Please send me a example y you have
**************************************************************************
|