A method and system for reverse updating of a three-dimensional virtual simulation scene

By constructing a projection transformation matrix and embedding a 3D associative index, the problem of information separation between 2D drawings and 3D models is solved, enabling precise updates of the 3D virtual simulation scene through 2D drawing editing, and improving the update accuracy and geometric consistency of the virtual simulation scene.

CN122134867APending Publication Date: 2026-06-02BEIJING LIANBO ZHIYE TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING LIANBO ZHIYE TECHNOLOGY CO LTD
Filing Date
2026-02-26
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

In existing technologies, two-dimensional drawing files lack an effective association with three-dimensional models, which makes it impossible to accurately infer the spatial changes of three-dimensional objects after modifications to two-dimensional drawings, thus reducing the accuracy of virtual simulation scene updates.

Method used

By acquiring the hierarchical structure information, vertex coordinate sequence, and 3D association index of the target virtual simulation scene, a projection transformation matrix is ​​constructed to project the 3D geometric objects onto a 2D plane. The 3D association index, projection transformation matrix, and plane definition parameters are then embedded in the 2D drawing file to achieve 3D spatial inverse mapping when modifying 2D primitives.

Benefits of technology

It enables synchronous driving and precise updating of 3D virtual simulation scenes through 2D drawing editing, improves the accuracy and geometric consistency of virtual simulation scene updates, and ensures geometric consistency maintenance and spatial mapping accuracy in multi-scale scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122134867A_ABST
    Figure CN122134867A_ABST
Patent Text Reader

Abstract

A method and system for reverse updating a 3D virtual simulation scene, wherein the method includes: acquiring the hierarchical structure information of the target virtual simulation scene, the vertex coordinate sequence of 3D geometric objects, the 3D association index, and the plane definition parameters; constructing a projection transformation matrix and performing projection transformation on the vertex coordinate sequence of each 3D geometric object to obtain 2D vector data; generating a 2D drawing file and writing the 3D association index, projection transformation matrix, and plane definition parameters into an extended attribute data area; extracting the target 2D vector data of the target 2D primitives and the target 3D association index, projection transformation matrix, and plane definition parameters of the target 2D primitives in the extended attribute data area from the 2D drawing file; calculating the 2D coordinate difference vector; calculating the 3D spatial change vector on the 3D plane corresponding to the preset 2D plane; and updating the spatial geometric parameters of the target 3D geometric objects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of reverse update technology for three-dimensional data, specifically to a reverse update method and system for a three-dimensional virtual simulation scene. Background Technology

[0002] With the rapid development of technologies such as Virtual Reality (VR), Augmented Reality (AR), and digital twins, 3D virtual simulation scenarios have been widely used in numerous fields, including industrial design, architectural modeling, urban planning, and equipment operation and maintenance. In these applications, users construct complex 3D geometric models using 3D modeling tools and deploy them in virtual simulation platforms to achieve visualization, interaction, and simulation of real-world objects and scenes.

[0003] In existing technologies, design software converts models in a 3D virtual simulation scene into 2D lines and fill patterns according to a specific perspective and projection rules, and saves them as standard 2D drawing files (such as DWG and DXF formats). These 2D drawings are then distributed to downstream personnel for viewing or modification.

[0004] However, existing 2D drawing files typically only contain 2D geometric data for drawing and display, such as the planar coordinates and visual attribute information of line segments, arcs, and other primitives, lacking an effective connection with the 3D model. Once a 3D model is exported as a 2D drawing, the spatial mapping relationship between the 2D primitives and the original 3D object is broken. As a result, after the 2D drawing is modified, the system cannot deduce the actual spatial changes of the corresponding 3D object based on the changes in the 2D primitives, reducing the accuracy of virtual simulation scene updates. Summary of the Invention

[0005] This application provides an invention title to solve the technical problem that the prior art cannot deduce the real spatial changes of the corresponding three-dimensional objects based on the change information of two-dimensional primitives, thereby improving the accuracy of virtual simulation scene updates. The first aspect of this application provides a method for reverse updating a three-dimensional virtual simulation scene, the method comprising: Obtain the hierarchical structure information of the target virtual simulation scene, the vertex coordinate sequence of each three-dimensional geometric object in the target virtual simulation scene, the three-dimensional association index of the three-dimensional geometric object, and the plane definition parameters of the preset two-dimensional plane; Based on the plane definition parameters, a projection transformation matrix is ​​constructed, and the vertex coordinate sequence of each of the three-dimensional geometric objects is projected and transformed based on the projection transformation matrix to obtain two-dimensional vector data; The two-dimensional vector data is input into a preset drawing generation model to obtain a two-dimensional drawing file. Based on the hierarchical structure information, the three-dimensional association index, the projection transformation matrix, and the plane definition parameters are written into the extended attribute data area. The extended attribute data area is the metadata storage space for the two-dimensional primitives corresponding to each three-dimensional geometric object in the two-dimensional drawing file. In response to a modification request for any two-dimensional element in the two-dimensional drawing file, the target two-dimensional vector data of the target two-dimensional element, the target three-dimensional association index of the target two-dimensional element in the extended attribute data area, the projection transformation matrix, and the plane definition parameters are extracted from the two-dimensional drawing file. The target two-dimensional element is the two-dimensional element corresponding to the modification request. Calculate the two-dimensional coordinate difference vector between the target two-dimensional vector data and the original two-dimensional vector data corresponding to the target two-dimensional primitive in the two-dimensional vector data; Based on the two-dimensional coordinate difference vector, the projection transformation matrix, and the plane definition parameters, calculate the three-dimensional spatial change vector on the three-dimensional plane corresponding to the preset two-dimensional plane; Based on the target 3D association index, the target 3D geometric object corresponding to the target 2D primitive is located in the target virtual simulation scene, and the spatial geometric parameters of the target 3D geometric object are updated based on the hierarchical structure information and the 3D spatial change vector.

[0006] Optionally, the plane definition parameters include the coordinates of the plane origin, a first unit basis vector, and a second unit basis vector orthogonal to the first unit basis vector. The cross product of the first unit basis vector and the second unit basis vector is the normal vector of the preset two-dimensional plane. The construction of the projection transformation matrix based on the plane definition parameters specifically includes: Obtain the unit conversion factor and drawing scaling factor between the target virtual simulation scene and the two-dimensional drawing file, and calculate the product of the unit conversion factor and the drawing scaling factor to obtain the comprehensive scaling coefficient; A translation matrix is ​​constructed based on the coordinates of the plane origin. The translation matrix is ​​used to translate the vertex coordinates of the three-dimensional geometric object from the world coordinate system to a local coordinate system centered on the coordinates of the plane origin. A rotation transformation matrix is ​​constructed based on the first unit basis vector and the second unit basis vector. The rotation transformation matrix is ​​used to project the translated vertex coordinates onto the two-dimensional coordinate axis defined by the first unit basis vector and the second unit basis vector. A scaling matrix is ​​constructed based on the comprehensive scaling factor. The scaling matrix is ​​used to unify the dimensions and adjust the scale of the projected two-dimensional coordinates. Following the preset logical order of coordinate transformation, the scaling matrix, the rotation transformation matrix, and the translation matrix are multiplied in a cascade manner to obtain the projection transformation matrix.

[0007] Optionally, based on the hierarchical structure information, the three-dimensional association index, the projection transformation matrix, and the plane definition parameters are written into the extended attribute data area of ​​the two-dimensional primitives corresponding to the three-dimensional geometric objects in the two-dimensional drawing file, specifically including: Extract the parent-child node relationships and semantic names of each node from the hierarchical structure information in the target virtual simulation scene. Based on the parent-child node relationship and the semantic name, create the corresponding layer definition or block definition in the two-dimensional drawing file; The two-dimensional vector data is instantiated into two-dimensional geometric primitives, and according to the affiliation of the three-dimensional geometric objects in the hierarchical structure information, the two-dimensional geometric primitives are assigned to the corresponding layer definition or block definition, and a hierarchical path identifier is generated. Construct an extended data package containing the 3D association index, the projection transformation matrix, the hierarchical path identifier, and the plane definition parameters; The extended data packet is written into the extended attribute data area of ​​the two-dimensional geometric primitive.

[0008] Optionally, based on the parent-child node relationship and the semantic name, a corresponding layer definition or block definition is created in the two-dimensional drawing file, specifically including: The node type of each node of the three-dimensional geometric object is identified based on the semantic name, and the node type includes logical grouping nodes and solid component nodes; If the node type is the logical group node, then create the corresponding layer definition in the two-dimensional drawing file; If the node type is the solid component node, a corresponding block definition is created in the two-dimensional drawing file. The block definition is used to encapsulate the local coordinate system and internal geometry of the solid component node, and to maintain the nested mapping of the parent-child node relationship.

[0009] Optionally, calculating the two-dimensional coordinate difference vector between the target two-dimensional vector data and the original two-dimensional vector data corresponding to the target two-dimensional primitive in the two-dimensional vector data specifically includes: Calculate the initial displacement vector between the target two-dimensional vector data and the original two-dimensional vector data; The preset degree-of-freedom constraint parameters of the target two-dimensional primitive are determined based on the target three-dimensional association index. The degree-of-freedom constraint parameters are used to define the specific axis or plane that the target two-dimensional primitive is allowed to displace in three-dimensional space. Based on the projection transformation matrix and the plane definition parameters, the degree-of-freedom constraint parameters are mapped to the preset two-dimensional plane to obtain the two-dimensional constraint projection axis; Calculate the deviation component of the initial displacement vector in the normal direction of the two-dimensional constraint projection axis; If the deviation component is less than the preset operation tolerance threshold, it is determined that the modification request contains unexpected operation jitter, the initial displacement vector is orthogonally projected onto the two-dimensional constraint projection axis, and the vector obtained after projection is determined as the two-dimensional coordinate difference vector.

[0010] Optionally, based on the two-dimensional coordinate difference vector, the projection transformation matrix, and the plane definition parameters, a three-dimensional spatial change vector on the three-dimensional plane corresponding to the preset two-dimensional plane is calculated, specifically including: Perform matrix decomposition on the projection transformation matrix to extract a two-dimensional linear transformation submatrix containing rotation and scaling information; Calculate the determinant of the two-dimensional linear transformation submatrix, and construct a local coordinate inverse mapping matrix based on the determinant of the two-dimensional linear transformation submatrix and the preset matrix inverse operation rules; The two-dimensional coordinate difference vector is input into the local coordinate inverse mapping matrix for inverse linear transformation to obtain the local restored displacement vector after eliminating scaling distortion; Based on the first unit basis vector and the second unit basis vector in the plane definition parameters, the local restored displacement vector is mapped to three-dimensional space to obtain the three-dimensional space change vector.

