GGEMS Community

General Category => Geometry, Material & Navigation => Topic started by: mwj12 on Dec 02, 2025, 08:59 PM

Title: Creating geometry components in loops (e.g. as lists)
Post by: mwj12 on Dec 02, 2025, 08:59 PM
My Python script generates a multitude of navigators, detectors, etc... in list form using a loop, something like,
   
meshed = []
for Md in as_list(cfg.get("meshedNavigators")):
        meshed.append(build_meshed_navigator(Md, matlabBase))

Here, the details of build_meshed_navigator() are not really important. It is my own function which constructs a meshed navigator with GGEMSMeshedPhantom and populates its members to certain specifications. The result is a list of navigators, held in the list 'meshed'.

But in all the documentation examples, the components are all created as explicit top-level variables, and  GGEMS v1.3 doesn't seem to be able to recognize GGEMS objects when they are encapsulated in lists or other containers. My simulation output thus contains all zeros, as if no sources or other components are present. Is there a way to get GGEMS v1.3 to recognize arrays of navigators and other components, built using loops?
Title: Re: Creating geometry components in loops (e.g. as lists)
Post by: didier.benoit on Dec 10, 2025, 01:25 PM
In GGEMS v1.3, Python is intentionally minimalistic. It does not manage the geometry, nor introspect lists or containers. Its only role is to create a few objects and pass them to the C++ engine, which performs all simulation work.Therefore, components must be exposed as simple top-level variables so that the C++ core can register them.