A lightweight method, device and equipment for converting three-dimensional model formats
By extracting and binding the parametric information and engineering metadata of the CAD three-dimensional model, mesh conversion and simplification are performed, which solves the problems of low efficiency and data loss in the three-dimensional model format conversion and lightweighting in the existing technology, and realizes efficient and automated three-dimensional model format conversion and lightweighting, which is suitable for the field of digital twin technology.
Patent Information
- Application Number
- CN202510732685.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-04
AI Technical Summary
Existing technologies have problems in the process of 3D model format conversion and lightweighting, such as low efficiency, data loss, loss of engineering semantic information, difficulty in ensuring modeling process consistency, strong tool dependence, functional limitations and insufficient compatibility, insufficient data fidelity, high performance and stability risks, limited customizability and control, and security and compliance risks.
By acquiring CAD 3D model files, extracting parametric geometry information, assembly relationships, and engineering metadata, performing mesh conversion and simplification, binding geometric features and animation parameters, embedding assembly relationships and engineering metadata, and using hierarchical processing and tool chains to achieve automated conversion, we ensure the accuracy and consistency of the model.
It achieves efficient and automated 3D model format conversion, maintains model accuracy and consistency, ensures the integrity of engineering semantic information, improves conversion efficiency, reduces data loss, enhances security and controllability, and is suitable for the field of digital twin technology.
Smart Images

