CAD model lightweight conversion method and system

By parsing, discretizing, and adaptively compressing the STEP format model, a PBZ format file is generated, which solves the problems of large CAD model file size and slow transmission. It achieves efficient lightweight conversion and accurate geometry preservation, making it suitable for the high-precision requirements of industrial scenarios.

CN121937671APending Publication Date: 2026-04-28上海数矩信息技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
上海数矩信息技术有限公司
Filing Date
2026-01-16
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies for processing 3D computer-aided design (CAD) models suffer from problems such as large file sizes, long transmission times, and inefficiency in rendering on web pages or mobile devices. In particular, STEP format B-rep data loses geometric accuracy and topological connectivity during the lightweighting process.

Method used

By parsing the STEP format model, the boundary representation geometric data and topological structure are extracted, discretized into triangular meshes while retaining the parameterized edge definitions, and a structured intermediate representation format (such as JSON) and differential encoding are used, combined with an adaptive compression algorithm to generate PBZ format files.

Benefits of technology

It achieves high compression ratio and maintains sub-micron level geometric accuracy, significantly improving network transmission efficiency and mobile rendering performance, and ensuring the integrity of the model's core information and its usability in engineering applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121937671A_ABST
    Figure CN121937671A_ABST
Patent Text Reader

Abstract

The invention discloses a lightweight conversion method and system for a CAD (computer-aided design) model. According to the method, a standard STEP format model is converted into a lightweight PBZ format through a multi-stage conversion architecture, and the method comprises the following steps: analyzing a STEP file to extract boundary representation geometry, a topological structure and product assembly data, discretizing an NURBS curved surface into a triangular mesh according to configurable precision, and meanwhile, nondestructively retaining parameterized sideline geometric definition; organizing the extracted data into a structured JSON (JavaScript Object Notation) intermediate representation; carrying out serialization by utilizing an optimized protobuf message structure, applying differential coding to vertex data, and applying triangular stripe coding to a patch index; and finally, based on the file size and the application scene precision requirement, adaptively selecting a GZIP compression level to carry out compression packaging. According to the method, the submicron geometric accuracy is kept, meanwhile, the high compression rate is achieved, the network transmission and mobile terminal rendering efficiency is remarkably improved, and the method is suitable for industrial scenes such as online collaborative design, digital twinning and mobile terminal detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer-aided design technology, specifically to a lightweight conversion method and system for CAD models. Background Technology

[0002] With the deepening development of Industry 4.0, digital twins, and intelligent manufacturing, 3D computer-aided design (CAD) models have become the core data carrier throughout the entire product lifecycle, from design and simulation analysis to manufacturing, quality inspection, and after-sales maintenance. To achieve data exchange and collaboration across systems, platforms, and even enterprises, the International Organization for Standardization (ISO) developed the STEP (Standard for the Exchange of Product model data, ISO 10303) format. Based on rigorous boundary representation (B-rep) theory, this format can completely and accurately describe the geometry, topology, and assembly information of products, thus becoming a de facto neutral data exchange standard in the industrial field.

[0003] However, to ensure lossless information and geometric accuracy, the STEP format typically contains a large number of detailed geometric definitions (such as NURBS surfaces), complete topological relationships, and multi-level product structure trees, resulting in exceptionally large file sizes, often reaching hundreds of megabytes (MB). This data volume brings significant bottlenecks in storage, transmission, and real-time processing: First, it consumes a large amount of local storage and server space; second, transmission in network environments (especially mobile networks or cross-border links) is time-consuming, severely hindering the efficiency of online collaborative design, remote review, and supply chain collaboration; finally, mainstream real-time rendering engines (such as WebGL and OpenGL ES) cannot directly parse and efficiently render B-rep-based STEP data, requiring complex conversion and simplification before it can be displayed on web pages or mobile devices.

[0004] To address these challenges, the industry has proposed various lightweight solutions, which can be mainly categorized into the following three types:

[0005] (1) Dedicated lightweight format conversion: This type of solution converts CAD models into lightweight formats optimized for visualization, such as JT (Jupiter Tessellation), 3D PDF, X3D, etc. Its core technology usually includes discretizing (tessell) the precise B-rep model into a triangular mesh, and may apply level of detail (LOD) technology to generate multiple versions of the model with different levels of precision. Although this method can effectively reduce the file size and support fast rendering, its core drawback is the loss of geometric precision and design features. The discretization process itself introduces approximation errors, and in order to further compress, the commonly used mesh simplification algorithms (such as vertex deletion and edge folding) will irreversibly destroy the original topological connections and sharp features (such as edges and corners), making the model unusable in high-precision industrial scenarios such as dimensional measurement and tolerance analysis.

[0006] (2) Direct application of general mesh simplification algorithms: These methods directly apply mesh simplification algorithms from computer graphics to the triangular mesh models (such as STL and OBJ) output by the CAD system, including but not limited to edge folding, vertex clustering, and quadratic error metric (QEM) simplification. Although these algorithms can significantly reduce the number of faces, their optimization goals are usually visual fidelity or the number of faces, completely ignoring the engineering semantics contained in the CAD model, such as feature faces, machining boundaries, and tolerance information. The simplified model often loses key geometric constraints and design intent, and cannot meet the requirements of advanced manufacturing models such as Model-Based Definition (MBD) or Model-Based Enterprise (MBE).

