GDML structure generation method and system and electronic equipment

By parsing STP files and processing them with mesh simplification algorithms, the efficiency and accuracy issues in generating GDML format were resolved, enabling the efficient generation of GDML structures that meet the requirements of radiation simulation.

CN121834931APending Publication Date: 2026-04-10HARBIN INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-31
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies for converting STP files to GDML format suffer from problems such as excessive number of triangles leading to high file storage costs, extended generation time, and decreased geometric model accuracy, which cannot meet the needs of radiation simulation.

Method used

By parsing the STP file, extracting geometric attribute data, constructing the data structure of the GDML file, determining the size data of the triangular facets based on the geometric attribute data, and using a mesh simplification algorithm to simplify the initial geometric model, the final GDML structure file is generated.

Benefits of technology

While ensuring geometric accuracy, the generation efficiency of GDML format is significantly improved, the number of triangles is reduced, the computational load and storage cost are lowered, and the accuracy of radiation transmission and intersection calculations is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121834931A_ABST
    Figure CN121834931A_ABST
Patent Text Reader

Abstract

The invention provides a GDML structure generation method and system and electronic equipment, and relates to the technical field of geometric structure modeling, and the method comprises the steps: obtaining a to-be-converted STP file, and analyzing the STP file to obtain geometric attribute data in the STP file; constructing a data structure of the GDML file according to the structure specification of the GDML file; determining size data of the triangular patches based on the geometric attribute data, and obtaining an initial triangular surface model composed of the triangular patches according to the size data; performing simplification processing on the initial geometric model through a grid simplification algorithm to obtain a simplified final triangular surface model; and generating a GDML structure file corresponding to the STP file according to the final triangular surface model in combination with the data structure. According to the method, on the premise of ensuring geometric accuracy, the generation efficiency of the GDML format is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of geometric structure modeling technology, and more specifically, to a GDML structure generation method, system, and electronic device. Background Technology

[0002] STP files are CAD file formats conforming to ISO standards, featuring standardized structure and semantics. They are widely used in the aerospace industry for cross-software and cross-system data exchange and sharing. The geometric data in STP files can meet the needs of spacecraft design, assembly, and performance analysis. Furthermore, Geant4 is a commonly used radiation simulation software in spacecraft radiation protection design, and GDML (Geometry Description Markup Language) structure files are deeply bound to Geant4. Therefore, it is usually necessary to convert STP format geometric files to GDML format.

[0003] In related technologies, surface elements in GDML structures are used to define the mesh representation of complex geometries. When a geometry cannot be described by simple geometric shapes such as spheres or cylinders, it needs to be divided into triangular facets to form a mesh structure. However, in existing STP-GDML conversion methods, in pursuit of conversion convenience, fixed small-size, small-angle triangular facet parameters are often used, resulting in an excessive number of triangular facets. This not only increases file storage costs but also prolongs the GDML structure generation time. On the other hand, simply reducing the number of triangular facets leads to a decrease in the accuracy of the geometric model, affecting the accuracy of radiation transfer and intersection calculations, and thus failing to meet the requirements of radiation simulation. Summary of the Invention

[0004] The problem addressed by this invention is how to improve the generation efficiency of GDML format while ensuring geometric accuracy.

[0005] To address the above problems, this invention provides a GDML structure generation method, system, and electronic device.

[0006] In a first aspect, the present invention provides a GDML structure generation method, comprising: Obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file; Construct the data structure of the GDML file according to the structure specification of the GDML file; Based on the geometric attribute data, the size data of the triangular facets is determined, and according to the size data, an initial triangular facet model composed of the triangular facets is obtained; The initial geometric model is simplified using a mesh simplification algorithm to obtain the simplified final triangular face model; Based on the final triangular face model and the data structure, the GDML structure file corresponding to the STP file is generated.

[0007] Optionally, parsing the STP file to obtain the geometric attribute data in the STP file includes: The STP file is parsed to obtain the point information, line information, surface information, and volume information of the geometric model in the STP file; Based on the point information, the line information, the surface information, and the volume information, the structural features of the geometric model are obtained; Based on the structural features, determine the vertex position data, patch index information, and material property data of the geometric model; The vertex position data and the patch index information are used as geometric data, and combined with the material property data to form the geometric property data.

[0008] Optionally, constructing the data structure of the GDML file according to the structure specification of the GDML file includes: Define material properties, geometric structure, and physical boundary relationships according to the structural specifications of the GDML file; Using an XML parsing library, the material definition area, geometric structure definition area, and physical definition area of ​​the GDML file are determined based on the material properties, the geometric structure, and the physical boundary relationships. The data structure of the GDML file is constructed based on the material definition area, the geometric structure definition area, and the physical definition area.

[0009] Optionally, determining the size data of the triangular facet based on the geometric attribute data includes: Based on the structural features in the geometric attribute data, determine the complexity distribution characteristics of the geometric model; Based on the complexity distribution characteristics of the geometric model, the geometric model is divided into multiple regions, and the maximum size parameter and maximum angle parameter of the triangular facet corresponding to each region are set. The maximum length threshold and the maximum angle threshold in the maximum angle parameters of the triangular facet corresponding to the region are used as the size data.

