I would like to give the surface a thickness, so that it looks more like this (surface has thickness and there should be no artifacts in the cross section):
What has not worked so far is:
Change line width: Under Styling > Line Width. This has no effect on the 3d view. It only changes the width of the line in the cross section. However, the larger line thickness leads to tiny evenly spaced dark artifacts.
Extrusion: After applying Extract Surface, the Linear Extrusion filter can move the mesh surface in a direction, but it is constant for each element of the mesh. Is it possible to set the extrusion direction as the surface normal?
Is there another way/filter available to achieve this?
Very neat. To make the sphere hollow, the trick is to clip a sphere out of it, correct? Is it possible to clip non-standard volumes as well, so one could use the approach for a non-spherical shape?
For a non-spherical shape, it is needed to use the Programmable filter so that the surface of the shape is extruded in each surface normal direction. As the simplest example, the state file is attached: extrusion.zip (356.1 KB)
And, the figure below shows the result.
Here is programmable filter:
Output Data set Type: vtkUnstructuredGrid
Script:
import numpy as np
pdi = self.GetInput()
ugo = self.GetOutput()
ugo.Allocate()
scale = 0.2
num_pts = pdi.GetNumberOfPoints()
num_cells = pdi.GetNumberOfCells()
new_pts = pdi.GetPoints()
in_pd = pdi.GetPointData()
out_pd = ugo.GetPointData()
out_pd.CopyAllocate(in_pd);
normals =in_pd.GetArray('Normals')
id_map = {}
for i in range(num_pts):
point = np.array(pdi.GetPoint(i))
normal = np.array(normals.GetTuple3(i))
j = new_pts.InsertNextPoint(point+normal*scale)
out_pd.CopyData(in_pd, i, i)
out_pd.CopyData(in_pd, i, j)
id_map[i] = j
ids = vtk.vtkIdList()
for c_id in range(num_cells):
pdi.GetCellPoints(c_id, ids)
new_ids = ids
for id in range(ids.GetNumberOfIds()):
extruded_pt_id = id_map[ids.GetId(id)]
new_ids.InsertNextId(extruded_pt_id)
ugo.InsertNextCell(vtk.VTK_WEDGE, new_ids)
ugo.SetPoints(new_pts)
This is awesome! Let me point out that this also generates good data for the sliced view. The slice edges can be made more accurate by running a loop subdivision beforehand on the surface.
I notice that the simulated value is the same along the vector, i.e. pointing to the centre of the ball. What
s the perspective can this figure offer to readers?
I am simulating a thin shell which can be approximated by its midsurface. The figure is very helpful in showing the actual geometry of the physical problem.
Naturally, the programmable filter wasn’t going to work in this situation because there are no normals to operate upon. When I insert the programmable filter one level above, it seems to work (bit tricky to tell right now). However, I only want a subset of the surfaces that are embedded inside a domain to be offset with some thickness.
I tried clipping the domain of interest and then extracting surfaces but that doesn’t seem to work.