[0007] (3) General data compression techniques: Directly apply general lossless compression algorithms such as ZIP and RAR to the STEP file or its exported data. Although this method can guarantee the complete reversibility of the data, the compression rate is limited, usually only 50%-70%. For the original model of several hundred MB, the compressed size is still considerable. More importantly, the compressed data is still in the STEP or similar structure, which cannot be efficiently parsed and rendered by lightweight clients or graphics APIs. After decompression, the aforementioned real-time processing problem still needs to be faced.

[0008] Existing technical literature also reflects the exploration and limitations of the aforementioned technical approaches. For example, Chinese patent CN110232326A discloses a method for lightweighting 3D models, which preserves visual features through feature-aware simplification. However, its processing object is not the original CAD feature model, and it lacks support for parametric curves and surfaces, precise topological associations, and Product Manufacturing Information (PMI) in B-rep data structures. US patent US20210027556A1 proposes a CAD data conversion and compression method, attempting to maintain a certain level of accuracy during compression. However, it still has significant room for improvement in balancing compression efficiency and accuracy, especially when processing complex assemblies. Summary of the Invention

[0009] To address the shortcomings of existing technologies, this invention provides a lightweight conversion method and system for CAD models, which overcomes the deficiencies of existing technologies, achieves high compression rates while maintaining sub-micron level geometric accuracy, and significantly improves network transmission and mobile rendering efficiency.

[0010] To achieve the above objectives, the present invention provides the following technical solution:

[0011] A lightweight conversion method for CAD models includes the following steps:

[0012] S1: Parsing: Parses the input STEP format CAD model file to extract the boundary geometric data, topological data, and product assembly relationship data of the model;

[0013] S2: Intermediate Transformation: The extracted geometric data, topological data, and product assembly relationship data are transformed and organized into a structured intermediate data representation that is independent of a specific geometric kernel;

[0014] S3: Serialization: Using a predefined protobuf message structure, the intermediate data representation is serialized into a compact binary data stream;

[0015] S4: Compression: Adaptively compress the binary data stream to generate a compressed lightweight model file.

[0016] Preferably, step S1 specifically includes:

[0017] S11: Use the geometry kernel library to parse the STEP format CAD model file and obtain its accurate geometric model based on the boundary representation method;

[0018] S12: Discretize the NURBS surface in the precise geometric model according to the preset discretization precision parameters and convert it into a triangular mesh representation;

[0019] S13: During and after the discretization process, the original parametric geometric definitions of the edges in the precise geometric model are extracted and retained simultaneously. The parametric geometric definitions include mathematical definition parameters of straight lines, circular arcs, or spline curves.

[0020] S14: Extract the product assembly structure tree and the relative transformation relationships between components from the STEP format CAD model file.

[0021] Preferably, the discrete precision parameter is a user-configurable parameter, and its value ranges from 0.001 mm to 0.1 mm;

[0022] And / or, the discretization process employs an adaptive discretization algorithm, dynamically adjusting the density of the triangular mesh based on the local curvature of the surface.

[0023] Preferably, in the intermediate conversion step S2, the generated structured intermediate data is represented in JSON format;

[0024] The intermediate data represents at least:

[0025] The geometric data segment is used to store the vertex coordinate array, normal vector array, and face index array of the triangular mesh;

[0026] The edge data segment is used to store the type of the model edge and its corresponding geometric parameters in a parametric form.

[0027] The structured data segment is used to store the assembly relationships of the product and the relative transformation matrices between the components in a tree or hierarchical form.

[0028] Preferably, the S3 serialization step is implemented using the Protocol Buffers protocol;

[0029] Specifically, this includes: predefining a protobuf message structure corresponding to the intermediate data representation structure, wherein the protobuf message structure includes at least a GeometryData message for encapsulating geometric data, an Edge message for encapsulating edge data, and a CADModel message for encapsulating the overall model; using the protobuf message structure to convert the intermediate data into a binary sequence, wherein the packed=true encoding option is enabled for repeated numerical fields storing vertex coordinates, normal vectors, or indices.

[0030] Preferably, in the protobuf message structure used in the S3 serialization step,

[0031] The vertex coordinate array is differentially encoded to store the coordinate differences between adjacent vertices instead of their absolute coordinate values;

[0032] And / or, perform triangle striping encoding on the facet index array to reorganize the independent triangle list into a continuous triangle striping sequence.

[0033] Preferably, the S4 compression step uses GZIP compression based on the DEFLATE algorithm;

[0034] The method for selecting the compression level includes: adaptively selecting the GZIP compression level according to a preset decision logic; the input parameters of the decision logic include at least the size of the binary data stream and the accuracy requirements associated with the target application scenario.

[0035] The accuracy requirements include high accuracy, medium accuracy, or low accuracy;

[0036] The decision logic is as follows: when the data stream size is less than or equal to the first threshold and the accuracy requirement is high, the first compression level is selected; when the data stream size is between the first threshold and the second threshold and the accuracy requirement is medium, the second compression level is selected; when the data stream size is greater than the second threshold and the accuracy requirement is low, the third compression level is selected; wherein, the first compression level is higher than the second compression level, and the second compression level is higher than the third compression level.

[0037] The present invention also discloses a lightweight CAD model conversion system for implementing the above method, including a conversion engine module, a data processing module, a serialization module, and a compression and packaging module;