[0010] Optionally, obtaining the initial triangular facet model composed of the triangular facets based on the size data includes: Based on the maximum length threshold and the maximum angle threshold of each region in the size data, the curves and surfaces in the corresponding regions of the geometric model are converted into triangular patch structures; The initial triangular facet model is formed based on the triangular facet structure of all regions.

[0011] Optionally, the step of simplifying the initial geometric model using a mesh simplification algorithm to obtain a simplified final triangular face model includes: The Quadric Error Metrics mesh simplification algorithm is used to construct a quadratic error matrix for each triangular facet in the initial triangular facet model. For each vertex of the initial triangular face model, the quadratic error matrix of all the triangular faces associated with the vertex is accumulated to form the error metric of the vertex; Based on the error metric value of the vertex and combined with a preset simplification threshold, the initial geometric model is simplified to obtain the final triangular face model.

[0012] Optionally, the step of simplifying the initial geometric model based on the error metric value of the vertex and a preset simplification threshold to obtain the final triangular face model includes: The error metric value of each vertex is compared with the preset simplification threshold. When the error metric value of the vertex is lower than the preset simplification threshold, the triangular facets associated with the vertex are merged to obtain the final triangular facet model.

[0013] Optionally, generating the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure includes: Map the vertex coordinates and triangle patch connections in the final triangle model to the geometric structure definition area of ​​the data structure; Map the material property data in the geometric property data to the material definition area of ​​the data structure; Based on the final triangular face model, establish a geometric-physical attribute association and map the geometric-physical attribute association to the physical definition region; The data in the material definition area, the geometric structure definition area, and the physical definition area are integrated to generate the GDML structure file corresponding to the STP file.

[0014] In a second aspect, the GDML structure generation system of the present invention includes: The STP file parsing unit is used to obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file. The data structure construction unit is used to construct the data structure of the GDML file according to the structure specification of the GDML file; An initial model generation unit is used to determine the size data of the triangular facets based on the geometric attribute data, and to obtain an initial triangular facet model composed of the triangular facets according to the size data. The model simplification unit is used to simplify the initial geometric model using a mesh simplification algorithm to obtain the simplified final triangular face model; The conversion unit is used to generate the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure.

[0015] Thirdly, the electronic device of the present invention includes: a processor and a memory, the memory being used to store a computer program; When the computer program is loaded by the processor, it causes the processor to execute the GDML structure generation method as described above.

[0016] The GDML structure generation method, system, and electronic device of this invention improve the efficiency of GDML format generation while ensuring geometric accuracy. First, by specifically analyzing the STP file, geometric attribute data is accurately extracted, providing accurate and complete basic data for model construction and avoiding repetitive modeling due to missing or biased data. Second, based on the extracted geometric attribute data, the size data of the triangular facets is determined, ensuring that the initial triangular facet model conforms to the characteristics of the geometry itself, eliminating the need for uniform small-size and small-angle parameters, reducing the number of unnecessary triangular facets, and lowering the complexity of the initial model. Then, a mesh simplification algorithm is used to simplify the initial triangular facet model, further eliminating redundant triangular facets without affecting geometric accuracy, significantly reducing the amount of model data and the computational load of subsequent format conversion. Finally, the target file is generated by combining a pre-constructed data structure conforming to the GDML specification, effectively shortening the generation time of the GDML structure. Simultaneously, through modeling and targeted simplification based on the original geometric attribute data, the geometric accuracy of the final GDML file is ensured to meet the requirements of radiation transmission and intersection calculations, successfully balancing geometric accuracy and generation efficiency. Attached Figure Description

[0017] Figure 1 This is a flowchart illustrating the GDML structure generation method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the geometric model corresponding to the STP file in an embodiment of the present invention; Figure 3 This is a schematic diagram of the final triangular face model according to an embodiment of the present invention; Figure 4 This is a schematic diagram of the GDML structure generation system according to an embodiment of the present invention. Detailed Implementation

[0018] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the accompanying drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.

[0019] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0020] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to"; the term "based on" means "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; and the term "optionally" means "optional embodiments". Definitions of other terms will be given in the following description. It should be noted that the concepts of "first," "second," etc., mentioned in this invention are used only to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0021] It should be noted that the terms "a" and "a plurality of" used in this invention are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0022] Combination Figure 1 As shown, an embodiment of the present invention provides a GDML structure generation method, comprising: Obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file.

[0023] Specifically, STP files, as CAD format files conforming to ISO standards, contain precise geometric information of geometric models such as spacecraft. Through targeted analysis, the core geometric data of the model can be completely extracted, providing reliable data support for subsequent model construction and format conversion. This avoids rework and repeated modeling caused by incomplete or inaccurate data extraction, ensuring the efficient progress of the entire process from the source, and also laying a data foundation for maintaining geometric accuracy.

[0024] Based on the structure specifications of GDML files, construct the data structure of the GDML file.

[0025] Specifically, as a format deeply integrated with the Geant4 radiation simulation software, GDML files have fixed structural specifications and element requirements. Pre-constructing a data structure containing necessary modules such as geometry, materials, and physical properties according to these specifications provides a clear framework for subsequent geometric data filling and format conversion. This pre-construction method avoids confusion and errors caused by unclear structures during the conversion process, ensuring that geometric data can be integrated into the GDML file in an orderly and accurate manner. This guarantees the standardization of the final GDML file and creates conditions for improved generation efficiency.

