[vtkusers] Problem with visualization and saving an image

Régis BLANCHON poete66 at caramail.com
Mon Apr 1 12:02:22 EST 2002


Hi,

I want to save in postscript the tetrahedron that I made. 
But in fact it saves the screen and I have a black screen 
in my postscript file. 
Anyone could tell me what is wrong in my code which is 
after the message.

Tanks very much.
With Regards
Régis Blanchon

catch {load vtktcl}
# get the interactor ui
#source ~/.wishrc
#source vtkInt.tcl
#source colors.tcl


proc DisplayMesh {file} {

vtkWindowToImageFilter w2if #I declare
vtkRenderer ren1
vtkRenderWindow renWin
vtkRenderWindowInteractor iren


vtkUnstructuredGridReader reader
 reader SetFileName "$file"
# reader Update is needed because of .. GetScalarRange ..
 reader Update

# create a hue lookup table
vtkLookupTable lut
# blue to red
 lut SetHueRange 0.33 0.66

vtkDataSetMapper dataMapper
 dataMapper SetInput [reader GetOutput]
 eval dataMapper SetScalarRange [[reader GetOutput] 
GetScalarRange]
 dataMapper SetLookupTable lut

vtkActor dataActor
 dataActor SetMapper dataMapper

 renWin AddRenderer ren1

 iren SetRenderWindow renWin

vtkCamera aCamera
 aCamera SetClippingRange 0.726079 36.3039
 aCamera SetFocalPoint 2.43584 2.15046 1.11104
 aCamera SetPosition -4.76183 -10.4426 3.17203
 aCamera SetViewUp 0.0511273 0.132773 0.989827
 aCamera SetViewAngle 18.604
 aCamera Zoom 1.2

ren1 SetActiveCamera aCamera



 w2if SetInput renWin

# assign our actor to the renderer
 ren1 AddActor dataActor
 ren1 SetBackground 1 1 1
 renWin SetSize 500 500
# render the image


 iren Initialize


 vtkPostScriptWriter psw #I save
 psw SetInput [w2if GetOutput]
 psw SetFileName "vtkPost.ps"
 psw Write
 psw Delete



# prevent the tk window from showing up then start the 
event loop
}

DisplayMesh vtk_tetra.vtk 

wm withdraw .


_________________________________________________________
Le journal des abonnés Caramail - http://www.carazine.com



More information about the vtkusers mailing list