[vtkusers] vtkLineWidget2 continued
Gheorghe Postelnicu
gheorghe.postelnicu at gmail.com
Wed Aug 2 13:10:34 EDT 2006
Hi,
I have the following Tcl code:
vtkLineWidget2 line2
vtkLineRepresentation lineRep
vtkPointHandleRepresentation3D ptRep1
vtkPointHandleRepresentation3D ptRep2
puts " pt rep 1 = [ptRep1 Print]"
set [lineRep GetPoint1Representation] ptRep1
puts " lineRep pt1 rep = [ [lineRep GetPoint1Representation] Print]"
set [lineRep GetPoint2Representation] ptRep2
lineRep SetPoint1DisplayPosition 0 0 0
lineRep SetPoint2DisplayPosition 1 1 1
[lineRep GetPoint1Representation] AllOn
[lineRep GetPoint1Representation] Modified
proc printColor {arg} {
puts " test $arg fct pt 1 color = [[[[line2 GetRepresentation]
GetPoint1Representation] GetProperty] GetColor]"
puts " test $arg fct pt 2 color = [[[[line2 GetRepresentation]
GetPoint2Representation] GetProperty] GetColor]"
}
proc testFct {} {
printColor 1
[ [ [line2 GetRepresentation] GetPoint1Representation] GetProperty
] SetColor .1 .1 .7;
printColor 2
[ [ [line2 GetRepresentation] GetPoint2Representation] GetProperty
] SetColor .7 .1 .1;
printColor 3
# puts " test fct pt 1 rep = [ [lineRep GetPoint1Representation] Print]"
line2 Modified
line2 Render
}
When I run it, I am expecting to have the two handles have different
colors, after testFct is called. However, I get the following output
of my test display
test 1 fct pt 1 color = 1 1 1
test 1 fct pt 2 color = 1 1 1
test 2 fct pt 1 color = 0.1 0.1 0.7
test 2 fct pt 2 color = 0.1 0.1 0.7
test 3 fct pt 1 color = 0.7 0.1 0.1
test 3 fct pt 2 color = 0.7 0.1 0.1
Is my representation assignment code wrong? A priori, I checked the
Print function of the object and it seems that the representations
have different addresses, so I assumed the representation assignment
worked ok.
Thanks,
--
Gheorghe Postelnicu, PhD
MGH, Harvard Medical School
More information about the vtkusers
mailing list