How to create vtkActor without solid representation?

Dear VTK developers and users,

I am trying to do the following:

  1. I create a surface representation based on polygons, which can contain holes (needed to use vtkContourTriangulator, see #14834);
  2. Now I want to also display edges of my surface.

The approach we have been using previously, is to use a VTK filter, namely vtkFeatureEdges. However, the issue is that after moving from vtkDelaunay2D to vtkContourTriangulator, the edge creation filter seem to be confused. In this particular case, it is only one additional internal line/edge, but for more complex cases it can look much worse. Code below:
20241118_py_surfWithEdges.py (6.5 KB)

Now the nice thing about actor generated via vtkFeatureEdges is that it never becomes solid, i.e., we can use key commands ‘s’ and ‘w’ and those will only modify the surface representation, not the edge representation.

Next, in order to resolve the unnecessary edge issue, I have been using the original polydata defining the surface polygons. This works fine as long as I keep the actor representation to wireframe. However, as soon as I hit key ‘s’, also my manually constructed edge actor becomes solid and destroys the whole view. Code below:
20241118_py_surfWithEdges_useOrigPoints.py (6.4 KB)

Question - how to make manually created actor to be always displayed as wireframe? It should be possible, as actor created via vtkFeatureEdges functions that way. But I can not find the right option for mapper/actor, if I manually put lines on screen … I have a workaround to modify keyboard shortcut ‘s’ behavior to skip the particular actor, but I would like to avoid this if possible.

Does anyone know if there is a simple way to achieve this?

Best,
Ugis

If an actor has polygons, then the polygons will always be rendered in “solid” mode.

So my question is, when you prep your polydata, why do you add polygons to it?

     polyData = vtkPolyData();
     polyData.SetPoints(points);
-    polyData.SetPolys(polys);
     polyData.SetLines(lines);

Try removing the SetPolys() line. If there are no polygons in the data, just lines, then it seems to me that your problem is solved. The vtkContourTriangulator only needs lines as input, anyway.

It looks like there is also something funny going on with the vtkContourTriangulator here, but I’ll have to do a thorough check of the input data connectivity to be sure.

Ah, I see, interesting. Yes, removing polygon definition worked! So problem solved.

Why I am adding polygons in the first place - in my main system, that is the way the surfaces are originally defined. Just for convenience, to be able to quickly swap between vtkContourTriangulator and vtkDelaunay2D filters, I kept both representations. But in principle, I do not need that so I should remove the polygon part after I have created the lines.