As an exercise (being new to ParaviewVTK) I tried to use this piece of python code
as a ProgrammableSource (Output Type set to StructuredGrid) in PARAVIEW 5.13.
I am trying to model two concentric spherical surface (radius values of 1 and 2).
I don’t know how to make those points (scalar “Radius”) magically appear in the RenderView !
A similar exercise but setting the Output Type to PolyData works fine (Glyph filter following the
ProgrammableSource is needed though).
import numpy as np
from vtkmodules.vtkCommonCore import vtkPoints, vtkDoubleArray
from vtkmodules.vtkCommonDataModel import vtkStructuredGrid
Define grid dimensions
n_theta = 18 # Number of points along theta
n_phi = 36 # Number of points along phi
radii = [1.0, 2.0] # Two radial layers
Initialize points and scalars
points = vtkPoints()
scalars = vtkDoubleArray()
scalars.SetName(“Radius”) # Scalar for radiusbased coloring
Fill points in spherical coordinates and convert to Cartesian
for r in radii:
for theta_idx in range(n_theta):
theta = theta_idx * np.pi / (n_theta  1)
for phi_idx in range(n_phi):
phi = phi_idx * 2 * np.pi / (n_phi  1)
# Spherical to Cartesian conversion
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * np.sin(phi)
z = r * np.cos(theta)
points.InsertNextPoint(x, y, z)
scalars.InsertNextValue(r) # Radius as a scalar value
Create the structured grid and assign points and scalars
output.SetDimensions(n_theta, n_phi, len(radii))
output.SetPoints(points)
output.GetPointData().SetScalars(scalars
Rendering for the Output Type PolyData gives this :
UPDATE: Thanks to Jean M. Favre suggestion in this 2019 post …
ProgrammableSource using StructuredGrid Output Type is working but …
I guess, the question that comes to my mind now is

Why in the PolyData Output type case,references to the vtk pipeline mechanics are not necessary ( i.e. commands like executive.GetOutputInformation(0), …,) ?

Also, there seems to have synchronization or communication issue (clientserver). The default Outline rendering does show only after pushing the Apply button a second time … Some some of update mechanism seems to be triggered then and the Outline appears.
But I’m way over my head here … speculating on something I barely know
Lots of fun ahead !