[0011] Optionally, updating the spatial geometric parameters of the target three-dimensional geometric object based on the hierarchical structure information and the three-dimensional spatial change vector specifically includes: Based on the hierarchical structure information, determine whether the target 3D geometric object has a parent node; If a parent node exists, obtain the global transformation matrix of the parent node in the world coordinate system, and calculate the inverse of the global transformation matrix; Extract the linear transformation components from the inverse matrix, perform coordinate system transformation operations on the three-dimensional spatial change vector based on the linear transformation components, and convert the three-dimensional spatial change vector into a local spatial change vector relative to the parent node; If there is no parent node, the three-dimensional spatial change vector is determined as a local spatial change vector; Obtain the current local position coordinates of the target 3D geometric object, add the local spatial change vector to the local position coordinates, and obtain the updated local position coordinates; The updated local position coordinates are written into the data storage module of the target three-dimensional geometric object to update the spatial geometric parameters.

[0012] Secondly, embodiments of this application provide a reverse update system for a three-dimensional virtual simulation scene. The reverse update system for the three-dimensional virtual simulation scene includes: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the reverse update system for the three-dimensional virtual simulation scene to perform the method described in the first aspect and any possible implementation thereof.

[0013] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a reverse update system for a three-dimensional virtual simulation scene, cause the reverse update system for the three-dimensional virtual simulation scene to perform the method described in the first aspect and any possible implementation thereof.

[0014] Fourthly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a reverse update system for a three-dimensional virtual simulation scene, causes the reverse update system for the three-dimensional virtual simulation scene to execute the method described in the first aspect and any possible implementation thereof.

[0015] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. By introducing projection transformation matrices and plane definition parameters during the generation of 2D drawings, and writing 3D association indexes, projection rules, and original spatial information into the extended attribute data area of ​​2D primitives, each 2D primitive retains the 2D geometric information used for drawing and display while embedding a spatial mapping relationship with the original 3D geometric object. When responding to subsequent drawing modification requests, the system can extract the extended attribute data of the target 2D primitive from the 2D drawing file, combine it with the 2D coordinate difference vector before and after modification, and realize the reverse mapping of 2D change information to 3D space based on the original projection transformation matrix and plane parameters. This allows for the accurate calculation of the actual geometric changes of the corresponding 3D geometric object in the virtual simulation scene, and the spatial parameter update of the target object based on the scene's hierarchical structure. Ultimately, this achieves synchronous driving and accurate updating of the 3D virtual simulation scene by 2D drawing editing, effectively overcoming the problems of 2D drawing and 3D model information separation and the inability to reverse derive 3D changes in existing technologies, thus improving the accuracy of virtual simulation scene updates.

[0016] 2. By introducing plane definition parameters including the coordinates of the plane origin, the first unit basis vector, and the second unit basis vector orthogonal to it, and explicitly defining the cross product direction of these two unit basis vectors as the normal vector of the two-dimensional projection plane, the system can uniquely determine the local two-dimensional reference plane for projection transformation in three-dimensional space. Furthermore, in the process of constructing the projection transformation matrix based on these plane definition parameters, the unit conversion factor and the drawing scaling factor between the target virtual simulation scene and the two-dimensional drawing file are first obtained, and the comprehensive scaling coefficient is calculated through their product to achieve consistent spatial scale matching. Subsequently, the translation matrix for coordinate translation is constructed sequentially. The rotation transformation matrix used for coordinate rotation and the scaling matrix used for coordinate scaling are combined and multiplied according to a preset matrix concatenation order to generate a unique projection transformation matrix corresponding to the projection plane. This ensures that the vertex coordinates of any 3D geometric object can be accurately mapped to the 2D drawing plane under a unified coordinate rule, guaranteeing a high degree of consistency of 2D vector data in geometric shape, scale accuracy, and spatial direction. This significantly improves the geometric accuracy and reversibility of changes in the 2D drawing generation, providing a rigorous geometric foundation for subsequent 3D reverse updates after 2D drawing modifications. It effectively enhances the system's ability to maintain geometric consistency and spatial mapping accuracy in multi-scale scenarios.

[0017] 3. By extracting hierarchical structure information from the target virtual simulation scene, including parent-child node relationships and the semantic names of each node, the system can automatically create layer and block definitions based on node type in 2D drawing files. Logical group nodes are mapped to layers, and entity component nodes are mapped to block definitions containing local coordinate systems and internal geometric structures. This constructs a hierarchical semantic structure in the 2D drawing that is consistent with the 3D scene. Simultaneously, the generated 2D geometric primitives are assigned to corresponding layers or blocks based on their affiliation information in the original hierarchical structure, and a unique hierarchical path identifier is generated. Furthermore, an extended data package containing 3D association indexes, projection transformation matrices, plane definition parameters, and hierarchical path identifiers is written into the extended attribute data area of ​​the primitives. This achieves precise binding and hierarchical mapping between primitives in the 2D drawing and the 3D model, thereby significantly improving the ability of the 2D drawing to express the semantics, structure, and geometric relationships of the 3D scene. This ensures that subsequent 2D editing can be accurately and context-consistently updated back into the complex 3D virtual simulation scene. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a reverse update method for a three-dimensional virtual simulation scene according to an embodiment of this application. Figure 2 This is a schematic diagram of the process of writing the three-dimensional association index, projection transformation matrix and plane definition parameters into the two-dimensional drawing file in the embodiments of this application; Figure 3This is a schematic diagram of the structure of a reverse update system for a three-dimensional virtual simulation scene according to an embodiment of this application; Explanation of reference numerals in the attached drawings: 301, Central Processing Unit; 302, Read-Only Memory; 303, Random Access Memory; 304, Bus; 305, Input / Output Interface; 306, Input Section; 307, Output Section; 308, Storage Section; 309, Communication Section; 310, Driver; 311, Removable Media. Detailed Implementation

[0019] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0020] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0021] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0022] Figure 1 This is a flowchart illustrating a reverse update method for a three-dimensional virtual simulation scene in an embodiment of this application.

[0023] Please see Figure 1 This application provides an embodiment of a reverse update method for a three-dimensional virtual simulation scene, the method comprising: S101. Obtain the hierarchical structure information of the target virtual simulation scene, the vertex coordinate sequence of each three-dimensional geometric object in the target virtual simulation scene, the three-dimensional association index of the three-dimensional geometric object, and the plane definition parameters of the preset two-dimensional plane; In this embodiment, the target virtual simulation scene refers to a set of three-dimensional spatial models constructed digitally. This set of models is used to simulate, display, or analyze physical environments, engineering structures, or system components in reality or design. The scene is generally composed of multiple three-dimensional geometric objects with spatial geometric attributes and semantic definitions, and is constructed into a logically related scene tree or component topology according to a certain hierarchical organizational structure.

[0024] The sources for constructing this virtual simulation scene typically include, but are not limited to: model data exported from 3D modeling software (such as Revit, SketchUp, 3ds Max, etc.), component structures generated by BIM platforms, the results of reverse-engineered point cloud model reconstruction, or digital twin scenes generated through automated modeling algorithms. This scene not only contains entity geometry but may also include multi-dimensional information such as materials, component numbers, installation status, attribute parameters, and structural relationships, serving as a 3D data source for the generation and updating of 2D drawings.

[0025] In this target virtual simulation scenario, each three-dimensional geometric object refers to the smallest geometric unit or component unit that constitutes the scenario. They have independent spatial geometric shapes and associated semantic attributes. These three-dimensional geometric objects may be represented as building components (such as beams, columns, and walls), equipment parts (such as flanges, valves, and supports), structural units (such as gusset plates and stiffening ribs), or other simulated objects with solid forms.

[0026] Each 3D geometric object typically consists of a set of vertex coordinate sequences, facet indices, and local coordinate definitions, forming its geometric foundation. The vertex coordinate sequence is a fundamental component of spatial geometric information, arranged in a specific order and combined using triangular faces or other facet construction rules to form a complete geometric solid. 3D geometric objects not only possess definite shapes and positions in space but may also have hierarchical relationships, type definitions, and status identifiers, constituting identifiable, manipulable, and manageable unit entities within a virtual simulation scene.

[0027] These three-dimensional geometric objects do not exist in isolation, but are organized in a holistic scene through hierarchical structural information. Each object, as a node in the hierarchy tree, may be a child component of a certain component, or it may be the parent node of multiple child objects, thus forming a semantically clear and structurally sound composite three-dimensional model system.

[0028] In practice, the process begins by traversing all nodes in the target virtual simulation scene, collecting the hierarchical structure path, semantic attributes, and parent-child relationships for each node. This hierarchical information is used to subsequently identify the organizational position of 3D geometric objects within the overall scene, ensuring that the original semantic structure, grouping logic, and nested relationships are maintained during the generation of 2D drawings. The extraction of the hierarchical structure is generally based on a scene description tree (Scene Graph) or a component topology structure tree. This structure uses the root node as the entry point and recursively traverses all child nodes using a depth-first or breadth-first approach, recording the unique identifier of each node and its parent node identifier, and then archiving them according to semantic label classification (such as main structure, pipeline system, equipment components, etc.).

[0029] Subsequently, for each 3D geometric object in the scene, its vertex coordinate sequence is extracted by calling the data interface provided by the modeling platform or 3D engine. The vertex coordinate sequence is the most basic data structure describing 3D geometry, typically represented as a set of sequentially arranged 3D coordinate points, defining the actual spatial contour of the geometric object. For example, a cube can be defined by eight vertices, and its coordinate sequence records its position in the world coordinate system.

[0030] To achieve a traceable association between 2D primitives and 3D objects, a 3D association index for each 3D geometric object is also required. This 3D association index assigns a unique identifier to each geometric object, used to identify the origin of the primitive in subsequent stages such as projection, drawing generation, and modification feedback, ensuring that any editing operation on the 2D primitive can be accurately mapped back to the original 3D entity. This index can be generated in the form of UUID, component ID, or path reference, depending on the actual platform settings.

[0031] Next, a two-dimensional plane for projection transformation needs to be defined, at which point complete plane definition parameters should be obtained. These parameters include three core components: the plane origin coordinates, the first unit basis vector, and a second unit basis vector orthogonal to the first unit basis vector. The plane origin coordinates are used to locate the starting point of the two-dimensional projection plane in three-dimensional space. The first unit basis vector represents the X-axis direction in the two-dimensional plane, and the second unit basis vector represents the Y-axis direction. The first and second unit basis vectors must maintain an orthogonal relationship; their cross product is the normal vector of the two-dimensional projection plane, used to determine the plane's orientation in three-dimensional space. Specifically, to ensure the uniqueness of the three-dimensional coordinate system definition, this embodiment specifies the use of the right-hand rule to determine the direction of the normal vector. That is, when the four fingers of the right hand bend from the first unit basis vector (considered the local X-axis) towards the second unit basis vector (considered the local Y-axis), the direction pointed to by the thumb is the positive direction of the normal vector of the preset two-dimensional plane (considered the local Z-axis). This specification ensures axial consistency during subsequent rotation matrix construction, avoiding mirror flip errors in 3D spatial projection caused by reversed normal vectors. This definition allows for the description of 2D projection surfaces in any direction and at any location, suitable for the local projection requirements of complex spatial components.