[0038] The conversion engine module is used to parse the input STEP format CAD model file, extract the boundary representation geometric data, topological structure data and product assembly relationship data of the model, and discretize the NURBS surface into a triangular mesh representation with configurable discretization precision, while retaining the parametric geometric definition of the model edge lines;

[0039] The data processing module is used to convert and organize the data output by the conversion engine module into an intermediate representation format with a predefined structure.

[0040] The serialization module is used to serialize the intermediate representation format into a binary data stream using a predefined protobuf message structure, and to apply differential encoding to the vertex coordinate data and triangle striping encoding to the triangle patch index data.

[0041] The compression and encapsulation module is used to adaptively select the GZIP compression level for compression based on the size of the binary data stream and the target precision scenario, and encapsulate it to generate a PBZ format file.

[0042] Preferably, the conversion engine module is implemented based on the Open CASCADE Technology geometry kernel; the intermediate representation format is JSON format, and its structure includes at least a geometric data segment, a parameterized edge data segment, and a hierarchical product structure data segment.

[0043] Preferably, the system is deployed and provided in any of the following forms: a plug-in module integrated into computer-aided design software, a network server providing a remote call interface, or a cloud service platform that supports elastic scaling.

[0044] This invention provides a lightweight conversion method for CAD models. It has the following beneficial effects:

[0045] By employing a multi-level transformation architecture of "analysis-structuring-serialization-compression," combined with lossless preservation of parametric edges, configurable discrete precision control, and targeted differential coding and triangle strip coding optimization, the model size is significantly reduced while ensuring the integrity of its core information. Furthermore, this invention is not simply mesh simplification, but rather establishes a clear precision control system. The upper limit of process error is controlled by user-adjustable discrete precision parameters, and the precise mathematical definitions of straight lines, arcs, and other edges are directly preserved, eliminating major error sources.

[0046] By introducing scenario-based adaptive compression decision logic, the system can dynamically select the optimal GZIP compression level based on the size of the data stream to be compressed and the accuracy requirements of the target task. This ensures that the system can always achieve the best balance between processing speed, compression efficiency, and accuracy requirements in different application scenarios, improving the overall efficiency and practicality of the system.

[0047] Because the generated lightweight PBZ file is only about 8% the size of the original file, network transmission time is reduced by 85% to 95%. Furthermore, the triangular mesh data contained within the PBZ format has been optimized into GPU-friendly formats such as triangular stripes, while retaining the complete hierarchical structure, enabling it to be loaded in seconds and rendered smoothly in real-time on the client side. This significantly improves the user experience in scenarios such as collaborative design and mobile inspection.

[0048] By introducing a structured JSON intermediate data representation, a clear interface is established between the parsing engine based on geometric kernels such as OCCT and the subsequent serialization and compression modules. This makes the core data format neutral, allows the front-end parser to be replaced or extended, and enables stable reuse of the back-end processing flow; it also makes the system deployment highly flexible. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in this invention or the prior art, the accompanying drawings used in the description of the prior art will be briefly introduced below.

[0050] Figure 1 This is an overall flowchart of the lightweight conversion method for CAD models according to the present invention;

[0051] Figure 2 This is a schematic diagram of the multi-level conversion process in this invention;

[0052] Figure 3 This is a schematic diagram of the internal data structure of the PBZ file generated in an embodiment of the present invention;

[0053] Figure 4 This is an optimization flowchart for applying differential encoding to vertex coordinate data in an embodiment of the present invention;

[0054] Figure 5 This is an optimized flowchart of applying triangle striping encoding to the triangular facet index data in an embodiment of the present invention;

[0055] Figure 6 This is a system architecture diagram of the lightweight CAD model conversion system of the present invention. Detailed Implementation

[0056] To make the objectives, technical solutions, and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings.

[0057] Example 1, as Figures 1 to 5 As shown, this invention discloses a lightweight conversion method for CAD models. Taking the STEP model conversion of a typical machine tool base part as an example, the implementation steps of this method are explained in detail:

[0058] S1: Parsing; Parsing the input STEP format CAD model file to extract the model's boundary geometric data, topological structure data, and product assembly relationship data; specifically including:

[0059] S11: File Reading and Kernel Parsing: This function calls a parser developed based on the open-source geometry kernel Open CASCADE Technology (OCCT). By calling classes such as STEPControl_Reader in OCCT, it loads and parses a STEP file named machine_base.stp (approximately 43MB in size). The parser reads the file's precise B-rep (boundary representation) data and reconstructs an accurate geometric model in memory, including entities such as planes, cylinders, and NURBS surfaces, as well as the complete topological connections between points, edges, loops, faces, shells, and volumes.

[0060] S12: Surface Discretization and Accuracy Control: Set the discretization accuracy parameter tessellation_tolerance = 0.01mm to control the discretization accuracy. This parameter is a configurable floating-point number, which in typical implementations can be adjusted between 0.001mm (high-precision detection) and 0.1mm (fast preview) via a slider in the graphical interface or API parameters. The parser traverses all NURBS surfaces (or other analytical surfaces) in the B-rep data, calls the OCCT tessellation algorithm, and generates a triangular mesh that approximates the original surface. In this embodiment, the adaptive option of the algorithm can be enabled. The algorithm automatically adjusts the density of the triangular patches according to the local radius of curvature of the surface. For areas with large curvature changes (such as rounded corners), an adaptive discretization algorithm is used to automatically increase the density of the triangular patches to ensure approximation accuracy; for flat areas, sparser patches are generated, thereby optimizing the amount of mesh data while ensuring accuracy.

