A cross-type measurement label generation method for a web three-dimensional engineering model

By combining predefined measurement modes with the WASM-based CAD kernel, precise measurement and dynamic annotation of multi-topology combinations in Web 3D engineering models are achieved, solving the problems of insufficient measurement accuracy and smooth interaction in existing technologies, and ensuring the accuracy and consistency of measurement results.

CN123049689APending Publication Date: 2026-11-06YUTUO ZHIYUAN (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611195592.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-07
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing Web-based 3D engineering model viewers cannot accurately measure various topological combinations, and the measurement results have large deviations on curved surfaces, non-planar boundaries, or complex assemblies. They also have poor interactive smoothness, insufficient correlation between annotations and model space, and difficulty in guaranteeing data consistency and reliability.

Method used

The order of picking topology objects is controlled by a predefined measurement mode configuration table. The WASM-side CAD kernel is used for precise picking and distance calculation, generating and projecting labeled objects to achieve the unification of topology-level precise measurement and dynamic visual labeling.

Benefits of technology

It achieves high precision and smooth interaction across different measurement types, ensuring that measurement results are automatically updated with viewpoint and zoom. The labeled objects are tightly bound to the model space, avoiding label deviation and data loss, and improving the efficiency and reliability of engineering design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123049689A_ABST
    Figure CN123049689A_ABST
Patent Text Reader

Abstract

This invention discloses a cross-type measurement annotation generation method for Web 3D engineering models, belonging to the field of Web 3D CAD visualization and geometric measurement technology. It includes: measurement mode configuration and slot sequence management, precise topology object picking, measurement calculation and result return, annotation object generation and dynamic projection drawing, and 2D hit detection and annotation interactive management. This invention uses a predefined measurement mode configuration table to control the topology object picking order according to the user-selected mode; it performs precise picking through the WASM-side CAD kernel and returns spatial points and status information; after picking, the kernel calculates measurement results such as distance based on the real topology; it generates annotation objects based on the results and projects them onto a 2D overlay layer for dynamic drawing; finally, it performs hit detection on the overlay layer annotations to achieve interactive management, realizing the unification of topology-level precise measurement and dynamic visual annotation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Web 3D CAD visualization and geometric measurement technology, and in particular to a method for generating cross-type measurement annotations for Web 3D engineering models. Background Technology

[0002] In scenarios where viewing and interacting with 3D engineering models on the Web (World Wide Web), common implementation solutions typically only support simple straight-line distance measurements between two points, and the measurement results are mostly presented in the form of pop-ups, side panels, or static text lists, lacking visual annotations that are bound to the spatial orientation of the model.

[0003] Users actually need to measure distances for various topological combinations such as point-to-point, point-to-edge, point-to-face, and edge-to-edge. However, most existing web viewers can only perform approximate calculations for mesh vertices or picked points, failing to utilize the inherent BREP (Boundary Representation) topological information of CAD (Computer-Aided Design) models. This results in significant deviations in measurement results on curved surfaces, non-planar boundaries, or complex assemblies. To obtain more accurate data, some solutions delegate all geometric calculations to the server. The user sends coordinates to a remote server after clicking, and the CAD kernel calculates and returns the results. While this ensures accuracy, each interaction requires a network round trip, significantly increasing latency for continuous picking, real-time dragging, or large model scenarios, severely weakening the smoothness of the interaction. Other solutions rely entirely on general-purpose graphics libraries like Three.js to measure triangular meshes on the front end. However, after meshing, the model loses its original surfaces, boundaries, and topological adjacency relationships, making it impossible to distinguish the true geometric properties of edges and faces. Therefore, it cannot support measurement types requiring topological recognition, and the insufficient mesh accuracy easily leads to numerical deviations. More critically, existing technologies distribute model downloading and loading, WASM (WebAssembly) module initialization, geometric calculations, user interaction, 3D rendering, and session state management across different modules or services, lacking a unified collaborative control mechanism and state machine management. In practical engineering applications, users often need to perform multiple different types of measurements on the same model consecutively and associate the results with engineering parameters, file versions, and review contexts. However, due to the loose data transfer between modules, measurement results cannot automatically update their screen projection position with viewpoint rotation, translation, or scaling, nor can they be selected, dragged, deleted, or batch-managed as interactive annotation objects. Once the window size or model viewpoint changes, the generated annotations often deviate from their original spatial positions, or even completely move out of view without being indicated, leading to a decrease in user trust in the results. Furthermore, after refreshing the page or switching sessions, the association between annotations and model and geometric parameters is easily lost, failing to guarantee the consistency of engineering data. Repeated measurements and erroneous decisions occur frequently, hindering the efficiency and reliability of web-based 3D engineering collaborative design. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method for generating cross-type measurement annotations for Web 3D engineering models. This method can control the picking order of topological objects according to the mode selected by the user through a predefined measurement mode configuration table; accurately pick objects through the WASM-side CAD kernel and return spatial points and status information; after picking, the kernel calculates measurement results such as distance based on the real topology; generates annotation objects based on the results and projects them onto a 2D overlay layer for dynamic drawing; finally, performs hit detection on the overlay annotations to achieve interactive management, thus realizing the unification of topology-level accurate measurement and dynamic visual annotation.

[0005] On the one hand, a method for generating cross-type measurement annotations for Web 3D engineering models is provided. This method includes: Step S1, pre-defining and storing a measurement mode configuration table; responding to the current measurement mode selected by the user from the interface; controlling the topological object type to be picked for each click on the 3D canvas according to the picking object type sequence corresponding to the current measurement mode; and recording the object type number required for each picking according to the slot order; Step S2, when the user clicks on the 3D canvas, obtaining the screen coordinates from the browser event, converting the screen coordinates to CAD canvas coordinates, and passing in the corresponding object type number for precise picking; and returning the unique identifier of the picked object, the actual spatial 3D picking point coordinates, and picking success or error status information; repeating Step S2 until measurement... All slots required for the pattern are successfully picked; Step S3: After all slots are picked, all picked object identifiers and spatial point information are transmitted to the WASM-side CAD kernel. Distance calculation is performed based on the real topological geometry data of the engineering model to obtain measurement results including the shortest distance value, the first nearest spatial point, and the second nearest spatial point. The measurement results are then returned to the front end; Step S4: Based on the measurement results, a measurement annotation object is generated on the front end. Each spatial point in all current measurement annotation objects is projected from the three-dimensional world coordinates to the current two-dimensional screen coordinates. Based on the projection results, it is drawn on the two-dimensional overlay layer; Step S5: All drawn annotation graphics are hit-detected. The two-dimensional distance from the mouse cursor position to each annotation point mark and annotation line segment is calculated in real time to determine whether the annotation has been hit.

[0006] Beneficial effects The beneficial effects of the technical solutions provided by the embodiments of the present invention include at least the following: By pre-configuring a measurement mode configuration table containing multiple types of topology picking sequences to constrain the picking process, and relying on the WASM built-in OCCT kernel to read the original BREP topology data of the engineering model, accurate ray intersection picking and geometric distance calculation are completed. This completely overcomes the shortcomings of existing Web 3D solutions, which can only approximate calculations based on mesh vertices and have insufficient accuracy for multi-type measurements across points / edges / faces. At the same time, all geometric calculations are performed locally in the browser's WASM. With the environment set up, frequent network requests to the server are eliminated, reducing interaction latency in scenarios involving continuous measurement, large assembly models, and real-time viewpoint dragging, while maintaining both measurement accuracy and operational smoothness. This invention unifies the management of pick slot indexes, pick caches, measurement annotation object sets, and 2D overlay rendering logic. It utilizes a camera matrix to perform real-time projection transformations of 3D spatial points to 2D screen coordinates, periodically redrawing annotations when the viewpoint rotates, zooms, or the browser window size changes. Only valid projection points within the visible range are rendered with point markers, measurement line segments, and dimension text labels. The original 3D measurement data is stored independently and unaffected by layer clearing operations, solving the problems of misalignment between annotations and model space, annotation failure after viewpoint changes, and easy loss of measurement data in traditional solutions. Furthermore, it refines the annotation graphics within the 2D overlay layer. The method utilizes Euclidean distance and perpendicular distance detection to filter unique target annotations based on the minimum comprehensive hit distance. It also provides interactive capabilities such as highlighting, cursor style switching, and selection editing and deletion. This allows for direct control of 3D measurement annotations from a 2D canvas, overcoming the limitations of existing technologies that can only clear annotations globally and cannot manage individual annotations in a refined manner. The entire method employs an ordered slot picking logic to automatically guide users to complete the selection of multiple topological objects step by step. If picking fails, the current slot is retained and can be clicked again. After picking is completed, the kernel is automatically triggered to calculate and generate standardized annotation objects with complete spatial points, style parameters, and distance values. All processes rely on a unified front-end state container for linkage scheduling, fully preserving the measurement topology parameters, 3D spatial coordinates, and annotation relationships, ensuring the reproducibility of measurement data in engineering drawing review and dimension verification scenarios. Attached Figure Description

[0007] Figure 1 A flowchart illustrating a method for generating cross-type measurement annotations for a Web-based 3D engineering model, as provided in this application embodiment; Figure 2 This is a functional architecture diagram of a cross-type measurement annotation generation method for Web 3D engineering models provided in an embodiment of this application. Detailed Implementation

[0008] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0009] like Figure 1The diagram shown is a flowchart of a method for generating cross-type measurement annotations for a Web 3D engineering model according to an embodiment of this application. The method includes the following steps: Step S1: Predefine and store the measurement mode configuration table. In response to the current measurement mode selected by the user from the interface, control the topological object type to be picked by the user on the 3D canvas for each click according to the picking object type sequence corresponding to the current measurement mode, and record the object type number required for each picking according to the slot order.