[0032] In practice, the coordinates of the origin point of the plane can be selected from the centroid of the component, the center of the bottom surface, or any feature point as the reference point, while the direction of the basis vectors can be generated based on the principal axis direction of the component or a user-defined direction. For example, when performing a two-dimensional projection on a section of inclined pipe, the direction of the pipe's central axis can be selected as the first unit basis vector, and the second unit basis vector can be calculated using geometric rules, so that the projection plane unfolds perpendicular to the pipe direction, avoiding projection distortion.

[0033] S102. Construct a projection transformation matrix based on the plane definition parameters, and perform projection transformation on the vertex coordinate sequence of each of the three-dimensional geometric objects based on the projection transformation matrix to obtain two-dimensional vector data; After acquiring the geometric data and structural information of the target virtual simulation scene, a unified two-dimensional projection transformation is required for the vertex coordinate sequence of the three-dimensional geometric objects to generate a two-dimensional vector representation with spatial correspondence. To achieve high-precision and reversible projection operations, a projection transformation matrix needs to be constructed based on the acquired plane definition parameters. This matrix is ​​then used as the basis for transformation, mapping the vertex coordinates in three-dimensional space onto a preset two-dimensional plane. This projection transformation process involves not only three-dimensional to two-dimensional spatial mapping but also considerations such as unit conversion, coordinate system transformation, and scaling adjustment. Therefore, to ensure consistency and engineering usability of the transformation results in the two-dimensional drawings, a complete projection transformation matrix must be constructed according to the standard matrix operation logic of translation, rotation, and scaling. Specifically, this may include the following steps: obtaining the unit conversion factor and drawing scaling factor between the target virtual simulation scene and the two-dimensional drawing file; calculating the product of the unit conversion factor and the drawing scaling factor to obtain a comprehensive scaling factor; constructing a translation matrix based on the coordinates of the plane origin, the translation matrix being used to translate the vertex coordinates of the three-dimensional geometric object from the world coordinate system to a local coordinate system centered on the coordinates of the plane origin; constructing a rotation transformation matrix based on the first unit basis vector and the second unit basis vector, the rotation transformation matrix being used to project the translated vertex coordinates onto the two-dimensional coordinate axes defined by the first unit basis vector and the second unit basis vector; constructing a scaling matrix based on the comprehensive scaling factor, the scaling matrix being used to unify the dimensions and adjust the scale of the projected two-dimensional coordinates; and multiplying the scaling matrix, the rotation transformation matrix, and the translation matrix in a cascaded manner according to a preset logical order of coordinate transformation to obtain the projection transformation matrix.

[0034] In constructing the projection transformation matrix, to ensure that geometric objects in 3D space maintain accurate proportions and positional relationships after being converted into 2D graphic representations, it is first necessary to obtain the unit conversion factor and drawing scaling factor between the target virtual simulation scene and the target 2D drawing file. The unit conversion factor is used to uniformly convert the spatial units used in the 3D model (such as meters and millimeters) to the drawing units used in the 2D drawing (such as millimeters and inches). This factor is usually determined by the unit settings of the modeling platform or drawing system. The drawing scaling factor, on the other hand, is manually set or automatically calculated based on the output scale of the drawing (such as 1:100, 1:50, etc.) and is used to control the display size of primitives in the 2D drawing. By multiplying the unit conversion factor and the drawing scaling factor, a unified comprehensive scaling coefficient is obtained. This coefficient is used in subsequent coordinate transformations to adjust the dimensions of the 2D projection results, thereby ensuring that the output graphics have the correct engineering scale. For example, if the 3D model uses meters as the unit, but the drawing requires it to be displayed at a scale of 1:50 and drawn in millimeters, then the unit conversion factor is 1000 (meters to millimeters), the drawing scaling factor is 1 / 50, and the final comprehensive scaling factor is 1000×1 / 50, which is 20.

[0035] After obtaining the overall scaling factor, a translation matrix needs to be constructed based on the plane origin coordinates in the plane definition parameters. The purpose of the translation matrix is ​​to transform the vertex coordinates of all 3D geometric objects from the original world coordinate system to a local coordinate system centered on the 2D projection plane, ensuring that subsequent rotation transformations can be simplified within this local coordinate system. The plane origin coordinates are set by the user or the system, typically selecting a feature point of the component (such as the construction center, datum plane center, geometric center, etc.) as the origin, aligning the logical center of the local coordinate system with the projection datum of the 2D drawing. The construction principle of the translation matrix is ​​based on vector offset, calculating the difference between the coordinates of each vertex and the plane origin coordinates as the new local coordinates, thus realizing the transformation from 3D space to local planar coordinates.

[0036] After completing the translation operation, a rotation transformation matrix needs to be constructed based on the first and second unit basis vectors in the plane definition parameters. The first and second unit basis vectors define the X-axis and Y-axis directions of the two-dimensional projection plane, respectively. They must satisfy the orthogonality condition to ensure that the generated two-dimensional coordinate system is a standard Cartesian coordinate system. These two vectors are usually derived from the principal direction of the component or the design projection direction. They can be used to construct an orthogonal coordinate axis mapping matrix from three-dimensional to two-dimensional. The rotation matrix's function is to rotate and project the coordinates of the three-dimensional vertices, which have already been translated to the local coordinate system, onto the two-dimensional plane defined by these two basis vectors, thus unifying the spatial orientation. When constructing the rotation matrix, the first unit basis vector is used as the X-axis, the second unit basis vector as the Y-axis, and the normal vector obtained from their cross product is used as the Z-axis, forming a three-dimensional orthogonal basis. The rotation transformation from world coordinates to projection plane coordinates is completed through transpose or inverse matrix calculation.

[0037] Since the projected 2D coordinates do not yet meet the dimensional standards required for drawing output, a scaling matrix needs to be constructed based on the aforementioned comprehensive scaling factor. The scaling matrix is ​​constructed by introducing a uniform scaling factor into the 2D coordinate transformation matrix, linearly scaling along both the X and Y axes to ensure that the dimensions of the graphic elements in the 2D drawing conform to engineering drawing standards. This scaling matrix is ​​typically a 2×2 or 3×3 diagonal matrix, with the scaling factors on its diagonal being the comprehensive scaling factor. The scaled 2D coordinate data will be directly used for drawing elements, possessing a uniform length unit and visual scale, ensuring the legibility and engineering adaptability of the drawing.

[0038] In this embodiment, to achieve accurate projection representation of 3D geometric objects on a 2D plane, a unified projection transformation matrix needs to be constructed through cascaded multiplication to convert 3D vertex coordinates into 2D vector data. The generation process of this projection transformation matrix is ​​not an arbitrary concatenation of multiple transformation matrices, but rather strictly follows a preset coordinate transformation logic order for matrix multiplication. This logic order is: translation first, then rotation, and finally scaling, which is represented in matrix calculation as: scaling matrix × rotation matrix × translation matrix. This order not only reflects the mathematical laws of spatial geometric transformations and the general practices of graphics engines, but also meets the geometric consistency requirements in engineering drawing generation.

[0039] This pre-defined logical sequence originates from the unity of mathematical principles of spatial transformation and engineering semantic logic. In 3D geometric transformations, translation, rotation, and scaling are linear transformations, but their effects in actual space differ, and the execution order of transformations directly affects the final position and shape. Therefore, to avoid unpredictable results caused by the transformation order, the system must adopt a universal, stable, and reversible transformation process. Based on the spatial meaning of geometric transformations, the reasonable sequence should be: first, using a translation matrix to move the 3D geometric object from the world coordinate system to a local coordinate system centered on the projection plane, thus establishing a transformation basis with the projection origin as a reference; second, applying a rotation transformation matrix to align the object in the local coordinate system towards the coordinate axes of the projection plane, thereby achieving a precise definition of the 2D projection direction; finally, applying a scaling matrix to perform unit conversion and scale adjustment on the already projected 2D coordinates, ensuring that the dimensions of the primitives in the drawing meet engineering drawing requirements. This sequence not only conforms to the transformation chain construction logic in computer graphics but is also widely used in the world coordinate transformation process of graphics systems such as OpenGL and Unity.

[0040] The core reason why matrix multiplication must be performed in this predetermined logical order during matrix cascading lies in the non-commutativity of matrix multiplication. In geometric transformations, matrix multiplication is directional; different multiplication orders will lead to completely different transformation effects. According to the rules of matrix multiplication, the multiplication of transformation matrices acts on the original coordinate vectors from right to left. That is, if the final transformation matrix is ​​M = S × R × T, the transformation process is: first translation T, then rotation R, and finally scaling S. If the multiplication order is changed, for example, if scaling is placed on the far right (scaling before rotation), the rotation will act on the already scaled coordinate system, leading to angular distortion or directional deviation. If rotation is placed before translation, the rotation operation will be performed around the origin of the world coordinate system, rather than around the center of the projection plane, leading to positional distortion. Therefore, the order of cascaded multiplication not only affects the geometric position but also directly determines the directionality of the projection and the controllability of the primitive size, ensuring the stability of geometric transformations and engineering accuracy.

[0041] In practical calculations, the concatenation of matrices follows the matrix multiplication rules in linear algebra. Let: the translation matrix T be a 4×4 homogeneous transformation matrix, defined as translating each 3D point P to a local coordinate system centered at the origin of the projection plane; the rotation matrix R is also a 4×4 homogeneous matrix, whose first three rows and first three columns consist of the first unit basis vector, the second unit basis vector, and their cross product (i.e., the normal vector), defining the direction mapping from the local coordinate system to the projection plane coordinate system; the scaling matrix S is a diagonal matrix, whose diagonal values ​​are the comprehensive scaling factor λ, used to uniformly adjust the 2D projection result to the drawing display scale. Finally, the transformation matrix M is constructed through matrix multiplication: M = S × R × T. This matrix M can be directly applied to the original 3D coordinates P_world, expressed in homogeneous form as [x, y, z, 1]^T, to calculate the 2D projected coordinates: P_2D = M × P_world. For example, if the vertex coordinates of a component in a 3D scene are [3.2, 5.1, 1.8] (meters), the origin of the projection plane is set to [3.0, 5.0, 1.5], the first unit basis vector is [1, 0, 0], the second unit basis vector is [0, 1, 0], the unit conversion factor is 1000 (meters to millimeters), and the drawing scaling factor is 1 / 50, then the overall scaling factor is 20. By constructing the above three transformation matrices and multiplying them in logical order, the complete projection transformation matrix M can be obtained. This allows the vertex coordinates to be accurately projected onto the corresponding primitive position in the 2D drawing, ensuring orientation alignment and accurate dimensions, and supporting subsequent reverse update operations based on primitives.

[0042] After constructing the projection transformation matrix, it needs to be applied to the vertex coordinate sequence of each 3D geometric object in the target virtual simulation scene to perform a unified projection transformation operation, generating 2D vector data that can be used for drawing and reverse updating. The core of this step is to map the coordinates of each 3D vertex onto a preset 2D projection view plane through matrix transformation and output the corresponding 2D coordinate values ​​for subsequent primitive drawing and associated attribute annotation. This operation is not only a crucial step in 3D-to-2D information conversion but also lays the foundation for subsequent geometric backhaul and data consistency.

