Three-dimensional model format conversion lightweight method, device and equipment

By extracting and binding the parameterized information and engineering metadata of CAD three-dimensional model, grid conversion and simplifying are solved, and problems such as low efficiency and data loss of three-dimensional model format conversion and lightweight processing in the existing technology are achieved, efficient and secure three-dimensional model format conversion and lightweight processing are achieved, and cross-platform query and reverse traceability are supported.

CN120257400AActive Publication Date: 2025-07-04RIAMB (BEIJING) TECH DEV CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202510732685.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-07-04
Estimated Expiration
2045-06-04

AI Technical Summary

Technical Problem

In the prior art, the three-dimensional model format conversion and lightweight processing have problems such as inefficiency, data loss, engineering semantic information loss, difficult to guarantee the consistency of modeling process, strong tool dependence, insufficient functional limitations and compatibility, insufficient data fidelity, high risk of performance and stability, limited customization and control rights, and hidden dangers of safety and compliance.

Method used

By obtaining CAD three-dimensional model files, parametric geometric information, assembly relationships and engineering metadata are extracted, grid transformation and simplification are performed, geometric features and animation parameters are bound, assembly relationships and engineering metadata are embedded, and hierarchical processing and automation toolchain are adopted to ensure the accuracy and consistency of the model.

Benefits of technology

It realizes efficient and automated three-dimensional model format conversion, maintains the accuracy and feature consistency of the model, ensures the security of sensitive data, supports cross-platform query and reverse traceability, is free from cloud dependence, and complies with information security standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120257400A_ABST
    Figure CN120257400A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of digital twinning, in particular to a three-dimensional model format conversion lightweight method, device and equipment, which can obtain a CAD three-dimensional model file and extract parameterized geometric information, an assembly relationship and engineering metadata; and according to the parameterized geometric information, carrying out grid conversion on a CAD three-dimensional model to generate a grid model, and carrying out grid simplification on the grid model to ensure the accuracy of the simplified model. And the geometric features and the engineering parameters are bound with animation parameters, and then the animation parameters are bound with the gridding model, so that parameterized animation driving is realized. And the assembly relationship and the engineering metadata are embedded into the grid model, so that a user can perform interactive query at the digital twin terminal. According to the technical scheme, the process is automatic, efficiency is high, and feature consistency can be kept. The sensitive engineering data is locally encrypted in the whole process, and the information security standard is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of digital twins, and particularly to a method, device, and equipment for three-dimensional model format conversion and lightweighting. Background Art

[0002] At present, when the digital twin technology is booming, realizing the real-time synchronization of physical entities and virtual entities has become a key link, which highly depends on the efficient integration of cross-domain data. In the field of engineering manufacturing, CAD models are widely used, and the STEP format is relatively common, which generally adopts parametric modeling. This modeling method uses mathematical equations (such as NURBS surfaces) to accurately describe geometric shapes to support the parametric features of the model, such as holes, chamfers, and threads. However, there is a significant formatting barrier between parametric CAD models and lightweight mesh models (such as FBX, glTF) required in the digital twin field. In order to accurately map the manufacturing attributes of physical entities, the digital twin model needs to perform format conversion and lightweighting on the CAD model.

[0003] Currently, the three-dimensional model format conversion and lightweighting for digital twin technology are mainly achieved through two methods: manual processing by modeling engineers or with the help of plugins.

[0004] The method of manual processing by modeling engineers means that the modeling engineer converts the parametric CAD three-dimensional model into a lightweight meshed three-dimensional model by himself / herself. The modeling engineer exports the three-dimensional model in a neutral format (such as STEP, STL) through CAD software (such as Solidworks), and then imports the three-dimensional model in the neutral format into modeling software such as 3ds max or Blender. The modeling engineer manually remakes the three-dimensional model using these modeling software and then exports it as a three-dimensional model in FBX or glTF format.

[0005] The disadvantages of this method are low efficiency, time-consuming and laborious, data loss and quality degradation, loss of engineering semantic information, difficulty in achieving consistency and standardization of the modeling process, and strong dependence on skills and tools.

[0006] The method of processing with the help of plugins is, for example: the user batch-converts the three-dimensional entity model file in stp format through CATIA software, and then uses the model lightweighting plugin 3DVIA Sync in 3DVIA Composer to perform batch format conversion and lightweighting on the obtained stp format model to obtain a three-dimensional model in 3ds format. Then, the model format is converted to FBX through the software 3ds max, and the final model is imported into the development platform Unity.

[0007] The disadvantages of this method are functional limitations, insufficient compatibility, insufficient data fidelity, high performance and stability risks, limited customization and control rights, and potential security and compliance issues.

[0008] Therefore, both of the current two methods have significant defects. Summary of the Invention

[0009] In view of this, the purpose of the present invention is to provide a lightweight method, device, and equipment for 3D model format conversion, so as to solve the above problems in the prior art to a certain extent.