[0010] It should be noted that the measurement mode configuration table records a variety of measurement modes, each measurement mode corresponds to a sequence of picking object types, the picking object types include at least one of point, edge, and surface, and the measurement mode includes at least one or more combinations of point-to-point measurement, point-to-edge measurement, point-to-surface measurement, and edge-to-edge measurement; The specific process for recording the object type number required for each pickup according to the slot order is as follows: In the measurement mode configuration table, each measurement mode also stores a total number of picking slots and a serial number for each slot. Each slot serial number is associated with a predefined object type number, which is used to uniquely identify one of the three topological object types: point, edge, and face. In response to the current measurement mode selected by the user, the front end reads the total number of picking slots corresponding to the mode and the object type number corresponding to each slot from the measurement mode configuration table, and stores the object type number in an ordered array in ascending order of slot number, and initializes the current valid slot index CurSlot to 0; Each time a user performs a click operation on the 3D canvas, the front end determines whether the current valid slot index CurSlot is less than the total number of slots to be picked.

[0011] The specific process for determining whether the current valid slot index CurSlot is less than the total number of slots to be picked is as follows: If CurSlot is greater than or equal to the total number of pick slots, it means that all slots have been picked up and the current click pick operation will no longer be responded to; if CurSlot is less than the total number of pick slots, the element value with index CurSlot is read from the ordered array SlotTypeList and used as the object type number TypeId required for this pick. The front end sends the object type number (TypeId) along with the CAD canvas coordinates converted from the currently clicked screen coordinates to the picking interface of the WASM-side CAD kernel. The WASM-side CAD kernel then filters the picking results based on the object type number (TypeId) and only returns the topology objects that match the object type number. After a successful pickup, the front-end increments the value of the current valid slot index CurSlot by 1 and checks whether CurSlot equals the total number of slots picked. Specifically: If the CurSlot is less than the total number of pick slots, the user is prompted with the type of object to be picked in the next slot; if the CurSlot is equal to the total number of pick slots, it is determined that all slots have been picked and the measurement calculation process is triggered. If picking fails in the current slot, the front end does not increment the value of CurSlot and returns an error message, allowing the user to re-execute the picking operation in the current slot until a topology object matching the object type number is successfully picked. Then, CurSlot is incremented and the user moves to the next slot.

[0012] In this embodiment, a measurement mode configuration table is pre-built and persistently stored. This configuration table pre-stores four commonly used engineering measurement modes: point-to-point measurement mode, point-to-edge measurement mode, point-to-surface measurement mode, and edge-to-edge measurement mode. Each measurement mode is independently bound to an ordered sequence of exclusive pick object types. The pick objects are distinguished only by three types of topological elements: points, edges, and faces. A unique object type number is assigned to each of these three types of topological elements, with number 0 representing a point, number 1 representing an edge, and number 2 representing a face. For each measurement mode, the configuration table synchronously stores the total number of pick slots corresponding to that mode and the unique sequence number of each pick slot. Each slot sequence number is bound one-to-one with a fixed object type number, serving as the underlying rule for constraining user pick behavior. Specifically, the point-to-point measurement mode has a total of 2 pick slots, with slot sequence number 0 bound to object type number 0, slot sequence number 1 bound to object type number 0, and the complete pick sequence is [point, point]. The point-to-edge measurement mode has a total of 2 pick slots, with slot sequence number 0... Bind ID 0, Slot ID 1. Bind ID 1, the picking sequence is [point, edge]; Point-face measurement mode picks a total of 2 slots, slot ID 0 is bound to ID 0, slot ID 1 is bound to ID 2, the picking sequence is [point, face]; Edge-edge measurement mode picks a total of 2 slots, slot ID 0 is bound to ID 1, slot ID 1 is bound to ID 1, the picking sequence is [edge, edge]. When a user selects any measurement mode through a drop-down menu or function button on the web front-end interface, the front-end program reads all configuration parameters corresponding to that mode from the measurement mode configuration table in real time. It extracts the total number of pick slots and the object type number corresponding to each slot number. According to the slot number in ascending order, the object type numbers associated with each slot are stored in an ordered one-dimensional array named SlotTypeList. At the same time, a global variable, CurSlot, is defined and initialized to 0 to mark the target slot that the user needs to complete the pick operation. After the initialization configuration is completed, the front-end continuously listens for mouse click interaction events in the 3D canvas area. Whenever a user performs a click pick operation on the 3D canvas, it first calls the global variable CurSlot and compares it with the total number of pick slots in the current measurement mode. If the value of CurSlot is greater than or equal to the total number of pick slots, it means that all topology object slots in this measurement mode have been effectively picked. The front-end directly ignores this mouse click behavior and does not send any pick request to the WASM CAD kernel.If the current CurSlot is less than the total number of pick slots, the element with the array index equal to the CurSlot position is read from the ordered array SlotTypeList. This value is defined as the object type ID (TypeId) corresponding to this pick operation. Simultaneously, the front-end performs the conversion from screen click coordinates to CAD canvas coordinates. The converted standardized CAD canvas coordinates, the current slot number (CurSlot), and the object type ID (TypeId) are encapsulated into a standard pick request parameter package and transmitted to the dedicated pick interface of the CAD kernel deployed in the browser's WASM runtime environment. During the ray intersection pick operation, the WASM CAD kernel filters all candidate topological objects that match the input TypeId, retaining only geometric objects whose topological type exactly matches the TypeId as valid pick results and returning them to the front-end. Other point, edge, and face elements with mismatched types are automatically blocked to prevent users from mistakenly picking non-target topological structures. When the WASM CAD kernel reports a successful pick status, the front-end increments the CurSlot by 1. The process involves comparing the updated CurSlot with the total number of pick slots: If the incremented CurSlot value is still less than the total number of pick slots, the front-end immediately displays the type of topology object corresponding to the next pick slot to be selected through a combination of interface text pop-ups, mouse cursor style switching, and function bar prompts, guiding the user to perform the next canvas click operation; if the incremented CurSlot value is exactly equal to the total number of pick slots, it is determined that all topology slots required for the current measurement mode have been selected compliantly, and the front-end automatically jumps to the WASM CAD kernel geometric distance calculation process to start multi-topology high-precision measurement calculation; if the WASM CAD kernel returns a pick failure status code, the front-end will not increment the current valid slot index CurSlot, keeping the CurSlot value unchanged, and simultaneously pushes a corresponding text error message to the user based on the failure reason code returned synchronously by the kernel, such as "Currently, edge objects need to be picked, please click the model edge again" or "No topology elements were hit, please click the model entity area again". Upon receiving the prompt message, the current slot remains locked. Users can repeatedly initiate click-and-pick operations on the 3D canvas until the WASM CAD kernel returns a valid topology object matching the current TypeId, and the picking process is deemed successful. Only then will the CurSlot auto-increment logic be executed, and the user be switched to the next picking slot. The entire process relies on the measurement mode configuration table and ordered slot array to standardize and constrain the user's picking order and object type, achieving ordered, standardized, and guided interactive picking for multi-topology combination measurements across points, edges, and surfaces.

