[vtkusers] TR : VTK Quad Tcl
Jim
jim.lejeune at skynet.be
Wed Feb 5 16:24:40 EST 2003
Hi,
I'm trying to develop an interface for a project. I have the positions
(x,y,z) of nodes and the number of the nodes wich are in a quad. I want
construct a mesh with quad and with this data. I have create a tcl
script . But this script is not perfect. How can I correct it ? I want
define my mesh with the coordinates of nodes not as made in my script.
Could you mail me some examples with tcl script with quad mesh ? Could
you explain me how develop this mesh ?
Thanks
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/20030205/ce7e8d5c/attachment.htm>
More information about the vtkusers
mailing list