[0026] Based on the geometric attribute data, the size data of the triangular facets is determined, and an initial triangular facet model composed of the triangular facets is obtained according to the size data.

[0027] Specifically, the initial triangular facet model is a geometric model carrier generated from an STP file and used for subsequent conversion to GDML format. The initial triangular facet model is constructed by determining the size data of the triangular facets based on geometric attribute data, achieving targeted and reasonable model construction. Unlike existing technologies that use fixed small-size, small-angle triangular facet parameters, this step sets the triangular facet sizes based on the geometric attribute data parsed from the STP file, combined with the characteristics of the geometry itself. This ensures that the number of triangular facets in the initial model is adapted to the actual situation of the geometry, avoiding unnecessary facet redundancy. This reduces the complexity of the initial model, lowers the computational burden of subsequent processing, and ensures that the initial model accurately reflects the original geometric structure through facet settings that fit the geometric features.

[0028] The initial geometric model is simplified using a mesh simplification algorithm to obtain the simplified final triangular face model.

[0029] Specifically, a mesh simplification algorithm is used to simplify the initial triangular facet model to obtain the final triangular facet model. Existing technologies either suffer from high computational and storage costs and low generation efficiency due to an excessive number of faces, or reduce accuracy simply by decreasing the number of faces. The mesh simplification algorithm, however, can eliminate redundant triangular faces in the initial model while maintaining the accuracy of the model surface. This significantly reduces the amount of model data, lowers the computational load during subsequent format conversion, and significantly improves the generation efficiency of GDML structures. Simultaneously, the precise simplification ensures that key geometric features of the model are not lost, guaranteeing that the geometric accuracy of the final model meets the requirements for radiative transfer and intersection calculations.

[0030] Based on the final triangular face model and the data structure, the GDML structure file corresponding to the STP file is generated.

[0031] Specifically, a GDML structure file is generated based on the final triangular facet model combined with a pre-built data structure. The pre-built GDML data structure provides a clear path and framework for filling in the geometric data, eliminating the need for structure building during file generation and saving significant time. Furthermore, the simplified final triangular facet model has a significantly reduced data volume, resulting in a substantial reduction in computational load during format conversion when combined with the data structure, effectively shortening file generation time. Simultaneously, because the entire process is based on the accurate geometric data of the original STP file and undergoes targeted model building and precise simplification, the generated GDML structure file can fully retain the key features of the original geometric model, ensuring its geometric accuracy meets the requirements of applications such as radiation simulation, ultimately achieving a balance between geometric accuracy and generation efficiency.

[0032] The GDML structure generation method of this invention improves the efficiency of GDML format generation while ensuring geometric accuracy. First, by specifically analyzing the STP file, geometric attribute data is accurately extracted, providing accurate and complete basic data for model construction and avoiding repetitive modeling due to missing or biased data. Second, based on the extracted geometric attribute data, the size data of the triangular facets is determined, ensuring that the initial triangular facet model conforms to the characteristics of the geometry itself, eliminating the need for uniform small-size and small-angle parameters, reducing the number of unnecessary triangular facets, and lowering the complexity of the initial model. Then, a mesh simplification algorithm is used to simplify the initial triangular facet model, further eliminating redundant triangular facets without affecting geometric accuracy, significantly reducing the amount of model data and the computational load of subsequent format conversion. Finally, the target file is generated by combining a pre-constructed data structure conforming to the GDML specification, effectively shortening the generation time of the GDML structure. Simultaneously, through modeling and targeted simplification based on the original geometric attribute data, the geometric accuracy of the final GDML file is ensured to meet the requirements of radiation transmission and intersection calculations, successfully balancing geometric accuracy and generation efficiency.

[0033] Optionally, parsing the STP file to obtain the geometric attribute data in the STP file includes: The STP file is parsed to obtain the point information, line information, surface information, and volume information of the geometric model in the STP file; Based on the point information, the line information, the surface information, and the volume information, the structural features of the geometric model are obtained; Based on the structural features, determine the vertex position data, patch index information, and material property data of the geometric model; The vertex position data and the patch index information are used as geometric data, and combined with the material property data to form the geometric property data.

[0034] Specifically, by importing a standard-compliant STP file using the OpenCascade geometry processing library, the file is structured and parsed to extract point information (vertex coordinates), line information (curve parameters), surface information (surface topology), and volume information (solid structure boundaries) of the geometric model. Based on the extracted four types of basic information, structural features such as the overall size of the geometry, surface curvature changes, and complex protrusion distribution are obtained through geometric topological relationship analysis. According to the structural features, the core data used to build the GDML model is further selected and determined, including vertex position data (precise coordinate values), patch index information (vertex connection logic), and material property data (density and elemental composition, etc., which can be called through the NIST material database or customized configuration). Finally, the vertex position data and patch index information are classified as geometric data and integrated with the material property data to form complete geometric property data.