[0013] Step S2: When the user clicks on the 3D canvas, obtain the screen coordinates from the browser event, convert the screen coordinates to CAD canvas coordinates, and pass in the current slot number, CAD canvas coordinates, and the object type number corresponding to the current slot for precise picking. Then, return the unique identifier of the picked object, the actual 3D picking point coordinates in space, and the picking success or error status information. Repeat step S2 until all slots required by the measurement mode are successfully picked.

[0014] It should be understood that the specific process until all slots required for the measurement mode are successfully picked up is as follows: The browser event listener mechanism captures the user's click operation on the 3D canvas, extracts the screen coordinates of the mouse pointer relative to the canvas viewport from the click event, converts the screen coordinates into standardized device coordinates according to the ratio between the actual pixel size of the 3D canvas and the CAD viewport size, and maps the standardized device coordinates into two-dimensional coordinates in the CAD canvas coordinate system by combining the projection matrix of the current 3D camera and the viewport transformation parameters. The front end reads the element value with index CurSlot from the ordered array SlotTypeList corresponding to the current measurement mode as the object type number required for the current slot, and assembles the current slot number CurSlot, CAD canvas coordinates and object type number into pick request parameters, and initiates a pick request to the WASM-side CAD kernel by calling the pick interface exposed by the WASM-side CAD kernel. After receiving the pick request parameters, the WASM-side CAD kernel verifies whether the current engineering model has been successfully loaded into memory. If the model has not been loaded, it directly returns an error status message. If the model has been loaded, it determines the topological object type to be picked based on the object type number, and performs intersection calculations along the line of sight in the BREP topological data structure of the engineering model using a ray intersection algorithm. During the intersection process, only objects whose topological type matches the object type number are included in the pick candidate set, and the closest object to the viewpoint is selected from the candidate set as the pick result.

[0015] The process of successfully picking up all slots required for the measurement mode also includes: The WASM-side CAD kernel encapsulates the picking result into a return data packet, which includes: a globally unique identifier of the picked object, the coordinates of the actual three-dimensional intersection point of the ray and the object surface, and a status code indicating whether the picking was successful; if the picking fails, the globally unique identifier and the intersection point coordinates are set to null values, and the status code carries a specific failure reason code. After receiving the pickup result data packet returned by the CAD kernel of the WASM terminal, the front end parses the status code: if the status code indicates that the pickup failed, the front end outputs the corresponding error message to the user according to the failure reason code, keeps the value of the current valid slot index CurSlot unchanged, and restores the interactive state to allow the user to re-execute the click pickup operation in the current slot; If the status code indicates successful pickup, the front end extracts the globally unique identifier and the actual three-dimensional intersection coordinates of the picked object from the returned data packet. The extracted data is then stored in the front end's pickup result cache array according to the current slot number (CurSlot). Simultaneously, the value of the current valid slot index (CurSlot) is incremented by 1. Finally, it is determined whether CurSlot equals the total number of pickup slots in the current measurement mode. If the CurSlot is less than the total number of pick slots, the object type number required for the next slot is obtained, and the user is informed of the object type of the next pick target through interface prompts or cursor style changes, and the user is waited to perform the next click pick operation. If CurSlot equals the total number of slots picked, then all slots required for the current measurement mode have been successfully picked.

