pyg4ometry.visualisation.ViewerBase¶
Classes¶
Base class for all viewers and exporters. Handles unique meshes and their instances |
Functions¶
Module Contents¶
- pyg4ometry.visualisation.ViewerBase._daughterSubtractedMesh(lv)¶
- class pyg4ometry.visualisation.ViewerBase.ViewerBase¶
Base class for all viewers and exporters. Handles unique meshes and their instances
- bSubtractDaughters = False¶
- defaultVisOptions = None¶
- defaultOverlapVisOptions = None¶
- defaultCoplanarVisOptions = None¶
- defaultProtusionVisOptions = None¶
- materialVisOptions¶
- materialPbrOptions¶
- clear()¶
- setSubtractDaughters(subtractDaughters=True)¶
- addLogicalVolume(lv, mtra=_np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]]), tra=_np.array([0, 0, 0]), visOptions=_VisOptions(representation='wireframe'), depth=0, name=None)¶
Add a logical volume to viewer (recursively)
- Parameters:
mtra (matrix(3,3)) – Transformation matrix for logical volume
tra (array(3)) – Displacement for logical volume
visOptions (VisualisationOptions) – VisualisationOptions for the lv mesh
- addFlukaRegions(fluka_registry, max_region=1000000, debugIO=False)¶
- addMesh(name, mesh)¶
Add a single mesh
- addInstance(name, transformation, translation, instanceName='')¶
Add a new instance for mesh with name
- addVisOptions(name, visOption)¶
Add vis options to mesh with name
- Parameters:
name (str) – name of mesh
visOptions (VisualisationOptions)
- addPbrOptions(name, pbrOption)¶
Add pbr options to mesh with name
- Parameters:
name (str) – name of mesh
pbrOptions (PbrOptions)
- addMaterialVisOption(materialName, visOption)¶
Append a visualisation option instance to the dictionary of materials.
- Parameters:
materialName (str) – material name to match
visOption (
VisualisationOptions) – instance
- addMaterialPbrOption(materialName, visOption)¶
Append a visualisation option instance to the dictionary of materials.
- Parameters:
materialName (str) – material name to match
visOption (
VisualisationOptions) – instance
- setDefaultVisOptions(visOption)¶
- getDefaultVisOptions()¶
- getMaterialVisOptions(material)¶
- setOverlapVisOption(visOption)¶
- setCoplanarVisOption(visOption)¶
- setProtusionVisOption(visOption)¶
- getOverlapVisOptions(overlaptype)¶
- removeInvisible()¶
Remove wireframe or transparent instances from self
- scaleScene(scaleFactor)¶
- exportGLTFScene(gltfFileName='test.gltf', singleInstance=False)¶
Export entire scene as gltf file, filename extension dictates binary (glb) or readable json (gltf) singleInstance is a Boolean flag to supress all but one instance
- exportGLTFAssets(gltfFileName='test.gltf')¶
Export all the assets (meshes) without all the instances. The position of the asset is the position of the first instance
- exportThreeJSScene(fileNameBase='test', lightBoxHDR='concrete_tunnel_02_4k.hdr')¶
html based on https://threejs.org/examples/#webgl_loader_gltf HRDI https://polyhaven.com/a/concrete_tunnel_02
npm install node wget https://dl.polyhaven.org/file/ph-assets/HDRIs/exr/4k/concrete_tunnel_02_4k.exr conver EXR to HDR e.g. https://convertio.co/exr-hdr/ python -m http.server 8000 open test.html
- dumpMeshQuality()¶
- __repr__()¶