From b242a685a7a410cdd7d8746424ddb79daaaa9d8d Mon Sep 17 00:00:00 2001 From: Manuel Huber Date: Thu, 5 Dec 2024 10:29:43 +0100 Subject: [PATCH] LogicalVolume: do not set material registry if addRegistry=False --- src/pyg4ometry/geant4/LogicalVolume.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pyg4ometry/geant4/LogicalVolume.py b/src/pyg4ometry/geant4/LogicalVolume.py index 9b9c72ec1..df229a2fc 100644 --- a/src/pyg4ometry/geant4/LogicalVolume.py +++ b/src/pyg4ometry/geant4/LogicalVolume.py @@ -79,7 +79,8 @@ def __init__(self, solid, material, name, registry=None, addRegistry=True, **kwa if isinstance(material, _mat.Material): self.material = material - self.material.set_registry(registry, dontWarnIfAlreadyAdded=True) + if registry and addRegistry: + self.material.set_registry(registry, dontWarnIfAlreadyAdded=True) elif isinstance(material, str): # If the material is registered already, use it if registry and material in registry.materialDict: