Tube
A hollow cylinder between two radii: a ring electrode when short, a drift tube or a chamber wall when long.
Tube(start, end, inner_radius, outer_radius) has an empty bore and an exact level set;
fillet rounds its four circular edges.
import numpy as np
from simgeometry import Cuboid, PolarRepeat, Tube
ring = Tube( start=(0.0, 0.0, -0.2), end=(0.0, 0.0, 0.2), inner_radius=1.0, outer_radius=1.5, fillet=0.05,)print("bore empty:", not ring.contains((0.0, 0.0, 0.0)))print("in the wall:", ring.contains((1.25, 0.0, 0.0)))print("distance from the centre:", ring.signed_distance((0.0, 0.0, 0.0)))assert np.isclose(ring.signed_distance((0.0, 0.0, 0.0)), 1.0)bore empty: Truein the wall: Truedistance from the centre: 1.0A slotted shield
Section titled “A slotted shield”PolarRepeat(shape, count) repeats a shape about an axis at the cost of one copy. Cutting
twelve slots out of a long tube gives a Faraday shield.
import plasma_plotsimport pyvista as pv
pv.OFF_SCREEN = True # render without a window, e.g. on a docs server
wall = Tube( start=(0.0, 0.0, -1.0), end=(0.0, 0.0, 1.0), inner_radius=0.9, outer_radius=1.0)slot = Cuboid(midpoint=(0.95, 0.0, 0.0), side_lengths=(0.3, 0.12, 1.5))shield = wall - PolarRepeat(slot, 12)assert not shield.contains((0.95, 0.0, 0.0)) and shield.contains((0.95, 0.0, 0.9))plotter = shield.show_3d( backend="pyvista", display=False, resolution=96, show_bounds=False)plasma_plots.scene(plotter, alt="A tube with twelve axial slots cut into its wall")