Forbid `renderer.RemoveActor` printing info

Hi,

I use VTK in python now and it works fine.
But when I remove actor renderer.RemoveActor(my_actor) I can see a lot of output messages like this:

vtkOpenGLActor (0000020430514220) 'my actor'
  Debug: Off
  Modified Time: 302624
  Reference Count: 2
  Registered Events: (none)
  Dragable: On
  Pickable: On
  AllocatedRenderTime: 10
  EstimatedRenderTime: 0
  NumberOfConsumers: 1
  RenderTimeMultiplier: 0
  Visibility: On
  PropertyKeys: none.
  useBounds: 1
  IsIdentity: true
  Position: (0, 0, 0)
  Orientation: (0, -0, 0)
  Origin: (0, 0, 0)
  Scale: (1, 1, 1)
  Bounds:
    Xmin,Xmax: (325244, 327194)
    Ymin,Ymax: (2.84141e+06, 2.84336e+06)
    Zmin,Zmax: (-1000, 1000)
  UserTransform: (none)
  UserMatrix: (none)
  Mapper:
    Debug: Off
    Modified Time: 302344
    Reference Count: 2
    Registered Events: (none)
    Executive: 000002043021A860
    ErrorCode: No error
    Information: 00000204302011E0
    AbortExecute: Off
    Progress: 0
    Progress Text: (None)
    TimeToDraw: 0.0001
    ClippingPlanes: (none)
    Lookup Table:
      Debug: Off
      Modified Time: 302344
      Reference Count: 1
      Registered Events: (none)
      Alpha: 1
      VectorMode: Component
      VectorComponent: 0
      VectorSize: -1
      IndexedLookup: OFF
      AnnotatedValues: 0 entries.
      TableRange: (0, 1)
      Scale: Linear
      HueRange: (0, 0.66667)
      SaturationRange: (1, 1)
      ValueRange: (1, 1)
      AlphaRange: (1, 1)
      NanColor: (0.5, 0, 0, 1)
      BelowRangeColor: (0, 0, 0, 1)
      UseBelowRangeColor: OFF
      AboveRangeColor: (1, 1, 1, 1)
      UseAboveRangeColor: OFF
      NumberOfTableValues: 256
      NumberOfColors: 256
      Ramp: SCurve
      InsertTime: 0
      BuildTime: 302349
      Table:
        Debug: Off
        Modified Time: 302347
        Reference Count: 1
        Registered Events: (none)
        Name: (none)
        Data type: unsigned char
        Size: 1040
        MaxId: 1023
        NumberOfComponents: 4
        Information: 0000000000000000
        Name: (none)
        Number Of Components: 4
        Number Of Tuples: 256
        Size: 1040
        MaxId: 1023
        LookupTable: (none)
    Scalar Visibility: On
    Static: Off
    Scalar Range: (0, 1)
    UseLookupTableScalarRange: 0
    Color Mode: Default
    InterpolateScalarsBeforeMapping: Off
    Scalar Mode: Default
    RenderTime: 0
    Resolve Coincident Topology: Off
    CoincidentPointOffset: 0
    CoincidentLineOffset: 0
    CoincidentPolygonOffset: 0
    CoincidentLineFactor: 0
    CoincidentPolygonFactor: 0
    Piece : 0
    NumberOfPieces : 1
    GhostLevel: 0
    Number of sub pieces: 1
  Property:
    Debug: Off
    Modified Time: 302621
    Reference Count: 1
    Registered Events: (none)
    Ambient: 0
    Ambient Color: (1, 1, 1)
    Diffuse: 1
    Diffuse Color: (1, 1, 1)
    Edge Color: (0, 0, 0)
    Edge Visibility: Off
    Vertex Color: (0.5, 1, 0.5)
    Vertex Visibility: Off
    Interpolation: VTK_GOURAUD
    Opacity: 1
    Representation: VTK_SURFACE
    Specular: 0
    Specular Color: (1, 1, 1)
    Specular Power: 1
    Backface Culling: Off
    Frontface Culling: Off
    Point size: 1
    Line width: 1
    Line stipple pattern: 65535
    Line stipple repeat factor: 1
    Lighting: On
    RenderPointsAsSpheres: Off
    RenderLinesAsTubes: Off
    ShowTexturesOnBackface: On
    Shading: Off
    MaterialName: (none)
    Color: (1, 1, 1)
    EmissiveFactor: (1, 1, 1)
    NormalScale: 1
    OcclusionStrength: 1
    Metallic: 0
    Roughness: 0.5
  BackfaceProperty: (none)
  Texture: (none)
  ForceOpaque: false
  ForceTranslucent: false

How to prevent VTK from printing these messages when removing actors?

Hello,

Those messagens are usually generated by a call to the actor’s Print() method. Python is known to make implicit calls all the time. While this makes life easier, it is a source of bugs. Maybe in your code there is a forgotten print(actor) used during debugging or even just an actor loose in a line of code.

best,

PC

1 Like

Sorry for the late reply,

Yes, I used to have a print(actor) explicitely.
I’m so ashamed. Sorry for disturbing the community with such a silly question :frowning:

Thank you for the help!

1 Like

No worries. Leaving behind debug messages can happen to any developer.

1 Like