[0016] In this embodiment, the point-edge measurement mode of the mechanical assembly STEP model is used as an example to fully explain the entire picking process. The front-end page continuously registers mouse click listener events. When the operator clicks the mouse in the 3D model canvas area, the browser click event will synchronously output the original screen pixel coordinates (screenX, screenY) of the mouse pointer relative to the origin of the top left corner of the canvas viewport. The front-end first reads the width and height pixel dimensions of the 3D canvas DOM elements and the standardized CAD viewport logical dimensions defined inside the WASM CAD kernel, calculates the horizontal and vertical scaling factors of the two, and uses the scaling factors to convert the pixel-level screen coordinates into standardized device NDC coordinates with values ​​in the range of [-1,1]. Then, it reads the projection matrix and viewport translation and scaling transformation parameters updated in real time by the current 3D camera, substitutes the standardized device coordinates into the coordinate mapping calculation formula, and calculates the 2D logical coordinates of the CAD canvas that are adapted to the OCCT kernel calculation rules. This completes the unified conversion from the front-end screen coordinates to the CAD calculated coordinates, eliminating the coordinate offset error caused by the browser canvas size adaptation. After completing the coordinate conversion, the front-end reads the current point-edge measurement mode of the 3D model canvas. The ordered array SlotTypeList bound to the edge measurement mode reads the stored value whose index equals the current valid slot index CurSlot as the object type TypeId for this pickup. Assuming the initial value of the current CurSlot is 0, the corresponding TypeId is 0, meaning only the topology of the pickup point is allowed. Then, the front end packages the current slot number CurSlot, the converted 2D coordinates of the CAD canvas, and the object type number TypeId into a structured pickup request JSON data packet, and calls the pickMeasurementSlotJson pickup interface pre-mounted in the global environment of the WASM CAD kernel to transmit the data packet to the OCCT geometry kernel module running in the browser sandbox. After receiving the pickup request data packet, the first step of the WASM CAD kernel is to execute the memory verification logic to check whether the loading and instantiation of the STEP model BREP boundary topology data of this project has been completed in the memory space. If the model is not loaded, the file parsing fails, or the memory resources are insufficient, the failure data packet is directly packaged and sent back to the front end; if the model loading is normal, the input TypeId is used to determine the type of the pickup request request. This time, only the corresponding topology type is identified. An infinitely extending projection ray is emitted along the current camera's line of sight. The ray intersection operation is performed by traversing the complete BREP entity topology. During the traversal, all intersecting geometries whose topology type does not match the TypeId are filtered out. Only the intersecting objects with the matching type are stored in a temporary picking candidate set. Then, the straight-line distance from all intersection points in the candidate set to the camera's viewpoint is compared, and the intersecting entity closest to the viewpoint is selected as the only valid result for this picking.After the WASM CAD kernel completes the picking calculation, it assembles a standard return data packet. This data packet contains three core fields: the globally unique identifier (objUUID) of the picked topology object, the 3D world coordinates (x, y, z) of the intersection point between the ray and the model surface, and a numerical status code (code) to distinguish the operation result. If the picking fails due to a lack of valid ray intersection, a mismatch in topology type, or a model anomaly, the objUUID and the 3D intersection coordinates in the data packet are all set to empty. Simultaneously, the status code carries a detailed fault code, such as code 1 representing no entity hit, code 2 representing a mismatch between the picked topology type and the current slot requirement, and code 3 representing a model memory loading error. After receiving the complete data packet from the kernel, the front-end prioritizes parsing the status code (code) for branch processing. If the code is identified as a failure fault code, the front-end matches a preset fault prompt message and displays the corresponding reminder in a pop-up window. For example, code 2 might display a prompt such as "The current slot requires picking a point element; please click on the model vertex," while maintaining the current valid slot index (CurSlot) throughout the process. The numerical value remains unchanged, and the canvas interaction logic is not locked. The operator can repeatedly click the canvas in the current slot to re-initiate the picking. If the status code indicates that the picking operation is successful, the front end extracts the objUUID and the coordinates of the 3D intersection point from the data packet. Using CurSlot as the array index, the two sets of data are stored in the PickResultCache array maintained globally by the front end for permanent storage. Then, the CurSlot is incremented by 1, and the updated CurSlot is compared with the total number of picking slots preset in the current measurement mode. Taking the point-edge measurement mode in this embodiment as an example, its total number of slots is 2. After the first picking is completed, CurSlot is updated from 0 to 1. 1 is less than 2. The front end reads the TypeId=1 (edge ​​topology) corresponding to index 1 in SlotTypeList, and synchronously changes the mouse cursor to a special style with an edge identifier. A light-colored prompt text "Please pick the model edge" pops up above the canvas. The system enters a waiting listening state to receive the user's next click operation.After the user completes edge picking and the kernel returns a success data packet, CurSlot increments to 2. At this point, CurSlot is exactly equal to the total number of slots, which is 2. The system automatically determines that all topology slots in the current point-edge measurement mode have been picked up in compliance with regulations, terminates the picking interaction process, and automatically calls the WASM CAD kernel measurement interface to enter the high-precision calculation stage of multi-topology distance. The entire process relies on browser native events, standardized coordinate transformation, WASM-side BREP ray filtering picking, front-end state caching, and slot loop verification linkage. Throughout the process, each click is constrained to pick only the specified topology type of the current slot, avoiding cross-type mispicking. At the same time, it relies on detailed fault codes to accurately reflect the reasons for picking anomalies, guiding operators to complete the picking of all slots in a standardized manner, ensuring the orderliness, accuracy, and user-friendliness of the pre-measurement picking stage.

[0017] Step S3: After all slots have been picked up, all picked object identifiers and spatial point information are transmitted to the WASM-side CAD kernel. Distance calculation is performed based on the actual topological geometry data of the engineering model to obtain the measurement results, and the measurement results are returned to the front end. The measurement results include the shortest distance value, the first nearest spatial point, and the second nearest spatial point.

[0018] To illustrate the complete process, using a point-to-surface measurement scenario for mechanical STEP parts as an example, after the front-end program determines that all pick slots in the current measurement mode have been picked up compliantly, the front-end reads the complete pick data sequentially from the global pick result cache array PickResultCache, in ascending order of slot number. This includes the globally unique identifier of the vertex object picked in the first slot, the coordinates of the 3D vertex formed by the ray intersection, and the globally unique identifier of the planar topology object picked in the second slot, the coordinates of the 3D landing point where the ray intersects the plane. All the unique identifiers of the picked objects and the coordinates of the actual 3D intersection points corresponding to each group of objects are uniformly encapsulated into a structured measurement calculation request data packet, which is then completely transmitted to the OCCT CAD kernel in the browser's WASM runtime environment through a pre-registered function interface. After receiving the computation request data packet, the kernel directly reads the original BREP boundary expression topological complete geometric data of the part that has already been loaded into memory, instead of relying on a lightweight discrete triangular mesh approximation model for computation. The kernel locates the corresponding complete geometric entities in the model memory based on two sets of topological object identifiers within the data packet, extracts the precise spatial geometric definition of the first set of point topology and the complete surface boundary equations of the second set of surface topology, and calls the OCCT's built-in topological shortest distance solution algorithm to perform precise analytical geometric calculations on the geometric constraints between discrete points and infinite planes. The entire process relies on the original CAD topological parameters for approximation-free solution, avoiding problems such as dimensional deviations and surface errors caused by traditional front-end mesh sampling calculations. After the computation is completed, the kernel automatically generates a standardized measurement result data packet, which serves as the measurement result g. The data package contains three core data categories. The first category is the actual geometric shortest distance between two sets of topological entities, with units consistent with the original engineering model and accurate to six decimal places. The second category is the first nearest spatial point, which is the three-dimensional spatial coordinate point located on the first picked topological object and closest to the other set of topological entities. The third category is the second nearest spatial point, which is the three-dimensional spatial coordinate point located on the second picked topological object and closest to the first set of topological entities. The data package also includes a current measurement mode type identifier for the front end to distinguish the annotation style.The WASM CAD kernel encapsulates the complete measurement result data package and sends it back to the web frontend via the WASM-JS interaction channel. Upon receiving the data package, the frontend parses the data, extracts the shortest distance value to generate dimension display text, and extracts and stores the complete 3D world coordinates of the first and second nearest spatial points. These serve as the core foundational data for generating standardized measurement annotation objects and real-time projection of 3D spatial points into 2D visualization annotations. The entire calculation process relies on the WASM local CAD kernel to read the native BREP topology for accurate solving, eliminating the need to transmit interaction requests to a remote server. This ensures engineering-grade measurement accuracy while eliminating interaction lag and latency issues caused by network round trips. Simultaneously, it outputs paired matching nearest spatial points, providing a precise 3D benchmark for subsequent spatial binding rendering of line segments and point markers, ensuring that the measurement annotations strictly conform to the actual measured geometric position of the model.

[0019] Step S4: Based on the measurement results, generate a measurement annotation object on the front end, project each spatial point in all current measurement annotation objects from the three-dimensional world coordinates to the current two-dimensional screen coordinates, and draw on the two-dimensional overlay based on the projection results.