[0043] In the specific implementation process, the vertex coordinate sequence of the target 3D geometric object is first processed in batches. Each 3D geometric object is usually composed of multiple vertices, and its vertex coordinate sequence is a list of 3D vectors in the form [x, y, z]. In order to adapt to the homogeneous coordinate format of matrix calculation, each vertex needs to be represented as a four-dimensional homogeneous vector [x, y, z, 1]^T so as to perform matrix multiplication with the previously constructed 4×4 projection transformation matrix M. During the processing, each 3D vertex is input into the transformation matrix one by one, and the following linear transformation calculation is performed: P_{2D}=M×P_{3D}. Where P_{3D} is the homogeneous coordinate of the original 3D vertex, M is the projection transformation matrix constructed in the previous step, and P_{2D} is the output 2D projection coordinate (still in homogeneous form). After the calculation is completed, according to the homogeneous coordinate transformation rules, the first three components [x', y', w] of the result vector are divided in a homogeneous manner to obtain the final 2D vector point (x' / w, y' / w) used for drawing. This conversion step ensures that primitives are not distorted due to differences in scale or projection direction during storage and rendering.

[0044] To improve efficiency, this transformation process is typically performed in batch mode. This involves using a matrix library (such as NumPy, Eigen, GLM, etc.) to convert the vertex list into an N×4 vector matrix, which is then multiplied by the projection matrix M in a single operation, thus simultaneously obtaining the 2D projection results for all vertices. This batch projection method significantly increases the speed of drawing generation, and is particularly suitable for complex scene models containing a large number of components.

[0045] The set of all two-dimensional coordinate points after projection constitutes the vector representation of the three-dimensional geometric object in the two-dimensional drawing. It can be further connected into line segments, polygons or curve contours. Two-dimensional primitives (such as lines, surfaces, symbols, etc.) are constructed according to the drawing logic, and a one-to-one index relationship is established with their original three-dimensional objects.

[0046] For example, when projecting a three-dimensional steel beam component, the original vertices are located at multiple points in the world coordinate system. By applying a projection transformation matrix, each vertex is accurately mapped to a two-dimensional cross-sectional view with the beam's central axis as the projection reference, forming a closed vector profile, and thus generating the "beam cross-sectional primitive" in the drawing. This primitive not only maintains spatial consistency with the three-dimensional model but also possesses a unified scale, standard orientation, and reversible mapping capability, serving as the core data unit for subsequent modifications and reverse updates.

[0047] S103. Input the two-dimensional vector data into the preset drawing generation model to obtain a two-dimensional drawing file, and write the three-dimensional association index, the projection transformation matrix and the plane definition parameters into the extended attribute data area based on the hierarchical structure information. The extended attribute data area is the metadata storage space of the two-dimensional primitives corresponding to each three-dimensional geometric object in the two-dimensional drawing file. In step S103, the system first inputs the two-dimensional vector data obtained in the previous step into a preset drawing generation model to generate a two-dimensional drawing file that conforms to engineering drawing specifications. Based on this, the system further combines the hierarchical structure information of the acquired target virtual simulation scene to perform semantic organization and structured management of the two-dimensional primitives in the drawing.

[0048] After projecting and transforming each 3D geometric object in the target virtual simulation scene and obtaining its corresponding 2D vector data, the system inputs this data into a preset drawing generation model for automatically generating standard 2D drawing files. This drawing generation model can be a graphics construction module based on a CAD graphics engine (such as AutoCAD, Open CASCADE, or a self-developed vector graphics engine). Its main function is to construct a primitive structure conforming to engineering drawing standards and organize it into a complete drawing file based on the input 2D vector data. This drawing file can be in DWG, DXF, SVG, or other 2D graphics formats that support extended attributes.

[0049] During implementation, the system first instantiates a primitive by calling the primitive construction interface in the drawing generation model, based on the type of each 2D vector data (such as line segments, polygons, curves, etc.). For example, connecting a group of adjacent projection points generates a 2D polyline primitive, or filling a closed contour into a section entity. Next, based on the semantic type of the corresponding 3D geometric object (such as beams, columns, floor slabs, etc.), the system assigns layers or block definitions in the drawing to achieve logical organization and semantic identification of the primitives. While constructing primitives, the drawing generation model also records the correspondence between the primitives and their source 3D objects, preparing for subsequent extended attribute writing.

[0050] The generated 2D drawing file not only contains the geometric information of all 2D vector primitives, but also reserves a metadata area (i.e., extended attribute data area) for storing extended attributes, which will be used to subsequently write key data such as 3D association indexes, projection transformation matrices, and plane definition parameters. This 2D drawing file can be directly used in engineering design, construction review, and other application scenarios, and also has a reversible and updatable structural foundation.

[0051] After generating 2D primitives and constructing 2D drawing files, to achieve accurate identification of the 2D drawings and reverse updating of the 3D model, it is necessary to further establish a clear binding relationship between the 3D source information and each 2D primitive. To this end, based on the hierarchical structure information of the target virtual simulation scene, the system writes key metadata such as the 3D association index, projection transformation matrix, and plane definition parameters of the 3D geometric object corresponding to each 2D primitive into the extended attribute data area of ​​that primitive in the drawing file. This extended attribute data area, as a dedicated metadata storage space in the drawing file that does not participate in geometric rendering, can completely preserve the mapping relationship between 3D and 2D, projection context, and semantic path information, thereby supporting primitive-level backtracking and parameter reconstruction. Figure 2 This is a schematic diagram illustrating the process of writing the 3D association index, projection transformation matrix, and plane definition parameters into a 2D drawing file in this embodiment of the application. The following is a detailed explanation... Figure 2 Please provide a detailed explanation.

[0052] S201. Extract the parent-child node relationship and the semantic name of each node from the hierarchical structure information in the target virtual simulation scene; In step S201, to achieve semantic mapping and structural alignment between the 3D model and the 2D drawing, the system first needs to extract complete hierarchical structure information from the target virtual simulation scene, and further parse the parent-child node relationships and node semantic names. The goal of this operation is to provide a basis for constructing layer definitions and block definitions in the subsequent 2D drawing file, so that the primitive organization system in the 2D drawing can truly reflect the component classification, system affiliation, and nested structure of the original 3D scene.

[0053] In practice, the system traverses the data structure within the target virtual simulation scene. This scene is typically organized using a tree-like hierarchical model, with the root node representing the overall project or system entry point, and each child node representing a component, component set, or subsystem. Each node in the data model usually contains two key fields: the first is the **"parentId" field**, which indicates the node's parent node in the tree structure; the second is the **"semanticName" field**, which expresses the node's specific type or purpose in terms of engineering semantics, such as "structural beam," "equipment foundation," or "cable tray system." By uniformly parsing the parentId field of all nodes, the system can construct a complete parent-child relationship mapping table, forming a hierarchical structure tree representing spatial affiliation and semantic classification.

[0054] During the extraction process, the system first identifies all root nodes and non-root nodes, and then traverses each branch path sequentially in a depth-first manner. Simultaneously, the system parses and caches the unique identifier of each node, its parent node identifier, and its semantic name, generating a structured data table. This table records the hierarchical path, semantic type, and parent-child reference relationships of each component node. This information will serve as the direct basis for subsequently constructing layer or block definitions in the 2D drawings.

[0055] For example, if a logical group node named "Structural Floor 1" contains multiple entity component nodes, such as "Beam A," "Beam B," and "Column A," the system will identify "Structural Floor 1" as the parent node of this branch during the extraction process and label its semantic type as a logical group. "Beam A," "Column A," etc., under it will be labeled as entity component nodes, each with its own independent semantic name and local geometric data. The parent-child node relationships and semantic name data extracted in this way not only constitute the semantic foundation of the 2D drawing element organization but also provide crucial support for the generation of hierarchical path identifiers in subsequent extended attribute writing.

[0056] For example, in a scene containing "Building Structure - Floor 1 - Beam Component - Beam A", the system extracts "Building Structure" as the root node, "Floor 1" as its child node, "Beam Component" as a child node of Floor 1, and "Beam A" as a specific entity component node in step S201. Based on this path, the system generates a hierarchical structural chain: "Building Structure / Floor 1 / Beam Component / Beam A", and records the semantic name of "Beam A" as "Structural Beam". This is used to generate the corresponding layer or block definition in the drawings and write extended attributes. This hierarchical path not only supports the organization and classification of 2D primitives but also allows for rapid location of the target 3D object in the original virtual scene during subsequent reverse updates.

[0057] S202. Based on the parent-child node relationship and the semantic name, create the corresponding layer definition or block definition in the two-dimensional drawing file; To ensure that 2D drawing files accurately represent the structural hierarchy and component semantics of the 3D virtual simulation scene, the system needs to create layer definitions or block definitions corresponding to the 3D structure in the drawing file based on the extracted parent-child node relationships and semantic names. This process achieves semantic classification and structural organization of 2D primitives in the drawing, enabling the 2D drawings to not only possess geometric expression capabilities but also a semantic context and hierarchical nesting relationship consistent with the 3D scene. Layer definitions are used to carry the 2D primitives corresponding to logically grouped nodes, while block definitions are used to encapsulate the local coordinate system and geometric structure of entity component nodes. The structural division of layers and blocks provides basic support for the subsequent assignment of primitives, binding of extended attributes, and reverse positioning. Specifically, it may include the following steps: identifying the node type of each node of the 3D geometric object according to the semantic name, wherein the node type includes logical group nodes and solid component nodes; if the node type is a logical group node, then creating a corresponding layer definition in the 2D drawing file; if the node type is a solid component node, then creating a corresponding block definition in the 2D drawing file, wherein the block definition is used to encapsulate the local coordinate system and internal geometric structure of the solid component node, and maintain the nested mapping of the parent-child node relationship.

[0058] In the specific implementation process, to ensure that 2D drawing files not only possess geometric information but also structured semantic organization capabilities when representing 3D virtual simulation scenes, the system needs to identify the node types of each node in the 3D geometric object based on the semantic names extracted from the hierarchical structure information, and create layer definitions or block definitions in the drawing file accordingly. Semantic names refer to the engineering semantic identifiers corresponding to each node in the 3D scene, such as "building structure," "first floor," "beam component," and "beam A," used to express the actual role of the node in the engineering system. Node types are logical classifications made by the system based on semantic names, divided into two main categories: logical group nodes and solid component nodes. Logical group nodes represent hierarchical structural units that do not carry geometric data but have organizational functions, suitable for use as layer carriers in drawings; solid component nodes represent specific 3D components, containing geometric data and transformation information, suitable for encapsulation as block definitions in drawings.

