Web-based three-dimensional part model conversion method and device
By acquiring multiple views of the 3D component model and performing projection and dimensioning processing, 2D drawings are generated, solving the problem of being unable to convert online based on the web and achieving flexible and personalized 2D drawing output.
Patent Information
- Application Number
- CN202410350798.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2025-09-26
AI Technical Summary
Web-based 3D component models cannot be directly converted into corresponding 2D drawings online, which hinders online modeling and further applications.
By obtaining multiple views of the 3D component model, projecting it, making selections on dimensioning, and outputting the layout according to preset rules, 2D drawings are generated.
It achieves flexible and personalized real-time output of 2D drawings, overcoming the technical defect of being unable to generate 2D drawings based on the web.
Smart Images

Figure CN120707787A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and device for converting a three-dimensional component model based on a web. Background Art
[0002] The 3D component models freely constructed on the web usually cannot be directly converted into corresponding 2D drawings online, which poses a major obstacle to online modeling and further applications. Summary of the Invention
[0003] The present application provides a web-based three-dimensional component model conversion method and device to solve the problems existing in the related art.
[0004] In a first aspect, the present invention provides a web-based three-dimensional component model conversion method, comprising: in response to an operation of triggering the generation of a 2D drawing on a three-dimensional component model, obtaining multiple views pointed to by the operation, wherein the three-dimensional component model contains dimension annotations; projecting the three-dimensional component model under different views to obtain projection drawings corresponding to the different views, wherein, during the projection process, the dimension annotations are selected and discarded; and laying out and outputting the projection drawings corresponding to the different views according to preset rules to obtain 2D drawings corresponding to the three-dimensional component model.
[0005] Optionally, the layout output of the projection drawings corresponding to different views according to preset rules includes: axis-aligning the projection drawings corresponding to different views according to a preset layout based on a default coordinate system of the three-dimensional component model; calculating the minimum bounding boxes corresponding to different views; and calculating the arrangement spacing between the projection drawings corresponding to different views based on the axis-aligned layout drawings using the size of each bounding box.
[0006] Optionally, the axial alignment of the projection drawings corresponding to different views according to a preset layout based on the default coordinate system of the three-dimensional component model includes: based on the default coordinate system of the three-dimensional component, using preset alignment rules, the axial alignment of the projection drawings corresponding to different views according to a preset layout, wherein the preset alignment rules include: setting the arrangement positions of different views, wherein the layout is expanded with the front view as the center; setting rules for X-axis alignment of the front view, left view, right view, and rear view; setting rules for Y-axis alignment of the top view, bottom view, and front view.
[0007] Optionally, the pre-set alignment rules also include: setting rules for aligning the left view and the isometric view on the Y axis, and aligning the isometric view and the top view on the X axis; setting rules for aligning the left view and the section view on the Y axis, and aligning the section view and the top view on the X axis.
[0008] Optionally, the method further includes: when an adjustment operation of the 2D drawing output by the layout is triggered, adjusting positions of different views based on the adjustment operation.
[0009] Optionally, during the projection process, the dimensioning operation includes: calculating whether the plane normal composed of the line segments of each dimensioning is parallel to the projection direction; if so, retaining the dimensioning; if not, hiding the dimensioning.
[0010] Optionally, before responding to the operation, the method further includes: in response to the import operation of the three-dimensional component elements to be combined being triggered, importing the three-dimensional component elements into the canvas of the web page; when the drag operation is triggered for any three-dimensional component element of the three-dimensional component elements to be combined in the canvas, detecting the dragged position; when the dragged position reaches a preset position, automatically adsorbing the dragged any three-dimensional component element and the target three-dimensional component element to obtain the three-dimensional component model.
[0011] In a second aspect, the present invention provides a web-based three-dimensional component model conversion device, including a trigger response unit, configured to trigger the unit in response to an operation of generating a 2D drawing by triggering the three-dimensional component model, and obtain multiple views pointed to by the operation, wherein the three-dimensional component model contains dimension annotations; a projection unit, configured to project the three-dimensional component model under different views to obtain projection drawings corresponding to different views, wherein the dimension annotations are selected and discarded during the projection process; an output unit, configured to layout and output the projection drawings corresponding to different views according to preset rules to obtain 2D drawings corresponding to the three-dimensional component model.
[0012] In a third aspect, the present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.
[0013] In a fourth aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method provided in the first aspect when executing the program.
[0014] The present invention discloses a web-based method and device for converting 3D component models. The method comprises: responding to an operation triggering the generation of a 2D drawing from a 3D component model; obtaining multiple views directed by the operation, wherein the 3D component model includes dimension annotations; projecting the 3D component model in different views to obtain projections corresponding to the different views; performing a selection operation on the dimension annotations during the projection process; and outputting the projections corresponding to the different views according to preset rules to obtain 2D drawings corresponding to the 3D component model. This solution achieves the technical effect of flexible and personalized real-time output of 2D drawings, thereby overcoming the technical deficiency of related web-based technologies that cannot generate 2D drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1 This application provides a web-based three-dimensional component model conversion method;
[0017] Figure 2 This is a schematic diagram of a bounding box corresponding to different views of this application;
[0018] Figure 3 This is a schematic diagram of an axisymmetric view of a different view of the present application;
[0019] Figure 4 A method corresponding to the Figure 1 Schematic diagram of the electronic device. DETAILED DESCRIPTION
[0020] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0021] The following is combined with Figure 1 The method is exemplified. The method comprises the following steps:
[0022] Step 101: In response to an operation of triggering the generation of a 2D drawing from a three-dimensional component model, a plurality of views directed by the operation are obtained, wherein the three-dimensional component model includes dimension annotations.
[0023] In this embodiment, users can freely construct 3D component models within a web-based visualization interface. Each 3D component model is composed of at least one 3D component element. Each element is dragged from the element library onto the canvas and then assembled using drag and drop. Each element is pre-annotated with corresponding dimensions at different locations. After assembly, a three-dimensional, intuitive 3D component model with multiple dimension annotations is created.
[0024] The user can trigger at least one view selection operation on the interface, and then convert the 2D drawing for the at least one selected view.
[0025] As an optional implementation of this embodiment, before responding to the operation, the method also includes: in response to the import operation of the three-dimensional component elements to be combined being triggered, importing the three-dimensional component elements into the canvas of the web page; when the drag operation is triggered for any three-dimensional component element of the three-dimensional component elements to be combined in the canvas, detecting the dragged position; when the dragged position reaches the preset position, automatically adsorbing the dragged any three-dimensional component element and the target three-dimensional component element to obtain the three-dimensional component model.
[0026] In this optional implementation, a webpage displaying the component model is created on the web. One or more 3D component elements can be imported by triggering the file import button on the webpage. Multiple 3D component elements can be imported if desired. 3D component elements can also be imported from an element library by triggering a component on the webpage. After the import operation is performed, the imported 3D component elements are displayed on the canvas. Users can drag and drop the 3D component elements in the canvas area to combine them. The current position is detected during the dragging process, allowing them to automatically adsorb when they reach the preset position.
[0027] Through the above optional implementation method, the conversion of 2D drawings based on the model of the free component is realized.
[0028] Step 102: Projecting the three-dimensional component model in different views to obtain projection drawings corresponding to the different views, wherein during the projection process, the dimension annotations are selected or discarded.
[0029] In this embodiment, projection is performed based on the user's selected view. Before projection, it is necessary to ensure that the camera focal length value is the same for each view, ensuring that the shape and size of the same model remain consistent in each view. Dimensions are typically marked with annotated line segments. Selecting and discarding dimension annotations during projection can reduce unnecessary interfering line segments. The projection image can be formatted as SVG to ensure clarity.
[0030] Step 103: The projection drawings corresponding to different views are laid out and output according to preset rules to obtain 2D drawings corresponding to the 3D component model.
[0031] In this embodiment, after the projection images corresponding to the multiple views are determined, they are laid out and output according to a preset rule. The layout can ensure that the marked positions on each view correspond to each other.
[0032] After generating the 2D drawing, you can store it in association with the 3D component model. Furthermore, when the dimension of the 3D component model is modified, the corresponding 2D drawing will be modified adaptively. The generated 2D drawing display effect can be used as follows: Figure 2 or Figure 3 The stereoscopic display effect, which is the same as the view display effect, can also use a line drawing as the final display effect, which is not limited here.
[0033] As an optional implementation method of this embodiment, the layout output of the projection drawings corresponding to different views according to preset rules includes: based on the default coordinate system of the three-dimensional component model, axis-aligning the projection drawings corresponding to different views according to a preset layout; calculating the minimum bounding boxes corresponding to the projection drawings corresponding to different views; and based on the axis-aligned layout diagram, using the size of each bounding box to calculate the arrangement spacing between the projection drawings corresponding to different views.
[0034] In this optional implementation, the combined model has a default coordinate system (XYZ axes and origin), and the views can be divided into front, back, left, right, top, bottom, and axial views. It can also include fracture views and section views. Different views can be aligned through axis alignment, and the positions on the projection diagram after alignment can correspond to each other.
[0035] Before projection, the minimum bounding box of each view can be calculated, that is, the minimum bounding box of the 3D component model and dimension annotation. Based on the bounding box, the maximum range of the projection can be calculated. At the same time, the spacing can be calculated when arranging and arranging to avoid overlap. Figure 2 The bounding boxes corresponding to different views are shown.
[0036] As an optional implementation method of this embodiment, the default coordinate system based on the three-dimensional component model, the axis alignment of the projection drawings corresponding to different views according to a preset layout includes: based on the default coordinate system of the three-dimensional component, using pre-set alignment rules, the axis alignment of the projection drawings corresponding to different views according to a preset layout, wherein the pre-set alignment rules include: setting the arrangement positions of different views, wherein the layout is expanded with the front view as the center; setting rules for X-axis alignment of the front view, left view, right view, and rear view; setting rules for Y-axis alignment of the top view, bottom view, and front view.
[0037] As an optional implementation method of this embodiment, the pre-set alignment rules also include: setting rules for aligning the left view and the isometric view on the Y axis, and aligning the isometric view and the top view on the X axis; setting rules for aligning the left view and the sectional view on the Y axis, and aligning the sectional view and the top view on the X axis.
[0038] In this optional implementation, alignment rules can be pre-set, and then when the user selects different views, the selected views can be aligned. The layout is centered on the front view, and the front, back, left, and right views of the projection are aligned in the horizontal x-axis direction, and the top, bottom, and front views are aligned in the y-axis direction. Figure 3 The alignment is shown schematically in the front view, left view, bottom view, and isometric view.
[0039] As an optional implementation of this embodiment, the method further includes: when an adjustment operation of the 2D drawing output by the layout is triggered, adjusting the positions of different views based on the adjustment operation.
[0040] In this optional implementation, the alignment positions of the various projections of the output 2D drawings can be customized.
[0041] As an optional implementation method of this embodiment, during the projection process, the dimension annotation is selected and discarded, including: calculating whether the plane normal composed of the line segments of each dimension annotation is parallel to the projection direction; if they are parallel, retaining the dimension annotation; if they are not parallel, hiding the dimension annotation.
[0042] In this optional implementation, it is calculated whether the plane normal and projection direction composed of each dimension line segment are parallel. If they are parallel, the dimension annotation is retained. If they are not parallel, the dimension annotation needs to be hidden to avoid the appearance of annotations with invisible dimension values in the projection view and reduce unnecessary interfering line segments.
[0043] The above is a method provided in one or more embodiments of the present application. Based on the same concept, the present application also provides a corresponding web-based 3D component model conversion device, comprising: a trigger response unit, configured to trigger the unit to respond to an operation of triggering the generation of a 2D drawing of a 3D component model, and obtain multiple views directed by the operation, wherein the 3D component model includes dimension annotations;
[0044] The projection unit is configured to project the three-dimensional component model under different views to obtain projection drawings corresponding to the different views, wherein, during the projection process, the dimension annotation is selected and discarded; the output unit is configured to layout and output the projection drawings corresponding to the different views according to preset rules to obtain a 2D drawing corresponding to the three-dimensional component model.
[0045] As an optional implementation method of this embodiment, the layout output of the projection drawings corresponding to different views according to preset rules includes: based on the default coordinate system of the three-dimensional component model, axis-aligning the projection drawings corresponding to different views according to a preset layout; calculating the minimum bounding boxes corresponding to different views; and based on the axis-aligned layout diagram, using the size of each bounding box to calculate the arrangement spacing between the projection drawings corresponding to different views.
[0046] As an optional implementation method of this embodiment, the default coordinate system based on the three-dimensional component model, the axis alignment of the projection drawings corresponding to different views according to a preset layout includes: based on the default coordinate system of the three-dimensional component, using pre-set alignment rules, the axis alignment of the projection drawings corresponding to different views according to a preset layout, wherein the pre-set alignment rules include: setting the arrangement positions of different views, wherein the layout is expanded with the front view as the center; setting rules for X-axis alignment of the front view, left view, right view, and rear view; setting rules for Y-axis alignment of the top view, bottom view, and front view.
[0047] As an optional implementation method of this embodiment, the pre-set alignment rules also include: setting rules for aligning the left view and the isometric view on the Y axis, and aligning the isometric view and the top view on the X axis; setting rules for aligning the left view and the sectional view on the Y axis, and aligning the sectional view and the top view on the X axis.
[0048] As an optional implementation of this embodiment, the method further includes: when an adjustment operation of the 2D drawing output by the layout is triggered, adjusting the positions of different views based on the adjustment operation.
[0049] As an optional implementation of this embodiment, during the projection process, the dimension annotation is subjected to a selection operation including: calculating whether the plane normal composed of the line segments of each dimension annotation is parallel to the projection direction; if so, retaining the dimension annotation; if not, hiding the dimension annotation.
[0050] As an optional implementation of this embodiment, before responding to the operation, the method also includes: in response to the import operation of the three-dimensional component elements to be combined being triggered, importing the three-dimensional component elements into the canvas of the web page; when the drag operation is triggered for any three-dimensional component element of the three-dimensional component elements to be combined in the canvas, detecting the dragged position; when the dragged position reaches the preset position, automatically adsorbing the dragged any three-dimensional component element and the target three-dimensional component element to obtain the three-dimensional component model.
[0051] Figure 4 A schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention, such as Figure 3As shown, the electronic device 50 includes: a processor 501 (processor), a memory 502 (memory) and a bus 503;
[0052] The processor 501 and the memory 502 communicate with each other via the bus 503 ; the processor 501 is used to call program instructions in the memory 502 to execute the methods provided by the above-mentioned method embodiments.
[0053] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions. The computer instructions enable a computer to execute the methods provided by the above method embodiments.
[0054] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk, etc. Various storage media that can store program codes.
[0055] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units. That is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0056] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.
[0057] Although the present invention has been described in detail above using general descriptions and specific embodiments, it will be apparent to those skilled in the art that modifications and improvements may be made thereto. Therefore, such modifications and improvements, without departing from the spirit of the present invention, are intended to be within the scope of protection claimed herein.
Claims
1. A web-based three-dimensional component model conversion method, characterized in that: include: In response to an operation of triggering generation of a 2D drawing of a three-dimensional component model, obtaining a plurality of views directed by the operation, wherein the three-dimensional component model includes dimension annotations; Projecting the three-dimensional component model in different views to obtain projection drawings corresponding to the different views, wherein, during the projection process, the dimension annotation is selected and discarded; The projection drawings corresponding to different views are laid out and output according to preset rules to obtain 2D drawings corresponding to the 3D component model.
2. The web-based three-dimensional component model conversion method according to claim 1, characterized in that: The layout output of the projection images corresponding to different views according to preset rules includes: Based on the default coordinate system of the 3D component model, the projection drawings corresponding to different views are aligned according to the preset layout; Calculate the minimum bounding box corresponding to different views; Based on the axis-aligned layout graph, the arrangement spacing between the projection graphs corresponding to different views is calculated using the sizes of each bounding box.
3. The web-based three-dimensional component model conversion method according to claim 2, characterized in that: The axis alignment of projection drawings corresponding to different views according to a preset layout based on the default coordinate system of the three-dimensional component model includes: Based on the default coordinate system of the three-dimensional component, the projection drawings corresponding to different views are axis-aligned according to a preset layout using pre-set alignment rules, wherein the pre-set alignment rules include: Set the layout of different views, with the front view as the center of the layout; Set the X-axis alignment rules for the front view, left view, right view, and back view; Set the Y-axis alignment rules for the top, bottom, and front views.
4. The web-based three-dimensional component model conversion method according to claim 3, characterized in that: The pre-set alignment rules also include: Set the rules for aligning the left view with the isometric view on the Y axis, and the isometric view with the top view on the X axis; Sets the rules for aligning the left view with the section view on the Y axis, and aligning the section view with the top view on the X axis.
5. The web-based three-dimensional component model conversion method according to claim 1, characterized in that: The method further comprises: When an adjustment operation of the 2D drawing output by the layout is triggered, the positions of different views are adjusted based on the adjustment operation.
6. The web-based three-dimensional component model conversion method according to claim 1, characterized in that: During the projection process, the operation of selecting and discarding the dimension annotation includes: Calculate whether the plane normal and projection direction of each dimensioned line segment are parallel; If they are parallel, keep the dimension; Hide the dimension if they are not parallel.
7. The web-based three-dimensional component model conversion method according to claim 1, characterized in that: Before responding to the operation, the method further includes: In response to triggering the import operation of the three-dimensional component element to be combined, importing the three-dimensional component element into the canvas of the web page; When a drag operation is triggered on any of the 3D component elements to be combined in the canvas, the dragged position is detected; When the dragged position reaches the preset position, the dragged any three-dimensional component element and the target three-dimensional component element are automatically adsorbed to obtain the three-dimensional component model.
8. A web-based 3D component model conversion device, characterized in that: include: a trigger response unit configured to trigger the unit to generate a 2D drawing in response to an operation of triggering a 3D component model, and obtain a plurality of views directed by the operation, wherein the 3D component model includes dimension annotations; A projection unit is configured to project the three-dimensional component model in different views to obtain projection images corresponding to the different views, wherein, during the projection process, the dimension annotation is selected and discarded; The output unit is configured to layout and output the projection drawings corresponding to different views according to preset rules to obtain 2D drawings corresponding to the three-dimensional component model.
9. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.