[0035] In this embodiment of the invention, the completeness and accuracy of the extraction of four basic types of information—points, lines, surfaces, and volumes—are ensured by parsing the STP file, avoiding missing or biased original data. Structural feature analysis enables precise screening of core data, eliminating redundant information and reducing the computational load of subsequent data processing. The resulting integrated geometric attribute data contains both the geometric topology information required for model construction and material attribute data suitable for radiation simulation. This not only provides a reliable data foundation for subsequent triangular facet size determination and model construction, ensuring geometric accuracy, but also reduces the difficulty of adapting to the GDML data structure through standardized data format, indirectly improving the generation efficiency of the GDML structure. Furthermore, it avoids repeated parsing or modeling due to incomplete data, further saving time and costs.

[0036] Optionally, constructing the data structure of the GDML file according to the structure specification of the GDML file includes: Define material properties, geometric structure, and physical boundary relationships according to the structural specifications of the GDML file; Using an XML parsing library, the material definition area, geometric structure definition area, and physical definition area of ​​the GDML file are determined based on the material properties, the geometric structure, and the physical boundary relationships. The data structure of the GDML file is constructed based on the material definition area, the geometric structure definition area, and the physical definition area.

[0037] Specifically, firstly, based on the official structure specifications of GDML files, the core elements required for radiation simulation are defined, including defining material properties, geometric structures, and physical boundary relationships. Material properties (including key information such as density and elemental composition) are defined using NIST material database calls or custom configurations, and physical boundary relationships are defined in conjunction with the requirements of radiative transfer and intersection calculations. Subsequently, the defined material properties, geometric structures, and physical boundary relationships are mapped to the material definition area, geometric structure definition area, and physical definition area of ​​the GDML file, respectively, through an XML parsing library. Each area corresponds to a specific tag level in the XML file to ensure the orderly storage of data. Finally, the node association function of the XML parsing library is used to integrate the three functional areas according to the topological relationship of the GDML specification, forming a data structure containing complete functional modules and conforming to Geant4 compatibility requirements, providing a standardized framework for subsequent geometric data filling and GDML file generation.

[0038] In a preferred embodiment of the present invention, combined with Figure 2 As shown, for the geometry of the hollow, enclosed aluminum box, based on the GDML structural specification, the material properties of aluminum (density 2.7 g / cm³) were retrieved from the NIST material database. 3 The elements are composed of Al. Based on the vertex coordinates, face indices and other data obtained from the STP file parsing, the geometric structure of the box body (cubic prism structure) and the bolt protrusions (high-precision protrusion structure) is defined. At the same time, the physical boundaries of radiation particle transmission (such as the interaction rules of the inner and outer surfaces of the box) are defined. A GDML file framework is created using an XML parsing library. The material properties of aluminum are stored in the material definition area, the geometric parameters of the cuboid and bolts are stored in the geometric structure definition area, and the physical boundary rules are stored in the physical definition area. The three areas are integrated through XML node association to construct a complete GDML data structure. This structure can accurately accommodate the subsequently optimized triangular face model data.

[0039] In this embodiment of the invention, the core elements are defined by a standardized GDML specification, ensuring the compatibility and rationality of the data structure and avoiding the problem that GDML files cannot be recognized by Geant4 due to non-standard structures. The partitioning and integration of functional areas are achieved with the help of an XML parsing library, making the data storage logic clear, greatly reducing the difficulty of subsequent geometric data filling, and improving the generation efficiency of GDML files. At the same time, the clear division and precise definition of material properties, geometric structures, and physical boundary relationships provide reliable data support for the calculation of material properties and the judgment of geometric intersections in the radiation simulation process, ensuring the accuracy of radiation simulation.

[0040] Optionally, determining the size data of the triangular facet based on the geometric attribute data includes: Based on the structural features in the geometric attribute data, determine the complexity distribution characteristics of the geometric model; Based on the complexity distribution characteristics of the geometric model, the geometric model is divided into multiple regions, and the maximum size parameter and maximum angle parameter of the triangular facet corresponding to each region are set. The maximum length threshold and the maximum angle threshold in the maximum angle parameters of the triangular facet corresponding to the region are used as the size data.

[0041] Specifically, based on the geometric attribute data obtained from parsing the STP file, structural features such as the overall size, surface curvature, and distribution of protrusions of the geometric object are extracted. A geometric topology complexity analysis algorithm is then used to determine the complexity distribution characteristics of the geometric model, such as which regions have regular, simple structures and which have complex, protruding structures. Specifically, first, the geometric attribute data obtained after parsing the STP file is extracted, including the vertex coordinates, face indices, surface curvature, number of edges and their connectivity, and protrusion / protrusion distribution characteristics of the geometric model. The model first identifies the location and dimensions of special structures such as depressions. Then, it calculates the vertex density (number of vertices per unit volume), facet density (number of triangular faces per unit area), rate of curvature change (amplitude of surface curvature fluctuation), and edge turning angle distribution of each local region to quantify the richness of geometric details in each region. Next, it sets complexity thresholds (such as vertex density threshold and rate of curvature change threshold), classifying regions with high vertex density, large rate of curvature change, frequent edge turning, and special structures such as protrusions / depressions as complex regions, and regions with low vertex density, gentle curvature changes, regular edge connections, and no special structures as simple regions. Finally, it integrates the judgment results of each region to form a complexity distribution feature covering the entire geometric model, clearly distinguishing the specific range and distribution of simple and complex regions in the model, providing a basis for subsequent region division and setting of triangular facet size parameters.