[0061] S13: Parametric Edge Extraction and Preservation: During discretization, all edges in the model are extracted simultaneously. For each edge, not only is its vertex sequence on the triangular mesh recorded after discretization, but more importantly, its underlying precise geometric definition is extracted and recorded using the OCCT API. For example, for a straight edge, the 3D coordinates of its start and end points are recorded; for a circular arc edge, its center, radius, normal vector, start angle, and end angle are recorded. If it is a B-spline curve, its control points, node vectors, and other information are recorded. These parametric definitions are stored independently and associated with the discretized triangular mesh data to ensure that the sharp edges and precise contours of the model can be restored without loss in subsequent processes.

[0062] S14: Product Assembly Structure Extraction: Parse the Product Structure Tree in the STEP file. Traverse the assembly and extract the instance name, identifier, and relative transformation matrix (a 4x4 homogeneous coordinate matrix containing rotation, translation, and scaling information) of each part or sub-assembly in the global coordinate system. In this embodiment, the machine tool base is a single part with a simple structure. For complex assemblies, a complete product structure tree will be extracted.

[0063] S2: Intermediate Transformation: The extracted geometric data, topological data, and product assembly relationship data are transformed and organized into a structured intermediate data representation independent of a specific geometric kernel; this decouples the data from subsequent processing steps. Specifically, this includes:

[0064] S21: Intermediate Format Selection: In implementation, JSON (JavaScript Object Notation) was chosen as the intermediate data representation format. JSON is human-readable, cross-platform, language-independent, and has a natural hierarchical structure, making it very suitable for representing complex CAD data.

[0065] All the data obtained in the S1 parsing step above is organized into a well-structured and easy-to-process JSON intermediate representation. This JSON object mainly contains the following root node:

[0066] "metadata": Stores metadata such as version number, unit (mm), and model bounding box size.

[0067] "geometry": Stores the geometric data segment. Contains three key arrays: (1) "vertices": A flattened floating-point array that stores the 3D coordinates of all triangular mesh vertices in the order [x1, y1, z1, x2, y2, z2, ...]. (2) "normals": A flattened floating-point array that stores the normal vector corresponding to each vertex. (3) "indices": An unsigned integer array that stores the indices of the three vertices that make up each triangle in the order [t1_v1, t1_v2, t1_v3, t2_v1, ...].

[0068] "edges": Stores edge data segments. It is an array of objects, creating a JSON object for each extracted parameterized edge.

[0069] "structure": Stores the structural data segment. The assembly hierarchy is represented as a tree-like JSON object. Each node contains a part ID, name, a reference to its geometry (e.g., an index range associated with a set of faces), and a transformation matrix relative to its parent node. Parent-child relationships are represented by nested JSON objects or a list of child node IDs.

[0070] S3: Serialization: Utilizing a predefined protobuf message structure, it efficiently converts structured JSON intermediate data representations into compact, serialized binary streams, preparing for final compression. Specifically, it includes:

[0071] S31: Protocol Buffers Schema Definition: First, based on the structure of the JSON intermediate representation, a strict Protocol Buffers (protobuf) message format (.proto file) is defined. Core messages include:

[0072] message GeometryData: contains repeated float vertices, repeated floatnormals, and repeated uint32 indices, all marked with packed=true.

[0073] message Edge: Uses the oneof union to distinguish different types of parameterized edges such as LineEdge, CircleEdge, and BSplineEdge.

[0074] message CADModel: As the root message, it contains fields such as GeometryData, repeated Edge, and StructureData.

[0075] In this step, for fields such as vertices, normals, and indices that contain a large number of repeated scalar values, the packed=true option must be used to eliminate the field header overhead that protobuf adds to each element by default, significantly reducing the size of the serialized data.

[0076] S32: Serialization and Data Optimization: Using code generated by the protobuf compiler, the data in the intermediate JSON representation is populated into the corresponding message object.

[0077] (1) Implement differential encoding: Before filling the vertex coordinate array into GeometryData.vertices, process the original vertex coordinate array first. Do not directly store absolute coordinates. Instead, it calculates and stores the difference between adjacent vertices. ,in Similarly, calculate and The reference point for the first vertex is the origin. .

[0078] Because adjacent vertices in CAD models are typically spatially close, these differences are usually very small, resulting in lower entropy values ​​during subsequent compression. This allows the DEFLATE compression algorithm to achieve a higher compression ratio. This process is completely reversible; the differences can be sequentially summed during decoding to restore the model.

[0079] (2) Implement triangle striping encoding: Before filling the facet index array into GeometryData.indices, the original list of triangle indices is reorganized. Using an optimized striping algorithm (such as the classic SGI algorithm or the NVTriStrip library), the triangles originally represented as independent triangles (each triangle represented by 3 indices) are reorganized into one or more continuous triangle strips. In a strip, each new vertex after the first two vertices can form a new triangle with the previous two vertices, thereby reducing the average number of indices representing a triangle from 3 to nearly 1, significantly reducing the amount of data and achieving compression. At the same time, the triangle striping format can be rendered efficiently by modern GPUs.

[0080] Finally, call SerializeToString() or a similar method to serialize the entire CADModel message into a compact binary data stream.