[0059] The process of identifying node types is typically based on parsing a predefined semantic rule base. For example, the system checks if the semantic name contains keywords such as "floor," "system," or "area." If so, it is marked as a logical group node; if the name contains specific component terms such as "beam," "column," or "equipment," it is marked as a solid component node. After identification, the system creates a layer definition corresponding to the logical group node in the drawing file to hold all subordinate elements under that semantic structure, and establishes a naming hierarchy in the drawing layer manager to maintain structural naming rules consistent with the 3D scene. Simultaneously, for each solid component node, the system creates a corresponding block definition with reference to its local coordinate system. A block definition is a structural unit in a CAD drawing file used to reuse and encapsulate geometric elements. It can combine all elements of a component into a whole and reference it in the drawing by inserting blocks. When creating a block definition, the system records the component's local coordinate system, geometric composition, and the path of its parent node in the 3D scene, encapsulating this as the block's metadata to ensure that the block insertion behavior in the drawing maintains the structural nesting relationship with the original 3D model.

[0060] The layer and block definitions created in the above manner not only endow 2D drawings with excellent engineering semantic organization capabilities, but also realize the mapping and preservation of 3D structural hierarchy in 2D representation. For example, in an architectural model, if "Architectural Structure" contains two logical group nodes, "Layer 1" and "Layer 2," and each layer contains several beams, columns, and other physical components, the system will create two layers, "Architectural Structure / Layer 1" and "Architectural Structure / Layer 2," respectively, and create multiple block definitions named "Beam A," "Column B," etc., under each layer, thereby realizing the structured classification and reuse management of graphic elements in 2D drawings. In this way, it not only facilitates the viewing, editing, and archiving of drawings, but also provides a complete organizational and semantic foundation for subsequent reverse geometry extraction and 3D synchronous updates based on the drawings.

[0061] S203. Instantiate the two-dimensional vector data into two-dimensional geometric primitives, and according to the affiliation of the three-dimensional geometric objects in the hierarchical structure information, assign the two-dimensional geometric primitives to the corresponding layer definition or block definition, and generate hierarchical path identifiers; To establish a mapping relationship between 3D geometric objects and 2D drawings, and to maintain consistency between the primitive organization structure in the 2D drawings and the hierarchical structure of the 3D virtual simulation scene, the system needs to instantiate the generated 2D vector data into 2D geometric primitives. Based on the node affiliation of the 3D geometric objects in the hierarchical structure information, these primitives are assigned to the corresponding layer or block definitions. Simultaneously, hierarchical path identifiers are generated to identify their positions within the overall hierarchical structure. The core of this step lies in completing the two processes of "geometric representation materialization" and "semantic affiliation mapping," enabling the 2D drawings to not only possess a visual geometric representation but also carry the corresponding semantic and structural information of the 3D model.

[0062] Two-dimensional vector data is a set of two-dimensional coordinates obtained in a preset two-dimensional plane after the vertex coordinate sequence of a three-dimensional geometric object is processed by a projection transformation matrix. It is usually represented in basic graphic forms such as polygons, polylines, and arcs. These vector data are essentially geometric descriptions in two-dimensional space, but they do not yet possess the primitive attributes and structural affiliations of CAD drawings. Therefore, they need to be converted into geometric entities with primitive identities through an instantiation process. In this process, the system calls the primitive construction module built into the drawing generation model to parse each set of vector data into a corresponding two-dimensional primitive object, and assigns it attributes such as a unique identifier, graphic category, primitive boundary, and style information, so that it can be recognized, rendered, stored, and edited in the drawing.

[0063] After primitive instantiation is complete, the system needs to assign each 2D primitive to its corresponding layer or block definition based on the hierarchical structure information of the 3D geometric object. The assignment process relies on the layer and block definition structures built in the previous step. The system locates the layer or block to which the current 2D primitive belongs by querying the path of the 3D object associated with it in the hierarchical structure and adds the primitive to the corresponding structure. If the 2D primitive corresponds to content under a logical group node, it is added to the layer definition; if it is a solid component node, it is included in the block definition as a block instance, preserving its local coordinate system information.

[0064] To ensure accurate reverse positioning of 2D drawings within the 3D scene during subsequent operations, the system generates a unique hierarchical path identifier for each 2D element after element allocation. This identifier is formed by concatenating the names of the multi-level nodes to which the element belongs, typically using a path-based naming convention, such as "Building Structure / Floor 1 / Beam Component / Beam A". It serves not only as a structural identifier in subsequent extended attribute data writing but also supports rapid path-based positioning of 3D objects during reverse updates.

[0065] For example, if a 3D geometric object is represented as "Column B" on "Floor 2", its 2D vector data after projection transformation is a set of rectangular boundary points. The system instantiates this as a 2D rectangular primitive and assigns it to the "Column B" block definition under the "Building Structure / Floor 2 / Column Components" layer, while simultaneously generating the hierarchical path identifier "Building Structure / Floor 2 / Column Components / Column B". After this processing, the primitive in the drawing not only has a geometric shape but also a complete semantic attribution and structural location, providing a clear organizational basis for subsequent attribute attachment and 3D synchronization.

[0066] S204. Construct an extended data package containing the 3D association index, the projection transformation matrix, the hierarchical path identifier, and the plane definition parameters; In step S204, to achieve a precise correspondence between 2D drawing primitives and geometric objects in the 3D virtual simulation scene, and to provide complete geometric and semantic tracking basis for the subsequent reverse update process, the system needs to construct an extended data package containing a 3D association index, projection transformation matrix, hierarchical path identifier, and plane definition parameters. This extended data package acts as a bridge between 2D primitives and 3D objects, carrying all the necessary information generated during the projection from the 3D virtual scene to the 2D drawing. The core purpose of constructing this data package is to save the geometric origin, transformation basis, and organizational structure of the 2D primitives in the drawing in data form, so that when the 2D primitives are modified, the system can fully restore their original state in 3D space and complete the reverse update reasoning accordingly.

[0067] A 3D associative index is a unique identifier for each geometric object in the global model of a 3D virtual simulation scene. It is typically encoded in a hierarchical string format, such as "BIM.STRUCTURE.FLOOR1.BEAM_A", and is used to quickly locate 3D objects within the scene data structure. A projection transformation matrix is ​​a composite matrix that transforms the coordinates of 3D vertices from the world coordinate system to the 2D projection plane coordinate system. It includes a combination of translation, rotation, and scaling transformations and is represented by a 3x3 or 4x4 matrix to describe the projection rules from 3D to 2D. A hierarchical path identifier is the full path representation of 2D primitives within the drawing layer structure. It indicates the structural location of a primitive within the drawing and typically uses a slash-separated naming convention to express node nesting relationships, such as "Building Structure / 1st Floor / Beam Component / Beam A". Plane definition parameters include three elements: the plane origin coordinates, the first unit basis vector, and the second unit basis vector. These are the fundamental parameters defining the position and orientation of the 2D projection reference plane, used to inversely derive the original projection datum of primitives in 3D space.

[0068] The process of constructing this extended data package typically employs a structured data format, such as JSON or XML, to encapsulate the four types of information mentioned above into named fields and organize them into a set of key-value pairs according to a preset data format specification. The system has a dedicated data encapsulation module within the drawing generation model, responsible for packaging the 3D associated data corresponding to 2D elements into standardized extended data packages to achieve cross-platform and cross-software data compatibility and portability. This process not only ensures a clear data structure and complete fields but also facilitates rapid extraction and parsing during subsequent drawing analysis or element modification.

[0069] S205. Write the extended data packet into the extended attribute data area of ​​the two-dimensional geometric primitive.

[0070] In step S205, the system writes the completed extended data package into the extended attribute data area of ​​the 2D graphic element. The extended attribute data area is a dedicated area in the drawing file for storing non-graphical attribute information. It typically does not participate in the rendering and display of the graphic element, but can be accessed and parsed by drawing software or platform plugins. This data area is designed to provide additional semantic information, engineering attributes, and external links to the graphic element, and is a widely supported data storage mechanism in modern industrial drawing formats (such as DWG, DXF, and SVG). The system binds the extended data package to the unique identifier of the current graphic element by calling the extended attribute writing interface in the drawing generation model, and writes it to the namespace specified in the extended attribute data area. This ensures that data is not lost during drawing saving, transmission, and reading, while also supporting subsequent fast access and parsing.

[0071] When the 2D drawing file is in DWG or DXF format, the extended attribute data area is specifically implemented as extended data (XData) or an object dictionary (Extension Dictionary). The system first calls the graphics engine interface to register a unique application name (RegAppName, e.g., 3D_Updater_Link) to distinguish it from data from other plugins. The 3D associative index is encoded as a string type (DxfCode 1000), the elements of the projection transformation matrix are serialized into a list of floating-point numbers in row-major order (DxfCode 1040), and the plane definition parameters are encapsulated as 3D point data (DxfCode 1010). Finally, the encoded data chain is appended to the handle of the 2D geometric primitive. Thus, this data is not visible when the drawing is opened by conventional CAD software, but can be fully read by the system's parser.

[0072] For example, a 2D primitive represents "Column B" on the "2nd floor" of a building model. When generating drawings, the system first constructs a 3D associative index containing "BIM.STRUCTURE.FLOOR2.COLUMN_B". This, combined with the projection transformation matrix used during projection, the 2D hierarchical path "Building Structure / 2nd Floor / Column Component / Column B", and the origin and basis vector parameters defining its projection plane, is then uniformly encapsulated into a standard JSON format extended data package. This data package is then written to the extended attribute data area of ​​the 2D primitive containing "Column B", identified by the key "VR_LINKED_METADATA". Finally, when a user modifies the "Column B" primitive in the 2D drawing, the system can parse its extended attribute data to extract the original projection matrix and 3D index, achieving a reverse geometric update of the column component in the 3D model. This design not only ensures semantic consistency and geometric synchronization between 2D drawings and 3D models but also greatly improves the intelligence level of cross-platform collaborative design and editing.

[0073] S104. In response to a modification request for any two-dimensional element in the two-dimensional drawing file, extract the target two-dimensional vector data of the target two-dimensional element, the target three-dimensional association index of the target two-dimensional element in the extended attribute data area, the projection transformation matrix, and the plane definition parameters from the two-dimensional drawing file. The target two-dimensional element is the two-dimensional element corresponding to the modification request. In step S104, to achieve reverse-driven updates of geometric data in the 3D virtual simulation scene from 2D drawings, the system needs to accurately extract the target 2D vector data of the target 2D element corresponding to the modification request, as well as its target 3D association index, projection transformation matrix, and plane definition parameters bound in the extended attribute data area, when receiving a user's modification request for any 2D element in the 2D drawing. The purpose of this step is to transform the user's direct modification behavior in the 2D drawing into geometric change information that can be recognized and calculated by the system, and to provide necessary data support for subsequently restoring the modification semantics and update accuracy in 3D space.

[0074] Two-dimensional primitives are the basic building blocks in two-dimensional drawings, typically existing in the form of line segments, polygons, arcs, or composite graphics, used to represent the geometric contours of three-dimensional geometric objects under two-dimensional projection. When a user edits the drawing content, such as dragging, rotating, stretching, or scaling a primitive, the drawing editing module generates a data request containing the primitive's identifier and geometric change information. Upon receiving this request, the system first accesses the primitive's data structure in the drawing file using its unique identifier and extracts the modified geometric information of the target two-dimensional primitive, i.e., the current target two-dimensional vector data. This data is usually represented as a set of two-dimensional coordinate points or control points, used to describe the primitive's current spatial position and morphological characteristics.