[0010] According to the first aspect of the embodiments of the present invention, a lightweight method for 3D model format conversion is provided, including: Obtain a CAD 3D model file, and extract parametric geometric information, assembly relationships, and engineering metadata from the CAD 3D model file; Perform mesh conversion on the CAD 3D model according to the parametric geometric information to generate a meshed model, and simplify the meshed model; Bind the geometric features in the parametric geometric information to animation parameters, bind the engineering parameters in the engineering metadata to animation parameters, and bind the animation parameters to the meshed model; Embed the assembly relationship and the engineering metadata into the meshed model.

[0011] Preferably, extracting parametric geometric information and assembly relationships from the CAD 3D model file includes: Parse the B-Rep model of the CAD 3D model file, traverse each entity in the B-Rep model, and generate a parsing result; According to the parsing result, identify the geometric features of each entity, and mark semantic tags for the entity according to the geometric features; generate a B-Rep model with semantic tags to represent parametric geometric information; Generate an assembly tree according to the parsing result to represent the assembly relationship.

[0012] Preferably, extracting engineering metadata from the CAD 3D model file includes: Extract CAD model attributes from the CAD 3D model file; If there are non-standard CAD model attributes, then according to a pre-stored user-defined mapping table, associate the attribute name with a semantic identifier; Generate engineering metadata according to the CAD model attributes.

[0013] Preferably, simplifying the meshed model includes: Select feature edges from all the edges of the meshed model; Add folding constraint factors to all feature edges; Calculate the folding cost of each grid edge, sort all grid edges in ascending order according to the folding cost, and generate a queue; According to the current sorting, take out the grid edge with the smallest folding cost from the queue. If the grid edge is a non-feature edge, fold it, update the folding cost of the affected edges, re-sort all edges in ascending order, and repeat this step until the number of faces of the meshed model is equal to the target number of faces.

[0014] Preferably, select feature edges from all edges of the meshed model, including: Map all semantic labels to the corresponding grid edges in the meshed model, and regard all mapped grid edges as feature edges.

[0015] Preferably, before adding folding constraint factors to all feature edges, it further includes: Calculate the curvature of each vertex of the meshed model; For each edge, take the average or maximum value of the curvatures of the two end vertices as the edge curvature; If the edge curvature is greater than the dynamic threshold, regard the edge as a feature edge.

[0016] Preferably, after mesh simplification of the meshed model, it further includes: Perform geometric repair on the feature edges of the meshed model, including: locally subdivide the faces on both sides of the feature edges, and perform Laplacian smoothing on the feature edges only along the edge direction.

[0017] Preferably, the method further includes: Before folding an edge, group the faces of the meshed model by UV island; when folding an edge, perform it within the same UV island; When folding an edge causes vertex merging, calculate the UV coordinates of the new vertex according to the UV coordinates of the vertices participating in the merging and the weights of the merged vertices; After the meshed model is simplified, use the minimum distortion algorithm to generate new UVs.

[0018] According to the second aspect of the embodiments of the present invention, there is provided a three-dimensional model format conversion and lightweight device, including: A data extraction module for obtaining a CAD three-dimensional model file and extracting parametric geometric information, assembly relationships, and engineering metadata from the CAD three-dimensional model file; A model conversion module for performing mesh conversion on the CAD three-dimensional model according to the parametric geometric information to generate a meshed model, and performing mesh simplification on the meshed model; An animation binding module, configured to bind geometric features in parametric geometric information to animation parameters, bind engineering parameters in engineering metadata to animation parameters, and bind animation parameters to the meshed model; A data embedding module, configured to embed the assembly relationship and the engineering metadata into the meshed model.

[0019] According to a third aspect of an embodiment of the present invention, there is provided a 3D model format conversion and lightweight device, including: A main controller, and a memory connected to the main controller; The memory stores program instructions therein; The main controller is configured to execute the program instructions stored in the memory to execute the method described in any one of the above.

[0020] The technical solution provided by the embodiment of the present invention may include the following beneficial effects: It can be understood that the technical solution shown in the present invention can obtain a CAD 3D model file, extract parametric geometric information, assembly relationship and engineering metadata; perform mesh conversion on the CAD 3D model according to the parametric geometric information to generate a meshed model, and perform mesh simplification on the meshed model to ensure the accuracy of the simplified model. Bind geometric features and engineering parameters to animation parameters, and then bind the animation parameters to the meshed model to achieve parametric animation drive. Embed the assembly relationship and engineering metadata into the meshed model, so that users can perform interactive queries on the digital twin terminal. The technical solution shown in the present invention has automated processes, high efficiency, and can maintain feature consistency. It does not rely on the cloud, and sensitive engineering data is encrypted locally throughout the process, meeting information security standards.

[0021] It should be understood that the above general description and subsequent detailed description are only exemplary and explanatory, and cannot limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention.

[0023] Figure 1 is a schematic diagram of steps of a 3D model format conversion and lightweight method shown according to an exemplary embodiment; Figure 2 is a schematic diagram of a data hierarchy structure shown according to an exemplary embodiment; Figure 3 is a schematic diagram of a tool chain process shown according to an exemplary embodiment; Figure 4 is a schematic diagram of parametric mesh conversion shown according to an exemplary embodiment; Figure 5 is a flowchart showing the implementation process of mesh simplification and repair according to an exemplary embodiment; Figure 6 is a flowchart showing the geometric analysis method according to an exemplary embodiment. Detailed implementation manners

