diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..292281c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+venv*
+GDML files
+.idea
\ No newline at end of file
diff --git a/GDMLSchema/gdml.xsd b/GDMLSchema/gdml.xsd
new file mode 100644
index 0000000..6fa092e
--- /dev/null
+++ b/GDMLSchema/gdml.xsd
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Represents a single unique copy a of an associated logical volume
+ in geometrical hierarchy
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Represents a division of the associated logical volume
+ in geometrical hierarchy
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Represents a top of a geometrical sub-hierarchy not placed in space
+ None of its children can coincide with its boundary defined by an associated solid
+ Two different placements of the same logical volume represent two different geometrical
+ hierarchies in space
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Allows to create a group of volumes bound together without a boundary
+ All the volumes exits inside the same virtual reference system of the assmebly volume
+ they belong to
+ When assembly volume is placed all its children follow the global transformation applied
+ to their assembly volume
+ After the assembly volume is placed its children exist as standalone placements in space
+ independent of each other
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base type for logical surfaces (for the moment only optical)
+
+
+
+
+
+
+
+
+ Abstract element for all solids substitution group
+
+
+
+
+
+ Surface between two physical volumes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Surface between two physical volumes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Definitions of a geometrical hierarchy of a set of volumes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Geometry setup representing the particular geometry hierarchy by refferring to
+ a given volume which becomes the top level volume
+
+
+
+
+
+ A reference to the previously defined volume
+ in the structure block chosen by this setup
+ World volumme can't be an assembly volume
+
+
+
+
+
+
+
+
+
+
+ The GDML Schema version consists of 3 digits X.Y.Z
+ where these mean:
+ X - major number, increased when major new
+ features or backward incompatible bug fixes
+ are added and means the GDML Processor is
+ allowed to refuse processing of such a
+ document if this is using the more recent
+ version of the GDML Schema then GDML Processor
+ understands
+ Y - minor number, increased when incremental and
+ backward compatible changes or improvements
+ are made into the GDML Schema. GDML Processor
+ should be able to process such a document
+ using higher minor version number then that of
+ the GDML Processor
+ Z - bugfix revision number, increased when fully
+ backward compatible changes which resolve a
+ problem in GDML Schema are applied
+
+
+
+
+
\ No newline at end of file
diff --git a/GDMLSchema/gdml_core.xsd b/GDMLSchema/gdml_core.xsd
new file mode 100644
index 0000000..fe7701c
--- /dev/null
+++ b/GDMLSchema/gdml_core.xsd
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ An anonymous, local scope, value
+
+
+
+
+
+
+ An anonymous, local scope, value
+
+
+
+
+
+
+ Named (referenced), global scope, constant value
+
+
+
+
+
+
+
+
+
+
+ Named (referenced), local scope, variable value
+
+
+
+
+
+
+
+
+
+
+ An anonymous quantity, local scope, with a unit,
+ (possibly of a given type) quantity
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Named (referenced), global scope,(possibly of a given type) quantity
+
+
+
+
+
+
+
+
+
+
+ An anonymous, 3 dimensional, local scope, vector of doubles
+
+
+
+
+
+
+
+
+ A bi-dimensional matrix of doubles
+
+
+
+
+
+
+
+
+ Named (referenced), 3 dimensional, global scope, vector of doubles
+
+
+
+
+
+
+
+
+
+
+ An anonymous, 3 dimensional, local scope, with a unit,
+ (possibly of a given type) quantity vector
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Named (referenced), 3 dimensional, global scope, with a unit,
+ (possibly of a given type) quantity vector
+
+
+
+
+
+
+
+
+
+
+
+ Local reference to an element of a named type
+
+
+
+
+
+
+ Reference to an external file containing sub-volume information
+
+
+
+
+
+
+
+ List of local references to a set of element of a named type
+
+
+
+
+
+
+ Auxiliary information like sensitive detector declaration, etc.
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GDMLSchema/gdml_define.xsd b/GDMLSchema/gdml_define.xsd
new file mode 100644
index 0000000..91d6e1f
--- /dev/null
+++ b/GDMLSchema/gdml_define.xsd
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+ Definition block of global named constants, quantitties, expressions,
+ positions and rotations which may be used by name or
+ by a reference in scope of the current document
+
+
+
+
+
+
+
+ The global complex type is defined in order to reuse this defintion
+ in derived schemas
+
+
+
+
+
+
+
+
+
+
+
+
+ Named constant
+
+
+
+
+
+
+ Named variable
+
+
+
+
+
+
+ Named matrix
+
+
+
+
+
+
+ Named quantity
+
+
+
+
+
+
+ Named expression, may contain other named constants,
+ quantities and expressions
+
+
+
+
+
+
+
+ Named cartesian position, default unit mm
+
+
+
+
+
+
+ Named cartesian rotation, default unit radian
+
+
+
+
+
+
+ Named cartesian rotation, default unit radian
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GDMLSchema/gdml_extensions.xsd b/GDMLSchema/gdml_extensions.xsd
new file mode 100644
index 0000000..8f6fd5e
--- /dev/null
+++ b/GDMLSchema/gdml_extensions.xsd
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/GDMLSchema/gdml_materials.xsd b/GDMLSchema/gdml_materials.xsd
new file mode 100644
index 0000000..d9dce32
--- /dev/null
+++ b/GDMLSchema/gdml_materials.xsd
@@ -0,0 +1,431 @@
+
+
+
+
+
+
+
+
+
+
+
+ Atomic mass, quantity type A, default unit g/mole
+
+
+
+
+
+
+
+
+
+
+
+ Density
+
+
+
+
+
+
+
+
+
+
+
+ General material properties
+
+
+
+
+
+ General material property (const or vector)
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Radiation length
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to a previsouly defined named radiation length quantity value
+
+
+
+
+
+
+
+ Absorption length
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to a previsouly defined named absorption length quantity value
+
+
+
+
+
+
+
+ Temperature
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to previously defined named temperature quantity value
+
+
+
+
+
+
+
+ Pressure
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to previously defined named pressure quantity value
+
+
+
+
+
+
+
+
+ Ionisation potential or Mean Excitation Energy
+
+
+
+
+
+
+
+
+
+
+
+
+ A reference to previously defined named ionisation potential quantity value
+
+
+
+
+
+
+
+
+
+
+ General material attributes
+
+
+
+ Material name
+
+
+
+
+ Material chemical formula
+
+
+
+
+ Material physical state
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base type for materials
+
+
+
+
+
+
+
+
+
+
+
+
+ Materials description
+
+
+
+
+
+
+ Material related definitons of constants and quantities
+ In this version of schema these become visible in global scope
+
+
+
+
+
+ An isotope
+
+
+
+
+ A simple element or an element composed of isotopes
+
+
+
+
+ A composite or a mixture complex material
+
+
+
+
+
+
+
+
+ Exported isotope type
+
+
+
+
+
+
+
+ Density quantity value
+
+
+
+
+ A reference to a previsouly defined named density quantity value
+
+
+
+
+
+
+
+
+ Number of nucleons
+
+
+
+
+ Atomic number
+
+
+
+
+
+
+
+
+ Exported material element type
+
+
+
+
+
+
+
+ Density quantity value
+
+
+
+
+ A reference to a previsouly defined named density quantity value
+
+
+
+
+
+
+ An element can be defined either as a simple element or by a set
+ of isotopes fractions
+
+
+
+
+
+ An isotope fraction of an element where n is the actual amount
+ of the isotope in the element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Number of nucleons
+
+
+
+
+ Atomic number
+
+
+
+
+
+
+
+
+ Exported material composite or mixture type
+
+
+
+
+
+
+
+
+ Density quantity value
+
+
+
+
+ A reference to a previsouly defined named density quantity value
+
+
+
+
+
+
+ A complex material can be defined as a simple mixture when
+ its material properties are known or as a composite material
+ or a mixture. A composite material is defined by a set of elements
+ by specifying the number of atoms.
+ The second way is by a set of material fractions where the fractions
+ can be either simple elements or other complex materials.
+ The restriction is that one can't mix composition by atoms and fractions
+ at the same time.
+
+
+
+
+
+ Elements of this composite material specified as a set of local
+ references
+ to already defined simple elements where value of n in each means the number of
+ atoms
+
+
+
+
+
+
+
+
+
+
+
+
+ Fractions of this mixture specified as a set of local references to
+ already defined
+ elements or other mixtures where value of n in each means the fraction of the whole
+ material in the range 0.0 < n < 1.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Atomic number
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GDMLSchema/gdml_parameterised.xsd b/GDMLSchema/gdml_parameterised.xsd
new file mode 100644
index 0000000..15e7f93
--- /dev/null
+++ b/GDMLSchema/gdml_parameterised.xsd
@@ -0,0 +1,336 @@
+
+
+
+
+
+
+
+ Abstract base for parametrised dimensions
+
+
+
+
+
+ Abstract element for substitution group
+
+
+
+
+
+ Dimensions for parametrised Boxes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Trd.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Trap.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Tubes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Cones.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Spheres.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Orbs.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Torus.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Ellipsoid.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Paras.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Polycone.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Polyhedra.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Dimensions for parametrised Hypes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Abstract base for parameterised placement strategies
+
+
+
+
+
+ Abstract element for substitution group
+
+
+
+
+
+ Parameterised volumes get created using
+ the tabularized position and sizes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base type for parameterised volumes
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Holds parameteres for parameterised volumes.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GDMLSchema/gdml_replicas.xsd b/GDMLSchema/gdml_replicas.xsd
new file mode 100644
index 0000000..2c2ac4b
--- /dev/null
+++ b/GDMLSchema/gdml_replicas.xsd
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+ Abstract base for replication placement strategies
+
+
+
+
+
+ Abstract element for substitution group
+
+
+
+
+
+
+
+ Replica volumes get created along the specified direction
+ starting with the first replica placed at the given position and rotated
+ according to the given rotation and others placed using the given distance;
+ If position and/or rotation is omitted the defaults will be applied, e.g.
+ position at the mother volume center and identity rotation;
+ NOTE: THE ROTATION IS APPLIED TO ALL REPLICATED VOLUMES!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base type for replicated volumes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GDMLSchema/gdml_solids.xsd b/GDMLSchema/gdml_solids.xsd
new file mode 100644
index 0000000..b7c7409
--- /dev/null
+++ b/GDMLSchema/gdml_solids.xsd
@@ -0,0 +1,1008 @@
+
+
+
+
+
+
+
+
+
+
+ Base solid type
+
+
+
+ Length unit of all dimensions used for this instance of solid
+
+
+
+
+ Angle unit of angles used in definition of this solid
+
+
+
+
+
+
+
+
+ Base type for boolean solids
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base node for Multi-Union structure
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MultiUnion is a Solid created by Union of many Solids.
+ This Solid is constructed by multiUnionNodes;
+ each Node is described by solid with its position and rotation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Reflected solid:
+ sx, sy, sz are scale components (containing reflection),
+ rx, ry, rz are rotation angles around given axes and
+ dx, dy, dz is the translation.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Scaled solid:
+ For the scale component, values must be greater than zero.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ General optical surface properties
+
+
+
+
+
+ General optical surface property (const or vector)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base surface type
+
+
+
+
+
+
+
+
+
+ Abstract element for all solids substitution group
+
+
+
+
+
+
+ Abstract element for surfaces substitution
+
+
+
+
+
+
+ Solids definitions block
+
+
+
+
+
+ Definitions of constants and expressions to be used for solids'
+ dimensions and transformations
+ In this version these become part of the global scope.
+
+
+
+
+
+
+
+
+
+
+
+
+ Exported boolean union of two solids
+
+
+
+
+
+
+ Exported boolean subtraction of two solids
+
+
+
+
+
+
+ Exported boolean intersectioin of two solids
+
+
+
+
+
+
+ CSG box solid described by 3 dimensions of x, y, and z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG twisted box solid described by 4 dimensions of
+ x length along x axis
+ y length along y axis
+ z length along z axis
+ PhiTwist twist angle
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ general twisted trapezoid. faces perpendicular to the z planes are trapezia, and their centres are
+ not necessarily on a line paralell to the z axis.
+ PhiTwist Twist Angle
+ z length along the z-axis
+ Theta Polar angle of the line joining the centres of the faces at -/+z
+ Phi Azimuthal angle of the line joing the centre of the face at -z to the centre of the face at +z
+ y1 length along y of the face at -z
+ x1 length along x of the side at y=-y1 of the face at -z
+ x2 length along x of the side at y=+y1 of the face at -z
+ y2 length along y of the face at +z
+ x3 length along x of the side at y=-y2 of the face at +z
+ x4 length along x of the side at y=+y2 of the face at +z
+ Alph Angle with respect to the y axis from the centre of the side
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ different length axis twistable trapezoid. faces perpendicular to the z planes are trapezia, and their centres are
+ not necessarily on a line paralell to the z axis.
+ PhiTwist Twist Angle
+ z length along the z-axis
+ y1 length along y of the face at -z
+ x1 length along x of the side at y=-y1 of the face at -z
+ x2 length along x of the side at y=+y1 of the face at -z
+ y2 length along y of the face at +z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG paraboloid defined by
+ rlo radius at -dz
+ rhi radius at +dz
+ dz half z length
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG sphere or spherical shell segment solid described by
+ rmin inner radius
+ rmax outer radius
+ startphi starting angle of the segment in radians(0 <= phi <= 2*PI)
+ deltaphi delta angle of the segment in radians
+ starttheta starting angle of the segment in radians(0 <= theta <= PI)
+ deltatheta delta angle of the segment in radians
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG ellispoid or ellipsoidal shell segment solid described by
+ ax x semiaxis
+ by y semiaxis
+ cz z semiaxis
+ zcut1 bottom plane cutting ellipsoid
+ zcut2 top plane cutting ellispoid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG tube or tube segement solid described by
+ rmin Inner radius
+ rmax Outer radius
+ z length in z
+ startphi The starting phi angle in radians, adjusted such that
+ (startphi+deltaphi <= 2PI, startphi > -2PI)
+ deltaphi Delta angle of the segment in radians
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG twisted tube segment solid described by
+ twistedangle twist angle (constructors 1,2,3,4)
+ endinnerrad inside radius at end of segment (constructors 1,2)
+ endouterrad outside radius at end of segment (constructors 1,2)
+ midinnerrad inner radius at z=0 (constructors 3,4)
+ midouterrad outer radius at z=0 (constructors 3,4)
+ negativeEndz -ve z endplate (constructors 3,4)
+ positiveEndz +ve z endplate (constructors 3,4)
+ zlen z length of segment (constructors 1,2)
+ nseg number of segments in totalPhi (constructors 2,4)
+ totphi total angle of all segments (constructors 2,4)
+ phi phi angle of a segment (constructors 1,3)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG cut tube or cut tube segment solid described by
+ rmin Inner radius
+ rmax Outer radius
+ z length in z
+ startphi The starting phi angle in radians, adjusted such that (startphi+deltaphi <= 2PI, startphi > -2PI)
+ deltaphi Delta angle of the segment in radians
+ lowX, lowY, lowZ Normal at lower Z plane
+ highX, highY, highZ Normal at higher Z plane
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG cone or cone segment described by
+ rmin1 inside radius at z/2
+ rmin2 inside radius at z/2
+ rmax1 outside radius at z/2
+ rmax2 outside radius at z/2
+ z length in z
+ startphi starting angle of the segment in radians
+ deltaphi delta angle of the segment in radians
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG cone with elliptical cross section
+ dx semiaxis in X
+ dy semiaxis in Y
+ zmax height of elliptical cone
+ zcut upper cut plane level
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG polycone or polycone segment described by
+ startphi starting angle of the segment in radians
+ deltaphi delta angle of the segment in radians
+
+ and a set of z-planes each described by
+ rmin inside radius at z/2
+ rmax outside radius at z/2
+ z length in z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Generic polycone or polycone segment described by
+ startphi starting angle of the segment in radians
+ deltaphi delta angle of the segment in radians
+ and a set of points with (r,z)coordinates
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG parallelepiped solid is described by
+ x, y, z length in x,y,z
+ alpha Angle formed by the y axis and by the plane joining the centre of the faces
+ G4Parallel to the z-x plane at -y and +y
+ theta Polar angle of the line joining the centres of the faces at -z and +z in z
+ phi Azimuthal angle of the line joining the centres of the faces at -z and +z in z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG trapezoid solid with varying x and y dimensions along z axis
+ x1 Length along x at the surface positioned at -z
+ x2 Length along x at the surface positioned at +z
+ y1 Length along y at the surface positioned at -z
+ y2 Length along y at the surface positioned at +z
+ z Length along z axis
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG general trapezoid solid is described by
+ z Length along the z-axis
+ theta Polar angle of the line joining the centres of the faces at -/+z
+ phi Azimuthal angle of the line joing the centre of the face at -z to the centre of the face at +z
+ y1 Length along y of the face at -z
+ x1 Length along x of the side at y = -y1 of the face at -z
+ x2 Length along x of the side at y = +y1 of the face at -z
+ alp1 Angle with respect to the y axis from the centre of the side at y =- y1 to the centre at y = +y1 of the face at -z
+ y2 Length along y of the face at +z
+ x3 Length along x of the side at y = -y2 of the face at +z
+ x4 Length along x of the side at y = +y2 of the face at +z
+ alp2 Angle with respect to the y axis from the centre of the side at y = -y2 to the centre at y = +y2 of the face at +z
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG torus solid is described by
+ rmin Inside radius
+ rmax Outside radius
+ rtor swept radius of torus
+ startphi The starting phi angle in radians adjusted such that sphi+dphi lt 2PI, sphi gt -2PI
+ deltaphi Delta angle of the segment in radians
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CSG orb solid (simplified sphere with only rmax) is described by
+ r Outside radius
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Polyhedra is described by
+ startphi initial phi starting angle
+ totalphi total phi angle
+ numsides number sides
+ and a set of zplanes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Polyhedra is described by
+ startphi initial phi starting angle
+ totalphi total phi angle
+ numsides number sides
+ and a set of points with (r,z) coordinates.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Poligonal extrusion is described by
+ an unbounded (min. 3) number of vertices of the blueprint polygon
+ and an unbounded number of Z sections.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tube with hyperbolic profile described by
+ rmin innerRadius
+ rmax outerRadius
+ inst innerStereo
+ outst outerStereo
+ z z length
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Volume representing a tube with elliptical
+ cross section.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Volume representing a tetrahedron.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Volume representing an (almost)arbitrary 8 vertices solid.
+ The solid is defined by two quadrilaterals sitting on parallel planes,
+ the distance between these two planes is dz*2.
+ The base quadrilateral contained within the plane located at -dz is defined by
+ the first 4 vertices (v1,v2,v3,v4 each one with the x and y coordinates).
+ The other parallel quadrilateral contained within the plane at +dz is defined by
+ the other 4 vertices (v5,v6,v7,v8 each one with the x and y coordinates).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Base facet type
+
+
+
+
+
+
+ Abstract element for all facets substitution group
+
+
+
+
+
+
+
+ Triangular facet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Quadrangular facet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Tessellated solid
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Optical surface used by Geant4 optical processes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/GUIMesh.py b/GUIMesh.py
index 13b0232..0013e15 100644
--- a/GUIMesh.py
+++ b/GUIMesh.py
@@ -39,6 +39,7 @@
from GUIMeshLibs import LoadOP
from GUIMeshLibs import MaterialManager
from GUIMeshLibs import WriteGDML
+ from GUIMeshLibs import Write1GDML
except:
print("Could not load GUIMesh libraries. Please check if the folder GUIMeshLibs exists and if the files are there.")
@@ -50,6 +51,9 @@ def Pressed_Find_FreeCAD_Dir():
print ("Pressed Find FreeCAD Dir")
#Import FreeCAD - essential to the whole program
try:
+ sys.path.append("/usr/lib/freecad-python3/lib")
+ sys.path.append("C:\\FreeCAD_0.18\\bin")
+ sys.path.append("C:/FreeCAD_0.18/bin")
import FreeCAD
FreeCAD_status="FreeCAD loaded"
label_FreeCAD_path.configure(text=FreeCAD_status)
@@ -82,7 +86,7 @@ def Pressed_Read_STEP():
if (FreeCAD_status=="FreeCAD loaded"):
STEP_file_status="Opening file..."
label_STEP_path.configure(text=STEP_file_status)
- temp_list_of_objects=LoadOP.Load_STEP_File(file_status,Element_List[13])#Load STEP with FreeCAD library - See LoadOP library
+ temp_list_of_objects=LoadOP.Load_STEP_File(file_status,Element_List[13], Material_List)#Load STEP with FreeCAD library - See LoadOP library
#Check if loading was done properly
if (temp_list_of_objects==0):
tkinter.messagebox.showinfo("Error", "File format or extension is incorrect.")
@@ -191,6 +195,19 @@ def Pressed_Write_GDML():
else:
tkinter.messagebox.showinfo("Error", "There are no volumes to mesh.")
+
+#################################################################
+############################Write GDML###########################
+#################################################################
+def Pressed_Write_1_GDML():
+ global list_of_objects
+ global world_dimensions
+ print("Pressed_Write_GDML STEP Mesh")
+ if len(list_of_objects)>0:
+ Write1GDML.Write_Files(list_of_objects, world_dimensions) #See WriteGDML library
+ else:
+ tkinter.messagebox.showinfo("Error", "There are no volumes to mesh.")
+
#################################################################
#################Selected Volume Operations######################
#################################################################
@@ -345,8 +362,8 @@ def Pressed_Exit_Program():
buttons_width=int(18*p_w)
buttons_height=int(2*p_h)
pos_x=0.1
-pos_y=0.05
-pos_y_os=0.115
+pos_y=0.02
+pos_y_os=0.108
font_size=20*p_h*p_w
#root.state("zoomed")
#Draw interface regions
@@ -408,9 +425,12 @@ def Pressed_Exit_Program():
#Write GDML button
button_Write_GDML = tk.Button(button_menu, text = 'Write GDML',font=("Helvetica", int(12*p_w)), command = Pressed_Write_GDML,bg="#e0e0d1")
button_Write_GDML.place(relx=0.1,rely=(pos_y+pos_y_os*6),relwidth=0.8, relheight=0.1)
+#Write 1 GDML button
+button_Write_1_GDML = tk.Button(button_menu, text = 'Write 1 GDML',font=("Helvetica", int(12*p_w)), command = Pressed_Write_1_GDML,bg="#e0e0d1")
+button_Write_1_GDML.place(relx=0.1,rely=(pos_y+pos_y_os*7),relwidth=0.8, relheight=0.1)
#Exit button
button_exit = tk.Button(button_menu, text = 'Exit Program',font=("Helvetica", int(12*p_w)), command = Pressed_Exit_Program,bg="#e0e0d1")
-button_exit.place(relx=0.1,rely=(pos_y+pos_y_os*7),relwidth=0.8, relheight=0.1)
+button_exit.place(relx=0.1,rely=(pos_y+pos_y_os*8),relwidth=0.8, relheight=0.1)
#####################################################################################
###################################Volume Lists######################################
diff --git a/GUIMeshLibs/LoadOP.py b/GUIMeshLibs/LoadOP.py
index 4adba8d..4c69a15 100644
--- a/GUIMeshLibs/LoadOP.py
+++ b/GUIMeshLibs/LoadOP.py
@@ -42,8 +42,43 @@ def Find_FreeCAD_Dir():
else:
return 0
+
+def find_material_from_label(label):
+ arr = label.replace('\r', '').split("_MATDEF_")
+ if len(arr) > 1:
+ return arr[1]
+
+
+def find_material(label, material_list, material):
+ obj_material = material
+ material_def = find_material_from_label(label)
+ if material_def:
+ found_m = False
+ for m in material_list:
+ if m.Name == material_def:
+ obj_material = m
+ found_m = True
+ break
+ if not found_m:
+ print("[Load_STEP_File]::: ERROR::: " + material_def + " not found for object " + label + ". Define it yourself")
+ return obj_material
+
+## freecad 0.19
+# def find_precision(shape, precision):
+# opt_precision = precision
+# triangles = shape.tessellate(opt_precision, True)
+# tolerance = 100000
+# if triangles[1].__len__() > tolerance:
+# triangles2 = shape.tessellate(opt_precision * 2, True)
+# while triangles[1].__len__() > triangles2[1].__len__() and triangles[1].__len__() > tolerance:
+# opt_precision = opt_precision * 2
+# triangles = triangles2
+# triangles2 = shape.tessellate(opt_precision * 2, True)
+# return opt_precision
+
+
#Add FreeCAD directory to os path
-def Load_STEP_File(doc_status,material):
+def Load_STEP_File(doc_status,material, material_list):
from GUIMeshLibs import Volumes
import tkinter.filedialog
import FreeCAD
@@ -59,19 +94,21 @@ def Load_STEP_File(doc_status,material):
print("Previous document closed")
FreeCAD.newDocument("Unnamed")
FreeCAD.setActiveDocument("Unnamed")
- try:
+ try:
Import.insert(path_to_file,"Unnamed") #FreeCAD attempts to open file - If the format is wrong it will be detected
print("File read successfuly")
list_of_objects=[]
for obj in FreeCAD.ActiveDocument.Objects:
try:
- if(obj.TypeId=="Part::Feature"):
- obj.Label=obj.Label.replace(" ","_")
- obj.Label=obj.Label.replace(".","_")
- obj.Label=obj.Label.replace("---","_")
- list_of_objects.append(Volumes.Volume(obj,material,0.1,1))
+ if(obj.TypeId == "Part::Feature") and hasattr(obj, "Shape"):
+ obj.Label = obj.Label.replace(" ", "_")\
+ .replace(".", "_").replace("---", "_")\
+ .replace('\r', '').replace(',', '_')
+ obj_material = find_material(obj.Label, material_list, material)
+ list_of_objects.append(Volumes.Volume(obj, obj_material, 0.1, 1))
except:
- continue
+ print('Part not added: ', obj.Label)
+ continue
return list_of_objects
except:
print("Error reading file. Format might be incorrect.")
diff --git a/GUIMeshLibs/Materials.py b/GUIMeshLibs/Materials.py
index bb571de..d7a5d77 100644
--- a/GUIMeshLibs/Materials.py
+++ b/GUIMeshLibs/Materials.py
@@ -19,6 +19,7 @@
#########################################################################################################
#Libaries
import os
+import sys
import tkinter.messagebox
#Class Element - an Element has a name (from G4 NIST), a density and zero number of elements (used to differentiate them from created materials)
@@ -27,7 +28,7 @@ def __init__(self,myname,mydensity):
self.Name=myname
self.Density=mydensity
self.Nelements=0
-
+
#Class Material - a Material has a name , a density, a number of elements, a list of elements (from the class Element) and a list with each element weight (fraction)
class Material:
def __init__(self,myname,mydensity,nelements,myelements):
@@ -79,7 +80,7 @@ def Load_Material(path_to_material):
if lines[i] not in ele_db_names:
print("Error: Element not in database, please check the name.")
error_check=1
- if str(check_fractions)!="1.0": #string used to fix a bug
+ if abs(1.0-check_fractions) > sys.float_info.epsilon:
error_check=1
print("Error: Element fraction sum different than 1.")
except ValueError:
@@ -88,7 +89,7 @@ def Load_Material(path_to_material):
except ValueError:
print("Error: Material density either not a float or <1.")
error_check=1
-
+
#Accept or not the material
if error_check==0:
print(lines[0]+" was imported successfully.")
@@ -97,7 +98,7 @@ def Load_Material(path_to_material):
else:
print(lines[0]+" was not imported due to format errors.")
return 0
-
+
#Loads all Materials in txt form from the "Materials" folder. Each file format is tested. Returns a Maerial database
def Load_Materials():
ele_db_names=["G4_H", "G4_He", "G4_Li", "G4_Be", "G4_B", "G4_C", "G4_N", "G4_O", "G4_F", "G4_Ne", "G4_Na", "G4_Mg", "G4_Al", "G4_Si", "G4_P", "G4_S", "G4_Cl", "G4_Ar", "G4_K", "G4_Ca", "G4_Sc", "G4_Ti", "G4_V", "G4_Cr", "G4_Mn", "G4_Fe", "G4_Co", "G4_Ni", "G4_Cu", "G4_Zn", "G4_Ga", "G4_Ge", "G4_As", "G4_Se", "G4_Br", "G4_Kr", "G4_Rb", "G4_Sr", "G4_Y", "G4_Zr", "G4_Nb", "G4_Mo", "G4_Tc", "G4_Ru", "G4_Rh", "G4_Pd", "G4_Ag", "G4_Cd", "G4_In", "G4_Sn", "G4_Sb", "G4_Te", "G4_I", "G4_Xe", "G4_Cs", "G4_Ba", "G4_La", "G4_Ce", "G4_Pr", "G4_Nd", "G4_Pm", "G4_Sm", "G4_Eu", "G4_Gd", "G4_Tb", "G4_Dy", "G4_Ho", "G4_Er", "G4_Tm", "G4_Yb", "G4_Lu", "G4_Hf", "G4_Ta", "G4_W", "G4_Re", "G4_Os", "G4_Ir", "G4_Pt", "G4_Au", "G4_Hg", "G4_Tl", "G4_Pb", "G4_Bi", "G4_Po", "G4_At", "G4_Rn", "G4_Fr", "G4_Ra", "G4_Ac", "G4_Th", "G4_Pa", "G4_U", "G4_Np", "G4_Pu", "G4_Am", "G4_Cm", "G4_Bk", "G4_Cf","G4_A-150_TISSUE", "G4_ACETONE", "G4_ACETYLENE", "G4_ADENINE", "G4_AIR", "G4_ALANINE", "G4_ALUMINUM_OXIDE", "G4_AMBER", "G4_AMMONIA", "G4_ANILINE", "G4_ANTHRACENE", "G4_B-100_BONE", "G4_BAKELITE", "G4_BARIUM_FLUORIDE", "G4_BARIUM_SULFATE", "G4_BENZENE", "G4_BERYLLIUM_OXIDE", "G4_BGO", "G4_BONE_COMPACT_ICRU", "G4_BONE_CORTICAL_ICRP", "G4_BORON_CARBIDE", "G4_BORON_OXIDE", "G4_BUTANE", "G4_N-BUTYL_ALCOHOL", "G4_C-552", "G4_CADMIUM_TELLURIDE", "G4_CADMIUM_TUNGSTATE", "G4_CALCIUM_CARBONATE", "G4_CALCIUM_FLUORIDE", "G4_CALCIUM_OXIDE", "G4_CALCIUM_SULFATE", "G4_CALCIUM_TUNGSTATE", "G4_CARBON_DIOXIDE", "G4_CARBON_TETRACHLORIDE", "G4_CELLULOSE_CELLOPHANE", "G4_CELLULOSE_BUTYRATE", "G4_CELLULOSE_NITRATE", "G4_CERIC_SULFATE", "G4_CESIUM_FLUORIDE", "G4_CESIUM_IODIDE", "G4_CHLOROBENZENE", "G4_CHLOROFORM", "G4_CYCLOHEXANE", "G4_1,2-DICHLOROBENZENE", "G4_DICHLORODIETHYL_ETHER", "G4_1,2-DICHLOROETHANE", "G4_DIETHYL_ETHER", "G4_N,N-DIMETHYL_FORMAMIDE", "G4_DIMETHYL_SULFOXIDE", "G4_ETHANE", "G4_ETHYL_ALCOHOL", "G4_ETHYL_CELLULOSE", "G4_ETHYLENE", "G4_EYE_LENS_ICRP", "G4_FERRIC_OXIDE", "G4_FERROBORIDE", "G4_FERROUS_OXIDE", "G4_FERROUS_SULFATE", "G4_FREON-12", "G4_FREON-12B2", "G4_FREON-13", "G4_FREON-13B1", "G4_FREON-13I1", "G4_GADOLINIUM_OXYSULFIDE", "G4_GALLIUM_ARSENIDE", "G4_GEL_PHOTO_EMULSION", "G4_Pyrex_Glass", "G4_GLASS_LEAD", "G4_GLASS_PLATE", "G4_GLUCOSE", "G4_GLUTAMINE", "G4_GLYCEROL", "G4_GUANINE", "G4_GYPSUM", "G4_N-HEPTANE", "G4_N-HEXANE", "G4_KAPTON", "G4_LANTHANUM_OXYBROMIDE", "G4_LANTHANUM_OXYSULFIDE", "G4_LEAD_OXIDE", "G4_LITHIUM_AMIDE", "G4_LITHIUM_CARBONATE", "G4_LITHIUM_FLUORIDE", "G4_LITHIUM_HYDRIDE", "G4_LITHIUM_IODIDE", "G4_LITHIUM_OXIDE", "G4_LITHIUM_TETRABORATE", "G4_M3_WAX", "G4_MAGNESIUM_CARBONATE", "G4_MAGNESIUM_FLUORIDE", "G4_MAGNESIUM_OXIDE", "G4_MAGNESIUM_TETRABORATE", "G4_MERCURIC_IODIDE", "G4_METHANE", "G4_METHANOL", "G4_MIX_D_WAX", "G4_MS20_TISSUE", "G4_MUSCLE_STRIATED_ICRU", "G4_MUSCLE_WITH_SUCROSE", "G4_MUSCLE_WITHOUT_SUCROSE", "G4_NAPHTHALENE", "G4_NITROBENZENE", "G4_NITROUS_OXIDE", "G4_NYLON-8062", "G4_NYLON-6/6", "G4_NYLON-6/10", "G4_NYLON-11_RILSAN", "G4_OCTANE", "G4_PARAFFIN", "G4_N-PENTANE", "G4_PHOTO_EMULSION", "G4_PLASTIC_SC_VINYLTOLUENE", "G4_PLUTONIUM_DIOXIDE", "G4_POLYACRYLONITRILE", "G4_POLYCARBONATE", "G4_POLYCHLOROSTYRENE", "G4_POLYETHYLENE", "G4_MYLAR", "G4_PLEXIGLASS", "G4_POLYOXYMETHYLENE", "G4_POLYPROPYLENE", "G4_POLYSTYRENE", "G4_TEFLON", "G4_POLYTRIFLUOROCHLOROETHYLENE", "G4_POLYVINYL_ACETATE", "G4_POLYVINYL_ALCOHOL", "G4_POLYVINYL_BUTYRAL", "G4_POLYVINYL_CHLORIDE", "G4_POLYVINYLIDENE_CHLORIDE", "G4_POLYVINYLIDENE_FLUORIDE", "G4_POLYVINYL_PYRROLIDONE", "G4_POTASSIUM_IODIDE", "G4_POTASSIUM_OXIDE", "G4_PROPANE", "G4_lPROPANE", "G4_N-PROPYL_ALCOHOL", "G4_PYRIDINE", "G4_RUBBER_BUTYL", "G4_RUBBER_NATURAL", "G4_RUBBER_NEOPRENE", "G4_SILICON_DIOXIDE", "G4_SILVER_BROMIDE", "G4_SILVER_CHLORIDE", "G4_SILVER_HALIDES", "G4_SILVER_IODIDE", "G4_SODIUM_CARBONATE", "G4_SODIUM_IODIDE", "G4_SODIUM_MONOXIDE", "G4_SODIUM_NITRATE", "G4_STILBENE", "G4_SUCROSE", "G4_TERPHENYL", "G4_TETRACHLOROETHYLENE", "G4_THALLIUM_CHLORIDE", "G4_TISSUE_SOFT_ICRU-4", "G4_TISSUE-METHANE", "G4_TISSUE-PROPANE", "G4_TITANIUM_DIOXIDE", "G4_TOLUENE", "G4_TRICHLOROETHYLENE", "G4_TRIETHYL_PHOSPHATE", "G4_TUNGSTEN_HEXAFLUORIDE", "G4_URANIUM_DICARBIDE", "G4_URANIUM_MONOCARBIDE", "G4_URANIUM_OXIDE", "G4_UREA", "G4_VALINE", "G4_VITON", "G4_WATER", "G4_WATER_VAPOR", "G4_XYLENE", "G4_GRAPHITE"]
@@ -132,7 +133,7 @@ def Load_Materials():
if lines[i] not in ele_db_names:
print("Error: Element not in database, please check the name.")
error_check=1
- if str(check_fractions)!="1.0": #string used to fix a bug
+ if abs(1.0-check_fractions) > sys.float_info.epsilon:
error_check=1
print("Error: Element fraction sum different than 1.")
except ValueError:
@@ -151,7 +152,7 @@ def Load_Materials():
print("Material Database loaded. Check log for errors.")
return mat_db
-#Save the Material Database into the "Materials" Folder.
+#Save the Material Database into the "Materials" Folder.
def Save_Materials(Mat_List):
if (os.path.isdir("Materials/")==False):
print('"Materials" folder not found')
diff --git a/GUIMeshLibs/Write1GDML.py b/GUIMeshLibs/Write1GDML.py
new file mode 100644
index 0000000..196ae46
--- /dev/null
+++ b/GUIMeshLibs/Write1GDML.py
@@ -0,0 +1,181 @@
+#########################################################################################################
+# GUIMesh v1 #
+# #
+# Copyright (c) 2018 Marco Gui Alves Pinto mail:mgpinto11@gmail.com #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see #
+# #
+#########################################################################################################
+
+# Libraries
+import os
+# import GMaterials
+from . import Volumes
+from tkinter import filedialog as tkFileDialog
+# from tkinter import simpledialog as tkSimpleDialog
+from tkinter import messagebox as tkMessageBox
+import datetime
+
+# import tkFileDialog
+# import tkMessageBox
+
+MATERIALS_TEMPLATE = '''
+
+
+
+
+
+
+
+
+'''
+
+
+def write_gdml_definition(write_dir):
+ from distutils.dir_util import copy_tree
+ from pathlib import Path
+ if (os.path.isdir("GDMLSchema/") == True):
+ to_dir = str(Path(write_dir, "GDMLSchema").resolve())
+ if (os.path.isdir(to_dir) == False):
+ os.makedirs(to_dir)
+ from_dir = "GDMLSchema"
+ copy_tree(from_dir, to_dir)
+ return True
+ return False
+
+
+def get_triangles(shape, precision):
+ opt_precision = precision
+ triangles = shape.tessellate(opt_precision, True)
+ if (triangles[1].__len__() > 10000):
+ triangles2 = shape.tessellate(opt_precision*2, True)
+ while(triangles[1].__len__() > triangles2[1].__len__() and triangles[1].__len__() > 10000):
+ opt_precision = opt_precision*2
+ triangles = triangles2
+ triangles2 = shape.tessellate(opt_precision*2, True)
+ return triangles, opt_precision
+
+# Main function called to write all GDML files
+def Write_Files(obj_list, world_list):
+ print("GDML STARTED")
+ write_dir = tkFileDialog.askdirectory()
+ print(write_dir)
+ gdml_local_definition = write_gdml_definition(write_dir)
+ counter = 1
+ define_list = ['\n', '\n']
+ solid_list = ['\n']
+ logical_volume_list = []
+ physical_volume_list = []
+ material_list = []
+ material_added = []
+ gdml_name_list = []
+ i = 0
+ for obj in obj_list:
+ i = i + 1
+ if obj.VolumeGDMLoption == 1:
+ # material list
+ if obj.VolumeMaterial.Nelements != 0:
+ if obj.VolumeMaterial.Name not in MATERIALS_TEMPLATE and obj.VolumeMaterial.Name not in material_added:
+ material = '\n' + '\n'
+ for i in range(0, obj.VolumeMaterial.Nelements):
+ material += '\n'
+ material += '\n'
+ material_list.append(material)
+ material_added.append(obj.VolumeMaterial.Name)
+ vol_numb = counter
+ precision = obj.VolumeMMD
+ # the number represents the precision of the tessellation #returns matrix with triangles vertices
+ triangles = obj.VolumeCAD.Shape.tessellate(precision, True)
+ count = 0
+ gdml_name = str(obj.VolumeCAD.Label) # + str(vol_numb)
+ # if (len(triangles[0]) > 300):
+ # print(obj.VolumeCAD.Label)
+ if gdml_name in gdml_name_list:
+ print("\t " + gdml_name + " not unique")
+ gdml_name = gdml_name + "_" + str(vol_numb)
+ counter += 1
+ gdml_name_list.append(gdml_name)
+ # define
+ for tri in triangles[0]:
+ define_list.append(' \n')
+ count = count + 1
+ # tessellated
+ count = 0
+ triangle_list = []
+ for tri in triangles[1]:
+ triangle_list.append(
+ '\n')
+ count += 3
+ tessellated = '\n' + ''.join(
+ triangle_list) + '\n'
+ solid_list.append(tessellated)
+ # logical volume
+ material_ref = str(obj.VolumeMaterial.Name)
+ logical_volume_list.append(
+ '''\n\n\n\n'''.format_map(
+ locals()))
+ # physical volume
+ physical_volume_list.append(
+ '''\n\n\n\n\n'''.format_map(
+ locals()))
+ F = open(str(write_dir) + "/unnamed.gdml", "w")
+ F.write('\n')
+ if gdml_local_definition:
+ F.write(
+ '\n')
+ else:
+ F.write(
+ '\n')
+ F.write('\n')
+ for d in define_list:
+ F.write(d)
+ F.write('\n')
+ # write material information
+ F.write('\n')
+ F.write(MATERIALS_TEMPLATE)
+ for m in material_list:
+ F.write(m)
+ F.write('\n')
+ # write solid information (world volume)
+ F.write('\n')
+ for s in solid_list:
+ F.write(s)
+ F.write('\n')
+ # write structure
+ F.write('\n')
+ for lv in logical_volume_list:
+ F.write(lv)
+ F.write('\n')
+ F.write('\n')
+ F.write('\n')
+ for pv in physical_volume_list:
+ F.write(pv)
+ F.write('\n')
+ F.write('\n')
+ F.write('\n')
+ F.write('\n')
+ F.write('\n')
+ F.write('')
+ F.close()
+ print("GDML FINISHED")
+ tkMessageBox.showinfo("Message", 'GDML Files ready.')
+# Note: A number is added to each volumes label to avoid that two different volumes have the same name. This can be seen in the mother and in the volumes GDMLs
diff --git a/STEP files/Sphere_System_DEFMAT.step b/STEP files/Sphere_System_DEFMAT.step
new file mode 100644
index 0000000..ea479c6
--- /dev/null
+++ b/STEP files/Sphere_System_DEFMAT.step
@@ -0,0 +1,118 @@
+ISO-10303-21;
+HEADER;
+FILE_DESCRIPTION(('FreeCAD Model'),'2;1');
+FILE_NAME('D:/IdeaProjects/GUIMesh/STEP files/Sphere_System_DEFMAT.step'
+ ,'2022-04-13T16:26:21',('Author'),(''),
+ 'Open CASCADE STEP processor 7.3','FreeCAD','Unknown');
+FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
+ENDSEC;
+DATA;
+#1 = APPLICATION_PROTOCOL_DEFINITION('international standard',
+ 'automotive_design',2000,#2);
+#2 = APPLICATION_CONTEXT(
+ 'core data for automotive mechanical design processes');
+#3 = SHAPE_DEFINITION_REPRESENTATION(#4,#10);
+#4 = PRODUCT_DEFINITION_SHAPE('','',#5);
+#5 = PRODUCT_DEFINITION('design','',#6,#9);
+#6 = PRODUCT_DEFINITION_FORMATION('','',#7);
+#7 = PRODUCT('Cut_MATDEF_SiO2','Cut_MATDEF_SiO2','',(#8));
+#8 = PRODUCT_CONTEXT('',#2,'mechanical');
+#9 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');
+#10 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#11,#15),#39);
+#11 = AXIS2_PLACEMENT_3D('',#12,#13,#14);
+#12 = CARTESIAN_POINT('',(0.,0.,0.));
+#13 = DIRECTION('',(0.,0.,1.));
+#14 = DIRECTION('',(1.,0.,-0.));
+#15 = BREP_WITH_VOIDS('',#16,(#27));
+#16 = CLOSED_SHELL('',(#17));
+#17 = ADVANCED_FACE('',(#18),#22,.T.);
+#18 = FACE_BOUND('',#19,.T.);
+#19 = VERTEX_LOOP('',#20);
+#20 = VERTEX_POINT('',#21);
+#21 = CARTESIAN_POINT('',(3.061616997868E-16,0.,-5.));
+#22 = SPHERICAL_SURFACE('',#23,5.);
+#23 = AXIS2_PLACEMENT_3D('',#24,#25,#26);
+#24 = CARTESIAN_POINT('',(0.,0.,0.));
+#25 = DIRECTION('',(0.,0.,1.));
+#26 = DIRECTION('',(1.,0.,0.));
+#27 = ORIENTED_CLOSED_SHELL('',*,#28,.F.);
+#28 = CLOSED_SHELL('',(#29));
+#29 = ADVANCED_FACE('',(#30),#34,.T.);
+#30 = FACE_BOUND('',#31,.T.);
+#31 = VERTEX_LOOP('',#32);
+#32 = VERTEX_POINT('',#33);
+#33 = CARTESIAN_POINT('',(1.224646799147E-16,0.,-2.));
+#34 = SPHERICAL_SURFACE('',#35,2.);
+#35 = AXIS2_PLACEMENT_3D('',#36,#37,#38);
+#36 = CARTESIAN_POINT('',(0.,0.,0.));
+#37 = DIRECTION('',(0.,0.,1.));
+#38 = DIRECTION('',(1.,0.,0.));
+#39 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3)
+GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#43)) GLOBAL_UNIT_ASSIGNED_CONTEXT(
+(#40,#41,#42)) REPRESENTATION_CONTEXT('Context #1',
+ '3D Context with UNIT and UNCERTAINTY') );
+#40 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
+#41 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
+#42 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
+#43 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#40,
+ 'distance_accuracy_value','confusion accuracy');
+#44 = PRODUCT_RELATED_PRODUCT_CATEGORY('part',$,(#7));
+#45 = SHAPE_DEFINITION_REPRESENTATION(#46,#52);
+#46 = PRODUCT_DEFINITION_SHAPE('','',#47);
+#47 = PRODUCT_DEFINITION('design','',#48,#51);
+#48 = PRODUCT_DEFINITION_FORMATION('','',#49);
+#49 = PRODUCT('Sphere002_MATDEF_DenseAl','Sphere002_MATDEF_DenseAl','',(
+ #50));
+#50 = PRODUCT_CONTEXT('',#2,'mechanical');
+#51 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');
+#52 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#11,#53),#65);
+#53 = MANIFOLD_SOLID_BREP('',#54);
+#54 = CLOSED_SHELL('',(#55));
+#55 = ADVANCED_FACE('',(#56),#60,.T.);
+#56 = FACE_BOUND('',#57,.T.);
+#57 = VERTEX_LOOP('',#58);
+#58 = VERTEX_POINT('',#59);
+#59 = CARTESIAN_POINT('',(1.224646799147E-16,0.,-2.));
+#60 = SPHERICAL_SURFACE('',#61,2.);
+#61 = AXIS2_PLACEMENT_3D('',#62,#63,#64);
+#62 = CARTESIAN_POINT('',(0.,0.,0.));
+#63 = DIRECTION('',(0.,0.,1.));
+#64 = DIRECTION('',(1.,0.,0.));
+#65 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3)
+GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#69)) GLOBAL_UNIT_ASSIGNED_CONTEXT(
+(#66,#67,#68)) REPRESENTATION_CONTEXT('Context #1',
+ '3D Context with UNIT and UNCERTAINTY') );
+#66 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
+#67 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
+#68 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
+#69 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#66,
+ 'distance_accuracy_value','confusion accuracy');
+#70 = PRODUCT_RELATED_PRODUCT_CATEGORY('part',$,(#49));
+#71 = MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#72,
+ #80),#39);
+#72 = STYLED_ITEM('color',(#73),#17);
+#73 = PRESENTATION_STYLE_ASSIGNMENT((#74));
+#74 = SURFACE_STYLE_USAGE(.BOTH.,#75);
+#75 = SURFACE_SIDE_STYLE('',(#76));
+#76 = SURFACE_STYLE_FILL_AREA(#77);
+#77 = FILL_AREA_STYLE('',(#78));
+#78 = FILL_AREA_STYLE_COLOUR('',#79);
+#79 = COLOUR_RGB('',0.800000011921,0.800000011921,0.800000011921);
+#80 = STYLED_ITEM('color',(#81),#29);
+#81 = PRESENTATION_STYLE_ASSIGNMENT((#82));
+#82 = SURFACE_STYLE_USAGE(.BOTH.,#83);
+#83 = SURFACE_SIDE_STYLE('',(#84));
+#84 = SURFACE_STYLE_FILL_AREA(#85);
+#85 = FILL_AREA_STYLE('',(#86));
+#86 = FILL_AREA_STYLE_COLOUR('',#79);
+#87 = MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#88),
+ #65);
+#88 = STYLED_ITEM('color',(#89),#55);
+#89 = PRESENTATION_STYLE_ASSIGNMENT((#90));
+#90 = SURFACE_STYLE_USAGE(.BOTH.,#91);
+#91 = SURFACE_SIDE_STYLE('',(#92));
+#92 = SURFACE_STYLE_FILL_AREA(#93);
+#93 = FILL_AREA_STYLE('',(#94));
+#94 = FILL_AREA_STYLE_COLOUR('',#79);
+ENDSEC;
+END-ISO-10303-21;
diff --git a/requirement.txt b/requirement.txt
new file mode 100644
index 0000000..c1762e5
--- /dev/null
+++ b/requirement.txt
@@ -0,0 +1,4 @@
+pyside2
+shiboken2
+six
+setuptools
\ No newline at end of file