[0081] S4: Compression: Adaptively compresses the serialized binary data stream to generate a compressed, lightweight model file. Specifically, this includes:

[0082] S41: Compression Algorithm Selection: GZIP compression based on the DEFLATE algorithm is adopted. The DEFLATE algorithm combines LZ77 dictionary encoding and Huffman coding, achieving a good balance between compression ratio and speed, and supports variable compression levels (usually 1-9 levels).

[0083] S42: Adaptive compression logic implementation:

[0084] (1) Input parameter acquisition:

[0085] File size (file_size): The binary size (in MB) of the CADModel protobuf message obtained after serialization in step S3. Assume file_size = 5.2 MB.

[0086] `precision_requirement`: Obtained from user input, API parameters, or system configuration. It is divided into three levels: "high precision" (e.g., detection, digital twins), "medium precision" (e.g., collaborative design), and "low precision" (e.g., mobile preview). For example, if the model is used for "online collaborative design review," then `precision_requirement="medium precision"` would be set.

[0087] (2) Decision logic implementation: Implement a decision function select_compression_level(file_size, precision_requirement), whose internal logic is based on a predefined rule table. Refer to the following table for logic:

[0088]

[0089] In this embodiment, the file size is file_size=5.2MB≤10MB and precision_requirement="medium precision", so the compression level L=5 is selected.

[0090] (3) Function call: In the compression module, call the GZIP compression function provided by the system or library (such as Python's gzip.compress(data, compresslevel=L), or zlib library's deflateInit2 to set the compression level), and pass the level L returned by the decision function as a parameter (L=5 in this embodiment). Compress the binary data stream based on the DEFLATE algorithm.

[0091] Finally, a custom file header (such as "PBZv1.0") is added before the compressed data, along with the necessary metadata index and CRC checksum, to generate the final lightweight file machine_base.pbz.

[0092] Performance Verification: Testing showed that the original 43MB STEP file was reduced to approximately 3.8MB in the final PBZ file, achieving a compression rate of 91.2%. With a discrete precision setting of 0.01mm, the deviation between the restored model and the original model was measured using 3D comparison software (such as CloudCompare). The maximum geometric error was less than 0.001mm, and the average error was less than 0.0001mm, fully meeting engineering accuracy requirements.

[0093] And after multiple experiments, this invention has demonstrated stable high compression ratio and high-precision restoration capability on multiple industrial model test sets:

[0094]

[0095] Test environment:

[0096] CPU: Intelli9 14900K

[0097] Chipset: Intel Z790

[0098] Memory: 64GB DDR

[0099] Solid State Drive: 2TB SSD

[0100] Graphics card: A6000 48G

[0101] The experimental data above demonstrates that this method achieves compression rates exceeding 91% on industrial models of varying complexity while maintaining sub-micron level geometric accuracy. Combined with a lightweight file header design and adaptive compression strategy, it significantly reduces storage and transmission overhead while ensuring efficient decompression and restoration capabilities, making it suitable for cloud-based collaboration and remote access scenarios involving large-scale engineering data.

[0102] This invention employs a multi-level transformation architecture of "analysis-structuring-serialization-compression," combined with lossless preservation of parametric edges, configurable discrete precision control, and targeted differential coding and triangular stripe coding optimization. This achieves a significant reduction in model size while ensuring the integrity of the model's core information. In tests on multiple complex industrial models, this invention can compress original STEP files of hundreds of MB to 5%-10% of their original size, with an average compression rate exceeding 90%. Furthermore, this invention is not simply a mesh simplification but establishes a clear precision control system. The upper limit of process error is controlled by user-adjustable discrete precision parameters (0.001-0.1mm), and the precise mathematical definitions of straight lines, arcs, and other edges are directly preserved, eliminating major error sources. Experimental results show that, with a discrete precision of 0.01mm, the maximum geometric error of the final recovered model can be stably controlled within 0.001mm, fully meeting the stringent requirements of high-precision inspection, digital twins, and other industrial scenarios. Simultaneously, the model's B-rep topology and assembly relationships are fully maintained, ensuring the model's usability in subsequent engineering applications.

[0103] Unlike existing solutions that employ fixed compression strategies, this invention introduces scenario-based adaptive compression decision logic. The system dynamically selects the optimal GZIP compression level based on the size of the data stream to be compressed (e.g., ≤10MB, 10-100MB, >100MB) and the accuracy requirements of the target task (high / medium / low). For example, speed (low compression level) is prioritized for small file preview scenarios, while compression ratio (high compression level) is prioritized for large file high-precision archiving scenarios. This intelligent strategy ensures that the system always achieves the best balance between processing speed, compression efficiency, and accuracy requirements in different application scenarios, improving the overall efficiency and practicality of the system.

[0104] Traditional STEP files are bulky and take a long time to transmit over the network, especially in mobile environments, and cannot be efficiently rendered directly by Web or mobile graphics APIs. The lightweight PBZ file generated by this invention is only about 8% the size of the original file, reducing network transmission time by 85% to 95%. Furthermore, the triangular mesh data contained in the PBZ format has been optimized into GPU-friendly formats such as triangle stripes, while retaining the complete hierarchical structure, enabling it to be loaded in seconds and rendered smoothly in real time on clients (including web browsers and mobile applications). Under the same hardware conditions, compared to loading and rendering traditional intermediate formats, the rendering frame rate can be increased by 3 to 5 times, and memory usage reduced by 60% to 80%, greatly improving the user experience in collaborative design, mobile inspection, and other scenarios.