[0020] Furthermore, the measurement annotation object includes a unique identifier, display text content, specified color value, a list of spatial points (including at least the first nearest spatial point and the second nearest spatial point), a Boolean flag indicating whether to draw a line segment, and the shortest distance value. The measurement annotation object is stored in the front-end state management container, enabling it to be selected, deleted, or cleared completely. The specific process for drawing on the two-dimensional overlay layer is as follows: The front end maintains a collection of annotation objects to store all currently generated and not deleted measurement annotation objects. Each measurement annotation object contains a unique identifier, display text, color, a list of spatial points (containing at least two spatial points, corresponding to the first and second nearest points returned by the measurement calculation), whether to draw a line segment icon, and a distance value. When a new measurement annotation object is generated, the front end adds the object to the collection of annotation objects. By listening to camera transformation events and browser window size change events in the 3D scene, a redrawing process is triggered after each viewpoint change or window size change. The redrawing process includes: clearing all existing drawn content on the 2D overlay and traversing each measurement annotation object in the annotation object set.

[0021] The drawing on the two-dimensional overlay layer also includes: For the currently traversed measurement and annotation object, the front end sequentially retrieves the three-dimensional world coordinates of each spatial point from its spatial point list, calls the projection interface exposed by the WASM CAD kernel, and passes in the view matrix, projection matrix, and viewport size parameters of the current three-dimensional camera, performs the projection transformation calculation from three-dimensional spatial points to two-dimensional screen coordinates, and obtains the corresponding two-dimensional screen coordinates and projection depth values. After receiving the projection result returned by the WASM CAD kernel, it is determined whether the projection depth value is within the effective range between the near clipping plane and the far clipping plane of the 3D camera, and whether the 2D screen coordinates fall within the effective pixel range of the current canvas viewport. Specifically: If the projection depth value is not within the valid range or the two-dimensional screen coordinates are outside the valid range of the viewport, the spatial point is determined to have failed to be projected or is located outside the visible area. The drawing of the point is skipped, the invisible state of the point is recorded, and the next spatial point of the labeled object is processed. If the projection depth value is within the valid range and the two-dimensional screen coordinates fall within the valid range of the viewport, then the spatial point is determined to be successfully projected and located within the current visible area. The front end stores the two-dimensional screen coordinates into the temporary projection coordinate cache list of the current labeled object and draws them one by one on the two-dimensional overlay.

[0022] The drawing process on the two-dimensional overlay layer includes: drawing point markers, drawing line segments, and drawing text labels. The point marker drawing specifically involves: drawing a circular or square marker of a preset size at the two-dimensional screen coordinate position, using the color value stored in the measurement and annotation object, and precisely aligning the center of the marker with the two-dimensional screen coordinates; The line segment drawing process is as follows: read the LineFlag flag of the measurement and annotation object; if LineFlag is true and the current annotation object's projection coordinate cache list contains at least two valid projection coordinates, then connect adjacent valid projection coordinates in sequence according to the original order of the spatial points in the spatial point list to form one or more continuous line segments. The line segment color uses the color value, the line segment width is a preset value, and a text label displaying the distance value is added at the middle position or end of the line segment. The text label drawing specifically involves drawing the display text of the measurement annotation object at a preset pixel distance offset from the point mark position or the midpoint position of the line segment. The font, size, color, and background style of the text label use preset style parameters. After the 2D overlay is drawn, the front-end associates and stores the projection coordinate cache list of each annotation object in the current annotation object set with its corresponding annotation object ID. Specifically, when the 3D viewpoint or window size changes continuously, the front-end uses a frame animation mechanism or a timer mechanism to repeatedly trigger the redrawing process at a frequency of no less than a preset frame rate per second, ensuring that the annotation graphics on the 2D overlay are synchronized and updated in real time with the 3D scene. Before each redraw, the front-end clears all drawn content of the 2D overlay and resets the temporary projection coordinate cache list of all measured annotation objects to avoid display errors caused by residual old projection data. This clearing only affects the 2D overlay and does not affect the original 3D spatial coordinate data and measurement numerical data stored in the annotation object set.

[0023] In this embodiment, the process of generating annotations and simultaneously drawing a 2D overlay layer after completing a set of point-polygon topology measurements is used as an example for complete explanation. When the WASM CAD kernel sends back the complete measurement results containing the shortest distance value, the first nearest spatial point, and the second nearest spatial point to the front end, the front end program immediately generates a standardized measurement annotation object. This annotation object has a complete set of built-in attribute fields, including an automatically generated globally unique UUID string as a unique identifier, and a combination of the measurement type identifier and distance value displayed by splicing and combining the text content. For example, in a point-polygon measurement scenario, the text "Point-polygon distance: 28.650000mm" is generated. A preset configuration of a dedicated RGB color value, such as red (255,0,0), is used as the unified rendering color for this set of annotations. The spatial point list is stored in order with the 3D world coordinates of the first nearest spatial point and the 3D world coordinates of the second nearest spatial point output in this measurement. The Boolean flag LineFlag is set to true, indicating that the connecting line segment between the two points needs to be drawn. At the same time, the kernel output of 28.650000mm is completely retained. The shortest distance value is generated. After generation, the front end pushes the measurement annotation object to a collection of annotation objects in a globally unified state management container. This collection persistently stores all historical measurement annotations that have not been deleted by the user. Relying on the front end state manager, it enables three types of interactive operations: single annotation selection, single annotation deletion, and one-click clearing of all annotations. All original 3D geometric data of the annotations will not be lost due to layer redrawing or temporary page refresh. The front end continuously listens for 3D scene camera transformation events and browser window resize events. As long as the user drags the mouse to rotate, translate, or scale the 3D model, or drags the browser border to adjust the canvas display size, the system will immediately trigger a complete redrawing process. The first step of a single redrawing operation is to call the 2D Canvas. The interface for clearing the canvas over the annotation layer erases all markers, lines, and text rendered in the previous round on the layer. It also resets the temporary projection coordinate cache list of each measurement annotation object in the collection, clears the 2D screen coordinate data retained in the previous round, and only clears the layer rendering pixels and temporary cache. The core data stored inside the annotation object collection, such as the unique identifier, original 3D spatial points, distance values, colors, and drawing switches, are completely preserved without any modification. In the redrawing process, the front end loops through each measurement annotation object in the annotation object collection. For the annotation object corresponding to this point-to-surface measurement, it reads the 3D world coordinates of the first nearest spatial point and the second nearest spatial point in the spatial point list in turn, and passes them one by one to the 3D point projection interface opened by the WASM CAD kernel. At the same time, it simultaneously passes the currently updated camera view matrix, projection matrix, and canvas viewport width and height pixel parameters. The WASM CAD kernel completes the projection transformation calculation from 3D world coordinates to 2D screen coordinates and outputs the projection depth value corresponding to each set of points.After receiving the projection results returned by the kernel, the front-end performs a two-layer validity check. The first layer checks whether the projection depth value falls within the effective visible range defined by the near and far clipping planes of the camera. The second layer checks whether the converted 2D screen coordinates (horizontal and vertical axes) are within the pixel range of the canvas viewport. If the projection depth exceeds the limit or the coordinates exceed the canvas boundary, the spatial point is determined to be a failed projection and outside the field of view. The subsequent drawing steps for that point are skipped, and the point is marked as invisible in the temporary projection coordinate cache list. The front-end then reads the next 3D spatial point of the current annotation object and performs projection calculations. If both checks pass, the spatial point projection is valid and within the visible area. The front-end stores the set of 2D screen coordinates in the temporary projection coordinate cache list specific to this annotation object. After all points in this annotation have undergone projection verification, the front-end executes three types of rendering logic in sequence based on the valid coordinates in the cache list: point marker drawing, line segment drawing, and text label drawing. In the point marker drawing stage, a solid circular marker with a radius of 3 pixels is drawn centered on the verified 2D screen coordinates. The rendering color directly reads the preset red RGB of the annotation object. The value ensures that the center point of the marker completely coincides with the projection coordinates. In the line segment drawing process, the LineFlag boolean flag inside the annotation object is read first. In this embodiment, the flag is true, and there are two sets of valid two-dimensional coordinates in the temporary projection coordinate cache list. The projection coordinates of the first point and the second point are connected according to the original order of the spatial point list to generate a continuous straight line segment. The line segment uses the preset red color of the annotation and the line width is 2 pixels. The reserved position is used to attach the size text. The text label drawing selects the midpoint coordinates of the two-point projection line segment and offsets it 6 pixels in the positive Y-axis direction as the reference position for text drawing. The pre-stitched "point-to-surface distance: 28.650000mm" text is rendered and displayed. The preset 12-point black sans-serif font and semi-transparent white background color are used to ensure that the text is not obscured by the 3D model. After all the graphics of this annotation are rendered, the front end binds and stores the complete temporary projection coordinate cache list of this annotation with the unique UUID of the annotation for subsequent mouse hit detection reading. For the continuous perspective change scene caused by the user's continuous rotation and scaling of the model, the front end enables the timer frame animation mechanism, which is fixed at 60. The entire redrawing process is executed cyclically at a frequency of frames per second, continuously and synchronously updating the positions of all labeled graphics on the 2D overlay layer. This ensures that the labeled points, line segments, and text always move in real-time in sync with the 3D model's perspective, preventing issues such as misalignment, offset, or lingering afterimages between the labeled and the measured geometry. The entire process relies on precise projection from the 3D point kernel, dual-layer visibility filtering, independent layered rendering, and persistent storage of original labeled data. This completely solves the defects of traditional Web 3D tools, such as labeled failure, overlapping afterimages, and loss of measurement data after perspective switching. Simultaneously, it provides unified management and control over all labeled data, enabling refined editing and management.

