A method for constructing and displaying OFD files for three-dimensional models
By constructing three-dimensional model page object placeholders and attachment objects in the OFD file, the shortcomings of 3D models storage and display in the OFD file are solved, and efficient storage and interactive display of 3D models are achieved.
Patent Information
- Application Number
- CN202410295903.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-15
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-03-15
AI Technical Summary
The existing open-type OFD files lack effective three-dimensional model page object construction and three-dimensional model display methods, which leads to the failure of OFD files to implement the three-dimensional model storage and display functions well.
The three-dimensional model-oriented OFD file construction and display method is adopted. By exporting the three-dimensional model into an STL format file, and creating three-dimensional model page object placeholders and attachment objects in the OFD file, combining the processing of OFD.xml, Content.xml and attachments.xml files, the storage and display of three-dimensional models are realized.
It realizes the effective storage and display of three-dimensional model objects on the OFD page, provides interactive operation functions such as rotation, scaling, and translation of the three-dimensional model, and improves the functionality and user experience of the OFD file.
Smart Images

Figure CN118093524B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of open format OFD (Open Fixed Document) file construction and display, and specifically discloses an OFD file construction and display method for a three-dimensional model. Background Art
[0002] The open format OFD file is a document format with its own intellectual property rights proposed by the State Archives Administration and other departments. It has been gradually applied in business links in the fields of taxation, official documents, commerce, etc., greatly improving the level of information security and autonomy. The continuous expansion of the scope of application has also put forward higher requirements for the construction and display functions of OFD files, especially the integration and display functions of product 3D model objects related to production and manufacturing business activities. The integration and display of 3D model objects can effectively meet the requirements of product design information technology communication and long-term preservation, improve manufacturing production efficiency, and ensure product quality accuracy.
[0003] OFD files involve multiple file types, page objects occupy a large buffer space, and the file element organization method is strictly restricted. Therefore, the construction and display of OFD files need to consider multiple influencing factors to reduce problems such as file element information conflicts and missing. Certain patent documents (application number: 201910091864.1, publication number: CN109829139A, application number 202110978178.3, publication number CN113849470A, application number: 202111455583.3, publication number: CN114118007A, application number: 202111388039.1, publication number: CN114265968A) explain and analyze the OFD layout file construction method, and propose a method for converting DOC / DOCX format streaming files into OFD format, an electronic seal extraction method based on electronic invoice OFD file, a layout data stream file to OFD file method, and an OFD layout file electronic signature method, which improves the OFD file construction method and enhances the security of OFD files. However, these documents do not consider the storage and display requirements of three-dimensional models in OFD layout files, and are not suitable for OFD file construction and display containing three-dimensional models. Summary of the invention
[0004] The technical problem to be solved by the present invention is that the existing open-format OFD files lack effective 3D model page object construction and 3D model display methods, resulting in the OFD files being unable to well implement 3D model storage and display functions.
[0005] In order to solve the above technical problems, the present invention provides a method for constructing and displaying an OFD file for a three-dimensional model, and the construction and display process of an OFD file containing a three-dimensional model includes:
[0006] S1. Export the 3D model from the 3D design tool to an STL format file;
[0007] S2. Create an OFD file basic template according to OFD national standards. The OFD file basic template includes OFD.xml, attachments.xml, Content.xml files, and Doc_0 folder. The Content.xml file includes page objects, including text, images, and signatures. The Doc_0 folder includes Res resource folders and Pages folders. In the Content.xml file, add an image-type page object at the location where the 3D model needs to be inserted, and set the image-type page object as a 3D model page object placeholder.
[0008] S3. Define a 3D model attachment object in the attachments.xml file, determine a unique ID for each 3D model attachment object, and each 3D model attachment object uniquely corresponds to a 3D model attachment; the 3D model attachment is an STL format file exported in S1; the 3D model attachment is placed in the Res resource folder, the 3D model attachment file name is consistent with the 3D model attachment object defined in the attachments.xml file, and the 3D model page object placeholder described in S2 is associated with the 3D model attachment object;
[0009] S4, compress and encapsulate the OFD.xml, Content.xml files, Doc_0 folder, Res resource folder, Pages folder formed by S2, and the attachments.xml file formed by S3 to complete the construction of the OFD file;
[0010] S5. Start the browser and load the OFD parsing service; select the OFD file to be displayed, and decompress the OFD file to a folder with the same name under the browser cache directory;
[0011] S6. Parse the page objects in the Content.xml file, which include text, images, and signatures, search for relevant resource files in the Res resource folder, and complete the display of text, images, and signatures;
[0012] S7, reading the 3D model attachment object defined in the attachments.xml file, where the information of the 3D model attachment object includes the ID, path, and file name of the 3D model attachment;
[0013] S8, reading the 3D model attachment according to the ID, path and file name of the 3D model attachment in S7, and parsing the 3D entity elements in the 3D model attachment;
[0014] S9, according to the association relationship between the 3D model page object placeholder and the 3D model attachment in S3, searching for the corresponding 3D model page object placeholder in the page object; at the position of the 3D model page object placeholder, drawing the 3D model geometric elements according to the specific page coordinate values and length and width dimensions of the 3D model page object placeholder;
[0015] S10. In the three-dimensional model display area, a user interaction operation response processing function is provided.
[0016] Furthermore, the STL format file adopts a binary data format.
[0017] Further, in S10, the user interaction operation response processing function includes rotation, scaling and translation of the three-dimensional model.
[0018] Compared with the prior art, the present invention has the following beneficial effects:
[0019] 1. The present invention adopts an optimization method to set a 3D model placeholder and define an OFD attachment file to achieve the storage of the 3D model object on the OFD page.
[0020] 2. The present invention realizes the display and interactive operation of the three-dimensional model in the OFD display interface through the method of parsing service, and provides concise and efficient interactive viewing functions such as rotation, scaling, and translation of the three-dimensional model. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A flowchart of a method for constructing and displaying an OFD file for a three-dimensional model according to the present invention;
[0022] Figure 2 is a flow chart of the construction method in the present invention;
[0023] Figure 3 It is a flow chart of the display method in the present invention;
[0024] Figure 4 It is a sample diagram for defining the attachment file of the OFD file in the present invention;
[0025] Figure 5 This is a sample diagram of the attachment file association information of the OFD file in the present invention;
[0026] Figure 6 This is a diagram showing the OFD file interface in the present invention. DETAILED DESCRIPTION
[0027] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] For the construction and display process of OFD files containing 3D models, combined with Figures 1 to 3 The present invention comprises the following steps:
[0029] S1. Export the 3D model from the 3D design tool. Export the 3D model from the 3D design tool in the form of an STL file, where the STL file uses a binary data format.
[0030] For example, export the 3D model of a disk-type component to the file A_drive_cdisk.stl.
[0031] S2. Create an OFD file basic template in accordance with the OFD national standard. The OFD file basic template includes files such as OFD.xml, Attachments.xml, Document.xml, DocumentRes.xml, PublicRes.xml, a Doc_0 folder, and each page folder and a page content file Content.xml; wherein the Content.xml file includes page objects, and the page objects include text, images, and signatures; wherein the Doc_0 folder includes a Res resource folder and a Pages folder; in the Content.xml file, insert an image type page object to the location where a three-dimensional model needs to be added, and set the image type page object as a three-dimensional model page object placeholder.
[0032] For example, define an image object in the page content file Content.xml as a 3D model page object placeholder. <ofd:ImageObject ID="4133"Boundary="82.2113 208.8727 40.936340.9364"CTM="40.9363 0 0 40.9363 0 0"ResourceID="4132" / > .
[0033] S3. Define the 3D model attachment object in the attachments.xml file of the OFD file basic template, determine a unique ID for each 3D model attachment object, and each 3D model attachment object uniquely corresponds to a 3D model attachment; the 3D model attachment is the STL format file exported by S1.
[0034] For example, the STL format file of the three-dimensional model of a disk-shaped component exported in step S1 is defined in the attachments.xml file as:
[0035] - <ofd:Attachment Size="52.426"CreationDate="2023-08-17T11:10:59"ID="12187"Name="A_drive_cdisk"> <ofd:fileloc> / Doc_0 / Res / A_drive_cdisk.stl< / ofd:fileloc> ,like Figure 4 shown.
[0036] And put the 3D model attachment in STL format into the Res resource folder. The name of the 3D model attachment file should be consistent with the name of the 3D model attachment object defined in the attachments.xml file.
[0037] For example, put the file described in S1 into "Doc_0\Res\A_drive_cdisk.stl".
[0038] Further, the three-dimensional model page object placeholder in step S2 is associated with the three-dimensional model attachment object in step S3.
[0039] For example, add association information in the OFD.XML file:
[0040] <ofd:CustomData Name="res_4132"> 12187_three_A_drive_cdisk, such as Figure 5 shown.
[0041] S4: compress and encapsulate the OFD.xml, Document.xml, DocumentRes.xml, PublicRes.xml, Content.xml files, Doc_0 folder, Res resource folder, Pages folder, and attachments.xml file formed by S2, and complete the construction of the OFD file.
[0042] For example, a CDisk.ofd file is generated.
[0043] S5. Start the browser and load the OFD parsing service. For example, start the Chrome browser and load the parsing service "java-jar ofdThree.jar". Select the OFD file to be displayed and decompress the OFD file to a folder with the same name under the browser cache directory.
[0044] For example, select the CDisk.ofd file constructed in step S4 and decompress it to the folder \CDisk.
[0045] S6. Parse the page objects in the Content.xml file. The page objects include text, images, and signatures. Search for related resource files in the Res resource folder to complete the display of text, images, and signatures.
[0046] Parse OFD.xml, Attachments.xml, Document.xml, DocumentRes.xml and other files, parse the content file Content.xml of each page folder, and complete the display of common objects such as text, images and signatures.
[0047] S7. Read the 3D model attachment object defined in the attachments.xml file. The 3D model attachment object includes the ID, path, and file name of the 3D model attachment.
[0048] For example, read the 3D model attachment object and obtain the 3D model attachment ID as 12187, the path as / Doc_0 / Res / , and the file name as A_drive_cdisk.stl.
[0049] S8. Read the three-dimensional model attachment according to the ID, path and file name of the three-dimensional model attachment in S7, and parse the three-dimensional entity elements in the three-dimensional model attachment.
[0050] For example, the geometric elements such as points, lines, surfaces, and normals of the three-dimensional model attachment A_drive_cdisk.stl are analyzed.
[0051] S9. According to the association relationship between the 3D model page object placeholder and the 3D model attachment in step S3, search for the corresponding 3D model page object placeholder in the page object.
[0052] For example, according to the relationship information:
[0053] <ofd:CustomData Name="res_4132"> 12187_three_A_drive_cdisk,
[0054] The 3D model page object placeholder ID = 4132 is found on the page, and the A_drive_cdisk object with the 3D model attachment ID = 12187 is found in the 3D model attachment object.
[0055] Furthermore, at the position of the 3D model page object placeholder, the 3D model geometric elements are drawn according to the specific page coordinate values and length and width dimensions of the 3D model page object placeholder.
[0056] For example, the location Boundary="82.2113 208.872740.936340.9364" where the graphic object ID=4132 is located is defined as the 3D model display area, and the 3D model geometric elements are displayed in this area.
[0057] S10. In the 3D model display area, a user interaction operation response processing function is provided, including interactive operations such as rotation, scaling, and translation of the 3D model.
[0058] For example, the user can use the mouse to rotate, zoom, and pan the displayed disk-shaped parts. Figure 6 shown.
[0059] Finally, it should be noted that the above functions are only used to illustrate the technical solution of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features can be replaced by equivalents. However, these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present invention.
Claims
1. A method for constructing and displaying OFD files for three-dimensional models, characterized in that: The steps include: S1. Export the 3D model from the 3D design tool to an STL format file; S2. Create an OFD file basic template according to OFD national standards. The OFD file basic template includes OFD.xml, attachments.xml, Content.xml files, and Doc_0 folder. The Content.xml file includes page objects, including text, images, and signatures. The Doc_0 folder includes Res resource folders and Pages folders. In the Content.xml file, add an image-type page object at the location where the 3D model needs to be inserted, and set the image-type page object as a 3D model page object placeholder. S3. Define a 3D model attachment object in the attachments.xml file, determine a unique ID for each 3D model attachment object, and each 3D model attachment object uniquely corresponds to a 3D model attachment; the 3D model attachment is an STL format file exported in S1; the 3D model attachment is placed in the Res resource folder, the 3D model attachment file name is consistent with the 3D model attachment object defined in the attachments.xml file, and the 3D model page object placeholder described in S2 is associated with the 3D model attachment object; S4, compress and encapsulate the OFD.xml, Content.xml files, Doc_0 folder, Res resource folder, Pages folder formed by S2, and the attachments.xml file formed by S3 to complete the construction of the OFD file; S5. Start the browser and load the OFD parsing service; select the OFD file to be displayed, and decompress the OFD file to a folder with the same name under the browser cache directory; S6. Parse the page objects in the Content.xml file, which include text, images, and signatures, search for relevant resource files in the Res resource folder, and complete the display of text, images, and signatures; S7, reading the 3D model attachment object defined in the attachments.xml file, where the information of the 3D model attachment object includes the ID, path, and file name of the 3D model attachment; S8, reading the 3D model attachment according to the ID, path and file name of the 3D model attachment in S7, and parsing the 3D entity elements in the 3D model attachment; S9, according to the association relationship between the 3D model page object placeholder and the 3D model attachment in S3, searching for the corresponding 3D model page object placeholder in the page object; at the position of the 3D model page object placeholder, drawing the 3D model geometric elements according to the specific page coordinate values and length and width dimensions of the 3D model page object placeholder; S10. In the three-dimensional model display area, a user interaction operation response processing function is provided.
2. The method for constructing and displaying OFD files for three-dimensional models according to claim 1, characterized in that: The STL format file adopts a binary data format.
3. The method for constructing and displaying an OFD file for a three-dimensional model according to claim 1, characterized in that: In S10, the user interaction operation response processing function includes rotation, scaling and translation of the three-dimensional model.
Citation Information
Patent Citations
method and device for converting a streaming file in a DOC / DOCX format into a format file in an OFD format
CN109829139A
Method and system for extracting electronic seal based on electronic invoice OFD file
CN113849470A
Method for converting layout data stream file into OFD file
CN114118007A
OFD layout file electronic signature method and system
CN114265968A
Method for converting OFD file into PDF file
CN116432609A