[0105] By introducing a structured JSON intermediate data representation, a clear interface is established between the parsing engine based on geometric kernels such as OCCT and the subsequent serialization and compression modules. This design achieves two major advantages: first, the core data format is neutral, making the front-end parser replaceable or extensible, and the back-end processing flow stable and reusable; second, the system deployment is highly flexible. Based on this architecture, this invention can be easily implemented as an embedded plugin for CAD software, a standalone network service providing standard APIs, or a cloud-native platform supporting elastic scaling. It can seamlessly integrate into various information environments, from personal design to enterprise-level collaboration, with extremely strong compatibility and integrability.

[0106] Unlike mesh simplification algorithms solely designed for visual display, this invention, during the lightweighting process, not only preserves the triangular mesh but, more importantly, fully retains the model's boundary representation topology, parametric edge geometry, and product assembly relationships. This means the converted lightweight model still carries crucial engineering semantic information, such as accurate boundaries, assembly constraints, and relative positional relationships. This enables the PBZ format model not only for visualization but also to directly support advanced engineering applications such as model-based definition, virtual assembly simulation, online dimensional measurement, and tolerance analysis, providing a high-quality, lightweight data foundation for advanced models like digital twins and intelligent manufacturing.

[0107] Example 2, as Figure 6 As shown, the present invention also discloses a lightweight CAD model conversion system for implementing the method described in Embodiment 1, including a conversion engine module, a data processing module, a serialization module, and a compression and encapsulation module; each module transmits data through a clearly defined internal interface (such as a memory data structure, file, or message queue) to achieve a design with high cohesion and low coupling.

[0108] User or client programs initiate conversion requests via system-provided APIs (such as `convert_step_to_pbz`). Request parameters include the STEP file path and configuration information (such as discrete precision and target scenario). The conversion task is submitted sequentially to four modules. After each module completes its specific responsibility, it passes the output to the next module until the final PBZ file is generated. The system stores the generated PBZ file in a specified location and notifies the caller of conversion completion via a callback function or event.

[0109] in:

[0110] The conversion engine module parses the input STEP format CAD model file, extracts the model's boundary geometric data, topological data, and product assembly relationship data, and discretizes the NURBS surfaces into triangular meshes with configurable discretization precision, while preserving the parametric geometric definitions of the model's edges; specifically:

[0111] Implementation Basis: A preferred implementation of this conversion engine module is based on the Open CASCADE Technology (OCCT) geometry kernel library. The system links to the OCCT dynamic library and calls its core classes and functions such as STEPControl_Reader, BRep_Tool, and BRepMesh_IncrementalMesh.

[0112] The workflow includes:

[0113] (1) Loading and parsing: The module receives the STEP file path, calls the OCCT reader to load the file into memory, and constructs a complete B-rep model topology tree.

[0114] (2) Discretization: Based on the user-configured or default discretization precision parameters (e.g., 0.01 mm), the module traverses all surfaces and calls the OCCT meshing algorithm to generate triangular meshes. The discretization precision parameters are exposed through the module configuration interface and can be dynamically set within the range of 0.001 mm to 0.1 mm. For example, setting aMesh→SetDeflection(tolerance) controls the maximum chord height error.

[0115] (3) Dual Data Extraction: This is the key to this module. It includes:

[0116] Mesh data extraction: Extract the vertex coordinate list and triangle patch index list from the discretized results, and calculate the vertex normal vector.

[0117] Parametric geometry preservation: During discretization, each edge (TopoDS_Edge) of the model is traversed in parallel. Using methods such as BRep_Tool::Curve, the precise geometric curve definitions at the underlying level of the edge (e.g., Geom_Line, Geom_Circle, Geom_BSplineCurve) are obtained, and their types and parameters (e.g., the start and end points of lines, the center and radius of arcs) are extracted and linked to the mesh data using an index.

[0118] (4) Product structure extraction: By parsing the product structure tree in the STEP file, the names, identifiers, parent-child relationships and relative transformation matrices (XCAFDoc_Location) of the parts / subassemblies are obtained, and a hierarchical assembly representation is constructed.

[0119] The final output is a unified in-memory data structure containing the following components: triangular mesh data (vertices, indices, normals), a list of parameterized edges, and a product assembly tree. This data structure acts as a bridge, passing the data to the data processing module.

[0120] The data processing module is used to convert and organize the data output by the conversion engine module into a predefined intermediate representation format; in this embodiment, JSON format is preferred as the standard intermediate representation format, taking advantage of its self-describing, cross-platform, and easy-to-debug advantages. Wherein:

[0121] The data processing module constructs a large JSON root object according to a predefined schema. This object mainly contains three root segments:

[0122] The geometry segment stores mesh data. It contains vertices (flattened arrays of vertex coordinates), normals (flattened arrays of normal vectors), and indices (arrays of triangle indices). For example, "vertices":[x1,y1,z1,x2,y2,z2,...], "indices":[i1,i2,i3,...], "normals":[nx1,ny1,nz1,...].

[0123] Parameterized edge data segment (topology segment): Stores parameterized edge data. Each edge is a JSON object containing a "type" field and a corresponding "parameters" object.

[0124] Hierarchical product structure data segment (structure segment): Stores the hierarchical product assembly tree in the form of nested JSON objects or arrays. Each node contains "name", "id", "transform" (4x4 matrix or translation / rotation / scaling components), and a list of "children".