[0042] Subsequently, a region segmentation algorithm was used to divide the geometric model into multiple independent regions based on the complexity distribution characteristics, ensuring that the complexity of each region tends to be consistent. For regions with different complexities, combined with the geometric accuracy requirements of radiation simulation, larger maximum size parameters and maximum angle parameters for triangular facets were set for simple regions, while smaller corresponding parameters were set for complex regions, thus balancing accuracy and efficiency. Finally, the maximum length threshold and maximum angle threshold of each region were integrated to form triangular facet size data that fits the entire geometric model, providing accurate parameter constraints for the construction of the initial triangular facet model.

[0043] In this embodiment of the invention, the complexity distribution characteristics of the geometric model are accurately identified by the geometric topology complexity analysis algorithm, and reasonable partitioning is achieved by combining the region segmentation algorithm, which avoids the problem of face redundancy or insufficient accuracy caused by uniform parameters in the prior art; different size parameters are set for regions with different complexity, which not only ensures that the triangular facets in the complex region can accurately capture geometric details and ensure geometric accuracy, but also reduces the number of unnecessary triangular facets in the simple region and reduces the computational load of model construction.

[0044] Optionally, obtaining the initial triangular facet model composed of the triangular facets based on the size data includes: Based on the maximum length threshold and the maximum angle threshold of each region in the size data, the curves and surfaces in the corresponding regions of the geometric model are converted into triangular patch structures; The initial triangular facet model is formed based on the triangular facet structure of all regions.

[0045] Specifically, based on the determined triangular facet size data (maximum length threshold and maximum angle threshold) for each region, the curves and surfaces in each region of the geometric model are meshed using the OpenCascade geometry processing library. During the processing, the size constraints of the corresponding region are followed to ensure that the side length of each generated triangular facet does not exceed the maximum length threshold and the interior angle does not exceed the maximum angle threshold. At the same time, the topology maintenance function of the OpenCascade geometry processing library ensures the consistency of the connection between triangular facets. Specifically, firstly, when triangulating curves and surfaces in various regions of the geometric model, the library automatically associates the topological data such as vertex coordinates and face indexes obtained from parsing the STP file, assigns a unique vertex identifier to each triangular face, and records the association information of shared vertices and edges between faces. Secondly, during the generation of triangular faces, a built-in topological consistency check algorithm checks the vertex connection relationship and edge matching of adjacent faces in real time (such as whether two faces sharing an edge share the same set of vertex coordinates and whether the edge directions are consistent). If problems such as vertex duplication or edge mismatch are found, vertex merging and edge alignment are automatically performed to ensure that adjacent faces can be accurately connected. At the same time, for triangular faces at the splicing points of different regions, a cross-regional topological association mechanism is used to cross-check the vertex and edge information of faces in adjacent regions to avoid splicing gaps or overlaps. Ultimately, all triangular faces of the entire initial triangular face model form a continuous, unbroken, and conflict-free topological network, ensuring the structural integrity and connection consistency of the model. After all the curves and surfaces in all regions have completed the triangular facet structure conversion, the geometric data integration tool is used to splice and merge the triangular facet structures of each region according to the topological relationship of the original geometric model, ensuring that the triangular facets of different regions are seamlessly connected, and finally forming an initial triangular facet model that can completely restore the geometric features of the original STP file.

[0046] In a preferred embodiment of the present invention, taking a hollow, enclosed aluminum box (including bolt protrusions) with dimensions of 1mm in length, width, and height as an example, the dimensions of the main body region of the cuboid are known to be a maximum length threshold of 0.1mm and a maximum angle threshold of 30°, while the dimensions of the bolt protrusion region are a maximum length threshold of 0.02mm and a maximum angle threshold of 15°. Using the surface triangulation function of the OpenCascade geometry processing library, the planar surface of the main body region and the hollow inner wall surface are converted into triangular facet structures with a side length less than or equal to 0.1mm and an interior angle less than or equal to 30°. The irregular surface of the bolt protrusion region is converted into a triangular facet structure with a side length less than or equal to 0.02mm and an interior angle less than or equal to 15°. During the conversion process, the vertex connection relationship of each triangular facet is maintained through library functions. Subsequently, using a geometric data integration tool, the triangular facets of the main body region and the bolt protrusion region are spliced ​​together according to the assembly relationship between the two in the original STP file, ensuring that the triangular facets of the bolt protrusion are precisely connected to the triangular facets of the main body surface, ultimately forming a complete initial triangular facet model.

[0047] In this embodiment of the invention, the complexity of the overall triangulation process is effectively reduced and the model building efficiency is improved by transforming and integrating by region. At the same time, the strict maintenance of topological relationships during the triangulation process ensures that the initial triangular face model can completely restore the shape and connection relationship of the original geometric structure, thus guaranteeing the accuracy and usability of the final GDML structure file.

[0048] Optionally, the step of simplifying the initial geometric model using a mesh simplification algorithm to obtain a simplified final triangular face model includes: The Quadric Error Metrics mesh simplification algorithm is used to construct a quadratic error matrix for each triangular facet in the initial triangular facet model. For each vertex of the initial triangular face model, the quadratic error matrix of all the triangular faces associated with the vertex is accumulated to form the error metric of the vertex; Based on the error metric value of the vertex and combined with a preset simplification threshold, the initial geometric model is simplified to obtain the final triangular face model.

