pyg4ometry.stl¶
Submodules¶
Classes¶
Package Contents¶
- class pyg4ometry.stl.Reader(filename, solidname='stl_tessellated', scale=1, centre=False, registry=None, forcebinary=False)¶
STL file reader
- Parameters:
filename (str) – Input STL filename
solidname (str) – Name of the solid to be created
scale (float) – Scaling of STL (e.g. for units)
centre (boolean) – Flag to centre STL solid
registry (Registry) – Registry to add solid to
forcebinary (boolean) – Forces to load this STL file in binary format, otherwise the file format is determined from whether it starts with the string ‘solid’
- filename¶
- _registry¶
- solidname¶
- worldVolumeName = ''¶
- facet_list = []¶
- scale¶
- solid¶
- _load_ascii(data)¶
Load ASCII STL file from bytes instance
- _load_binary(data)¶
Load binary STL file from bytes instance
- extent()¶
Compute the axis aligned extent of the STL solid.
- Returns:
list of minima and maxima in 3 axes
- Return type:
[[xmin,ymin,zmin],[xmax, ymax, zmax]]
- extentCentre()¶
Translate STL mesh to centre of the extent
- translate(translation=[0, 0, 0])¶
Translate STL mesh by translation
- Parameters:
translation (list(3) or array(3)) – Vector to translate mesh
- getSolid()¶
Get geant4.solid
- Returns:
G4Tesselated for STL
- Return type:
- getRegistry()¶
Return registry
- visualise()¶
View solid directly by using a dummy world
- writeDefaultGDML(filename='default', gmad_tester=False)¶
Write the tessellated solid loaded from STL to GDML. The placement has no rotation or translation. The world material is G4_Galactic, the solid material is G4_Fe.
- Parameters:
filename (str) – Output file name
gmad_tester (boolean) – Flag for writing BDSIM gmad tester