[0024] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0025] The existing method of converting a parametric CAD 3D model into a lightweight meshed 3D model by modeling engineers themselves has the following main defects: Low efficiency and time-consuming: Modeling engineers need to repeatedly import and export models in different software, and each step requires manual processing of model parameters. Moreover, when modeling engineers face a large number of models, each model needs to be processed one by one, and the time consumption increases exponentially.

[0026] Data loss and quality degradation: Manually converting the model format easily ignores feature protection (such as holes, chamfers, etc.), resulting in jagged edges or loss of details in the simplified model.

[0027] Loss of engineering semantic information: The manufacturing attributes (tolerance, material specifications) in the CAD 3D model file cannot be directly mapped to meshed model files such as FBX and glTF. Modeling engineers need to manually annotate, which is very easy to miss key information.

[0028] Problems with the consistency and standardization of the modeling process: In large-scale digital twin scenarios, multiple modelers need to work together, and differences in the operating habits of different modeling engineers may lead to inconsistent model conversion results (such as the decimation rate and UV unfolding strategy of the model). In addition, multiple manual format conversions may generate multiple file versions, making it difficult to track the latest version.

[0029] High dependence on skills and tools: Modeling engineers need to master CAD software (such as Solidworks) and 3D editors (such as 3ds max, Blender) at the same time. At the same time, modeling engineers also need to solve the problem that the model cannot be opened normally due to software version differences during the process of manually converting the model format.

[0030] However, the existing method of performing format conversion and lightweight processing on the model through plugins has the following defects: Functional limitations and compatibility issues: Most plugins support mainstream 3D model formats (such as FBX, OBJ), but have insufficient support for CAD 3D model formats (such as STEP, IGES). For example, when converting a CAD 3D model to FBX or glTF, the plugin cannot parse the assembly hierarchy in the CAD model, resulting in the loss of the parent-child relationship of the model. In addition, the plugin may only be adapted to a fixed version of the modeling software, severely limiting the user's choices.

[0031] Insufficient data fidelity: The automatic simplification algorithm of the plugin may misjudge or ignore key geometric features (such as fine textures, thin-walled structures), leading to model distortion. At the same time, the plugin usually does not process engineering attributes (such as tolerances, materials), resulting in the lack of manufacturing-related information in the digital twin model.

[0032] Performance and stability risks: Faced with high-polygon models, the plugin may crash due to insufficient memory or unoptimized algorithms. Complex conversion tasks (such as parallel decimation while preserving features) may cause CPU / GPU overload, affecting other processes.

[0033] Limited customizability and control: The preset parameters of the plugin (such as decimation rate, UV unwrapping strategy) may not meet specific requirements, and there are limited advanced adjustment options. For example, a certain plugin only provides three levels of decimation: "high / medium / low", and cannot set different simplification intensities by region. In addition, users cannot intervene in the internal algorithm (such as the priority of edge collapse), which may lead to unexpected simplification in key areas.

[0034] Security and compliance risks: Some cloud plugins need to upload models to external servers, posing a risk of leakage of sensitive engineering data. Engineers using unauthorized plugins to convert commercial models may also lead to legal disputes.

[0035] Generally speaking, it is inefficient for modeling engineers to manually convert formats and lightweight models, and it requires a high level of professional skills from the modelers. This method also requires a high level of collaboration efficiency within the team. Although using plugins improves the efficiency of model processing, the general-purpose design and black-box operation of plugins inherently involve compromises in model accuracy, controllability, and security. In a high-demand scenario like digital twins, a combination of manual review and customized toolchains is needed to achieve a perfect balance between efficiency and quality.

[0036] To solve the above technical problems in the prior art, the present application proposes the following embodiments.

[0037] In one embodiment, Figure 1 is a schematic diagram of the steps of a method for converting and lightweighting a 3D model format shown according to an exemplary embodiment.

[0038] The core architecture of this embodiment is to perform hierarchical processing on the 3D model data of digital twins, which is divided into an engineering layer, a visual layer, and a metadata layer. See Figure 2 . Among them, the engineering layer is the parametric data of the CAD 3D model, the visual layer is the mesh and animation data of the fbx or glTF 3D model, and the metadata layer is the standardized attributes of the CAD 3D model. After performing hierarchical processing on the 3D model file, this embodiment adopts a tool chain for performing model parsing, mesh optimization, animation binding, and metadata injection on the CAD 3D model file. The tool chain is as shown in Figure 3 .

[0039] For the specific implementation steps, see Figure 1 , and a lightweight method for 3D model format conversion is provided, including: Step S11: Obtain a CAD 3D model file, and extract parametric geometric information, assembly relationships, and engineering metadata from the CAD 3D model file.

[0040] For example, the input CAD 3D model file can be a production line equipment in step format, including models such as robotic arms and chain conveyors with up to 1 million faces.

[0041] It should be noted that extracting parametric geometric information and assembly relationships from the CAD 3D model file includes: Step S111: Parse the B-Rep model of the CAD 3D model file, traverse each entity in the B-Rep model, and generate a parsing result.

[0042] The tool that can be used is PythonOCC, which is an open-source development framework based on the Python language and is widely used in 3D CAD applications, supporting the reading, writing, and operation of STEP, IGES, and STL files.