[0049] Specifically, based on the Quadric Error Metrics (QEM) mesh simplification algorithm and combined with the initial triangular facet model data extracted from the OpenCascade geometry processing library, a quadratic error matrix is ​​constructed for each triangular facet based on its vertex 3D coordinates, surface normal vector, and topological connectivity. This matrix is ​​used to quantify the impact of facet deletion on the model surface accuracy. Specifically, the 3D coordinates (x1, y1, z1), (x2, y2, z2), and (x3, y3, z3) of the three vertices of the triangular facet are first extracted using the OpenCascade geometry processing library. The surface normal vector (a, b, c) of the facet is then calculated through the vector cross product. Finally, the plane equation is derived using the point normal equation of the plane containing the facet. ax + by + cz + d = 0; Here, d is solved by substituting the coordinates of any vertex; then, the plane equation is standardized to obtain the coefficients (a', b', c', d') corresponding to the unit normal vector, ensuring the consistency of matrix construction; then, a 4×4 quadratic error matrix is ​​constructed, with matrix elements q ij (i = 1, 2, 3, 4; j = 1, 2, 3, 4) are generated by the standardized combination of plane equation coefficients, specifically: q 11 =a' 2 q 12 =q 21 =a'b'、q 13 =q 31 =a'c'、q 14 =q 41 =a'd'、q 22 =b' 2 q 23 =q 32 =b'c'、q 24 =q 42 =b'd'、q 33 =c' 2 q 34 =q 43 =c'd'、q 44 =d' 2 ; The above elements together form a 4×4 quadratic error matrix, which is used to quantify the impact of deleting the triangular facet on the surface accuracy of the model.

[0050] The quadratic error matrix is: ; Where Q is the quadratic error matrix. The fundamental error matrix of the plane containing a single triangular facet. Let P be the vertex coordinate vector, P be the plane containing a triangle associated with vertex v, and Planes(v) be the set of all planes containing triangles associated with vertex v. Finally, the matrix elements are fine-tuned based on the topological connections between the triangle and its neighboring faces (such as shared vertices and shared edge information) to ensure that the matrix can accurately quantify the impact of deleting the face on the continuity and accuracy of the model surface, providing a reliable basis for the subsequent calculation of vertex error metrics.

[0051] By traversing all vertices of the model, the quadratic error matrices of all triangles associated with each vertex are accumulated to obtain the comprehensive error metric for that vertex. This metric reflects the accuracy loss of the model after deleting the vertex and its associated triangles. Specifically, the vertex-level comprehensive error matrix Q is obtained by accumulating the quadratic error matrices. v Since it is a 4×4 matrix, it cannot be directly compared with a numerical threshold. Therefore, it is necessary to convert the matrix into a single scalar through quadratic error value calculation. The specific steps are as follows: First, define the homogeneous coordinate vector of the vertex v=[x,y,z,1] T (where x, y, z are the three-dimensional coordinates of the vertex, and 1 is a constant term for homogeneous coordinates); then, the quadratic error value Δ(v) = v is calculated through matrix multiplication. T Q v v, this calculation process will transform the 4×4 matrix Q v The algorithm performs calculations with a 4×1 coordinate vector v to obtain a non-negative scalar value (i.e., a comprehensive error metric). Through the algorithm's vertex filtering mechanism, vertices with error metrics greater than a threshold (corresponding to key geometric feature faces of the model) are retained, while vertices with error metrics less than or equal to the threshold and their associated redundant triangular faces are deleted. Simultaneously, the topology maintenance function of the OpenCascade library is used to ensure consistency in face connection during the simplification process, ultimately resulting in a final triangular face model that balances accuracy and efficiency.

[0052] In this embodiment of the invention, a scientific assessment of the impact of vertex deletion is achieved through the construction and accumulation of a quadratic error matrix, avoiding the loss of geometric accuracy caused by blind deletion in traditional simplification methods. Combined with a screening mechanism based on a preset simplification threshold, redundant triangular faces are accurately eliminated, significantly reducing the amount of model data. At the same time, the algorithm's retention of key feature vertices ensures that the final triangular face model can completely restore the core features of the original geometric structure, meeting the accuracy requirements of radiation transmission and intersection calculations, and providing efficient and accurate geometric model support for spacecraft radiation protection design.

[0053] Optionally, the step of simplifying the initial geometric model based on the error metric value of the vertex and a preset simplification threshold to obtain the final triangular face model includes: The error metric value of each vertex is compared with the preset simplification threshold. When the error metric value of the vertex is lower than the preset simplification threshold, the triangular facets associated with the vertex are merged to obtain the final triangular facet model.

