I am using Paraview 5.13.3. Via Tools > Python Script Editor I can compute things of the…
- User
I am using Paraview 5.13.3. Via Tools > Python Script Editor I can compute things of the loaded mesh. This is the script I am using: from paraview.simple import * import math
Get the active source
source = GetActiveSource()
Fetch the data from the server to access its points
Note: This can be slow for very large meshes
polydata = servermanager.Fetch(source)
Get the bounding box from the data information
bounds = polydata.GetBounds()
--- 1. Calculate the Center ---
center_x = (bounds[0] + bounds[1]) / 2.0 center_y = (bounds[2] + bounds[3]) / 2.0 center_z = (bounds[4] + bounds[5]) / 2.0
--- 2. Calculate the Bounding Sphere Radius ---
max_dist_sq = 0.0 points = polydata.GetPoints() num_points = points.GetNumberOfPoints()
Iterate through all points to find the one furthest from the center
for i in range(num_points): p = points.GetPoint(i) # Calculate squared distance (it's faster than the actual distance) dist_sq = (p[0] - center_x)**2 + (p[1] - center_y)**2 + (p[2] - center_z)**2 if dist_sq > max_dist_sq: max_dist_sq = dist_sq
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.