Figure CN120257400B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of digital twin technology, and in particular to a lightweight method, device and equipment for converting three-dimensional model formats. Background Art
[0002] With the booming development of digital twin technology, achieving real-time synchronization between physical and virtual entities has become a key link, which is highly dependent on the efficient integration of cross-domain data. In the field of engineering and manufacturing, CAD models are widely used, among which the STEP format is more common, which generally adopts parametric modeling. This modeling method uses mathematical equations (such as NURBS surfaces) to accurately describe geometric shapes, thereby supporting parametric features of the model, such as holes, chamfers, and threads. However, there is a significant formatting barrier between parametric CAD models and the lightweight mesh models (such as FBX and glTF) required in the field of digital twins. In order to accurately map the manufacturing properties of physical entities, digital twin models need to convert the format of CAD models and lightweight processing.
[0003] At present, the format conversion and lightweighting of three-dimensional models for digital twin technology are mainly achieved through manual processing by modeling engineers or with the help of plug-ins.
[0004] Manual processing by modelers involves converting parametric CAD 3D models into lightweight meshed 3D models. Modelers use CAD software (such as SolidWorks) to export the 3D model to a neutral format (such as STEP or STL). These neutral formats are then imported into modeling software such as 3ds Max or Blender. Modelers then manually recreate the 3D model using these software and export it to FBX or glTF formats.
[0005] The disadvantages of this method are low efficiency, time-consuming and labor-intensive, 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] For example, using plug-in processing: a user can batch convert 3D solid model files to STP format using CATIA software. Then, using the 3DVIA Sync plug-in for 3DVIA Composer, they can batch convert and lightweight the resulting STP models to 3DS format. The resulting 3D models can then be converted to FBX using 3ds Max, and imported into the Unity development platform.
[0007] The disadvantages of this approach are functional limitations and lack of compatibility, insufficient data fidelity, high performance and stability risks, limited customizability and control, and security and compliance risks.
[0008] Therefore, both of the current methods have major defects. Summary of the Invention
[0009] In view of this, the object of the present invention is to provide a lightweight method, device and equipment for converting three-dimensional model formats, so as to solve the above-mentioned problems in the prior art to a certain extent.
[0010] According to a first aspect of an embodiment of the present invention, a lightweight method for converting a 3D model format is provided, comprising:
[0011] Obtaining a CAD three-dimensional model file, and extracting parametric geometric information, assembly relationships, and engineering metadata from the CAD three-dimensional model file;
[0012] Performing mesh conversion on the CAD three-dimensional model according to the parameterized geometric information to generate a meshed model, and performing mesh simplification on the meshed model;
[0013] Binding geometric features in the parameterized geometric information to animation parameters, binding engineering parameters in the engineering metadata to animation parameters, and binding the animation parameters to the meshed model;
[0014] The assembly relationships and the engineering metadata are embedded in the meshed model.
[0015] Preferably, extracting the parametric geometric information and assembly relationship from the CAD three-dimensional model file includes:
[0016] Parse the B-Rep model of the CAD 3D model file, traverse each entity in the B-Rep model, and generate parsing results;
[0017] According to the parsing results, the geometric features of each entity are identified, and a semantic label is marked on the entity according to the geometric features; a B-Rep model with the semantic label is generated to represent the parameterized geometric information;
[0018] An assembly tree is generated according to the parsing result to represent the assembly relationship.
[0019] Preferably, extracting engineering metadata from the CAD three-dimensional model file includes:
[0020] Extracting CAD model attributes from the CAD three-dimensional model file;
[0021] If there are non-standard CAD model attributes, the attribute names are associated with semantic identifiers according to a pre-stored user-defined mapping table;
[0022] Engineering metadata is generated based on the CAD model attributes.
[0023] Preferably, mesh simplification is performed on the meshed model, comprising:
[0024] Selecting characteristic edges from all edges of the meshed model;
[0025] Add folding limit factors to all feature edges;
[0026] Calculate the folding cost of each mesh edge, sort all mesh edges from small to large according to the folding cost, and generate a queue;
[0027] According to the current sorting, the mesh edge with the smallest folding cost is taken from the queue. If the mesh edge is a non-feature edge, it is folded, the folding cost of the affected edge is updated, and all edges are re-sorted from small to large. This step is repeated until the number of faces of the meshed model is equal to the target number of faces.
[0028] Preferably, selecting characteristic edges from all edges of the meshed model includes:
[0029] All semantic labels are mapped to the corresponding mesh edges in the meshed model, and all mapped mesh edges are regarded as feature edges.
[0030] Preferably, before adding the folding limiting factors to all feature edges, the method further includes:
[0031] Calculate the curvature of each vertex of the meshed model;
[0032] For each edge, the average or maximum curvature of the two vertices is taken as the edge curvature;
[0033] If the edge curvature is greater than the dynamic threshold, the edge is considered as a feature edge.
[0034] Preferably, after the mesh model is mesh-simplified, the method further comprises:
[0035] Performing geometric repair on the feature edge of the meshed model includes: locally subdividing the faces on both sides of the feature edge, and performing Plasma smoothing on the feature edge only along the edge direction.
[0036] Preferably, the method further comprises:
[0037] Before folding the edges, the faces of the meshed model are grouped according to UV islands; when folding the edges, the folding is performed on the same UV island;
[0038] When collapsing edges and merging vertices, the UV coordinates of the new vertex are calculated based on the UV coordinates of the vertices involved in the merger and the weights of the merged vertices.
[0039] After the meshed model is simplified, new UVs are generated using a distortion minimization algorithm.
[0040] According to a second aspect of an embodiment of the present invention, a lightweight device for converting a 3D model format is provided, comprising:
[0041] A data extraction module is used 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;
[0042] A model conversion module is used to perform mesh conversion on the CAD three-dimensional model according to the parameterized geometric information, generate a meshed model, and perform mesh simplification on the meshed model;
[0043] An animation binding module, used to bind geometric features in the parameterized geometric information with animation parameters, bind engineering parameters in engineering metadata with animation parameters, and bind animation parameters with the meshed model;
[0044] A data embedding module is used to embed the assembly relationship and the engineering metadata into the gridded model.
[0045] According to a third aspect of an embodiment of the present invention, there is provided a lightweight device for converting a 3D model format, comprising:
[0046] A main controller, and a memory connected to the main controller;
[0047] The memory stores program instructions;
[0048] The main controller is used to execute program instructions stored in the memory and perform any of the above methods.
[0049] The technical solutions provided by the embodiments of the present invention may have the following beneficial effects:
[0050] It can be understood that the technical solution shown in the present invention can obtain CAD three-dimensional model files, extract parametric geometric information, assembly relationships and engineering metadata; mesh the CAD three-dimensional model according to the parametric geometric information to generate a mesh model, and mesh simplify the mesh model to ensure the accuracy of the simplified model. Bind the geometric features and engineering parameters to the animation parameters, and then bind the animation parameters to the mesh model to achieve parametric animation drive. Embed the assembly relationship and engineering metadata into the mesh model so that the user 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 locally encrypted throughout the process, meeting information security standards.
[0051] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0053] Figure 1 1 is a schematic diagram showing the steps of a lightweight method for converting a three-dimensional model format according to an exemplary embodiment;
[0054] Figure 2 is a schematic diagram of a data hierarchical structure according to an exemplary embodiment;
[0055] Figure 3 is a schematic diagram of a tool chain process according to an exemplary embodiment;
[0056] Figure 4 is a schematic diagram of parameterized grid conversion according to an exemplary embodiment;
[0057] Figure 5 is a flowchart illustrating a mesh simplification and repair implementation according to an exemplary embodiment;
[0058] Figure 6 is a flow chart of a geometric analysis method according to an exemplary embodiment. DETAILED DESCRIPTION
[0059] Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, like numbers in different figures represent like or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present invention, as detailed in the appended claims.
[0060] The existing method where modeling engineers convert parametric CAD 3D models into lightweight meshed 3D models has the following main drawbacks:
[0061] Inefficiency and time-consuming: Modeling engineers must repeatedly import and export models between different software programs, manually processing model parameters at each step. Furthermore, when faced with a large number of models, each one must be processed individually, increasing the time consumption exponentially.
[0062] Data loss and quality degradation: Manually converting model formats can easily overlook feature protection (such as holes, chamfers, etc.), resulting in jagged edges or loss of details in the simplified model.
[0063] Loss of engineering semantic information: Manufacturing properties (tolerances, material specifications) in CAD 3D model files cannot be directly mapped to mesh model files such as FBX and glTF. Modeling engineers need to manually annotate them, which can easily lead to missing key information.
[0064] Modeling process consistency and standardization challenges: Large-scale digital twin scenarios require the collaborative work of multiple modelers. Differences in operational habits among modelers can lead to inconsistent model conversion results (e.g., model face reduction and UV unwrapping strategies). Furthermore, multiple manual format conversions can generate multiple file versions, making it difficult to track the latest version.
[0065] Strong reliance on skills and tools: Modeling engineers must master both CAD software (such as SolidWorks) and 3D editors (such as 3ds Max and Blender). Furthermore, when manually converting model formats, they must also address issues such as model opening issues caused by software version differences.
[0066] However, existing plug-ins for model format conversion and lightweight processing have the following drawbacks:
[0067] Functional limitations and compatibility issues: Most plug-ins support mainstream 3D model formats (such as FBX and OBJ), but lack support for CAD 3D model formats (such as STEP and IGES). For example, when converting CAD 3D models to FBX or glTF, the plug-in cannot interpret the assembly hierarchy within the CAD model, resulting in the loss of parent-child relationships. Furthermore, plug-ins may only be compatible with specific modeling software versions, significantly limiting user options.
[0068] Insufficient data fidelity: Plug-ins’ automatic simplification algorithms may misjudge or ignore key geometric features (such as fine textures and thin-walled structures), resulting in model distortion. Furthermore, plug-ins often do not address engineering properties (such as tolerances and materials), resulting in a lack of manufacturing-related information in the digital twin model.
[0069] Performance and stability risks: When working with high-polygon models, the plugin may crash due to insufficient memory or suboptimal algorithms. Complex conversion tasks (such as parallel feature-preserving polygon reduction) may overload the CPU / GPU, impacting other processes.
[0070] Limited Customizability and Control: Plugins' preset parameters (such as face reduction rate and UV unwrapping strategy) may not meet specific needs, and advanced adjustment options are limited. For example, one plugin only offers three levels of face reduction: high, medium, and low, with no way to set different simplification levels per region. Furthermore, users cannot manipulate internal algorithms (such as edge collapse priority), which can lead to unintended simplification in critical areas.
[0071] Security and compliance risks: Some cloud-based plug-ins require uploading models to external servers, potentially exposing sensitive engineering data. Engineers using unauthorized plug-ins to convert business models could also lead to legal disputes.
[0072] In general, manual format conversion and lightweight modeling by modeling engineers is inefficient and requires high-level modeling expertise. Such methods also require highly collaborative teams. While plug-ins improve model processing efficiency, their generalized design and black-box operation inherently compromise model accuracy, controllability, and security. In demanding scenarios like digital twins, a combination of manual review and customized toolchains is necessary to achieve a perfect balance between efficiency and quality.
[0073] In order to solve the above technical problems in the prior art, the present application proposes the following embodiments.
[0074] In one embodiment, Figure 1 The figure is a schematic diagram showing the steps of a lightweight method for converting a three-dimensional model format according to an exemplary embodiment.
[0075] The core architecture of this embodiment is to process the 3D model data of the digital twin in layers, which are divided into engineering layer, visual layer and metadata layer. Figure 2 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 the 3D model file is layered, this embodiment uses a tool chain for model parsing, mesh optimization, animation binding and metadata injection for the CAD 3D model file. The tool chain is as follows: Figure 3 shown.
[0076] For specific implementation steps, see Figure 1 , provides a lightweight method for 3D model format conversion, including:
[0077] Step S11: Acquire a CAD three-dimensional model file, and extract parametric geometric information, assembly relationships, and engineering metadata from the CAD three-dimensional model file.
[0078] For example, the input CAD 3D model file can be a production line equipment in step format, including models of robotic arms, chain conveyors, etc. with up to 1 million faces.
[0079] It should be noted that extracting parametric geometric information and assembly relationships from the CAD three-dimensional model file includes:
[0080] Step S111: Parse the B-Rep model of the CAD three-dimensional model file, traverse each entity in the B-Rep model, and generate a parsing result.
[0081] The tool that can be used is PythonOCC, an open source development framework based on the Python language, which is widely used in 3D CAD applications and supports reading, writing and operating STEP, IGES, and STL files.
[0082] The B-Rep model is a commonly used method for representing 3D entities in the CAD field. It defines entities by describing their boundary information. It is primarily composed of geometric elements such as faces, edges, and vertices, as well as the topological relationships between them. It can be used to model, analyze, and render complex geometries.
[0083] Parsing the B-Rep model of a CAD three-dimensional model file is to extract the geometric features and topological relationship information contained in the B-Rep model from the CAD file.
[0084] In a B-Rep model, a solid refers to a complete three-dimensional object. A CAD model may contain multiple solids, for example, a mechanical assembly model may consist of multiple part solids.
[0085] Step S112: Identify the geometric features of each entity based on the parsing results, and label the entity with a semantic label based on the geometric features; generate a B-Rep model with the semantic label to represent the parameterized geometric information.
[0086] Geometric features are the basic shape units that make up a 3D model, such as holes, chamfers, threads, etc.
[0087] Semantic tags are labels with clear meanings used to describe geometric features. Labeling identified geometric features with semantic tags imbues them with richer semantic information, facilitating subsequent processing. For example, labeling a hole with a diameter of 10 mm with the label "Hole-φ10mm" not only indicates that the feature is a hole but also includes key dimensional information. These semantic tags play a significant role in subsequent model processing. For example, during mesh optimization, the mesh around the hole can be encrypted based on the tags; during animation binding, specific animation logic can be determined based on the tags.
[0088] After all semantic labels are generated, a B-Rep model with semantic labels can be generated to represent parameterized geometric information.
[0089] Step S113: generating an assembly tree according to the parsing result to represent the assembly relationship.
[0090] To avoid loss of model assembly relationships, the assembly tree uses a JSON hierarchical structure to record parent-child component relationships. JSON (JavaScript Object Notation) is a lightweight data exchange format commonly used for point data transfer between different programming languages. It is easy for humans to read and write, and also easy for machines to parse and generate.
[0091] The code example is as follows:
[0092] from OCC.Core.STEPControl import STEPControl_Reader
[0093] from OCC.Core.TopoDS import TopoDS_Shape
[0094] # Load STEP file
[0095] reader = STEPControl_Reader()
[0096] reader.ReadFile("input.step")
[0097] reader.TransferRoots()
[0098] shapes = reader.Shape()
[0099] # Traverse the entities and identify features
[0100] explorer = TopExp_Explorer(shapes, TopAbs_FACE)
[0101] while explorer.More():
[0102] face = explorer.Current()
[0103] if _is_hole(face):# Custom hole recognition algorithm
[0104] add_semantic_tag(face, "Hole-Ø10mm")
[0105] explorer.Next()
[0106] The following code example outputs a B-Rep model and assembly tree with semantic labels:
[0107] {
[0108] "name": "Assembly1",
[0109] "children": [
[0110] {"name": "PartA", "type": "B-Rep", "tags": ["Hole-Ø10mm"]},
[0111] {"name": "PartB", "type": "CSG", "transform": "Translation(0, 50,0)"} ]
[0113] }
[0114] It should be noted that extracting engineering metadata from the CAD three-dimensional model file includes: extracting CAD model attributes from the CAD three-dimensional model file; if there are non-standard CAD model attributes, associating the attribute name with the semantic identifier according to a pre-stored user-defined mapping table; and generating engineering metadata based on the CAD model attributes.
[0115] CAD model attributes include standard CAD model attributes such as material attributes and tolerances, as well as non-standard CAD model attributes customized by the enterprise. For standard CAD model attributes, they can be directly extracted and annotations can be made. For non-standard CAD model attributes, this embodiment will provide a user-defined mapping table. The user can enter the user-defined mapping table in advance to help the user manually associate attribute names and semantic identifiers. For example, the enterprise customized an attribute name "ProdLineID", which actually represents "production line number". The user can manually associate "ProdLineID" with the semantic identifier "production line number" in the mapping table.
[0116] Code example for extracting material properties:
[0117] for product in STEP_entities:
[0118] if product.Type() == "PRODUCT_DEFINITION":
[0119] material = product.GetAttribute("material")
[0120] metadata_store(product.Name(), "material", material)
[0121] Code example of custom attribute mapping:
[0122] custom_mapping = {
[0123] "COMPANY_MATERIAL": "material",
[0124] "USER_TOLERANCE": "tolerance"
[0125] }
[0126] Step S12: mesh the CAD three-dimensional model according to the parameterized geometric information to generate a meshed model, and mesh simplify the meshed model.
[0127] This step can convert the CAD 3D model into an FBX or GLTF 3D model. Both FBX and GLTF are file formats widely used in the fields of 3D graphics and animation.
[0128] Parametric mesh conversion can be performed using the tool Gmsh, which 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.
[0129] Preferably, during mesh conversion, the local mesh density can be set based on the semantic label of the feature. For example, the mesh around a hole may need to be denser. In actual execution, each semantic label is looped through. If a hole semantic label is detected, the mesh size of the entity corresponding to the area around the hole is set to 0.1, aiming to generate a finer mesh to more accurately describe the hole's geometry. For other areas, the mesh size of the entities corresponding to these areas is set to 1.0, generating a relatively coarse mesh.
[0130] After that, the triangular mesh of the CAD 3D model can be converted into a quadrilateral mesh that retains the features, see Figure 4 .
[0131] The code example is as follows:
[0132] import gmsh
[0133] gmsh.initialize()
[0134] gmsh.model.add("CAD Model")
[0135] gmsh.merge("input.brep") #Import B-Rep model
[0136] # Set grid size based on semantic tags
[0137] for tag in semantic_tags:
[0138] if tag.startswith("Hole"):
[0139] gmsh.model.mesh.setSize(tag.get_entities(), 0.1) #fine mesh around the hole
[0140] else:
[0141] gmsh.model.mesh.setSize(tag.get_entities(), 1.0) #Coarse mesh in other areas
[0142] gmsh.model.mesh.generate(3) #Generate 3D mesh
[0143] gmsh.write("output.msh")
[0144] Afterwards, the processed CAD 3D model was imported into Blender to perform mesh simplification.
[0145] Blender is a powerful 3D creation tool that supports custom functions through Python scripts and has the advantages of open source, free and cross-platform compatibility.
[0146] Through the Blender Python API, users can modify and delete objects in the scene, and use Python scripts to automate and batch operations. Figure 5 shown.
[0147] It should be noted that the mesh simplification of the mesh model includes:
[0148] Select characteristic edges from all edges of the meshed model; add folding limiting factors to all characteristic edges; calculate the folding cost of each mesh edge, sort all mesh edges in ascending order according to the folding cost, and 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-characteristic edge, fold it, update the folding cost of the affected edge, 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.
[0149] The mesh simplification method demonstrated in this embodiment uses the Quadric Edge Collapse Decimation algorithm, a feature-preserving surface reduction algorithm, to preserve key geometric edges and avoid the loss of critical details in engineering models due to excessive surface reduction. Based on this surface reduction algorithm, this embodiment achieves feature preservation in the model through semantic label-driven and edge collapse optimization.
[0150] See also Figure 5 ,First, the feature edges are identified in order to determine the set of edges that need to be protected.
[0151] In a preferred embodiment, a semantic labeling method and a geometric analysis method are used to jointly determine characteristic edges.
[0152] Semantic labeling method (preferred): Map all semantic labels to the corresponding mesh edges in the meshed model, and regard all mapped mesh edges as feature edges.
[0153] The code example is as follows:
[0154] for edge in mesh.edges:
[0155] if edge.semantic_tag in ["Hole", "SharpEdge"]:
[0156] edge.is_feature = True
[0157] Geometric analysis method (can handle edges without semantic labels): 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 vertices at both ends as the edge curvature; if the edge curvature is greater than a dynamic threshold, the edge is regarded as a feature edge.
[0158] The characteristic edges of the model are determined by the curvature detection of the geometric analysis method. Curvature is used to describe the degree of curvature of the surface at a certain point. The core principle of this method is to determine the degree of local geometric mutation by calculating the curvature value of the mesh vertex or edge area, and thus mark the characteristic edges. See the flowchart for details. Figure 6 .
[0159] First, traverse all vertices and calculate the curvature of each vertex, which is Gaussian curvature or mean curvature.
[0160] Gaussian curvature (discretization formula):
[0161] in is the angle of the triangle around vertex v, and A is the area of the vertex.
[0162] Mean curvature (discretization formula):
[0163] in 、 For the edge adjacent corner.
[0164] The curvature is then propagated to the edge, where the curvature of the edge can be defined as the average or maximum of the curvatures of the two vertices. For example: edge curvature: .
[0165] Set dynamic threshold according to the overall curvature distribution of the model Since the threshold setting for determining feature edges will affect the feature edge calibration, this embodiment adopts a dynamic threshold, and the user can adaptively adjust it according to the overall curvature distribution of the model (such as taking the top 5% of the curvature as the threshold).
[0166] After setting the dynamic threshold, the feature edges can be identified:
[0167] If the edge curvature , then the marked edge is a feature edge.
[0168] The relevant concepts of geometric analysis are as follows:
[0169] Principal curvatures: The maximum and minimum curvatures at a point on a surface.
[0170] Gaussian curvature: the product of the principal curvatures ( ), reflecting whether the local surface is saddle-shaped (negative values), cylindrical / planar (zero), or spherical (positive values).
[0171] Mean curvature: the average of the principal curvatures ( ), reflecting the local bending direction.
[0172] Curvature characteristics of characteristic edges: Characteristic edges are usually located in areas with sudden changes in curvature (such as the junction of two planes), which manifest as discontinuity of Gaussian curvature or significant change in mean curvature.
[0173] After selecting the characteristic edges, it is necessary to add a folding limit factor to all the characteristic edges in order to increase the protection of the characteristic edges in the edge folding algorithm.
[0174] Traditional edge collapsing algorithms calculate the error of each edge and prioritize edges with the smallest error. This approach can collapse feature edges, resulting in loss of detail. In this preferred embodiment, two collapsing constraints—a feature edge weight penalty and an edge collapsing constraint—are introduced to improve this traditional edge collapsing algorithm.
[0175] They are: feature edge weight penalty and edge collapse constraint.
[0176] The feature edge weight penalty adds a penalty term to the folding error of the feature edge (such as multiplying it by a very large coefficient), making it difficult to be selected.
[0177] The code example is as follows:
[0178] def compute_edge_cost(edge):
[0179] if edge.is_feature:
[0180] return standard_quadric_error(edge) * 1e6#penalty feature edge
[0181] else:
[0182] return standard_quadric_error(edge)
[0183] The edge folding constraint directly prohibits the feature edge from participating in folding and locks the feature edge.
[0184] The code example is as follows:
[0185] def collapse_edge(edge):
[0186] if edge.is_feature:
[0187] return# Skip feature edge
[0188] else:
[0189] perform_collapse(edge)
[0190] After adding folding limit factors to all feature edges, perform edge folding iterative optimization.
[0191] Calculate the folding cost of each mesh edge (including the characteristic edge penalty), sort all mesh edges from small to large according to the folding cost, and generate a queue.
[0192] The code example is as follows:
[0193] import heapq
[0194] heap = []
[0195] for edge in mesh.edges:
[0196] cost = compute_edge_cost(edge)
[0197] heapq.heappush(heap, (cost, edge))
[0198] According to the current sorting, the mesh edge with the smallest folding cost is taken from the queue. If the mesh edge is a non-feature edge, it is folded, the folding cost of the affected edge (usually the adjacent edge) is updated, and all edges are re-sorted from small to large. This step is repeated until the number of faces of the meshed model is equal to the target number of faces.
[0199] The code example is as follows:
[0200] while len(heap)>0 and face_count>target_faces:
[0201] cost, edge = heapq.heappop(heap)
[0202] if edge.is_feature:
[0203] continue# Skip feature edges
[0204] if edge.is_valid():
[0205] collapse_edge(edge)
[0206] update_adjacent_edges(edge, heap) #Update the cost of adjacent edges
[0207] In a preferred embodiment, after mesh simplification is performed on the meshed model, the method further comprises:
[0208] Performing geometric repair on the feature edge of the meshed model includes: locally subdividing the faces on both sides of the feature edge, and performing Plasma smoothing on the feature edge only along the edge direction.
[0209] It is understandable that even if folding is prohibited, simplification of adjacent faces may result in deformation of feature edges (such as jagged edges). In this preferred embodiment, two factors, local subdivision and edge straightening optimization, are introduced to post-process the model.
[0210] Local subdivision: Locally subdivide the faces on both sides of the feature edge to improve geometric smoothness.
[0211] The code example is as follows:
[0212] for edge in mesh.feature_edges:
[0213] if edge.is_distorted():
[0214] subdivide_adjacent_faces(edge, level=1)
[0215] Edge straightening optimization: Performs Plasma smoothing on feature edges (only along the edge direction) to maintain straightness.
[0216] The code example is as follows:
[0217] for vertex in feature_edge.vertices:
[0218] if vertex.on_feature_edge:
[0219] new_pos = 0.5 * (vertex.prev.pos + vertex.next.pos)
[0220] vertex.pos = new_pos
[0221] Model simplification (such as edge collapse and vertex merging) may destroy the original UV coordinates, resulting in texture stretching, misalignment, or unpacking discontinuities. To ensure that the simplified or repaired model maintains visual consistency and accuracy during texture mapping, in a preferred embodiment, the UV coordinates are recalculated after the model is simplified to ensure that the texture mapping of each facet is aligned with the simplified geometry, as follows:
[0222] UV partition preservation: before folding the edges, the faces of the meshed model are grouped according to UV islands; when folding the edges, they are performed on the same UV island to reduce cross-island merging.
[0223] A UV island is an area in Blender's UV editor where the surface of a 3D model is unfolded onto a 2D plane.
[0224] Automatic UV transfer: When collapsing edges and merging vertices, the UV coordinates of the new vertices are calculated based on the UV coordinates of the vertices involved in the merger and the weights of the merged vertices (such as area and edge length).
[0225] The code example is as follows:
[0226] uv_new = (uv1 * weight1 + uv2 * weight2) / (weight1 + weight2)
[0227] Parametric Mapping: After the mesh model is simplified, a new UV is generated using a distortion minimization algorithm. A least squares conformal parametric mapping algorithm is used to achieve UV parametric mapping of the model.
[0228] The principle is to define a minimization energy function so that in the process of minimizing the function, the conditions of angle-preserving mapping are met 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.
[0229] Minimize the energy function:
[0230] is the two-dimensional coordinate gradient; is the optimal transformation matrix from 3D to 2D.
[0231] Preferably, it also includes: seam repositioning: inserting new seams at the repair boundary to ensure texture continuity. Checkerboard test: applying a checkerboard texture to check UV distortion, investigating the unfolding parameters until the grid is uniform, and the UV islands are closely arranged to reduce texture space waste.
[0232] Step S13: Bind the geometric features in the parameterized geometric information with the animation parameters, bind the engineering parameters in the engineering metadata with the animation parameters, and bind the animation parameters with the meshed model.
[0233] In practice, a skeleton matching rule engine can be developed to use the rules to bind geometric features and animation parameters. For example, see Table 1:
[0234] Table 1 Rule base table
[0235]
[0236] The code example is as follows:
[0237] def auto_rigging(obj):
[0238] for feature in obj.semantic_tags:
[0239] if feature.type == "Cylinder":
[0240] bone = create_rotation_joint(feature.axis)
[0241] set_rotation_limits(bone, 0, 360)
[0242] elif feature.type == "Slider":
[0243] bone = create_translation_joint(feature.direction)
[0244] set_translation_limits(bone, 0, 100)
[0245] By traversing the semantic tags of the model, automatically creating corresponding bones (rotational joints or translational joints) according to different feature types (cylinders or sliders), and setting appropriate motion restrictions for these bones, the automatic bone binding function is realized.
[0246] The binding of project parameters and animation parameters, the sample code is as follows:
[0247] # Example: Project parameters drive animation parameters
[0248] # Bind the "max_rpm" attribute in STEP to the bone rotation speed
[0249] max_rpm = obj.metadata.get("max_rpm", 1000)
[0250] driver = bone.driver_add("rotation_euler", 0).driver
[0251] driver.expression = f"frame * {max_rpm / 60}" # RPM converted to degrees per second
[0252] Step S14: embed the assembly relationship and the engineering metadata into the grid model, so that the grid model supports cross-platform query and reverse tracing.
[0253] The specific implementation steps are as follows:
[0254] First, Schema design: Using JSON (JavaScript Object Notation) as the basic framework, Schema design ensures that the engineering properties of the CAD model (tolerances, materials, assembly relationships, etc.) can be accurately transmitted, parsed, and reused.
[0255] Schema design goals: Cross-platform compatibility: Supports parsing for digital twin development software on both the web (Three.js) and desktop (Unity). Semantic extensibility: Allows dynamic addition of new fields (such as thermodynamic parameters and manufacturer information). Lightweight and efficient querying: Avoids redundant data and supports fast retrieval of key attributes.
[0256] Schema Framework: We chose JSON-LD (JSON for Linked Data) as the foundation for the following reasons: Semantic relevance: Using the @context field to define vocabulary ensures consistent understanding of the same terminology across different systems. Compatibility with existing standards: We can embed glTF extras fields or FBX custom properties without modifying the file format specification.
[0257] Data validation and security: Define strict JSON Schema rules to ensure that input data complies with format requirements. Data encryption: Sensitive information (such as supplier ID) can be encrypted using a JWT token and embedded in the extras field.
[0258] The code example is:
[0259] # Example: Schema Design
[0260] {
[0261] "@context": "https: / / schema.org / ",
[0262] "@type": "EngineeringObject",
[0263] "name": "Bearing-001",
[0264] "material": "Steel-45#",
[0265] "tolerance": "±0.01mm",
[0266] "sourceStep": "original.step"
[0267] }
[0268] Taking the glTF format as an example, the code example of glTF metadata injection is as follows:
[0269] # Example: glTF metadata injection
[0270] import pygltflib
[0271] gltf = pygltflib.GLTF2().load("input.gltf")
[0272] node = gltf.nodes[0]
[0273] node.extras = {
[0274] "engineeringData": {
[0275] "material": "Steel-45#",
[0276] "tolerance": "±0.01mm"
[0277] }
[0278] }
[0279] gltf.save("output.gltf")
[0280] Regarding FBX data injection: Due to cross-tool compatibility issues, Unity cannot read FBX custom properties. This example uses Unity's TextAsset class to load these files and uses corresponding libraries (such as JsonUtility) for parsing.
[0281] It is understandable that the technical solution shown in the present invention has the following advantages:
[0282] High-fidelity data conversion: A semantically labeled local encryption algorithm (e.g., a 5x increase in hole edge subdivision density) ensures that the geometric error between the simplified mesh model and the original CAD model is less than 0.1mm. Furthermore, by embedding CAD model engineering properties (such as tolerances and materials) into glTF extras fields or FBX custom properties, users can interactively query them on the digital twin terminal.
[0283] Improved efficiency and automated processes: Single model processing time is reduced from hours to minutes, and assemblies of thousands of components can be processed simultaneously, generating multi-resolution LOD models while maintaining feature consistency.
[0284] Enhanced dynamic interaction and collaboration: The virtual model's motion logic is controlled in real time based on the CAD 3D model's engineering parameters (e.g., "maximum speed 3000 rpm"), enabling parametric animation. Furthermore, the output model is compatible with Unity and Three.js, supporting digital twin development on both PC and web platforms.
[0285] Controllability and security: When simplifying 3D meshes, users can customize protection rules to avoid black-box operations. Furthermore, this proposal is cloud-independent, and sensitive engineering data is fully encrypted locally, complying with information security standards.
[0286] In another embodiment, a lightweight device for converting a 3D model format is provided, comprising:
[0287] A data extraction module is used 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;
[0288] A model conversion module is used to perform mesh conversion on the CAD three-dimensional model according to the parameterized geometric information, generate a meshed model, and perform mesh simplification on the meshed model;
[0289] An animation binding module, used to bind geometric features in the parameterized geometric information with animation parameters, bind engineering parameters in engineering metadata with animation parameters, and bind animation parameters with the meshed model;
[0290] A data embedding module is used to embed the assembly relationship and the engineering metadata into the gridded model.
[0291] In another embodiment, a lightweight device for converting a 3D model format is provided, comprising:
[0292] A main controller, and a memory connected to the main controller;
[0293] The memory stores program instructions;
[0294] The main controller is used to execute program instructions stored in the memory and perform any of the above methods.
[0295] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0296] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" is at least two.
[0297] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention pertain.
[0298] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.
[0299] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and 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.
[0300] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing module, or each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.
[0301] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0302] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0303] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A lightweight method for converting 3D model formats, characterized in that: include: Obtaining a CAD three-dimensional model file, and extracting parametric geometric information, assembly relationships, and engineering metadata from the CAD three-dimensional model file; Performing mesh conversion on the CAD three-dimensional model according to the parameterized geometric information to generate a meshed model, and performing mesh simplification on the meshed model; Binding geometric features in the parameterized geometric information to animation parameters, binding engineering parameters in the engineering metadata to animation parameters, and binding the animation parameters to the meshed model; embedding the assembly relationship and the engineering metadata into the gridded model; Extracting parametric geometric information and assembly relationships from the CAD three-dimensional model file includes: parsing a B-Rep model of the CAD three-dimensional model file, traversing each entity in the B-Rep model, and generating a parsing result; identifying geometric features of each entity based on the parsing result, and marking the entity with a semantic label based on the geometric features; generating a B-Rep model with a semantic label for representing the parametric geometric information; and generating an assembly tree based on the parsing result for representing the assembly relationship. Mesh simplification is performed on the meshed model, including: selecting characteristic edges from all edges of the meshed model; adding folding limiting factors to all characteristic edges, wherein the folding limiting factors include characteristic edge weight penalties and edge folding constraints; calculating a folding cost for each mesh edge, sorting all mesh edges in ascending order according to the folding cost, and generating a queue; taking a mesh edge with the smallest folding cost from the queue according to the current sorting, and if the mesh edge is a non-characteristic edge, folding it, updating the folding cost of the affected edge, and re-sorting all edges in ascending order, and repeating this step until the number of faces of the meshed model equals the target number of faces; Selecting characteristic edges from all edges of the gridded model includes: mapping all semantic labels to corresponding grid edges in the gridded model, and considering all mapped grid edges as characteristic edges.
2. The method according to claim 1, characterized in that Extracting engineering metadata from the CAD 3D model file includes: Extracting CAD model attributes from the CAD three-dimensional model file; If there are non-standard CAD model attributes, the attribute names are associated with semantic identifiers according to a pre-stored user-defined mapping table; Engineering metadata is generated based on the CAD model attributes.
3. The method according to claim 1, characterized in that Before adding the folding limit factor to all feature edges, it also includes: Calculate the curvature of each vertex of the meshed model; For each edge, the average or maximum curvature of the two vertices is taken as the edge curvature; If the edge curvature is greater than the dynamic threshold, the edge is considered as a feature edge.
4. The method according to claim 1, wherein After the mesh model is mesh-simplified, the following steps are further included: Performing geometric repair on the feature edge of the meshed model includes: locally subdividing the faces on both sides of the feature edge, and performing Plasma smoothing on the feature edge only along the edge direction.
5. The method according to claim 4, characterized in that Also includes: Before folding the edges, grouping the faces of the meshed model into UV islands; When folding edges, do it on the same UV island; When collapsing edges and merging vertices, the UV coordinates of the new vertex are calculated based on the UV coordinates of the vertices involved in the merger and the weights of the merged vertices. After the meshed model is simplified, new UVs are generated using a distortion minimization algorithm.
6. A lightweight device for converting 3D model formats, characterized in that: include: A data extraction module is used 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; Extracting parametric geometric information and assembly relationships from the CAD three-dimensional model file includes: parsing a B-Rep model of the CAD three-dimensional model file, traversing each entity in the B-Rep model, and generating a parsing result; identifying geometric features of each entity based on the parsing result, and marking the entity with a semantic label based on the geometric features; generating a B-Rep model with a semantic label for representing the parametric geometric information; and generating an assembly tree based on the parsing result for representing the assembly relationship. a model conversion module, configured to perform mesh conversion on a CAD three-dimensional model according to the parameterized geometric information to generate a meshed model, and perform mesh simplification on the meshed model, including: selecting feature edges from all edges of the meshed model; adding a folding limitation factor to all feature edges, wherein the folding limitation factor includes a feature edge weight penalty and an edge folding constraint; calculating a folding cost for each mesh edge, sorting all mesh edges in ascending order according to the folding cost, and generating a queue; taking out a mesh edge with the smallest folding cost from the queue according to the current sorting, and folding the mesh edge if the mesh edge is a non-feature edge, updating the folding cost of the affected edge, and re-sorting all edges in ascending order, and repeating this step until the number of faces of the meshed model equals the target number of faces; Selecting characteristic edges from all edges of the gridded model includes: mapping all semantic labels to corresponding grid edges in the gridded model, and considering all mapped grid edges as characteristic edges; An animation binding module, used to bind geometric features in the parameterized geometric information with animation parameters, bind engineering parameters in engineering metadata with animation parameters, and bind animation parameters with the meshed model; A data embedding module is used to embed the assembly relationship and the engineering metadata into the gridded model.
7. A lightweight device for converting 3D model formats, characterized in that: include: A main controller, and a memory connected to the main controller; The memory stores program instructions; The main controller is used to execute program instructions stored in the memory and perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Three-dimensional model automatic lightweight processing method and system
CN116991795A