[0054] Specifically, based on the error metric of each vertex and a preset simplification threshold (e.g., 0.001), all vertices of the initial triangular face model are traversed, and the error metric of each vertex is compared with the preset simplification threshold one by one. When the error metric of a vertex is lower than the preset simplification threshold, its associated triangular face is determined to be a redundant face. Through a face merging algorithm, the adjacent triangular face associated with the vertex is merged. At the same time, the topological connection relationship between the face is maintained in real time to avoid structural breaks or overlaps, and finally a simplified and accurate final triangular face model is obtained. Specifically, the algorithm locates all adjacent triangular faces associated with the vertex, obtaining key information such as vertex coordinates, edge connectivity, and surface normals for each face. Then, using a face merging algorithm, with the vertex as the core, it calculates the common edges and overlapping areas of adjacent faces. Adjacent faces that meet merging conditions (e.g., the angle between normals is less than a preset threshold, and the overlapping area reaches a set proportion) undergo vertex merging and edge reorganization, deleting redundant vertices and edges to generate new, larger triangular faces. Simultaneously, it ensures that the surface normals of the new face are consistent with the overall normal trend of the original face group. During the merging process, the connectivity consistency between the new face and surrounding unmerged faces is checked in real time, and the edge vertex coordinates of the new face are automatically adjusted to ensure precise connection between the new face and surrounding faces, avoiding gaps, overlaps, or topological breaks. Finally, the merging of redundant faces is completed, reducing the number of faces while maintaining the structural integrity and surface continuity of the geometric model. Merging is not performed if the vertex error metric is greater than or equal to a preset simplification threshold.

[0055] In a preferred embodiment of the present invention, for the aluminum hollow closed box, a preset simplification threshold of 0.001 is used. After traversing all vertices of the model, it is found that the error metric values ​​of most vertices in the main body region of the cuboid are between 0.002 and 0.01 (above the threshold), while the error metric values ​​of most vertices in the bolt protrusion region are between 0.0001 and 0.001 (below or equal to the threshold). Using a face merging algorithm, the vertices in the bolt protrusion region with an error metric value below 0.001 are merged with their associated triangular faces, while retaining the vertices and associated faces in the main body region that are above the threshold. During the merging process, a topology maintenance function ensures the consistency of the connection between the protrusion region and the main body region. The final triangular face model obtained eliminates redundant faces while completely preserving the hollow structure of the box and the bolt protrusion features. Figure 3 As shown.

[0056] In this embodiment of the invention, the precise comparison between the error metric and a preset threshold enables the directional selection of redundant patches, avoiding the loss of geometric accuracy caused by blind simplification and ensuring that the final model error meets the requirements of radiation simulation. This significantly reduces storage overhead and subsequent computational load, improves the efficiency of GDML structure generation, and provides technical support for the efficient advancement of spacecraft radiation protection design.

[0057] Optionally, generating the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure includes: Map the vertex coordinates and triangle patch connections in the final triangle model to the geometric structure definition area of ​​the data structure; Map the material property data in the geometric property data to the material definition area of ​​the data structure; Based on the final triangular face model, establish a geometric-physical attribute association and map the geometric-physical attribute association to the physical definition region; The data in the material definition area, the geometric structure definition area, and the physical definition area are integrated to generate the GDML structure file corresponding to the STP file.

[0058] Specifically, using an XML parsing library, the 3D coordinates of the vertices and the vertex connection logic (facet index information) of the triangular facets in the final triangular facet model are first accurately mapped to the geometric structure definition area of ​​the pre-built GDML data structure, ensuring that the geometric topology is consistent with the final triangular facet model. Then, material property data (such as density and elemental composition) is called from the NIST materials database or configured custom-by-custom, and mapped to the material definition area of ​​the data structure to complete the standardized entry of material information. Subsequently, based on the structural features of the final triangular facet model and the radiation simulation requirements, a geometric-physical property association between the geometry and the physical boundary and radiation interaction rules is established, and this association information is mapped to the physical definition area. Finally, using the file integration function of the XML parsing library, the standardized data of the material definition area, geometric structure definition area, and physical definition area are structurally integrated according to the GDML file specification to generate a GDML structure file that meets the Geant4 compatibility requirements.

[0059] In this embodiment of the invention, the partition mapping method ensures the accurate correspondence and standardized storage of geometric, material, and physical property data in the GDML structure, avoiding file compatibility issues caused by data chaos; the establishment of geometric-physical property association enables the generated GDML file to be directly adapted to the radiation simulation requirements of Geant4 without the need for manual supplementation of physical parameters; the structured integration function of the XML parsing library greatly improves the efficiency of file generation, while ensuring the standardization and integrity of the GDML file.

[0060] In summary, based on the obtained final triangular face model, a 2MeV Gamma ray was used as the test radiation source, located at one corner of the box, with the emission direction of the radiating particles being the isotropic direction. Using the unoptimized GDML geometry as a reference, the optimized geometry had an error of less than 20%.

[0061] Combination Figure 4 As shown, another embodiment of the present invention provides a GDML structure generation system, comprising: The STP file parsing unit is used to obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file. The data structure construction unit is used to construct the data structure of the GDML file according to the structure specification of the GDML file; An initial model generation unit is used to determine the size data of the triangular facets based on the geometric attribute data, and to obtain an initial triangular facet model composed of the triangular facets according to the size data. The model simplification unit is used to simplify the initial geometric model using a mesh simplification algorithm to obtain the simplified final triangular face model; The conversion unit is used to generate the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure.

[0062] The GDML structure generation system of the present invention has the same advantages over the prior art as the GDML structure generation method described above, and will not be repeated here.