[0075] To map these 2D modifications back to the original 3D model, the system also needs to simultaneously extract the 3D associated data bound to the 2D primitive in the extended attribute data area. The extended attribute data area is the metadata storage space in the drawing file, used to record information related to the primitive but not directly involved in graphic rendering. The system accesses the predefined namespace fields in the primitive's extended attributes to parse out the previously written 3D association index, projection transformation matrix, and plane definition parameters.

[0076] Among them, the 3D association index is used to quickly locate the corresponding 3D geometric objects in the virtual simulation scene. It is the key index value for realizing the one-to-one mapping between drawing primitives and 3D models. The projection transformation matrix records the coordinate transformation logic used by the primitive to project from 3D space to 2D plane during the generation process. It is used to reverse restore the 3D meaning of the change. The plane definition parameters include the origin coordinates of the projection plane, 2D basis vectors and other information. It is the basis for constructing the projection matrix and determines the projection direction and reference datum of the 2D primitive in 3D space.

[0077] The implementation of this step relies on the primitive access interface and extended attribute reading mechanism provided by the drawing platform. The system first locates the graphic data structure of the target primitive by calling the primitive parsing module in the drawing generation model and extracts its current two-dimensional vector data; then, through the extended attribute reading module, it parses and extracts the three-dimensional association index, projection transformation matrix and plane definition parameters in the extended attribute data area, and encapsulates the above data into a structured dataset, which is then passed to the subsequent geometric derivation module for processing.

[0078] For example, when a user offsets a 2D element numbered "Beam A" in a drawing, the current 2D vector data of that element will change. Upon receiving this modification event, the system immediately extracts the modified 2D coordinates and simultaneously parses the 3D associative index "BIM.STRUCTURE.FLOOR1.BEAM_A" from the extended attributes, as well as the projection transformation matrix and plane definition parameters used in the element's projection generation process. This process ensures that the system can accurately reconstruct the geometric change direction and magnitude in the original 3D space based on the modifications made to the 2D drawing, providing a complete data foundation for the subsequent synchronous updates of the 3D model. This design significantly enhances the linkage and consistency between 2D drawings and 3D simulation models, supporting efficient and accurate reverse editing of 3D models within a 2D environment.

[0079] S105. Calculate the two-dimensional coordinate difference vector between the target two-dimensional vector data and the original two-dimensional vector data corresponding to the target two-dimensional primitive in the two-dimensional vector data; In step S105, the system aims to identify the geometric position changes of 2D primitives after user modification operations and accurately quantify these geometric changes into 2D coordinate difference vectors, providing a basis for the reverse derivation of subsequent 3D spatial changes. Since modification operations on 2D primitives may include error interference or changes in degrees of freedom exceeding design expectations, the coordinate difference before and after the primitive change is insufficient to directly reflect its allowable effective displacement in 3D space. Therefore, this step not only requires calculating the initial 2D displacement vector but also combining the degree-of-freedom constraint information of the original objects in the 3D scene for constraint correction processing. Specifically, this may include the following steps: Calculate the initial displacement vector between the target two-dimensional vector data and the original two-dimensional vector data; The preset degree-of-freedom constraint parameters of the target two-dimensional primitive are determined based on the target three-dimensional association index. The degree-of-freedom constraint parameters are used to define the specific axis or plane that the target two-dimensional primitive is allowed to displace in three-dimensional space. Based on the projection transformation matrix and the plane definition parameters, the degree-of-freedom constraint parameters are mapped to the preset two-dimensional plane to obtain the two-dimensional constraint projection axis; Calculate the deviation component of the initial displacement vector in the normal direction of the two-dimensional constraint projection axis; If the deviation component is less than the preset operation tolerance threshold, it is determined that the modification request contains unexpected operation jitter, the initial displacement vector is orthogonally projected onto the two-dimensional constraint projection axis, and the vector obtained after projection is determined as the two-dimensional coordinate difference vector.

[0080] In practice, when the system receives a modification request for any two-dimensional element in a two-dimensional drawing file, it first compares the geometric data of the element before and after the modification to determine its spatial changes in the two-dimensional coordinate system. To this end, the system extracts the target two-dimensional vector data of the element in its current state from the drawing parsing module. Simultaneously, it retrieves the initial two-dimensional vector data of the element recorded in the version cache or original drawing data, and calculates the initial displacement vector of the element on the two-dimensional plane by measuring the difference between point coordinates. This displacement vector represents the change in position of the element after modification compared to its original state. It is used to quantify the geometric offset of the user's editing behavior and serves as the basic input for subsequent three-dimensional change calculations.

[0081] To prevent arbitrary displacements of geometric primitives in 2D space from being directly mapped into the 3D model, which could lead to erroneous updates of 3D geometric objects that do not conform to actual design rules, the system needs to identify and apply degree-of-freedom constraint parameters. Degree-of-freedom constraint parameters are motion restriction rules pre-defined for each geometric object in the 3D virtual simulation scene. They describe the directions or areas where components can move in 3D space and are typically generated based on component type, engineering semantics, or user settings. They are used to ensure that geometric changes during reverse updates conform to actual physical or structural rules. For example, a beam component may only be allowed to translate along its axial direction, or a certain type of equipment may only be allowed to slide within a certain plane. The system locates the original object entity in the 3D simulation scene through the 3D association index bound to the target 2D primitive and reads its pre-defined degree-of-freedom constraint parameters. These parameters are typically expressed in the form of vectors or plane equations, representing the directions or ranges of allowed 3D motion.

[0082] Since a 2D drawing is a projection of a 3D model onto a specific projection plane, the system needs to map the 3D degree-of-freedom parameters to a 2D coordinate system based on the projection transformation matrix corresponding to the primitives and the plane definition parameters defining the projection process, in order to obtain the 2D constrained projection axes. The plane definition parameters include the coordinates of the plane origin, the first unit basis vector, and the second unit basis vector. The two basis vectors constitute the 2D projection plane coordinate axis system, and their cross product is the normal vector of the plane. By projecting the 3D degree-of-freedom vectors onto the 2D plane basis vectors, the system obtains the projection direction of the degrees of freedom in the 2D drawing, thereby determining the motion direction that the 2D primitives should follow in the drawing.

[0083] After obtaining the 2D constraint projection axis, the system calculates the deviation component of the initial displacement vector in the direction of the normal to that projection axis, i.e., measures the magnitude of the user's modification action deviating from the design constraint direction. If this deviation value is less than the preset operation tolerance threshold, it indicates that the editing behavior may be caused by errors in the user's interface or hand tremors, rather than an intentional design change. The preset operation tolerance threshold is a numerical limit used to determine whether there are unexpected errors (such as mouse jitter) in the modification of 2D primitives. It is usually set based on a combination of user interaction accuracy, drawing scale, and actual engineering tolerance standards. In specific application scenarios, the setting of the preset operation tolerance threshold is related to the viewport scale of the 2D drawing file. For example, when the drawing scale is 1:100, the threshold can be set to a small displacement within 0.5mm of the drawing space distance; or, based on screen pixel coordinates, the threshold can be set to a range of 3-5 pixels. Any component perpendicular to the constraint axis that is less than this threshold is considered as unintentional jitter during mouse operation and is automatically filtered by the system, thereby ensuring that the reverse-updated 3D model strictly follows engineering constraints (such as grid alignment). To eliminate the interference of unexpected factors on the 3D model update, the system performs an orthogonal projection operation on the initial displacement vector, so that it is strictly aligned with the constraint axis direction on the 2D projection plane, and uses the projected vector as the final confirmed 2D coordinate difference vector.

[0084] Through this process, the system not only extracts effective geometric changes from primitive modification behavior, but also ensures the rationality and safety of 2D editing behavior in 3D model updates by incorporating 3D degree-of-freedom constraints. For example, when a user attempts to drag a vertical column component horizontally in a drawing, if the component's degree of freedom only allows movement in the vertical direction, the system will ignore its horizontal offset operation and retain only the vertical component for subsequent 3D geometric updates, preventing damage to the model's structural logic. This mechanism effectively improves the system's robustness and engineering constraint matching capabilities during the 2D-to-3D reverse update process.

[0085] S106. Based on the two-dimensional coordinate difference vector, the projection transformation matrix, and the plane definition parameters, calculate the three-dimensional spatial change vector on the three-dimensional plane corresponding to the preset two-dimensional plane. In step S106, the core objective of the system is to accurately restore the two-dimensional coordinate difference vector extracted from the modification of two-dimensional primitives to its corresponding true geometric change in three-dimensional space, thereby providing a precise spatial displacement reference for parameter updates of three-dimensional geometric objects. Since the two-dimensional drawing is a mapping result of the three-dimensional scene on a specific projection plane, the two-dimensional coordinate difference vector is essentially a projection of the three-dimensional change on the projection plane. Therefore, it must be restored back to three-dimensional space through a reverse projection process. Specifically, this may include the following steps: performing matrix decomposition on the projection transformation matrix to extract a two-dimensional linear transformation sub-matrix containing rotation and scaling information; calculating the determinant value of the two-dimensional linear transformation sub-matrix, and constructing a local coordinate inverse mapping matrix based on the determinant value of the two-dimensional linear transformation sub-matrix and a preset matrix inverse operation rule; inputting the two-dimensional coordinate difference vector into the local coordinate inverse mapping matrix for inverse linear transformation to obtain a local restored displacement vector after eliminating scaling distortion; and mapping the local restored displacement vector to three-dimensional space based on the first unit basis vector and the second unit basis vector in the plane definition parameters to obtain the three-dimensional space change vector.

[0086] To accurately restore the projection transformation matrix from a 2D coordinate difference vector to a 3D spatial transformation vector, matrix decomposition is required first. This projection transformation matrix is ​​an affine transformation matrix constructed during the 2D drawing generation stage based on translation, rotation, and scaling operations. Its core function is to project the spatial coordinates of a 3D geometric object onto a specified 2D plane. Since this matrix is ​​typically a non-square matrix from 3D to 2D, it cannot be directly inverted; therefore, it is necessary to extract the 2D linear transformation submatrix. In the process of decomposing the projection transformation matrix and extracting the 2D linear transformation submatrix containing rotation and scaling information, the construction logic of the projection transformation matrix must first be clarified. This matrix is ​​constructed during the 2D drawing generation stage by sequentially performing translation, rotation, and scaling operations on the spatial coordinates of the 3D geometric object. Essentially, it is a 3×4 or 3×3 affine transformation matrix containing a complete coordinate transformation chain. Since points in 3D space are ultimately projected onto a 2D plane during the 2D projection process, we only need to focus on the part of the matrix that describes the coordinate transformation within the 2D plane. Assuming that when constructing the projection matrix, the three-dimensional geometric object has been transformed into a local coordinate system with the projection plane as the XY plane, specifically, this two-dimensional linear transformation submatrix is ​​located in the upper left corner of the original projection transformation matrix. It is usually a 2×2 submatrix, and its elements correspond to the transformation results of the first unit basis vector and the second unit basis vector on the two-dimensional plane, respectively. It is used to describe the direction and scale of the two-dimensional coordinate axes after rotation and scaling operations.