[0024] Step S5: Perform hit detection on all drawn annotation graphics, calculate the two-dimensional distance from the mouse cursor position to each annotation point mark and annotation line segment in real time, and determine whether the annotation has been hit.

[0025] It is important to understand that the specific process for determining whether the label has been hit is as follows: The browser event listener mechanism captures mouse movement events within the 3D canvas and 2D overlay area, and extracts the current screen coordinates of the mouse pointer relative to the canvas viewport from the mouse movement events. Obtain all measurement annotation objects that are currently visible and have at least one spatial point successfully projected into the visible area from the set of annotation objects, and use them as the candidate annotation set for this hit detection; if the candidate annotation set is empty, skip the hit detection process and restore the cursor to the default style; For each candidate measurement label object in the candidate label set, calculate the two-dimensional distance from the current mouse position to the point marker and line segment of the label; where, the point marker distance is calculated by traversing the projection coordinate cache list of the label object for each projection point coordinate (projX, projY), and calculating the Euclidean distance from the mouse coordinates (mouseX, mouseY) to the projection point d_point_i = sqrt((mouseX - projX)). 2 + (mouseY - projY) 2 The minimum distance among all projected points is taken as the point marker distance d_point_min for this annotation. The projected coordinates of the point with the minimum distance and its index position in the spatial point list are recorded. Line segment distance calculation: The LineFlag flag of the annotation object is read. If LineFlag is true and the ProjectedPointList contains at least two valid projected points, then according to the order of the projected points in the list, adjacent two projected points P1(projX1, projY1) and P2(projX2, projY2) are taken to form a line segment. The perpendicular distance d_line_j from the mouse coordinates (mouseX, mouseY) to this line segment is calculated as follows: First, calculate vector V = P2 - P1 and vector W = mouse coordinates - P1. Calculate the projection parameter t = (W·V) / (V·V). If t ≤ 0, then d_line_j is equal to the Euclidean distance from the mouse to P1; if t ≥ 1, then d_line_j is equal to the Euclidean distance from the mouse to P2; if 0 < t < 0, then d_line_j is equal to the Euclidean distance from 0 to P2. 1. Then d_line_j is equal to the vertical distance from the mouse to the line segment |W×V| / |V|; after traversing all line segments, take the minimum value among all line segment distances as the line segment distance d_line_min of the label.

[0026] The obtained point marker distance is compared with the preset point hit threshold, and the obtained line segment distance is compared with the preset line segment hit threshold. The smaller value between the point marker distance and the line segment distance is taken as the comprehensive hit distance of the label, and the corresponding hit type is marked as point hit or line segment hit.

[0027] If the total hit distance is equal to the point marker distance and the point marker distance is less than the preset point hit threshold, then it is determined that the current mouse hover position hits the point marker area of ​​the labeled object, and the hit type of the label is recorded as point hit. If the total hit distance is equal to the line segment distance and the line segment distance is less than the preset line segment hit threshold, then it is determined that the current mouse hover position hits the line segment area of ​​the labeled object, and the hit type of the label is recorded as line segment hit. If the distance between the point marker and the line segment is greater than or equal to the preset point hit threshold and the distance between the line segments is greater than or equal to the preset line segment hit threshold, then it is determined that the current position of the mouse has not hit the marked object.

[0028] The determination of whether the label has been hit also includes: After traversing all the annotation objects in the candidate annotation set, sort all the annotation objects that are determined to be hit according to their comprehensive hit distance from smallest to largest, select the annotation object with the smallest comprehensive hit distance as the target hit annotation object at the current mouse position, and record its unique identifier ID and hit type; reset the hit status of all other annotation objects except the target hit annotation object to miss. The interface state is updated according to the judgment result. If a target hits the labeled object, the point mark and line segment of the target labeled object are drawn in a highlight style on the two-dimensional overlay layer. The highlight style includes at least one of changing the point mark size, changing the line segment width and changing the color. The mouse cursor style is switched to a hand pointer. Optionally, the distance value and text content of the labeled object are displayed floating in the interface. If no matched annotation objects are found, restore the default drawing style of all annotation objects and restore the mouse cursor to the default style. When the mouse moves out of the canvas area or leaves the 2D overlay area, clear the current target hit annotation object state, restore the default drawing style of all annotation objects, and restore the cursor to the default style; When a user clicks the mouse while the target is in the selected state, the front end triggers a selection state switch or attribute management operation for the selected object based on the unique identifier ID of the currently selected object. The front end then displays the detailed measurement data of the object and provides interactive controls for deletion, editing, or moving, thereby enabling visual interactive management of 3D measurement and annotation objects through a 2D overlay.

[0029] It's important to understand that a predefined measurement mode configuration table is used. Each mode contains a sequence of object types to be picked, such as point-to-point, point-to-edge, point-to-face, and edge-to-edge. After the user selects a mode, the front-end controls the topology type to be picked for the next click according to the sequence. Browser event coordinates are converted to CAD canvas coordinates, and the `pickMeasurementSlotJson` interface of the CAD runtime is called, passing in the slot number, canvas coordinates, and object type number to obtain the object name, actual spatial pick point, and error information. Once all required slots have been picked, `measureCurrentSelectionsJson` is called, and the CAD kernel calculates the distance, nearest point, second nearest point, etc., based on the actual topology, avoiding errors caused by front-end mesh approximation. Annotation objects are generated based on the measurement results. Each annotation object includes a unique ID, display text, color, list of spatial points, whether to draw line segments, and distance values. Annotation objects are stored in the front-end state and can be selected, deleted, or cleared. When the 3D viewpoint changes or the window size changes, `projectPointToCanvasJson` is periodically called to project spatial points onto the current canvas's 2D coordinates, drawing points, line segments, and labels on the overlay canvas. Drawing is skipped if the annotation point fails to project or is outside the field of view. Hit detection is performed on the overlay annotations, calculating the distance from the mouse point to the annotation point or line segment, allowing users to select and manage 3D measurement results on the 2D overlay.

