How can i know the size of this sphere?

Hello Experts,
i have one GDML file
air_gold.txt (2.0 MB)

in that object is defined in tessellated form that creates a sphere. see below:-


but in this file the radius of this sphere is not specified then how can i know that the sphere that is created by tessellation is of some radius ?
is there any way to know that ?
because in this i have specified dimensions of world but i am not sure am i writing the dimensions of world right or wrong because i don’t know the size of this object (sphere).
can anyone please suggest me a way so i can find that.
any type of help will be appreciated. waiting for the response!
Thanks
Regards
priyanshu

You can call BoundingLimits(pmin, pmax). This method returns min and max corners of a bounding box that contains the solid. In your case, the dimensions of the box will be equal to the diameter of the sphere.

Thank you so much for your reply!
but where i have to put this command?
i am working in the EXample/extended/persistency/G01 and this GDML file i have invoked in this example so please ?
Thanks
priyanshu

As I understand the logical volume, that you are interested in, has a name “air_gold”.
You can get it from the G4LogicalVolumeStore by GetVolume(“air_gold”). Then you can get the solid by GetSolid().

Loaded your gdml file into the FreeCAD GDML workbench https://github.com/KeithSloan/GDML

There is a bug that stops the Tessellation showing, but I was still able to convert it to a FreeCAD mesh
which I exported here
air_gold_SOL001.stl.txt (692.7 KB)
You would need to remove the extra txt on the extension if you wanted to examine the stl file.

But drawing another sphere and matching sizes it looks like your tessellated sphere has a radius of 750mm

Thank you very much for your help!
can you please tell me how did you know that the radius of my tessellated sphere is 750mm (unit i know, but exact radius value how ?).
'‘But drawing another sphere and matching sizes it looks like your tessellated sphere has a radius of 750mm’’ how did you match the sizes and where you draw another sphere?

along with this, can you please tell me is there any python package (on internet , i came to know about pyg4ometry, am i correct?) to convert stl file into GDML file again.
i want to convert some STL files into GDML files without using any tool but using python. so can i do this, if you know about this can you please help me with this.
Thanks in advance !
priyanshu

Well I fixed the problem on importing the Tessellate and checking the bounding box it is 1512.3597 x 1512.3597 x 1512.3597 but that is the Tessellated object not a sphere that it would have been created from

To get the bounding box I used a development branch Gmsh and selected the Tessellated ‘sphere’ and then clicked on the icon to Tessellate with Gmsh and before it uses Gmsh the Task Window shows the dimensions of the bounding box.

The code for reading in the gdml tesselate could be improved. On my Todo list

When you say python to convert stl to gdml are you thinking of whole gdml file with material definitions or a xml file with just solid definition that one could then use as an imbed via use of ENTITIES?

With FreeCAD you can import STL and then using the workbench allocate a material and convert to GDML Tessellated object

Meant to say if you do try FreeCAD and the workbench it is worth installing one of Lei Zheng’s Daily releases as things will be quicker https://github.com/realthunder/FreeCAD_assembly3/releases.

I rename my FreeCAD installs so that I can easily have more than one installed.

Thank you @KeithSloan for your detailed explanation!
one thing can you please tell me that in this above image what is the black one (just above the sphere green one), is it my world from the GDML i shared with you ? meaning my sphere is not inside the world volume ?

also can you please tell me how can i install Gmsh in my local (ubuntu 20.04) ? so i can also see this .
"The code for reading in the gdml tesselate could be improved." i didn’t understand this ?

yes, using some python packages, i want to convert stl file into gdml file that contains only solid definition but i don’t know which python package i should use.
for time being i used this tool that also convert stl to gdml file .

but i want to know about python package.
can you please help me with this?
Thanks in advance!
priyanshu

please tell me that in this above image what is the black one (just above the sphere green one), is it my world from the GDML i shared with you ? meaning my sphere is not inside the world volume ?

In theory yes, but it could be a bug that the Tessellated Sphere is wrongly positioned I would have to check, but yes the black wireframe is the World Volume box.

To install Gmsh
sudo apt update
sudo apt install gmsh

To install Gmsh python library
Gmsh install should be very similar to Windows. The thing to remember is that FreeCAD stores it python libraries in a different place than the system version of python.

Hence gmsh - python library

Must be installed in a location that FreeCAD sees to check path FreeCAD uses from a command line terminal

freecad -c
import sys
print(sys.path)
pip install --upgrade --target <Full path to directory> gmsh

The code for reading in the gdml tesselate could be improved.
The current python coding is not very efficient, needs work on my. ToDo list

I believe pyg4geometry has code to import STEP file via FreeCAD, mesh and output as gdml,
but I don’t know anymore. Same could be true for STL

There is also GAMOS where you can just tell it about the location of STL files and Have Geant4 process everything I believe see http://fismed.ciemat.es/GAMOS/

If you don’t want to have to mess with git branches i.e. branch Gmsh
To get the bounding Box. Import your GDML file, on my system with FreeCAD Daily it takes around 60 secs. Select the Tessellated Sphere then click Tess 2 Mesh icon. Then use the Mesh Workbench to check the Meshes Bounding box see https://wiki.freecadweb.org/Mesh_BoundingBox

Think there is a bug with Placement as all the values are negative and if I edit them to be positive your sphere is in the World Box.

On the other hand if I view the GDML file with a text editor all the Vertex for the Tessellation have negative values and the same goes for the position of the physical volume. So I guess the fact that all the vertex are negative are then placed at a negative value means GEANT4 is happy, but in the workbench the tessellate sphere is created and then placed at a negative position so appears outside of the world volume i.e. the workbench has a bug.