[0087] During actual extraction, the system indexes the projection transformation matrix according to its row and column structure, extracting the position data of the first two rows and first two columns, which constitute the four elements in the upper left corner of the matrix. This data is then encapsulated into a new 2×2 matrix. In this sub-matrix, each column represents the new direction of a two-dimensional basis vector along the two-dimensional coordinate axes after transformation, with its magnitude reflecting the scaling ratio and its direction reflecting the rotation angle. Since the translation part of the affine transformation is located in the last column of the matrix, it is not included in this sub-matrix. After extraction, this two-dimensional linear transformation sub-matrix can serve as the input basis for subsequent inverse transformation and distortion removal processing, ensuring that the two-dimensional difference vector has the correct directionality and scaling relationship when it is restored to the three-dimensional spatial transformation vector. For example, if the upper left corner of the original projection matrix is ​​[[0.866, -0.5], [0.5, 0.866]], it indicates that the two-dimensional coordinate system has undergone a 30-degree rotation during projection, and this sub-matrix is ​​the required rotation + scaling information matrix.

[0088] After extracting the two-dimensional linear transformation submatrix, the system needs to calculate its determinant. First, it's necessary to clarify that this two-dimensional linear transformation submatrix is ​​a set of 2×2 matrices containing information about the rotation and scaling of primitives after projection, denoted as M = [[a, b], [c, d]]. This matrix is ​​used to encode the local coordinate changes of three-dimensional geometric objects on the two-dimensional projection plane into a linear transformation form. To achieve the reverse process of pushing back from two-dimensional primitive modifications to three-dimensional changes, the transformation matrix must be inversely operated on, i.e., its inverse matrix M⁻¹ must be constructed, so that the transformed coordinate difference vector can be restored to its standard form in the original coordinate system.

[0089] Before performing the inverse operation, the determinant of matrix M needs to be calculated, with the formula det(M) = a * db * c. The determinant is a prerequisite for determining whether a matrix is ​​invertible; a matrix has an inverse only when det(M) ≠ 0. If the determinant is zero, it indicates that the transformation has undergone linear degradation in a certain direction, making effective coordinate restoration impossible. In this case, the system should abort the inverse update process and display an error message.

[0090] After confirming the invertibility of the matrix, the system constructs the local coordinate inverse mapping matrix based on the standard inverse operation rule of a 2×2 matrix in linear algebra. This rule states that if M = [[a, b], [c, d]], then its inverse matrix M⁻¹ can be expressed as: M⁻¹ = (1 / det(M)) × [[d, -b], [-c, a]]. This rule is a pre-defined, universal inverse operation formula applicable to all full-rank two-dimensional linear transformation matrices. In actual calculations, the system substitutes the extracted matrix elements a, b, c, d along with the calculated det(M) into the above formula to directly construct M⁻¹, i.e., the local coordinate inverse mapping matrix.

[0091] The purpose of this inverse mapping matrix is ​​to restore the two-dimensional coordinate difference vector affected by the projection transformation to the local restored displacement vector in its undistorted state, providing a correct numerical basis for subsequent three-dimensional spatial mapping. For example, if M=[[2,0],[0,3]], then the determinant is 6, and the inverse matrix is ​​[[0.5,0],[0,0.333]], which means that the matrix is ​​shrunk to 1 / 2 and 1 / 3 of its original size along the two local axes, respectively, thereby eliminating the original scaling effect.

[0092] It should be noted that since the two-dimensional coordinate difference vector Δv_2d only represents the relative change in position and does not contain absolute position information, the translation component does not need to be considered during the reverse derivation. In this case, the two-dimensional linear transformation submatrix M_sub only contains rotation and scaling coefficients. Constructing its inverse matrix M_sub^(-1) and applying it to Δv_2d, i.e., performing matrix multiplication: Δv'_local = M_sub^(-1) × Δv_2d, allows us to reconstruct the true physical displacement in the local coordinate system without projection distortion.

[0093] Furthermore, since the reverse mapping is based on a "preset two-dimensional plane", the system assumes that the displacement occurs on the three-dimensional subspace surface spanned by the first unit basis vector u1 and the second unit basis vector u2, that is, there is no displacement component in the normal vector direction of the local coordinate system (i.e., Δz=0), thus ensuring the uniqueness and determinism of the mapping from two-dimensional to three-dimensional.

[0094] After constructing the local coordinate inverse mapping matrix, the system needs to perform an inverse linear transformation on the coordinate difference vector generated by the modification of 2D primitives to eliminate geometric distortions caused by drawing scaling or coordinate rotation. The 2D coordinate difference vector is the displacement generated after the user interacts with primitives in the 2D drawing, usually represented as a 2D vector v=[x, y]. However, this vector includes the scaling and rotation effects during projection and cannot be directly used as the basis for updating 3D space. Therefore, the system inputs this difference vector into the local coordinate inverse mapping matrix M⁻¹ constructed in the previous step and performs a standard matrix-vector multiplication operation: v'=M⁻¹×v. The purpose of this operation is to restore the deformed 2D displacement vector to the true geometric displacement in the local 2D coordinate system, i.e., the locally restored displacement vector v'. This vector eliminates the influence of scaling factors and rotation angles on the direction and magnitude of displacement, representing the pure translation that the primitive should undergo in the local coordinate system. For example, if the two-dimensional coordinate difference vector is [6, 9], and M⁻¹ = [[0.5, 0], [0, 0.333]], then the local restored displacement vector is [3, 3], indicating that the primitive should move 3 units along each of the two basis vectors in the local coordinate system. This coordinate restoration operation provides a foundation for subsequent three-dimensional mapping with correct orientation and consistent dimensions.

[0095] After the coordinate restoration is completed, the system needs to map the displacement vector v'=[dx, dy] in the local two-dimensional coordinate system back to three-dimensional space. This process relies on the first unit basis vector u1 and the second unit basis vector u2 provided in the plane definition parameters. These two unit vectors are set by the system or specified by the user during the construction of the two-dimensional projection plane and are used to describe the directional distribution of the two-dimensional plane in three-dimensional space. They represent the actual directions of the horizontal and vertical axes of the two-dimensional local coordinate system in three-dimensional space, respectively.

[0096] The system uses a linear combination method to map two-dimensional displacements into three-dimensional vectors. The calculation formula is as follows: ΔP = dx × u1 + dy × u2. This formula means that the horizontal component dx of the locally restored displacement vector on the two-dimensional plane is projected along the u1 direction in three-dimensional space, and the vertical component dy is projected along the u2 direction. The vector synthesis of the two components constitutes the final three-dimensional spatial change vector ΔP. This vector not only maintains the directionality of two-dimensional operations but also restores its true spatial meaning in the three-dimensional modeling coordinate system. For example, if v' = [3, 3], u1 = [1, 0, 0] (along the X-axis), and u2 = [0, 0, 1] (along the Z-axis), then the three-dimensional spatial change vector is: ΔP = 3 × [1, 0, 0] + 3 × [0, 0, 1] = [3, 0, 3]. This means that the user's operation on the primitives in the two-dimensional drawing will ultimately cause the corresponding components in the three-dimensional model to move 3 units along the X-axis and Z-axis respectively, achieving precise correspondence and logical consistency between two-dimensional editing and three-dimensional updating.

[0097] S107. Locate the target three-dimensional geometric object corresponding to the target two-dimensional primitive in the target virtual simulation scene according to the target three-dimensional association index, and update the spatial geometric parameters of the target three-dimensional geometric object based on the hierarchical structure information and the three-dimensional spatial change vector.

[0098] In step S107, based on the target 3D association index extracted from the 2D drawing file, the system quickly locates the 3D geometric object corresponding to the modified 2D primitive in the target virtual simulation scene. This is the key entry point for achieving reverse update. After location, the system needs to further utilize the established hierarchical structure information in the scene to determine whether the 3D geometric object belongs to a parent node or component combination relationship, and combine it with the 3D spatial change vector calculated in the previous step to accurately update the spatial geometric parameters of the object. Specifically, this may include the following steps: Based on the hierarchical structure information, determine whether the target 3D geometric object has a parent node; If a parent node exists, obtain the global transformation matrix of the parent node in the world coordinate system, and calculate the inverse of the global transformation matrix; Extract the linear transformation components from the inverse matrix, perform coordinate system transformation operations on the three-dimensional spatial change vector based on the linear transformation components, and convert the three-dimensional spatial change vector into a local spatial change vector relative to the parent node; If there is no parent node, the three-dimensional spatial change vector is determined as a local spatial change vector; Obtain the current local position coordinates of the target 3D geometric object, add the local spatial change vector to the local position coordinates, and obtain the updated local position coordinates; The updated local position coordinates are written into the data storage module of the target three-dimensional geometric object to update the spatial geometric parameters.

[0099] When updating the spatial geometric parameters of a 3D geometric object, it is first necessary to determine whether the object has a parent node based on the hierarchical structure information. This is because 3D virtual simulation scenes typically use a hierarchical modeling approach, where each 3D object may be in a parent-child relationship. Its spatial parameters are not directly expressed in the world coordinate system but depend on the local transformation system of the parent component. If the target 3D geometric object has a parent node, it means its position is defined in the parent node's local coordinate system. Therefore, when updating the spatial parameters of this object, the 3D spatial change vector must be transformed from the world coordinate system to the parent node's local coordinate system. To this end, the system first obtains the global transformation matrix in the world coordinate system from the scene data based on the parent node's identifier. This matrix is ​​typically a 4×4 homogeneous transformation matrix, containing the translation, rotation, and scaling information of the parent component. Subsequently, the system performs an inverse operation on this global transformation matrix to obtain its inverse matrix. This inverse matrix is ​​used to convert any vector in the world coordinate system into a vector relative to the parent node's local coordinate system.

[0100] To improve transformation efficiency and simplify computational complexity, the system only needs to extract the linear transformation components from the inverse matrix, namely the first 3×3 submatrix. This submatrix contains rotation and scaling information but not translation components, because the 3D spatial transformation vector itself only describes direction and magnitude, not absolute position. Next, the system multiplies this 3D spatial transformation vector by the extracted linear transformation components to complete the coordinate system transformation, obtaining a local spatial transformation vector with the parent node as the reference frame. The mathematical principle of this operation is based on the fundamental formulas for coordinate system transformation in linear algebra, ensuring accurate representation of geometric changes even in nested structures.

[0101] If the system determines that the target 3D geometric object does not have a parent node, that is, it is at the top of the scene, it means that its spatial parameters are defined based on the world coordinate system. Therefore, the aforementioned coordinate transformation process can be omitted, and the 3D spatial change vector can be directly used as the local spatial change vector of the object.