[0030] like Figure 2 The diagram shows the functional architecture of a cross-type measurement annotation generation method for Web 3D engineering models provided in this application embodiment. It includes four execution layers from top to bottom: an interactive input layer, a CAD picking and calculation layer, an annotation management layer, and a measurement display layer. This constitutes a complete workflow for cross-type measurement annotation of Web 3D engineering models. First, the interactive input layer receives user canvas click points, completes screen-canvas coordinate transformation, and reads measurement mode parameters. Then, the CAD picking and calculation layer completes the step-by-step picking of point, edge, and face topology objects according to the slot order. After collecting all picked points, the WASM-CAD kernel is called to calculate the shortest distance and a pair of nearest spatial coordinate points based on BREP topology data. Next, the data is passed to the annotation management layer to generate dedicated measurement annotation objects, continuously performing projection calculations from 3D coordinates to the 2D screen, layer redrawing and rendering, and then mouse hit detection of the 2D layer, supporting the selection and deletion of various annotation objects. Finally, the measurement display layer completes the 3D point projection refresh, continuously rendering measurement marks, dimension lines, and text labels. The entire process is closed-loop, realizing the entire workflow of picking, kernel calculation, visualization drawing, and annotation interaction control.

[0031] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope and intent of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and variations.

Claims

1. A method for generating cross-type measurement annotations for Web-based 3D engineering models, characterized in that, Includes the following steps: Step S1: Predefine and store the measurement mode configuration table. In response to the current measurement mode selected by the user from the interface, control the topological object type that the user should pick with each click on the 3D canvas according to the picking object type sequence corresponding to the current measurement mode, and record the object type number required for each picking according to the slot order. Step S2: When the user clicks on the 3D canvas, obtain the screen coordinates in the browser event, convert the screen coordinates into CAD canvas coordinates, and pass in the corresponding object type number for precise picking. Then, return the unique identifier of the picked object, the actual 3D picking point coordinates in space, and the picking success or error status information. Repeat step S2 until all slots required by the measurement mode are successfully picked. Step S3: After all slots have been picked up, all picked object identifiers and spatial point information are transmitted to the WASM CAD kernel. Distance calculation is performed based on the real topological geometry data of the engineering model to obtain the measurement results, and the measurement results are returned to the front end. Step S4: Based on the measurement results, generate a measurement annotation object on the front end, project each spatial point in all current measurement annotation objects from the three-dimensional world coordinates to the current two-dimensional screen coordinates, and draw on the two-dimensional overlay based on the projection results. Step S5: Perform hit detection on all drawn annotation graphics, calculate the two-dimensional distance from the mouse cursor position to each annotation point mark and annotation line segment in real time, and determine whether the annotation has been hit.

2. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 1, characterized in that: The measurement mode configuration table records a variety of measurement modes. Each measurement mode corresponds to a sequence of picking object types. The picking object types include at least one of point, edge, and surface. The measurement mode includes at least one or more combinations of point-to-point measurement, point-to-edge measurement, point-to-surface measurement, and edge-to-edge measurement. The specific process for recording the object type number required for each pickup according to the slot order is as follows: In the measurement mode configuration table, each measurement mode also stores a total number of picking slots and a serial number for each slot. Each slot serial number is associated with a predefined object type number, which is used to uniquely identify one of the three topological object types: point, edge, and face. In response to the current measurement mode selected by the user, the front end reads the total number of picking slots corresponding to the mode and the object type number corresponding to each slot from the measurement mode configuration table, and stores the object type number in an ordered array in ascending order of slot number, and initializes the current valid slot index CurSlot to 0; Each time a user performs a click operation on the 3D canvas, the front end determines whether the current valid slot index CurSlot is less than the total number of slots to be picked.

3. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 2, characterized in that: The specific process for determining whether the current valid slot index CurSlot is less than the total number of slots to be picked is as follows: If CurSlot is greater than or equal to the total number of pick slots, it means that all slots have been picked up and the current click pick operation will no longer be responded to; if CurSlot is less than the total number of pick slots, the element value with index CurSlot is read from the ordered array SlotTypeList and used as the object type number TypeId required for this pick. The front end sends the object type number (TypeId) along with the CAD canvas coordinates converted from the currently clicked screen coordinates to the picking interface of the WASM-side CAD kernel. The WASM-side CAD kernel then filters the picking results based on the object type number (TypeId) and only returns the topology objects that match the object type number. After a successful pickup, the front-end increments the value of the current valid slot index CurSlot by 1 and checks whether CurSlot equals the total number of slots picked. Specifically: If the CurSlot is less than the total number of pick slots, the user is prompted with the type of object to be picked in the next slot; if the CurSlot is equal to the total number of pick slots, it is determined that all slots have been picked and the measurement calculation process is triggered. If picking fails in the current slot, the front end does not increment the value of CurSlot and returns an error message, allowing the user to re-execute the picking operation in the current slot until a topology object matching the object type number is successfully picked. Then, CurSlot is incremented and the user moves to the next slot.

4. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 1, characterized in that: The specific process until all slots required for the measurement mode are successfully picked up is as follows: The browser event listener mechanism captures the user's click operation on the 3D canvas, extracts the screen coordinates of the mouse pointer relative to the canvas viewport from the click event, converts the screen coordinates into standardized device coordinates according to the ratio between the actual pixel size of the 3D canvas and the CAD viewport size, and maps the standardized device coordinates into two-dimensional coordinates in the CAD canvas coordinate system by combining the projection matrix of the current 3D camera and the viewport transformation parameters. The front end reads the element value with index CurSlot from the ordered array SlotTypeList corresponding to the current measurement mode as the object type number required for the current slot, and assembles the current slot number CurSlot, CAD canvas coordinates and object type number into pick request parameters, and initiates a pick request to the WASM-side CAD kernel by calling the pick interface exposed by the WASM-side CAD kernel. After receiving the pick request parameters, the WASM-side CAD kernel verifies whether the current engineering model has been successfully loaded into memory. If the model has not been loaded, it directly returns an error status message. If the model has been loaded, it determines the topological object type to be picked based on the object type number, and performs intersection calculations along the line of sight in the BREP topological data structure of the engineering model using a ray intersection algorithm. During the intersection process, only objects whose topological type matches the object type number are included in the pick candidate set, and the closest object to the viewpoint is selected from the candidate set as the pick result.

5. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 4, characterized in that: The process of successfully picking up all slots required for the measurement mode also includes: The WASM-side CAD kernel encapsulates the picking result into a return data packet, which includes: a globally unique identifier of the picked object, the coordinates of the actual three-dimensional intersection point of the ray and the object surface, and a status code indicating whether the picking was successful; if the picking fails, the globally unique identifier and the intersection point coordinates are set to null values, and the status code carries a specific failure reason code. After receiving the pickup result data packet returned by the CAD kernel of the WASM terminal, the front end parses the status code: if the status code indicates that the pickup failed, the front end outputs the corresponding error message to the user according to the failure reason code, keeps the value of the current valid slot index CurSlot unchanged, and restores the interactive state to allow the user to re-execute the click pickup operation in the current slot; If the status code indicates successful pickup, the front end extracts the globally unique identifier and the actual three-dimensional intersection coordinates of the picked object from the returned data packet. The extracted data is then stored in the front end's pickup result cache array according to the current slot number (CurSlot). Simultaneously, the value of the current valid slot index (CurSlot) is incremented by 1. Finally, it is determined whether CurSlot equals the total number of pickup slots in the current measurement mode. If the CurSlot is less than the total number of pick slots, the object type number required for the next slot is obtained, and the user is informed of the object type of the next pick target through interface prompts or cursor style changes, and the user is waited to perform the next click pick operation. If CurSlot equals the total number of slots picked, then all slots required for the current measurement mode have been successfully picked.

6. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 1, characterized in that: The measurement annotation object includes a unique identifier, display text content, specified color value, list of spatial points, Boolean flag indicating whether to draw line segments, and the shortest distance value. The measurement annotation object is stored in the front-end state management container, enabling it to be selected, deleted, or cleared completely. The specific process for drawing on the two-dimensional overlay layer is as follows: The front end maintains a collection of annotation objects to store all currently generated and not deleted measurement annotation objects. Each measurement annotation object contains a unique identifier, display text, color, list of spatial points, whether to draw a line segment marker, and distance value. When a new measurement annotation object is generated, the front end adds the object to the collection of annotation objects. By listening to camera transformation events and browser window size change events in the 3D scene, a redraw process is triggered after each viewpoint change or window size change. The redrawing process includes: clearing all existing drawn content on the two-dimensional overlay layer, and traversing each measurement annotation object in the annotation object set.

7. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 6, characterized in that: The drawing on the two-dimensional overlay layer also includes: For the currently traversed measurement and annotation object, the front end sequentially retrieves the three-dimensional world coordinates of each spatial point from its spatial point list, calls the projection interface exposed by the WASM CAD kernel, and passes in the view matrix, projection matrix, and viewport size parameters of the current three-dimensional camera, performs the projection transformation calculation from three-dimensional spatial points to two-dimensional screen coordinates, and obtains the corresponding two-dimensional screen coordinates and projection depth values. After receiving the projection result returned by the WASM CAD kernel, it is determined whether the projection depth value is within the effective range between the near clipping plane and the far clipping plane of the 3D camera, and whether the 2D screen coordinates fall within the effective pixel range of the current canvas viewport. Specifically: If the projection depth value is not within the valid range or the two-dimensional screen coordinates are outside the valid range of the viewport, the spatial point is determined to have failed to be projected or is located outside the visible area. The drawing of the point is skipped, the invisible state of the point is recorded, and the next spatial point of the labeled object is processed. If the projection depth value is within the valid range and the two-dimensional screen coordinates fall within the valid range of the viewport, then the spatial point is determined to be successfully projected and located within the current visible area. The front end stores the two-dimensional screen coordinates into the temporary projection coordinate cache list of the current labeled object and draws them one by one on the two-dimensional overlay.

8. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 7, characterized in that: The drawing process on the two-dimensional overlay layer includes: drawing point markers, drawing line segments, and drawing text labels. The point marker drawing specifically involves: drawing a circular or square marker of a preset size at the two-dimensional screen coordinate position, using the color value stored in the measurement and annotation object, and precisely aligning the center of the marker with the two-dimensional screen coordinates; The line segment drawing process is as follows: read the LineFlag flag of the measurement and annotation object; if LineFlag is true and the current annotation object's projection coordinate cache list contains at least two valid projection coordinates, then connect adjacent valid projection coordinates in sequence according to the original order of the spatial points in the spatial point list to form one or more continuous line segments. The line segment color uses the color value, the line segment width is a preset value, and a text label displaying the distance value is added at the middle position or end of the line segment. The text label drawing specifically involves drawing the display text of the measurement annotation object at a preset pixel distance offset from the point mark position or the midpoint position of the line segment. The font, size, color, and background style of the text label use preset style parameters. After the two-dimensional overlay is drawn, the front end will cache the list of projected coordinates of each annotation object in the current annotation object set and store it in association with its corresponding annotation object ID.

9. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 1, characterized in that: The specific process for determining whether the label has been hit is as follows: The browser event listener mechanism captures mouse movement events within the 3D canvas and 2D overlay area, and extracts the current screen coordinates of the mouse pointer relative to the canvas viewport from the mouse movement events. Obtain all measurement annotation objects that are currently visible and have at least one spatial point successfully projected into the visible area from the set of annotation objects, and use them as the candidate annotation set for this hit detection; if the candidate annotation set is empty, skip the hit detection process and restore the cursor to the default style; For each candidate measurement label object in the candidate label set, calculate the two-dimensional distance from the current mouse position to the point mark and line segment of the label; The obtained point marker distance is compared with the preset point hit threshold, and the obtained line segment distance is compared with the preset line segment hit threshold; the smaller value between the point marker distance and the line segment distance is taken as the comprehensive hit distance of the label, and the corresponding hit type is marked as point hit or line segment hit; If the total hit distance is equal to the point marker distance and the point marker distance is less than the preset point hit threshold, then it is determined that the current mouse hover position hits the point marker area of ​​the labeled object, and the hit type of the label is recorded as point hit. If the total hit distance is equal to the line segment distance and the line segment distance is less than the preset line segment hit threshold, then it is determined that the current mouse hover position hits the line segment area of ​​the labeled object, and the hit type of the label is recorded as line segment hit. If the distance between the point marker and the line segment is greater than or equal to the preset point hit threshold and the distance between the line segments is greater than or equal to the preset line segment hit threshold, then it is determined that the current position of the mouse has not hit the marked object.

10. The method for generating cross-type measurement annotations for Web 3D engineering models as described in claim 9, characterized in that: The determination of whether the label has been hit also includes: After traversing all the annotation objects in the candidate annotation set, sort all the annotation objects that are determined to be hit according to their comprehensive hit distance from smallest to largest, select the annotation object with the smallest comprehensive hit distance as the target hit annotation object at the current mouse position, and record its unique identifier ID and hit type; reset the hit status of all other annotation objects except the target hit annotation object to miss. The interface state is updated according to the judgment result. If a target hits the labeled object, the point mark and line segment of the target labeled object are drawn in a highlight style on the two-dimensional overlay layer. The highlight style includes at least one of changing the point mark size, changing the line segment width and changing the color. The mouse cursor style is switched to a hand pointer. Optionally, the distance value and text content of the labeled object are displayed floating in the interface. If no matched annotation objects are found, restore the default drawing style of all annotation objects and restore the mouse cursor to the default style. When the mouse moves out of the canvas area or leaves the 2D overlay area, clear the current target hit annotation object state, restore the default drawing style of all annotation objects, and restore the cursor to the default style; When a user clicks the mouse while the target is in the selected state, the front end triggers a selection state switch or attribute management operation for the selected object based on the unique identifier ID of the currently selected object. The front end then displays the detailed measurement data of the object and provides interactive controls for deletion, editing, or moving, thereby enabling visual interactive management of 3D measurement and annotation objects through a 2D overlay.