[0125] The introduction of the data processing module completely decouples the front-end geometry kernel dependency (OCCT) from the back-end serialization and compression logic. Any parser capable of generating this standard JSON format can be integrated into the system, improving its flexibility and maintainability.

[0126] The serialization module receives intermediate data in JSON format and serializes it into a binary data stream using a predefined protobuf message structure. It applies differential encoding to the vertex coordinate data and triangle striping encoding to the triangle facet index data. Specifically, it includes:

[0127] (1) Protobuf Schema Integration: The system loads a predefined .proto file during compilation or initialization. This schema defines message structures such as GeometryData, Edge, and CADModel.

[0128] (2) Conversion and Encoding: The serialization module first maps the JSON object and populates it into the corresponding Protobuf message object. During the population process, optimized encoding is performed synchronously:

[0129] Implement differential encoding: Before filling the vertex coordinate array into GeometryData.vertices, process the original vertex coordinate array first. Store the coordinate difference sequence.

[0130] Triangle striping encoding: Before filling the facet index array into GeometryData.indices, an optimized striping algorithm (such as the classic SGI algorithm or the NVTriStrip library) is used to reorganize the stripes, resulting in a more compact stripe sequence. The encoded stripe information (such as stripe start markers and vertex sequences) is stored in the optimized index field.

[0131] All repeated numeric fields (such as vertices and indices) are packed with the packed=true attribute enabled.

[0132] (3) Output: The module calls the Protobuf serialization interface (such as SerializeToString or SerializeToArray) to convert the CADModel message containing the optimized data into the final binary data stream.

[0133] The compression and encapsulation module is used to adaptively select the GZIP compression level for compression based on the size of the binary data stream and the target precision scenario, and then encapsulate it to generate a PBZ format file.

[0134] The compression and encapsulation module has a built-in decision function whose logic is exactly the same as that described in Example 1. The function reads the size of the binary data stream and, in conjunction with the precision label ("high precision" / "medium precision" / "low precision") from the user or application context, dynamically selects the GZIP compression level (1-9) according to a preset rule table (as described in Example 1).

[0135] Call the standard zlib library or a similar library to perform GZIP compression on the binary data using the selected compression level. For particularly large data streams, a block compression strategy can be used to balance memory usage. For example, in C++: compress2(dest, &destLen, source, sourceLen, selected_level).

[0136] Add a custom header before the compressed data. The header contains a magic number (e.g., "PBZv1.0"), the protocol version, the original file checksum (e.g., CRC32), and optional data block indexes. Finally, write the header and the compressed data stream together into a file with the .pbz extension.

[0137] The system described in this invention can be flexibly deployed to adapt to different application scenarios and infrastructures.

[0138] Form 1: CAD software plug-in module

[0139] Implementation method: Compile the above four core modules into dynamic link libraries (DLL / SO) and develop plug-in interfaces for specific CAD software (such as SolidWorks, AutoCAD, Fusion 360).

[0140] Workflow: Users directly select the model or open the STEP file within the CAD software, triggering the conversion via the plug-in menu. The plug-in calls the core library, using the CAD software's own in-memory model or file for parsing (or still calling OCCT). After conversion, the PBZ file is saved or directly sent to the collaborative platform.

[0141] Advantages: Seamless integration into the design environment, ensuring uninterrupted designer workflow.

[0142] Form 2: Network server providing remote call interface

[0143] Implementation: Package the system as a standalone service process, providing a RESTful API (e.g., POST / api / v1 / convert). Use a web framework (e.g., Python Flask, Java Spring Boot) to handle HTTP requests, encapsulating functions such as file upload, parameter parsing, task scheduling, asynchronous conversion, and result download.

[0144] Workflow: Clients (such as web front-ends and other applications) upload the STEP file and configuration parameters via the HTTP protocol. The server places the task in a queue, where a background worker process executes the conversion pipeline. Upon completion, the PBZ file is stored on the server or object storage, and a download link is returned via API.

[0145] Advantages: Cross-platform, easy to integrate, supports multi-user and remote collaboration.

[0146] Type 3: Cloud service platform supporting elastic scaling

[0147] Implementation: Building upon Phase 2, a comprehensive cloud-native transformation is implemented. The transformation engine is containerized (Docker) and orchestrated using Kubernetes. Message queues (such as RabbitMQ and Kafka) are introduced to decouple request reception from task processing, object storage (such as AWS S3 and MinIO) is used to persist files, and a database records task status.

[0148] Workflow: Users submit tasks through the cloud service portal or API. Upon receiving the request, the gateway publishes the message to a queue. An elastically scalable cluster of Worker Pods consumes the message; each Pod runs a transformation engine instance, pulls input files from object storage, processes them, and writes the results back. Users can query the task status and download the results.

[0149] Advantages: It has extremely high availability, scalability and concurrent processing capabilities, and can meet the needs of enterprise-level large-scale, high-concurrency model conversion.

[0150] Through modular implementation and flexible deployment, the system described in this invention can seamlessly integrate the efficient and high-fidelity lightweight conversion capability of CAD models into various industrial software ecosystems, ranging from personal design workstations to large enterprise cloud environments.