[0043] The B-Rep model is a commonly used method for representing 3D entities in the CAD field. It defines an entity by describing the boundary information of the entity, mainly composed of geometric elements such as faces, edges, and vertices and their topological relationships, and can be used for modeling, analysis, and rendering of complex geometric bodies.

[0044] Parsing the B-Rep model of the CAD 3D model file is to extract the geometric features and topological relationship information contained in the B-Rep model from the CAD file.

[0045] In the B-Rep model, an entity refers to a complete 3D object. A CAD model may contain multiple entities. For example, a mechanical assembly model may be composed of multiple part entities.

[0046] Step S112: According to the parsing result, identify the geometric features of each entity, and based on the geometric features, label semantic tags for the entity; generate a B-Rep model with semantic tags to represent parametric geometric information.

[0047] Geometric features are the basic shape units that make up a 3D model, such as holes, chamfers, threads, etc.

[0048] Semantic tags are tags with clear meanings used to describe geometric features. Labeling the identified geometric features with semantic tags can endow these features with richer semantic information, facilitating subsequent processing. For example, labeling a hole with a diameter of 10mm with the tag "Hole-φ10mm", this tag not only indicates that the feature is a hole but also contains key dimension information. These semantic tags play an important role in subsequent model processing. For example, in the mesh optimization stage, the mesh around the hole can be encrypted according to the tag; in the animation binding process, specific animation logic can be determined according to the tag.

[0049] After generating all the semantic tags, a B-Rep model with semantic tags can be generated to represent parametric geometric information.

[0050] Step S113: Generate an assembly tree according to the parsing result to represent the assembly relationship.

[0051] To avoid the loss of the model assembly relationship, the assembly tree here uses a JSON hierarchical structure to record the parent-child part relationship. JSON (JavaScript Object Notation) is a lightweight data interchange format, commonly used for data transfer between different programming languages, easy to read and write by humans, and also easy to parse and generate by machines.

[0052] The code example is as follows: from OCC.Core.STEPControl import STEPControl_Reader from OCC.Core.TopoDS import TopoDS_Shape # Load the STEP file reader = STEPControl_Reader() reader.ReadFile("input.step") reader.TransferRoots() shapes = reader.Shape() # Traverse the entities and identify the features explorer = TopExp_Explorer(shapes, TopAbs_FACE) while explorer.More(): face = explorer.Current() if _is_hole(face):# Custom hole recognition algorithm add_semantic_tag(face, "Hole-Ø10mm") explorer.Next() Code example for outputting a B-Rep model and an assembly tree with semantic tags is as follows: { "name": "Assembly1", "children": {"name": "PartA", "type": "B-Rep", "tags": ["Hole-Ø10mm"]}, {"name": "PartB", "type": "CSG", "transform": "Translation(0, 50,0)"} } It should be noted that extracting engineering metadata from the CAD 3D model file includes: extracting CAD model attributes from the CAD 3D model file; if there are non-standard CAD model attributes, then according to the pre-stored user-defined mapping table, associating the attribute name with the semantic identifier; generating engineering metadata according to the CAD model attributes.

[0053] CAD model attributes include standard CAD model attributes such as material attributes and tolerances, as well as non-standard CAD model attributes defined by the enterprise. For standard CAD model attributes, they can be directly extracted and annotated. For non-standard CAD model attributes, this embodiment provides a user-defined mapping table, and the user can enter the user-defined mapping table in advance to help the user manually associate the attribute name and the semantic identifier. For example, the enterprise defines an attribute name "ProdLineID", which actually represents "production line number", and the user can manually associate "ProdLineID" with the semantic identifier "production line number" in the mapping table.

[0054] Code example for extracting material attributes: for product in STEP_entities:​ if product.Type() == "PRODUCT_DEFINITION": material = product.GetAttribute("material") metadata_store(product.Name(), "material", material) Code example for custom attribute mapping: custom_mapping = { "COMPANY_MATERIAL": "material", "USER_TOLERANCE": "tolerance" } Step S12: According to the parametric geometric information, perform mesh conversion on the CAD three-dimensional model to generate a meshed model, and perform mesh simplification on the meshed model.

[0055] In this step, the CAD three-dimensional model can be converted into an fbx or glTF three-dimensional model. Both FBX and glTF are file formats widely used in the fields of 3D graphics and animation.

[0056] The tool Gmsh can be used for parametric mesh conversion. This is a powerful 3D mesh generator with a built-in CAD engine. Users can generate high-quality meshes according to their needs, including triangular meshes, quadrilateral meshes, etc.

[0057] Preferably, when performing mesh conversion, the local mesh density can be set according to the semantic tags of the features. For example, the mesh around the hole needs to be encrypted. During actual execution, each semantic tag will be traversed in a loop. If the semantic tag of the hole is detected, the mesh size of the entity corresponding to the area around the hole will be set to 0.1, with the aim of generating a finer mesh to more accurately describe the geometry of the hole. For other areas, the mesh size of the entities corresponding to these areas will be set to 1.0 to generate a relatively coarser mesh.

