[vtkusers] VTK Quad Tcl 2
Jim
jim.lejeune at skynet.be
Thu Feb 6 13:18:24 EST 2003
Hi,
I always have a problem with the developpement of a mesh with quad.
Could you give me some exemple developped in TCL please. My script is
listed below. but it's not perfect. I want use only the coordinates of
nodes for my mesh.
Please help me
JIM
package require vtk
package require vtkinteraction
for {set j 0} {$j<10} {incr j 3} {
for {set i 0} {$i<100} {incr i 2} {
vtkPoints quadPoints$i$j
quadPoints$i$j SetNumberOfPoints 4
quadPoints$i$j InsertPoint 0 0 1 0
quadPoints$i$j InsertPoint 1 2 1 0
quadPoints$i$j InsertPoint 2 2 0 0
quadPoints$i$j InsertPoint 3 0 0 0
vtkQuad aQuad$i$j
[aQuad$i$j GetPointIds] SetId 0 0
[aQuad$i$j GetPointIds] SetId 1 1
[aQuad$i$j GetPointIds] SetId 2 2
[aQuad$i$j GetPointIds] SetId 3 3
vtkUnstructuredGrid aQuadGrid$i$j
aQuadGrid$i$j Allocate 3 5
aQuadGrid$i$j InsertNextCell [aQuad$i$j GetCellType] [aQuad$i$j
GetPointIds]
aQuadGrid$i$j SetPoints quadPoints$i$j
vtkDataSetMapper aQuadMapper$i$j
aQuadMapper$i$j SetInput aQuadGrid$i$j
vtkActor aQuadActor$i$j
aQuadActor$i$j SetMapper aQuadMapper$i$j
aQuadActor$i$j AddPosition $j $i 0
[aQuadActor$i$j GetProperty] SetDiffuseColor .3 1 .5
}}
# Create graphics stuff
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
ren1 SetBackground .1 .2 .4
for {set j 0} {$j<10} {incr j 3} {
for {set i 0} {$i<100} {incr i 2} {
ren1 AddActor aQuadActor$i$j
}}
set cam1 [ren1 GetActiveCamera]
$cam1 Zoom 1.5
renWin Render
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize
wm withdraw .
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030206/b4651390/attachment.htm>
More information about the vtkusers
mailing list