[0151] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A lightweight conversion method for CAD models, characterized in that, Includes the following steps: S1: Parsing: Parses the input STEP format CAD model file to extract the boundary geometric data, topological data, and product assembly relationship data of the model; S2: Intermediate Transformation: The extracted geometric data, topological data, and product assembly relationship data are transformed and organized into a structured intermediate data representation that is independent of a specific geometric kernel; S3: Serialization: Using a predefined protobuf message structure, the intermediate data representation is serialized into a compact binary data stream; S4: Compression: Adaptively compress the binary data stream to generate a compressed lightweight model file.

2. The lightweight conversion method for CAD models according to claim 1, characterized in that: Step S1 specifically includes: S11: Use the geometry kernel library to parse the STEP format CAD model file and obtain its accurate geometric model based on the boundary representation method; S12: Discretize the NURBS surface in the precise geometric model according to the preset discretization precision parameters and convert it into a triangular mesh representation; S13: During and after the discretization process, the original parametric geometric definitions of the edges in the precise geometric model are extracted and retained simultaneously. The parametric geometric definitions include mathematical definition parameters of straight lines, circular arcs, or spline curves. S14: Extract the product assembly structure tree and the relative transformation relationships between components from the STEP format CAD model file.

3. The lightweight conversion method for CAD models according to claim 2, characterized in that: The discrete precision parameter is a user-configurable parameter, and its value ranges from 0.001 mm to 0.1 mm. And / or, the discretization process employs an adaptive discretization algorithm, dynamically adjusting the density of the triangular mesh based on the local curvature of the surface.

4. A lightweight conversion method for CAD models according to claim 2 or 3, characterized in that: In the S2 intermediate conversion step, the generated structured intermediate data is represented in JSON format; The intermediate data represents at least: The geometric data segment is used to store the vertex coordinate array, normal vector array, and face index array of the triangular mesh; The edge data segment is used to store the type of the model edge and its corresponding geometric parameters in a parametric form. The structured data segment is used to store the assembly relationships of the product and the relative transformation matrices between the components in a tree or hierarchical form.

5. The lightweight conversion method for CAD models according to claim 1, characterized in that: The S3 serialization step is implemented using the Protocol Buffers protocol; Specifically, this includes: predefining a protobuf message structure corresponding to the intermediate data representation structure, wherein the protobuf message structure includes at least a GeometryData message for encapsulating geometric data, an Edge message for encapsulating edge data, and a CADModel message for encapsulating the overall model; using the protobuf message structure to convert the intermediate data into a binary sequence, wherein the packed=true encoding option is enabled for repeated numerical fields storing vertex coordinates, normal vectors, or indices.

6. The lightweight conversion method for CAD models according to claim 4, characterized in that: In the protobuf message structure used in the S3 serialization step, The vertex coordinate array is differentially encoded to store the coordinate differences between adjacent vertices instead of their absolute coordinate values; And / or, perform triangle striping encoding on the facet index array to reorganize the independent triangle list into a continuous triangle striping sequence.

7. The lightweight conversion method for CAD models according to claim 1, characterized in that: The S4 compression step uses GZIP compression based on the DEFLATE algorithm; The method for selecting the compression level includes: adaptively selecting the GZIP compression level according to a preset decision logic; the input parameters of the decision logic include at least the size of the binary data stream and the precision requirements associated with the target application scenario; The accuracy requirements include high accuracy, medium accuracy, or low accuracy; The decision logic is as follows: when the data stream size is less than or equal to the first threshold and the accuracy requirement is high, the first compression level is selected; when the data stream size is between the first threshold and the second threshold and the accuracy requirement is medium, the second compression level is selected; when the data stream size is greater than the second threshold and the accuracy requirement is low, the third compression level is selected; wherein, the first threshold is less than the second threshold, the first compression level is higher than the second compression level, and the second compression level is higher than the third compression level.

8. A lightweight CAD model conversion system for implementing the method as described in any one of claims 1-7, characterized in that: It includes a conversion engine module, a data processing module, a serialization module, and a compression and packaging module; The conversion engine module is used to parse the input STEP format CAD model file, extract the boundary representation geometric data, topological structure data and product assembly relationship data of the model, and discretize the NURBS surface into a triangular mesh representation with configurable discretization precision, while retaining the parametric geometric definition of the model edge lines; The data processing module is used to convert and organize the data output by the conversion engine module into an intermediate representation format with a predefined structure. The serialization module is used to serialize the intermediate representation format into a binary data stream using a predefined protobuf message structure, and to apply differential encoding to the vertex coordinate data and triangle striping encoding to the triangle facet index data. The compression and encapsulation module is used to adaptively select the GZIP compression level for compression based on the size of the binary data stream and the target precision scenario, and encapsulate it to generate a PBZ format file.

9. A lightweight CAD model conversion system according to claim 8, characterized in that: The conversion engine module is implemented based on the Open CASCADE Technology geometry kernel; the intermediate representation format is JSON, and its structure includes at least geometric data segments, parameterized edge data segments, and hierarchical product structure data segments.

10. A lightweight CAD model conversion system according to claim 8, characterized in that: The system is deployed and provided in any of the following forms: a plug-in module integrated into computer-aided design software, a network server providing a remote call interface, or a cloud service platform that supports elastic scaling.

Citation Information

Patent Citations

  • Three-dimensional object recognition method and device and storage medium

    CN110232326A

  • Abnormality sign diagnosis apparatus and abnormality sign diagnosis method

    US20210027556A1