[0058] After that, the triangular mesh of the CAD three-dimensional model can be converted into a quadrilateral mesh that retains the features. See Figure 4 .

[0059] The code example is as follows: import gmsh gmsh.initialize() gmsh.model.add("CAD Model") gmsh.merge("input.brep") # Import the B-Rep model # Set the mesh size according to semantic tags for tag in semantic_tags: if tag.startswith("Hole"): gmsh.model.mesh.setSize(tag.get_entities(), 0.1) # Fine mesh around the hole else: gmsh.model.mesh.setSize(tag.get_entities(), 1.0) # Coarse mesh in other areas gmsh.model.mesh.generate(3) # Generate 3D mesh gmsh.write("output.msh") After that, import the processed CAD 3D model into Blender to perform mesh simplification.

[0060] Blender is a powerful 3D creation tool that supports customizing functions through Python scripts and has the advantages of being open-source, free, and cross-platform compatible.

[0061] Through the Blender Python API, users can modify and delete objects in the scene, and achieve automated and batch operations through Python scripts. The implementation process is as Figure 5 shown.

[0062] It should be noted that mesh simplification of the meshed model includes: Select feature edges from all the edges of the meshed model; add a folding limit factor to all the feature edges; calculate the folding cost of each mesh edge, sort all the mesh edges from smallest to largest according to the folding cost to generate a queue; according to the current sorting, take out the mesh edge with the smallest folding cost from the queue. If the mesh edge is a non-feature edge, fold it, update the folding cost of the affected edges, re-sort all the edges from smallest to largest, and repeat this step until the number of faces of the meshed model is equal to the target number of faces.

[0063] The mesh simplification method shown in this embodiment is based on the face reduction algorithm Quadric Edge Collapse Decimation that preserves feature edges, retains key geometric feature edges, and avoids the loss of key details of the engineering model due to excessive face reduction. Based on this face reduction algorithm, this embodiment realizes feature retention of the model through semantic tag-driven and edge collapse optimization methods.

[0064] See Figure 5 , first, the discrimination of feature edges is performed, aiming to determine the set of edges that need to be protected.

[0065] In the preferred embodiment, the semantic tagging method and geometric analysis method are used together to determine feature edges.

[0066] Semantic tagging method (preferred for use): Map all semantic tags to the corresponding mesh edges in the meshed model, and regard all the mapped mesh edges as feature edges.

[0067] The code example is as follows: for edge in mesh.edges: if edge.semantic_tag in ["Hole", "SharpEdge"]: edge.is_feature = True Geometric analysis method (can handle edges without semantic tags): Calculate the curvature of each vertex in the meshed model; for each edge, take the average or maximum value of the curvatures of the two end vertices as the edge curvature; if the edge curvature is greater than the dynamic threshold, then regard this edge as a feature edge.

[0068] Determine the feature edges of the model according to the curvature detection of the geometric analysis method. Curvature is used to describe the degree of bending of a surface at a certain point. The core principle of this method is to calculate the curvature values of the mesh vertices or edge neighborhoods, judge the degree of local geometric mutation, and thus mark the feature edges. See the flowchart in Figure 6 .

[0069] First, traverse all vertices and calculate the curvature of each vertex, which is the Gaussian curvature or mean curvature.

[0070] Gaussian curvature (discretized formula):

[0071] where is the angle of the triangle around vertex v, and A is the area of the vertex neighborhood.

[0072] Mean curvature (discretized formula):

[0073] where , is the edge Adjacent angles.

[0074] After that, the curvature is propagated to the edges, and the curvature of an edge can be defined as the average or maximum value of the curvatures of the two end vertices. For example: Edge curvature: .

[0075] Set a dynamic threshold according to the overall curvature distribution of the model . Since setting the threshold for determining the feature edges will affect the calibration of the feature edges, a dynamic threshold is adopted in this embodiment, and the user can adaptively adjust it according to the overall curvature distribution of the model (such as taking the top 5% of the curvatures as the threshold).

[0076] After setting the dynamic threshold, the feature edges can be discriminated: If the edge curvature , then mark the edge as a feature edge.

[0077] The related concepts of the geometric analysis method are as follows: Principal curvature: The maximum and minimum degrees of bending at a point on the surface.

[0078] Gaussian curvature: The product of the principal curvatures ( ), which reflects whether the local area is saddle-shaped (negative value), cylindrical / plane (zero), or spherical (positive value).

[0079] Mean curvature: The average value of the principal curvatures ( ), which reflects the local bending direction.

[0080] Curvature characteristics of feature edges: Feature edges are usually located in the regions of curvature mutation (such as the junction of two planes), and are characterized by discontinuous Gaussian curvature or significant change in mean curvature.

[0081] After selecting the feature edges, a folding limit factor needs to be added to all the feature edges, aiming to increase the protection of the feature edges in the edge folding algorithm.

[0082] The traditional edge folding algorithm selects the edge with the smallest error to fold first by calculating the error of each edge. This method may fold the feature edges, resulting in loss of details. In this preferred embodiment, two folding limit factors, namely, feature edge weight penalty and edge folding constraint, are introduced to improve the traditional edge folding algorithm.

[0083] They are respectively: feature edge weight penalty and edge folding constraint.