[0063] Another embodiment of the present invention provides an electronic device, comprising: a processor and a memory, the memory being used to store a computer program; When the computer program is loaded by the processor, it causes the processor to execute the GDML structure generation method as described above.

[0064] The electronic device of the present invention has the same advantages over the prior art as the aforementioned GDML structure generation method over the prior art, and will not be repeated here.

[0065] While the present invention has been disclosed above, its scope of protection is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and all such changes and modifications will fall within the scope of protection of the present invention.

Claims

1. A method for generating GDML structures, characterized in that, include: Obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file; Construct the data structure of the GDML file according to the structure specification of the GDML file; Based on the geometric attribute data, the size data of the triangular facets is determined, and according to the size data, an initial triangular facet model composed of the triangular facets is obtained; The initial geometric model is simplified using a mesh simplification algorithm to obtain the simplified final triangular face model; Based on the final triangular face model and the data structure, the GDML structure file corresponding to the STP file is generated.

2. The GDML structure generation method according to claim 1, characterized in that, The step of parsing the STP file to obtain the geometric attribute data in the STP file includes: The STP file is parsed to obtain the point information, line information, surface information, and volume information of the geometric model in the STP file; Based on the point information, the line information, the surface information, and the volume information, the structural features of the geometric model are obtained; Based on the structural features, determine the vertex position data, patch index information, and material property data of the geometric model; The vertex position data and the patch index information are used as geometric data, and combined with the material property data to form the geometric property data.

3. The GDML structure generation method according to claim 2, characterized in that, The process of constructing the data structure of the GDML file according to its structural specifications includes: Define material properties, geometric structure, and physical boundary relationships according to the structural specifications of the GDML file; Using an XML parsing library, the material definition area, geometric structure definition area, and physical definition area of ​​the GDML file are determined based on the material properties, the geometric structure, and the physical boundary relationships. The data structure of the GDML file is constructed based on the material definition area, the geometric structure definition area, and the physical definition area.

4. The GDML structure generation method according to claim 2, characterized in that, Determining the size data of the triangular facet based on the geometric attribute data includes: Based on the structural features in the geometric attribute data, determine the complexity distribution characteristics of the geometric model; Based on the complexity distribution characteristics of the geometric model, the geometric model is divided into multiple regions, and the maximum size parameter and maximum angle parameter of the triangular facet corresponding to each region are set. The maximum length threshold and the maximum angle threshold in the maximum angle parameters of the triangular facet corresponding to the region are used as the size data.

5. The GDML structure generation method according to claim 4, characterized in that, The step of obtaining the initial triangular facet model composed of the triangular facets based on the size data includes: Based on the maximum length threshold and the maximum angle threshold of each region in the size data, the curves and surfaces in the corresponding regions of the geometric model are converted into triangular patch structures; The initial triangular facet model is formed based on the triangular facet structure of all regions.

6. The GDML structure generation method according to claim 1, characterized in that, The process of simplifying the initial geometric model using a mesh simplification algorithm to obtain the simplified final triangular face model includes: The Quadric Error Metrics mesh simplification algorithm is used to construct a quadratic error matrix for each triangular facet in the initial triangular facet model. For each vertex of the initial triangular face model, the quadratic error matrix of all the triangular faces associated with the vertex is accumulated to form the error metric of the vertex; Based on the error metric value of the vertex and combined with a preset simplification threshold, the initial geometric model is simplified to obtain the final triangular face model.

7. The GDML structure generation method according to claim 6, characterized in that, The step of simplifying the initial geometric model based on the error metric value of the vertex and a preset simplification threshold to obtain the final triangular face model includes: The error metric value of each vertex is compared with the preset simplification threshold. When the error metric value of the vertex is lower than the preset simplification threshold, the triangular facets associated with the vertex are merged to obtain the final triangular facet model.

8. The GDML structure generation method according to claim 3, characterized in that, The step of generating the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure includes: Map the vertex coordinates and triangle patch connections in the final triangle model to the geometric structure definition area of ​​the data structure; Map the material property data in the geometric property data to the material definition area of ​​the data structure; Based on the final triangular face model, establish a geometric-physical attribute association and map the geometric-physical attribute association to the physical definition region; The data in the material definition area, the geometric structure definition area, and the physical definition area are integrated to generate the GDML structure file corresponding to the STP file.

9. A GDML structure generation system, characterized in that, include: The STP file parsing unit is used to obtain the STP file to be converted and parse the STP file to obtain the geometric attribute data in the STP file. The data structure construction unit is used to construct the data structure of the GDML file according to the structure specification of the GDML file; An initial model generation unit is used to determine the size data of the triangular facets based on the geometric attribute data, and to obtain an initial triangular facet model composed of the triangular facets according to the size data. The model simplification unit is used to simplify the initial geometric model using a mesh simplification algorithm to obtain the simplified final triangular face model; The conversion unit is used to generate the GDML structure file corresponding to the STP file based on the final triangular face model and the data structure.

10. An electronic device, characterized in that, include: Processor and memory, the memory being used to store computer programs; When the computer program is loaded by the processor, it causes the processor to execute the GDML structure generation method as described in any one of claims 1-8.