[0102] After constructing the local spatial change vector, the system needs to obtain the current local position coordinates of the 3D geometric object. These coordinates are typically stored as a vector, representing the object's original position in its local coordinate system. Subsequently, the system adds these local position coordinates to the previously calculated local spatial change vector to obtain updated local position coordinates, which geometrically represent the object's displacement adjustment from its original position. To make this update effective in the system, the system writes the updated coordinate values ​​to the data storage module of the 3D geometric object within the scene data structure, thus completing the update of its spatial geometric parameters.

[0103] For example, in a building structure scenario, suppose a column is a child node of a floor component, its position defined relative to the floor origin. When the user makes minor adjustments to this column in a 2D drawing, the system calculates its 3D spatial change vector in the world coordinate system as [1.2, 0, -0.5]. The system then extracts the global transformation matrix from the floor's parent node, calculates the inverse matrix to obtain the linear transformation component, and converts this change vector into a local spatial displacement relative to the floor, for example, [1.0, 0, -0.4]. This new displacement is then added to the column's original local coordinates [3.0, 0, 2.0], updating it to [4.0, 0, 1.6]. Finally, this new coordinate is written into the model data, achieving precise structural adjustments. This process ensures consistent and accurate geometric updates even in complex nested parent-child scenarios.

[0104] Please see Figure 3 This is a schematic diagram of the structure of a reverse update system for a three-dimensional virtual simulation scene in an embodiment of this application.

[0105] It should be noted that, Figure 3 The structure of the reverse update system for a three-dimensional virtual simulation scene shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0106] like Figure 3 As shown, a reverse update system for a 3D virtual simulation scene includes a central processing unit 301, which can perform various appropriate actions and processes based on a program stored in a read-only memory 302 or a program loaded from a storage section 308 into a random access memory 303, such as executing the methods described in the above embodiments. The random access memory 303 also stores various programs and data required for system operation. The central processing unit 301, the read-only memory 302, and the random access memory 303 are interconnected via a bus 304. An input / output interface 305 is also connected to the bus 304.

[0107] The following components are connected to the input / output interface 305: an input section 306 including audio input devices, push-button switches, etc.; an output section 307 including an LCD display, audio output devices, indicator lights, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the input / output interface 305 as needed. A removable medium 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 310 as needed so that computer programs read from it can be installed into the storage section 308 as needed.

[0108] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit 301, it performs the various functions defined in the present invention.

[0109] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory, flash memory, optical fiber, portable compact disk read-only memory, optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.

[0111] Specifically, the reverse update system for a three-dimensional virtual simulation scene in this embodiment includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, it implements the reverse update method for a three-dimensional virtual simulation scene provided in the above embodiment.

[0112] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the reverse update system for a three-dimensional virtual simulation scene described in the above embodiments; or it may exist independently and not assembled into the reverse update system for a three-dimensional virtual simulation scene. The storage medium carries one or more computer programs, which, when executed by a processor of the reverse update system for the three-dimensional virtual simulation scene, cause the reverse update system to implement the reverse update method for the three-dimensional virtual simulation scene provided in the above embodiments.

Claims

1. A method for reverse update of a three-dimensional virtual simulation scene, characterized in that, The method includes: Obtain the hierarchical structure information of the target virtual simulation scene, the vertex coordinate sequence of each three-dimensional geometric object in the target virtual simulation scene, the three-dimensional association index of the three-dimensional geometric object, and the plane definition parameters of the preset two-dimensional plane; Based on the plane definition parameters, a projection transformation matrix is ​​constructed, and the vertex coordinate sequence of each of the three-dimensional geometric objects is projected and transformed based on the projection transformation matrix to obtain two-dimensional vector data; The two-dimensional vector data is input into a preset drawing generation model to obtain a two-dimensional drawing file. Based on the hierarchical structure information, the three-dimensional association index, the projection transformation matrix, and the plane definition parameters are written into the extended attribute data area. The extended attribute data area is the metadata storage space for the two-dimensional primitives corresponding to each three-dimensional geometric object in the two-dimensional drawing file. In response to a modification request for any two-dimensional element in the two-dimensional drawing file, the target two-dimensional vector data of the target two-dimensional element, the target three-dimensional association index of the target two-dimensional element in the extended attribute data area, the projection transformation matrix, and the plane definition parameters are extracted from the two-dimensional drawing file. The target two-dimensional element is the two-dimensional element corresponding to the modification request. Calculate the two-dimensional coordinate difference vector between the target two-dimensional vector data and the original two-dimensional vector data corresponding to the target two-dimensional primitive in the two-dimensional vector data; Based on the two-dimensional coordinate difference vector, the projection transformation matrix, and the plane definition parameters, calculate the three-dimensional spatial change vector on the three-dimensional plane corresponding to the preset two-dimensional plane; Based on the target 3D association index, the target 3D geometric object corresponding to the target 2D primitive is located in the target virtual simulation scene, and the spatial geometric parameters of the target 3D geometric object are updated based on the hierarchical structure information and the 3D spatial change vector.

2. The method of claim 1, wherein, The plane definition parameters include the coordinates of the plane origin, a first unit basis vector, and a second unit basis vector orthogonal to the first unit basis vector. The cross product of the first unit basis vector and the second unit basis vector is the normal vector of the preset two-dimensional plane. The construction of the projection transformation matrix based on the plane definition parameters specifically includes: Obtain the unit conversion factor and drawing scaling factor between the target virtual simulation scene and the two-dimensional drawing file, and calculate the product of the unit conversion factor and the drawing scaling factor to obtain the comprehensive scaling coefficient; A translation matrix is ​​constructed based on the coordinates of the plane origin. The translation matrix is ​​used to translate the vertex coordinates of the three-dimensional geometric object from the world coordinate system to a local coordinate system centered on the coordinates of the plane origin. A rotation transformation matrix is ​​constructed based on the first unit basis vector and the second unit basis vector. The rotation transformation matrix is ​​used to project the translated vertex coordinates onto the two-dimensional coordinate axis defined by the first unit basis vector and the second unit basis vector. A scaling matrix is ​​constructed based on the comprehensive scaling factor. The scaling matrix is ​​used to unify the dimensions and adjust the scale of the projected two-dimensional coordinates. Following the preset logical order of coordinate transformation, the scaling matrix, the rotation transformation matrix, and the translation matrix are multiplied in a cascade manner to obtain the projection transformation matrix.

3. The method of claim 1, wherein, The step of writing the 3D association index, the projection transformation matrix, and the plane definition parameters into the extended attribute data area of ​​the 2D primitive corresponding to the 3D geometric object in the 2D drawing file based on the hierarchical structure information specifically includes: Extract the parent-child node relationships and semantic names of each node from the hierarchical structure information in the target virtual simulation scene. Based on the parent-child node relationship and the semantic name, create the corresponding layer definition or block definition in the two-dimensional drawing file; The two-dimensional vector data is instantiated into two-dimensional geometric primitives, and according to the affiliation of the three-dimensional geometric objects in the hierarchical structure information, the two-dimensional geometric primitives are assigned to the corresponding layer definition or block definition, and a hierarchical path identifier is generated. Construct an extended data package containing the 3D association index, the projection transformation matrix, the hierarchical path identifier, and the plane definition parameters; The extended data packet is written into the extended attribute data area of ​​the two-dimensional geometric primitive.

4. The method of claim 3, wherein, The step of creating corresponding layer or block definitions in the two-dimensional drawing file based on the parent-child node relationship and the semantic name specifically includes: The node type of each node of the three-dimensional geometric object is identified based on the semantic name, and the node type includes logical grouping nodes and solid component nodes; If the node type is the logical group node, then create the corresponding layer definition in the two-dimensional drawing file; If the node type is the solid component node, a corresponding block definition is created in the two-dimensional drawing file. The block definition is used to encapsulate the local coordinate system and internal geometry of the solid component node, and to maintain the nested mapping of the parent-child node relationship.

5. The method of claim 1, wherein, The calculation of the two-dimensional coordinate difference vector between the target two-dimensional vector data and the original two-dimensional vector data corresponding to the target two-dimensional primitive in the two-dimensional vector data specifically includes: Calculate the initial displacement vector between the target two-dimensional vector data and the original two-dimensional vector data; The preset degree-of-freedom constraint parameters of the target two-dimensional primitive are determined based on the target three-dimensional association index. The degree-of-freedom constraint parameters are used to define the specific axis or plane that the target two-dimensional primitive is allowed to displace in three-dimensional space. Based on the projection transformation matrix and the plane definition parameters, the degree-of-freedom constraint parameters are mapped to the preset two-dimensional plane to obtain the two-dimensional constraint projection axis; Calculate the deviation component of the initial displacement vector in the normal direction of the two-dimensional constraint projection axis; If the deviation component is less than the preset operation tolerance threshold, it is determined that the modification request contains unexpected operation jitter, the initial displacement vector is orthogonally projected onto the two-dimensional constraint projection axis, and the vector obtained after projection is determined as the two-dimensional coordinate difference vector.

6. The method of claim 1, wherein, The calculation of the three-dimensional spatial change vector on the three-dimensional plane corresponding to the preset two-dimensional plane, based on the two-dimensional coordinate difference vector, the projection transformation matrix, and the plane definition parameters, specifically includes: Perform matrix decomposition on the projection transformation matrix to extract a two-dimensional linear transformation submatrix containing rotation and scaling information; Calculate the determinant of the two-dimensional linear transformation submatrix, and construct a local coordinate inverse mapping matrix based on the determinant of the two-dimensional linear transformation submatrix and the preset matrix inverse operation rules; The two-dimensional coordinate difference vector is input into the local coordinate inverse mapping matrix for inverse linear transformation to obtain the local restored displacement vector after eliminating scaling distortion; Based on the first unit basis vector and the second unit basis vector in the plane definition parameters, the local restored displacement vector is mapped to three-dimensional space to obtain the three-dimensional space change vector.

7. The method according to claim 1, characterized in that, The process of updating the spatial geometric parameters of the target 3D geometric object based on the hierarchical structure information and the 3D spatial change vector specifically includes: Based on the hierarchical structure information, determine whether the target 3D geometric object has a parent node; If a parent node exists, obtain the global transformation matrix of the parent node in the world coordinate system, and calculate the inverse of the global transformation matrix; Extract the linear transformation components from the inverse matrix, perform coordinate system transformation operations on the three-dimensional spatial change vector based on the linear transformation components, and convert the three-dimensional spatial change vector into a local spatial change vector relative to the parent node; If there is no parent node, the three-dimensional spatial change vector is determined as a local spatial change vector; Obtain the current local position coordinates of the target 3D geometric object, add the local spatial change vector to the local position coordinates, and obtain the updated local position coordinates; The updated local position coordinates are written into the data storage module of the target three-dimensional geometric object to update the spatial geometric parameters.

8. A reverse update system for a three-dimensional virtual simulation scene, characterized in that, The reverse update system for the three-dimensional virtual simulation scene includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the reverse update system for the three-dimensional virtual simulation scene to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is run on the reverse update system of the three-dimensional virtual simulation scene, the reverse update system of the three-dimensional virtual simulation scene performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the reverse update system of the three-dimensional virtual simulation scene, the reverse update system of the three-dimensional virtual simulation scene performs the method as described in any one of claims 1-7.