[0084] The feature edge weight penalty adds a penalty term (such as multiplying by a very large coefficient) to the folding error of the feature edge, making it difficult to be selected.

[0085] The code example is as follows: def compute_edge_cost(edge): if edge.is_feature: return standard_quadric_error(edge) * 1e6# Penalize feature edges else: return standard_quadric_error(edge) Edge collapse constraints directly prohibit feature edges from participating in collapse and lock the feature edges.

[0086] The code example is as follows: def collapse_edge(edge): if edge.is_feature: return# Skip feature edges else: perform_collapse(edge) After adding a collapse limit factor to all feature edges, perform edge collapse iterative optimization.

[0087] Calculate the collapse cost of each mesh edge (including feature edge penalty), sort all mesh edges from smallest to largest according to the collapse cost, and generate a queue.

[0088] The code example is as follows: import heapq heap = [] for edge in mesh.edges: cost = compute_edge_cost(edge) heapq.heappush(heap, (cost, edge)) According to the current sorting, take out the mesh edge with the smallest collapse cost from the queue. If the mesh edge is not a feature edge, collapse it, update the collapse costs of the affected edges (usually adjacent edges), re-sort all edges from smallest to largest, and repeat this step until the number of faces of the meshed model is equal to the target number of faces.

[0089] The code example is as follows: while len(heap)>0 and face_count>target_faces: cost, edge = heapq.heappop(heap) if edge.is_feature: continue# Skip feature edges if edge.is_valid(): collapse_edge(edge) update_adjacent_edges(edge, heap) # Update the costs of adjacent edges In a preferred embodiment, after mesh simplification of the meshed model, it further includes: Performing geometric repair on the feature edges of the meshed model, including: locally subdividing the faces on both sides of the feature edges and performing Laplacian smoothing on the feature edges only along the edge direction.

[0090] It can be understood that even if folding is prohibited, adjacent face simplification may cause distortion of feature edges (such as jagged edges). In this preferred embodiment, two factors of local subdivision and edge straightening optimization are introduced for post-processing of the model.

[0091] Local subdivision: Locally subdivide the faces on both sides of the feature edges to improve geometric smoothness.

[0092] The code example is as follows: for edge in mesh.feature_edges: if edge.is_distorted(): subdivide_adjacent_faces(edge, level=1) Edge straightening optimization: Perform Laplacian smoothing (only along the edge direction) on the feature edges to maintain linearity.

[0093] The code example is as follows: for vertex in feature_edge.vertices: if vertex.on_feature_edge: new_pos = 0.5 * (vertex.prev.pos + vertex.next.pos) vertex.pos = new_pos Model simplification (such as edge collapse, vertex merging) may destroy the original UV coordinates, resulting in texture stretching, misalignment, or discontinuity of texture mapping. To ensure visual consistency and accuracy of the simplified or repaired model during texture mapping, in a preferred embodiment, the UV coordinates are recalculated after model simplification to ensure that the texture mapping of each patch is aligned with the simplified geometric structure, as follows: UV partition reservation: Before folding the opposite sides, group the faces of the meshed model by UV islands; when folding the opposite sides, perform the operation within the same UV island to reduce cross-island merging.

[0094] A UV island refers to a region where the surface of a 3D model is unfolded onto a 2D plane in the UV editing of Blender.

[0095] Automatic UV transfer: When vertex merging is caused by folding the opposite sides, calculate the UV coordinates of the new vertex based on the UV coordinates of the vertices participating in the merging and the weights of the merged vertices (such as area, side length).

[0096] The code example is as follows: uv_new = (uv1 * weight1 + uv2 * weight2) / (weight1 + weight2) Parametric mapping: After simplifying the meshed model, generate new UVs using the minimum distortion algorithm. The least squares conformal parametric mapping algorithm is used to achieve the UV parametric mapping of the model.

[0097] The principle is to define a minimum energy function, such that during the process of minimizing this function, the conditions of conformal mapping are satisfied as much as possible, that is, the small angles on the surface of the three-dimensional model remain as unchanged as possible after being mapped to the two-dimensional plane.

[0098] Minimum energy function:

[0099] is the two-dimensional coordinate gradient; is the best transformation matrix from three dimensions to two dimensions.

[0100] Preferably, it further includes: Seam repositioning: Insert new seams at the repair boundaries to ensure texture continuity. Checkerboard test: Apply a checkerboard texture to check for UV distortion, investigate the unfolding parameters until the squares are uniform, and arrange the UV islands closely to reduce texture space waste.

[0101] Step S13: Bind the geometric features in the parametric geometric information to the animation parameters, bind the engineering parameters in the engineering metadata to the animation parameters, and bind the animation parameters to the meshed model.

[0102] In specific practice, a bone matching rule engine can be formulated to use rules to bind geometric features to animation parameters. For an example, see Table 1: Table 1 Rule library table

[0103] The code example is as follows: def auto_rigging(obj): for feature in obj.semantic_tags: if feature.type == "Cylinder": bone = create_rotation_joint(feature.axis) set_rotation_limits(bone, 0, 360) elif feature.type == "Slider": bone = create_translation_joint(feature.direction) set_translation_limits(bone, 0, 100) By traversing the semantic tags of the model, corresponding bones (rotation joints or translation joints) are automatically created according to different feature types (cylinders or sliders), and appropriate motion limits are set for these bones, thus realizing the function of automatic bone rigging.

