No subject


Mon Dec 15 09:51:36 EST 2008


do what I want, but the example provided online doesn't cover this corner.
Any help is greatly appreciated.

Sincerely,

-- 
Ola Skavhaug

--000e0cd25b4cb9501a046188521d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<br><br>I am trying to debug some mesh partitioning algorithm, and
need to label the points of the new a unstructured vtk (sub-)grid
according to the global numbering of the old mesh. I have tried the
vtkLabeledDataMapper in combination with vtkIdFilter after setting the
global numbering as field data of the unstructured mesh given as input
to the vtkIdFilter, but I guess this is not the way to go (at least, I
can&#39;t get it to work).<br>
<br>This is my, probably retarded, attempt:<br><br>&nbsp;&nbsp;&nbsp; def a=
dd_point_labels(self, labels=3DNone):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp; ldm =3D vtk.vtkLabeledDataMapper()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp; ldm.SetLabelFormat(&quot;%g&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids =3D vtk.vtkIdFilter()<br>&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if labels !=3D None:<br>&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arr =3D vtk.vtkIdTy=
peArray()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; arr.SetVoidArray(labels, len(labels), 1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arr.SetName(&quot;point labels&quo=
t;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s=
elf.vtkgrid.GetFieldData().AddArray(arr)<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids.SetI=
nput(self.vtkgrid)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp; ids.SetFieldData(1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; ldm.SetFieldDataArray(0)<br>&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldm.SetLabelModeToLabelFie=
ldData()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids.SetInput(self.v=
tkgrid)<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids.Poin=
tIdsOn()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; ids.FieldDataOn()<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldm=
.SetInputConnection(ids.GetOutputPort())<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; ldm.GetLabelTextProperty().SetColor(0, 0, 0)<br>&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp; ldm.GetLabelTextProperty().BoldOn()<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pointLabels =3D vtk.vtkActor2D()=
<br clear=3D"all"><br>From
my understanding of the nightly documentation, it should be possible to
do what I want, but the example provided online doesn&#39;t cover this
corner. Any help is greatly appreciated.<br>
<br>Sincerely,<br clear=3D"all"><br>-- <br>Ola Skavhaug<br>

--000e0cd25b4cb9501a046188521d--


More information about the vtkusers mailing list