[0104] The binding of engineering parameters and animation parameters is as follows in the example code: # Example: Engineering parameter drives animation parameter # Bind the "max_rpm" attribute in STEP to the bone rotation speed max_rpm = obj.metadata.get("max_rpm", 1000) driver = bone.driver_add("rotation_euler", 0).driver driver.expression = f"frame * {max_rpm / 60}" # RPM converted to degrees per second Step S14: Embed the assembly relationship and the engineering metadata into the meshed model, so that the meshed model supports cross-platform query and reverse traceability.

[0105] The specific implementation steps are as follows: First, Schema design: Using JSON (JavaScript Object Notation) as the basic framework, through Schema design, ensure that the engineering attributes (tolerances, materials, assembly relationships, etc.) of the CAD model can be accurately transmitted, parsed, and reused.

[0106] Design Goals of Schema: Cross - platform Compatibility: Support software parsing related to digital twin development on the Web side (Three.js) and the PC side (Unity). Semantic Extensibility: Allow dynamic addition of new fields (such as thermodynamic parameters, manufacturer information). Lightweight and Efficient Query: Avoid redundant data and support fast retrieval of key attributes.

[0107] Schema Framework Selection: Adopt JSON - LD (JSON for Linked Data) as the basic framework. Reasons are: Semantic Relevance: Define the vocabulary through the @context field to ensure consistent understanding of the same term by different systems. Compatibility with Existing Standards: Can embed glTF extras fields or FBX custom attributes without modifying the file format specification.

[0108] Data Validation and Security: Define strict JSON Schema rules to ensure that the input data meets the format requirements. Data Encryption: Sensitive information (such as supplier ID) can be encrypted with a JWT token and embedded in the extras field.

[0109] The code example is as follows: # Example: Schema Design { "@context": "https: / / schema.org / ", "@type": "EngineeringObject", "name": "Bearing - 001", "material": "Steel - 45#", "tolerance": "±0.01mm", "sourceStep": "original.step" } Taking the glTF format as an example, the code example for glTF metadata injection is as follows: # Example: glTF Metadata Injection import pygltflib gltf = pygltflib.GLTF2().load("input.gltf") node = gltf.nodes[0] node.extras = { "engineeringData": { "material": "Steel - 45#", "tolerance": "±0.01mm" } } gltf.save("output.gltf") For FBX data injection: Due to cross - tool compatibility issues, Unity cannot read FBX custom properties. In this embodiment, Unity's TextAsset class is used to load these files, and corresponding libraries (such as JsonUtility) are used for parsing.

[0110] It can be understood that the technical solution shown in the present invention has the following advantages: High - fidelity data conversion: Through a local encryption algorithm based on semantic tags (such as a 5 - fold increase in the subdivision density of hole edges), it is ensured that the geometric error between the simplified mesh model and the original CAD model is less than 0.1mm. At the same time, by embedding the engineering properties (such as tolerance, material) of the CAD model into the extras field of glTF or the custom properties of FBX, users can interactively query them on the digital twin terminal.

[0111] Efficiency improvement and process automation: It realizes the processing of a single model from hours to minutes, can process thousands of component assemblies simultaneously, generates multi - resolution LOD models and maintains feature consistency.

[0112] Enhanced dynamic interaction and collaboration: According to the engineering parameters of the CAD three - dimensional model (such as "maximum rotational speed 3000rpm"), the motion logic of the virtual model is controlled in real - time to achieve parametric animation drive. And the models output by this proposal are compatible with Unity and Three.js, supporting digital twin development on the PC side and the Web side.

[0113] Controllability and security: When performing mesh simplification of the three - dimensional model, users can customize protection rules to avoid the risk of black - box operations. In addition, this proposal is independent of cloud dependence, and sensitive engineering data is encrypted locally throughout the process, meeting information security standards.

[0114] In another embodiment, a three - dimensional model format conversion and lightweight device is provided, including: A data extraction module for obtaining a CAD three - dimensional model file and extracting parametric geometric information, assembly relationships, and engineering metadata from the CAD three - dimensional model file; A model conversion module for performing mesh conversion on the CAD three - dimensional model according to the parametric geometric information to generate a meshed model and performing mesh simplification on the meshed model; An animation binding module, configured to bind geometric features in parametric geometric information to animation parameters, bind engineering parameters in engineering metadata to animation parameters, and bind the animation parameters to the meshed model; A data embedding module, configured to embed the assembly relationship and the engineering metadata into the meshed model.

[0115] In another embodiment, there is provided a 3D model format conversion and lightweight device, including: A main controller, and a memory connected to the main controller; The memory, in which program instructions are stored; The main controller is configured to execute the program instructions stored in the memory to execute the method described in any one of the above.

[0116] It can be understood that the same or similar parts in the above embodiments can be referred to each other, and the content not detailed in some embodiments can be seen in the same or similar content of other embodiments.

[0117] It should be noted that in the description of the present invention, terms such as "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "a plurality of" means at least two.

[0118] Any process or method description shown in the flowchart or described in other ways herein can be understood as representing a module, segment, or part of code including one or more executable instructions for implementing a specific logical function or process, and the scope of the preferred embodiments of the present invention includes additional implementations, where the functions can be executed in a substantially simultaneous manner or in a reverse order according to the functions involved, rather than in the order shown or discussed, which should be understood by those skilled in the technical field to which the embodiments of the present invention belong.

[0119] It should be understood that each part of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in the memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one of the following well-known technologies in the art or a combination of them can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0120] Those of ordinary skill in the art can understand that all or part of the steps carried out in implementing the above-described embodiment methods can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0121] In addition, in each of the embodiments of the present invention, the functional units can be integrated into a processing module, or each unit can exist physically alone, or two or more units can be integrated into one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0122] The above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disc, or the like.

[0123] In the description of this specification, the description with reference to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0124] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A lightweight method for 3D model format conversion, characterized in that, Including: Obtain a CAD 3D model file, and extract parametric geometric information, assembly relationships, and engineering metadata from the CAD 3D model file; Perform mesh conversion on the CAD 3D model according to the parametric geometric information to generate a meshed model, and simplify the meshed model; Bind the geometric features in the parametric geometric information to animation parameters, bind the engineering parameters in the engineering metadata to animation parameters, and bind the animation parameters to the meshed model; Embed the assembly relationship and the engineering metadata into the meshed model.

2. The method according to claim 1, characterized in that Extracting parametric geometric information and assembly relationships from the CAD 3D model file includes: Parse the B-Rep model of the CAD 3D model file, traverse each entity in the B-Rep model, and generate a parsing result; According to the parsing result, identify the geometric features of each entity, and mark semantic tags for the entity according to the geometric features; generate a B-Rep model with semantic tags to represent parametric geometric information; Generate an assembly tree according to the parsing result to represent the assembly relationship.

3. The method according to claim 1, characterized in that Extracting engineering metadata from the CAD 3D model file includes: Extract CAD model attributes from the CAD 3D model file; If there are non-standard CAD model attributes, then according to a pre-stored user-defined mapping table, associate the attribute name with a semantic identifier; Generate engineering metadata according to the CAD model attributes.

4. The method according to claim 2, wherein Simplifying the meshed model includes: Select feature edges among all the edges of the meshed model; Add a folding limit factor to all the feature edges; Calculate the folding cost of each mesh edge, sort all the mesh edges from smallest to largest according to the folding cost to generate a queue; According to the current sorting, take out the mesh edge with the smallest folding cost from the queue. If the mesh edge is a non-feature edge, then fold it, update the folding cost of the affected edges, and re-sort all the edges from smallest to largest. Repeat this step until the number of faces of the meshed model is equal to the target number of faces.

5. The method according to claim 4, characterized in that Selecting feature edges among all the edges of the meshed model includes: Map all the semantic tags to the corresponding mesh edges in the meshed model, and regard all the mapped mesh edges as feature edges.

6. The method according to claim 4, characterized in that, Before adding a folding limit factor to all the feature edges, it also includes: Calculate the curvature of each vertex of the meshed model; For each edge, take the average or maximum value of the curvatures of the two end vertices as the edge curvature; If the edge curvature is greater than the dynamic threshold, then regard the edge as a feature edge.

7. The method according to claim 4, characterized in that After simplifying the meshed model, it also includes: Perform geometric repair on the feature edges of the meshed model, including: locally subdivide the faces on both sides of the feature edge, and perform Laplacian smoothing on the feature edge only along the edge direction.

8. The method according to claim 7, wherein It also includes: Before folding an edge, group the faces of the meshed model by UV island; When folding an edge, perform it within the same UV island; When folding an edge causes vertex merging, calculate the UV coordinates of the new vertex according to the UV coordinates of the vertices participating in the merging and the weights of the merged vertices; After the meshed model is simplified, a new UV is generated using the minimum distortion algorithm.

9. A lightweight device for 3D model format conversion, characterized in that, It includes: A data extraction module, configured to obtain a CAD three-dimensional model file, and extract parametric geometric information, assembly relationships, and engineering metadata from the CAD three-dimensional model file; A model conversion module, configured to perform mesh conversion on the CAD three-dimensional model according to the parametric geometric information, generate a meshed model, and simplify the meshed model; An animation binding module, configured to bind geometric features in the parametric geometric information to animation parameters, bind engineering parameters in the engineering metadata to animation parameters, and bind the animation parameters to the meshed model; A data embedding module, configured to embed the assembly relationships and the engineering metadata into the meshed model.

10. A lightweight device for 3D model format conversion, characterized in that, It includes: A main controller, and a memory connected to the main controller; The memory stores program instructions; The main controller is configured to execute the program instructions stored in the memory and execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Three-dimensional model batch format conversion and weight reduction method

    CN105005642A

  • General CAD model result lightweight visual viewing method

    CN111783186A

  • Digital twin BIM model conversion and lightweight method and device

    CN113870437A

  • Building information model lightweight processing method, system and equipment and storage medium

    CN115601523A

  • BIM data lightweight method and system

    CN116756796A