A drawing migration method, device, equipment and storage medium

By converting formats and matching user selection or graphic element templates, the system automatically identifies and renders graphic elements in drawings, solving the problem of manual drawing required in existing technologies and achieving efficient drawing migration.

CN116245052BActive Publication Date: 2026-06-12JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
Filing Date
2023-03-27
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

In existing technologies, when migrating drawings to graphical configuration software, manual redrawing is required, which is time-consuming and labor-intensive, reducing migration efficiency.

Method used

The first graphic file of the drawing to be migrated is obtained, converted into a format that can be recognized by the graphic configuration software, parsed and rendered onto the canvas, and the target graphic elements are determined and rendered by combining user selection operations and/or graphic element template matching methods, and connected to generate logical drawings.

🎯Benefits of technology

No manual redrawing is required, simplifying the drawing migration process and improving the efficiency of drawing migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245052B_ABST
    Figure CN116245052B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a kind of drawing migration method, device, equipment and storage medium, the method comprises: obtaining the first graph file in the first graph file format corresponding to the drawing to be migrated;Based on the second graph file format, the vector graphic element in the first graph file is converted, and the second graph file in the second graph file format is obtained;Second graph file is parsed, and the target vector graphics after parsing is rendered to the first canvas;Based on the user selection operation and / or graphic element template matching mode triggered on the first canvas, determine the target graphic element corresponding to the target vector graphics, and render the target graphic element to the second canvas;Each target graphic element on the second canvas is connected, and the logic drawing migrated to the graphic configuration software is obtained.The technical scheme of the embodiment of the present application can simplify the operation of drawing migration to graphic configuration software, improve the efficiency of drawing migration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to computer technology, and more particularly to a method, apparatus, device and storage medium for transferring drawings. Background Technology

[0002] Graphical configuration software is a data visualization and integration tool that enables component interaction through drag-and-drop layout and configuration, and provides a visual and controllable page in a graphical way, thereby enabling the monitoring and control of real devices.

[0003] Currently, when migrating drawings that are only for display and cannot be edited to graphical configuration software, it is usually necessary to manually draw logical drawings with element connection relationships corresponding to the vector graphics in the drawing in the graphical configuration software.

[0004] However, in the process of realizing this invention, the inventors discovered at least the following problems in the prior art:

[0005] The existing method of transferring drawings requires manual redrawing, which is time-consuming and labor-intensive, reducing the efficiency of drawing transfer. Summary of the Invention

[0006] This invention provides a drawing migration method, apparatus, device, and storage medium to simplify drawing migration operations and improve drawing migration efficiency.

[0007] In a first aspect, embodiments of the present invention provide a drawing migration method, including:

[0008] Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated;

[0009] Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format.

[0010] The second graphic file is parsed, and the parsed target vector graphics are rendered onto the first canvas;

[0011] Based on the user selection operation triggered on the first canvas and / or the primitive template matching method, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas;

[0012] Connect the target elements on the second canvas to obtain a logic drawing that is migrated to the graphical configuration software.

[0013] Secondly, embodiments of the present invention also provide a drawing migration device, comprising:

[0014] The first drawing file acquisition module is used to acquire the first drawing file in the first drawing file format corresponding to the drawing to be migrated.

[0015] The first graphic file conversion module is used to convert the vector graphic elements in the first graphic file according to the second graphic file format to obtain a second graphic file in the second graphic file format.

[0016] The target vector graphics rendering module is used to parse the second graphic file and render the parsed target vector graphics onto the first canvas;

[0017] The target primitive rendering module is used to determine the target primitive corresponding to the target vector graphic based on the user selection operation triggered on the first canvas and / or the primitive template matching method, and render the target primitive onto the second canvas;

[0018] The target element connection module is used to connect the various target elements on the second canvas to obtain a logical drawing that is migrated to the graphical configuration software.

[0019] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0020] One or more processors;

[0021] Memory, used to store one or more programs;

[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement the drawing migration method provided in any embodiment of the present invention.

[0023] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the drawing migration method as provided in any embodiment of the present invention.

[0024] One embodiment of the above invention has the following advantages or beneficial effects:

[0025] By acquiring a first graphic file in a first graphic file format corresponding to the drawing to be migrated, and converting the vector graphic elements in the first graphic file according to a second graphic file format, a second graphic file in the second graphic file format is obtained. The second graphic file is then parsed, and the parsed target vector graphic is rendered onto a first canvas. Based on the user selection operation and / or element template matching method triggered on the first canvas, the target element corresponding to the target vector graphic is determined, and the target element is rendered onto a second canvas. All target elements on the second canvas are then connected to obtain the logical drawing to be migrated into the graphic configuration software. Thus, through user selection operation and / or element template matching method, the vector graphics in the drawing to be migrated can be split into elements without manual redrawing, simplifying the drawing migration operation and improving the efficiency of drawing migration. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a flowchart of a drawing migration method provided in one embodiment of the present invention;

[0028] Figure 2 This is an example of a drawing migration process according to an embodiment of the present invention;

[0029] Figure 3 This is a flowchart of another drawing migration method provided in one embodiment of the present invention;

[0030] Figure 4 This is a schematic diagram of the structure of a drawing transfer device provided in one embodiment of the present invention;

[0031] Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation

[0032] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0033] Figure 1This is a flowchart illustrating a drawing migration method according to an embodiment of the present invention. This embodiment is applicable to situations where drawings intended only for display and not for editing are migrated to graphical configuration software, particularly CAD drawings. The method can be executed by a drawing migration device, which can be implemented in software and / or hardware and integrated into an electronic device. Figure 1 As shown, the method specifically includes the following steps:

[0034] S110. Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated.

[0035] In this context, "drawings to be migrated" refers to drawings that need to be transferred to graphic configuration software for display purposes only and cannot be edited. For example, drawings to be migrated could be CAD drawings created using CAD drawing software. These drawings contain generated vector graphics. The first graphic file format can refer to the file storage format of the vector graphics in the drawings to be migrated. The graphic configuration software cannot recognize vector graphics in the first graphic file format. For example, the first graphic file format could be the DXF (Drawing Exchange Format) format corresponding to the CAD drawing, and the corresponding first graphic file could be the DXF file corresponding to the CAD drawing. The DXF format is stored in ASCII code and can be read and edited using Notepad. Accordingly, a DXF file is a graphic representation file stored in ASCII code format and can be read and edited using Notepad.

[0036] Specifically, drawing software can be used to create drawings containing vector graphics, such as CAD drawings, and the first graphic file in the first graphic file format, such as the DXF file corresponding to the CAD drawing, can be imported into the graphic configuration software so that the drawing can be converted based on the DXF file in the graphic configuration software to obtain logical drawings with logical connections.

[0037] S120. Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format.

[0038] The second graphics file format can refer to a file storage format that can recognize vector graphics in graphics configuration software. For example, the second graphics file format can refer to the Scalable Vector Graphics (SVG) format. Vector graphics elements can be element objects used to compose vector graphics. For example, vector graphics elements can include, but are not limited to: lines, line segments, circles, ellipses, arcs, and splines. The representation of the same vector graphics element differs in different graphics file formats. For example, different element names can be used to represent the same vector graphics element. For instance, in DXF format, the element name for the vector graphics element "line" is LINE, while in SVG format, the element name for the vector graphics element "line" is Line. Different graphics file formats also correspond to different coordinate systems, thus requiring conversion of the element coordinate values ​​for each vector graphics element. For example, in DXF format, the origin of the coordinate system is at the lower left corner of the screen, with the positive X-axis pointing to the right and the positive Y-axis pointing upwards. In SVG format, the origin of the coordinate system is at the upper left corner of the screen, with the positive X-axis pointing to the right and the positive Y-axis pointing downwards.

[0039] Specifically, existing format conversion tools can be used to convert a first graphic file in a first graphic file format into a second graphic file in a second graphic file format. Alternatively, based on the element conversion relationship between the second and first graphic file formats, the vector graphic elements in the first graphic file can be renamed and their coordinates transformed to obtain a second graphic file in the second graphic file format.

[0040] For example, S120 may include: converting the vector graphic element names in the first graphic file based on the correspondence between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic format; converting the element coordinate values ​​of the vector graphic elements in the first graphic file based on the first graphic coordinate system corresponding to the first graphic file format and the second graphic coordinate system corresponding to the second graphic file format; and determining the graphic file obtained after converting the element names and element coordinate values ​​as the second graphic file under the second graphic file format.

[0041] Specifically, based on the correspondence between vector graphic element names in the first graphic file format and those in the second graphic format, the element name of each vector graphic element in the first graphic file is converted to its corresponding name in the second graphic format, thus achieving element name conversion and translation. Based on the first graphic coordinate system corresponding to the first graphic file format and the second graphic coordinate system corresponding to the second graphic file format, a coordinate transformation matrix can be determined. Based on this matrix, the element coordinate values ​​of each vector graphic element in the first graphic file are transformed to obtain element coordinate values ​​in the second graphic coordinate system, thus achieving coordinate system conversion of element coordinate values. After completing the conversion of element names and element coordinate values, the resulting graphic file can be defined as a second graphic file in the second graphic file format, thereby converting and translating vector graphics from drawings in the first graphic file format to drawings in the second graphic file format, such as converting and translating vector graphics from CAD drawings to SVG drawings.

[0042] It should be noted that the second graphic file obtained after conversion is only a collection of elements; the element combinations have not yet been mapped to specific device primitives. For example, the SVG file obtained after conversion is shown below:

[0043] <svg viewBox="0 0 800 600"version="1.1"stroke-linecap="round"stroke-linejoin="round"fill-rule="evenodd"xml:space="preserve">

[0044] <defs>

[0045] <clipPath id="clipId0">

[0046] <path d="M0,600 800,600 800,0 0,0z" / >

[0047]

[0048] < / defs>

[0049] <gclip-path="url(#clipId0)"fill="none"stroke="rgb(0,0,0)"stroke-width="0.1" / >

[0050] <path d="M26.1687,572.645 26.8215,571.992 787.167,571.992 787.82,572.645z" / >

[0051] S130. Parse the second graphic file and render the parsed target vector graphic onto the first canvas.

[0052] The target vector graphic can refer to the vector graphic that needs to be migrated. The canvas can be a drawing used to display the graphic. For example, the canvas can be, but is not limited to, a Canvas. The first canvas can be a drawing used to display the target vector graphic of the primitives to be segmented, so as to allow subsequent editing and extraction operations.

[0053] Specifically, because the second graphic file format (such as SVG) does not provide pixel-level processing and cannot obtain pixel data at specific locations in the image, a canvas plugin, such as fabric.js, can be used to parse the second graphic file into JavaScript drawing code corresponding to the target vector graphics. By executing the JavaScript drawing code, the target vector graphics can be rendered onto the first canvas, such as the first Canvas. For example, Figure 2 An example of a drawing migration process is given, such as Figure 2 As shown, the target vector graphics in the drawing to be transferred are rendered on the first canvas, so that the user can select elements on the first canvas.

[0054] S140. Based on the user selection operation triggered on the first canvas and / or the primitive template matching method, determine the target primitive corresponding to the target vector graphic, and render the target primitive onto the second canvas.

[0055] In this context, a primitive can refer to a configuration element used to represent a device graphic. It should be noted that primitives can be closed or open, such as pins with two ends. For example, a resistor primitive can be constructed using a combination of straight lines, rectangles, and straight lines to create the resistor graphic. A target primitive can refer to the primitives contained within a target vector graphic. A target vector graphic contains multiple target primitives. The second canvas can be a drawing used to display the segmented target primitives.

[0056] Specifically, all target primitives in the target vector graphic can be obtained through user selection operations triggered on the first canvas and / or through primitive template matching. For example, if the primitive template library does not contain primitives in the drawing domain to be migrated, the user can select primitives on the target vector graphic displayed on the first canvas based on business needs. For instance, the user can click or circle graphic parts belonging to the same primitive, thereby combining the set of target elements selected by the user each time into a corresponding target primitive. For example, such as... Figure 2 As shown, the user has circled the diode section of the circuit on the first canvas, for example... Figure 2The dashed box in the image allows the user to select a target graphic element, namely a diode graphic element. This enables the user to directly trigger a selection operation on each graphic element on the first canvas, thus separating all target graphic elements in the target vector graphic. This allows for rapid drawing migration even when there are no domain graphic elements in the graphic configuration software.

[0057] For example, if the graphic element template library contains graphic elements in the drawing area to be migrated, the graphic element templates in the graphic element template library can be matched with the target vector graphics on the first canvas to automatically match the target graphic elements in the target vector graphics without the need for manual drawing of the target graphic elements.

[0058] Furthermore, user selection and primitive template matching can be combined to accurately extract all target primitives from the target vector graphic. For example, after a user selects a target primitive on the first canvas, the selected primitive can be used as a template and matched with the target vector graphic to automatically extract other target primitives within the target vector graphic. This reduces the number of times the user needs to select primitives, thereby improving primitive extraction efficiency. For example, ... Figure 2 As shown, the diode element selected by the user is used as the element template for template matching to obtain the matched resistor element and capacitor element.

[0059] This embodiment can create a new second canvas, such as a second Canvas, within the DOM (Document Object Model) tree to hold the split target primitives. By rendering each split target primitive onto the second canvas for display, the user can be informed of the splitting process. This embodiment can render the corresponding target primitives according to their original graphic positions in the imported drawing, displaying the target primitives at the same locations to simplify subsequent connection operations and further improve drawing migration efficiency.

[0060] S150. Connect the target elements on the second canvas to obtain the logic drawing to be migrated to the graphic configuration software.

[0061] The graphical configuration software can be, but is not limited to, web-based visual graphics drawing software. Logical drawings can refer to drawings with logical connections between graphic elements, that is, visual drawings created within the graphical configuration software.

[0062] Specifically, after extracting all target elements from the target vector graphic, on the second canvas, lines can be connected and filled in according to the original graphic positions to update the drawing to be migrated imported into the graphic configuration software into a logical drawing with logical connections between elements, thus completing the drawing migration operation. Through format conversion and user selection of elements, drawings from the original work area can be quickly migrated to the technologically updated graphic configuration software, reducing dependence on starting domain elements and minimizing the workload of building from scratch, thereby improving drawing migration efficiency.

[0063] The technical solution of this embodiment obtains a first graphic file in a first graphic file format corresponding to the drawing to be migrated, and converts the vector graphic elements in the first graphic file according to a second graphic file format to obtain a second graphic file in the second graphic file format. The second graphic file is parsed, and the parsed target vector graphic is rendered onto a first canvas. Based on the user selection operation and / or graphic element template matching method triggered on the first canvas, the target graphic element corresponding to the target vector graphic is determined, and the target graphic element is rendered onto a second canvas. All target graphic elements on the second canvas are connected to obtain the logical drawing to be migrated into the graphic configuration software. Thus, through the user selection operation and / or graphic element template matching method, the vector graphics in the drawing to be migrated can be split into graphic elements without manual redrawing, simplifying the drawing migration operation and improving the drawing migration efficiency.

[0064] Based on the above technical solution, after S140, it may also include: displaying the primitive confirmation information corresponding to the target primitive after each rendering; and deleting the target primitive that the user confirmed as incorrect in response to the primitive error command triggered by the user based on the primitive confirmation information.

[0065] The primitive confirmation information can be used to prompt the user whether the target primitive rendered in this instance is the primitive that needs to be separated. The primitive error instruction can be used to indicate that the target primitive rendered in this instance is not the primitive that needs to be separated.

[0066] Specifically, after each rendering of a target element on the second canvas, corresponding element confirmation information can be displayed to prompt the user for element confirmation. The user can trigger an element error command by clicking the "Error" button on the displayed confirmation information. If an error command is detected, the target element confirmed as incorrect can be deleted from the second canvas for re-splitting. Alternatively, the user can trigger a correct command by clicking the "Correct" button, allowing the correctly confirmed target elements to continue to be displayed on the second canvas. Once all target elements in the target vector graphic have been split and confirmed as correctly split, connections can be made between all correctly confirmed target elements on the second canvas, ensuring the accuracy of the drawing migration.

[0067] Figure 3 This is a flowchart of another drawing migration method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment describes the process of determining the target graphic element through user selection, and further describes the process of determining the target graphic element through graphic element template matching. Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.

[0068] See Figure 3 Another drawing migration method provided in this embodiment specifically includes the following steps:

[0069] S310. Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated.

[0070] S320. Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format.

[0071] S330. Parse the second graphic file and render the parsed target vector graphic onto the first canvas.

[0072] S340. Based on the user selection operation triggered on the first canvas, determine the set of target elements selected by the user in the target vector graphics.

[0073] Specifically, users can select graphic elements on the target vector graphics displayed on the first canvas based on business needs. For example, users can click or circle parts of graphics belonging to the same graphic element. Mouse events can be listened to on the first canvas, such as the mouseup (click start event), mousedown (click end event), and mousemove (click move event). By listening to these mouse events, the user can determine the graphic area selected or circled in the current click or circle, and all elements within that area can be identified as the target element set selected by the user in this instance.

[0074] S350. Combine the set of target elements to determine the target primitive selected at this time, and render the target primitive selected at this time onto the second canvas.

[0075] Specifically, the set of target elements selected by the user in this instance is combined into the target primitives selected in this instance, and a new second canvas is created within the DOM tree to accommodate the selected target primitives. By having the user directly trigger the primitive selection operation on the first canvas, the target primitives involved in the target vector graphics can be generated, thus allowing for rapid drawing migration even when the domain primitives do not exist in the graphic configuration software.

[0076] S360. Add the selected target graphic element as a graphic element template to the graphic element template library for storage.

[0077] Specifically, the target graphic element selected by the user in this instance can be added as a new graphic element template to the graphic element template library of the graphic configuration software for storage, so that the graphic element styles in the graphic element template library can be updated in real time.

[0078] S370. Obtain the target graphic area that has not yet been rendered in the target vector graphic.

[0079] The target graphic area can refer to the unrendered graphic area remaining after removing the currently rendered primitive area in the second canvas from the target vector graphic in the first canvas.

[0080] Specifically, the target graphic area that has not yet been rendered will change dynamically with each split rendering of the primitives. Therefore, it is necessary to obtain the target graphic area that has not yet been rendered in the target vector graphic in real time so as to continue to split the primitives of the target graphic area.

[0081] S380. Perform template matching on the target graphic area using the graphic template library to determine the target graphic element that matches the graphic template, and render the matching target graphic element onto the second canvas.

[0082] The target graphic element matching the graphic element template can include graphic elements that are exactly the same as the graphic element template, or it can include similar graphic elements that belong to the same category as the graphic element template. For example, such as Figure 2 As shown, if the primitive template is a diode primitive, the matching target primitives can include resistor primitives and capacitor primitives.

[0083] Specifically, since similar primitives in the target graphic area have different displacements and scaling ratios, the position and size data of the target graphic area and the primitive template can be preprocessed during the first round of template matching. For example, the "points" tag of a polyline is used to indicate the number of points involved in the polyline element, thus allowing matching and filtering of polyline elements with the same number of points. If the primitive template contains multiple polyline elements or combinations of other elements, each element is matched, which is considered a preliminary match. During the first round of template matching, potentially similar areas in the target graphic area can be cropped, and a second round of template matching can be performed on these areas. For example, taking a polyline as an example, it can be determined whether points with the same number of points have the same slope, whether the distance between points is the same or a uniform multiple, and whether this multiple can be carried over to other graphic traversal matches. Through two rounds of template matching, target primitives that match each primitive template in the primitive template library can be quickly identified, and all matching target primitives can be rendered on the second canvas.

[0084] It should be noted that if there are still unrendered target graphic areas in the target vector graphic after template matching, that is, there are still unsplittered target graphic elements, the user can continue to trigger the selection operation, that is, return to step S340 to continue graphic element splitting, and store the latest split target graphic element as a graphic element template, and perform graphic element template matching based on the latest stored graphic element template, until all target graphic elements in the target vector graphic have been split. Thus, graphic element splitting is performed by combining user selection operation and graphic element template matching, which further improves the efficiency of graphic element splitting.

[0085] It should be noted that after step S330, the primitive template matching operation can also be performed first, i.e., steps S370-S380. If there are still unrendered target graphic areas in the target vector graphic after template matching, then the user manually selects primitives operation in S340-S350 is performed again, and the newly selected target primitive is used as a new primitive template for primitive template matching again, until all target primitives in the target vector graphic have been completely split. This embodiment does not limit the execution order of the user selection operation and the primitive template matching method.

[0086] S390. Perform connection processing on each target graphic element on the second canvas to obtain the logic drawing that is migrated to the graphic configuration software.

[0087] The technical solution of this embodiment adds the target graphic element selected by the user as a graphic element template to the graphic element template library for storage. This allows for real-time updates of the graphic element styles in the graphic element template library. Furthermore, it enables template matching based on the target graphic area that has not yet been rendered by the stored graphic element template, automatically extracting other target graphic elements that match the graphic element template. This eliminates the need for the user to select target graphic elements one by one, reducing the number of selections required by the user. Consequently, it further improves the efficiency of drawing migration even when the required domain graphic elements are not available.

[0088] Based on the above technical solution, S380 may include: performing document traversal matching between the template tag document corresponding to the graphic template in the graphic template library and the target graphic document corresponding to the target graphic area by means of tag attribute matching; and rendering the target graphic onto the second canvas based on the target graphic document that matches the template tag document.

[0089] Each time a primitive template is added to the primitive template library, it is essentially a hierarchical XML (Extensible Markup Language) template tag document. For example, the XML tag document portion corresponding to the target element set in the SVG file can be determined as the template tag document of the corresponding primitive template. The target graphic document corresponding to the target graphic region can refer to the remaining document in the second graphic file after removing the document portion corresponding to the rendered target primitive. For example, Table 1 gives an example of a template tag document and the matched target primitive document. Table 2 gives an example of the tag attributes that need to be matched for different graphic elements in an SVG file.

[0090] Table 1 shows examples of template tag documents and matched target meta-documents.

[0091]

[0092] Table 2 shows examples of tag attributes that need to be matched for different graphic elements in an SVG file.

[0093]

[0094] Specifically, by using tag attribute matching, the system can traverse and query the template tag documents corresponding to the graphic template in the target graphic document corresponding to the target graphic area, accurately match the similar parts to determine the target graphic document that belongs to the same category as the graphic template, and parse the target graphic document into the corresponding target graphic and render it onto the second canvas. This allows for the automatic matching and rendering of graphic elements of the same category.

[0095] The following are embodiments of the drawing migration device provided in this invention. This device and the drawing migration methods in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the drawing migration device, please refer to the embodiments of the drawing migration methods described above.

[0096] Figure 4 This is a schematic diagram of a drawing migration device provided in an embodiment of the present invention. This embodiment is applicable to situations where drawings intended only for display and not for editing are migrated to graphical configuration software, and is particularly applicable to scenarios where CAD drawings are migrated to graphical configuration software. Figure 4 As shown, the device specifically includes: a first graphic file acquisition module 410, a first graphic file conversion module 420, a target vector graphic rendering module 430, a target primitive rendering module 440, and a target primitive connection module 450.

[0097] The system includes: a first graphic file acquisition module 410, used to acquire a first graphic file in a first graphic file format corresponding to the drawing to be migrated; a first graphic file conversion module 420, used to convert the vector graphic elements in the first graphic file according to a second graphic file format to obtain a second graphic file in the second graphic file format; a target vector graphic rendering module 430, used to parse the second graphic file and render the parsed target vector graphic onto a first canvas; a target primitive rendering module 440, used to determine the target primitive corresponding to the target vector graphic based on the user selection operation triggered on the first canvas and / or the primitive template matching method, and render the target primitive onto a second canvas; and a target primitive connection module 450, used to connect each of the target primitives on the second canvas to obtain a logical drawing to be migrated to the graphic configuration software.

[0098] The technical solution of this embodiment obtains a first graphic file in a first graphic file format corresponding to the drawing to be migrated, and converts the vector graphic elements in the first graphic file according to a second graphic file format to obtain a second graphic file in the second graphic file format. The second graphic file is parsed, and the parsed target vector graphic is rendered onto a first canvas. Based on the user selection operation and / or graphic element template matching method triggered on the first canvas, the target graphic element corresponding to the target vector graphic is determined, and the target graphic element is rendered onto a second canvas. All target graphic elements on the second canvas are connected to obtain the logical drawing to be migrated into the graphic configuration software. Thus, through the user selection operation and / or graphic element template matching method, the vector graphics in the drawing to be migrated can be split into graphic elements without manual redrawing, simplifying the drawing migration operation and improving the drawing migration efficiency.

[0099] Optionally, the drawing to be migrated is a CAD drawing created using CAD drawing software, the first graphic file format is DXF (Drawing Exchange File) format, and the second graphic file format is Scalable Vector Graphics (SVG) format.

[0100] Optionally, the first image file conversion module 420 is specifically used for:

[0101] Based on the correspondence between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic format, the vector graphic elements in the first graphic file are converted in terms of element name; based on the first graphic coordinate system corresponding to the first graphic file format and the second graphic coordinate system corresponding to the second graphic file format, the vector graphic elements in the first graphic file are converted in terms of element coordinate value; the graphic file obtained after the element name and element coordinate value conversion is determined as the second graphic file under the second graphic file format.

[0102] Optionally, the target primitive rendering module 440 includes:

[0103] The first primitive rendering unit is used to determine the set of target elements selected by the user in the target vector graphics based on the user selection operation triggered on the first canvas; combine the set of target elements to determine the target primitive selected in the current time; and render the target primitive selected in the current time onto the second canvas.

[0104] Optionally, the target primitive rendering module 440 also includes:

[0105] The target primitive storage unit is used to add the selected target primitive as a primitive template to the primitive template library for storage after rendering the selected target primitive onto the second canvas.

[0106] Optionally, the target primitive rendering module 440 also includes:

[0107] The second primitive rendering unit is used to obtain the target graphic area that has not yet been rendered in the target vector graphic; perform template matching of primitive templates in the primitive template library in the target graphic area, determine the target primitive that matches the primitive template, and render the matching target primitive onto the second canvas.

[0108] Optionally, the second primitive rendering unit is specifically used for:

[0109] By matching tag attributes, the template tag documents corresponding to the graphic templates in the graphic template library are matched with the target graphic documents corresponding to the target graphic area; based on the target graphic documents that match the template tag documents, the target graphic is rendered onto the second canvas.

[0110] Optionally, the device further includes:

[0111] The target primitive deletion module is used to display primitive confirmation information corresponding to each rendered target primitive after rendering it onto the second canvas; and to delete the target primitive that the user has confirmed as incorrect in response to a primitive error command triggered by the user based on the primitive confirmation information.

[0112] The drawing migration device provided in the embodiments of the present invention can execute the drawing migration method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the drawing migration method.

[0113] It is worth noting that in the embodiments of the above-mentioned drawing migration device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0114] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 5 A block diagram is shown of an exemplary electronic device 12 suitable for implementing embodiments of the present invention. Figure 5 The electronic device 12 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0115] like Figure 5 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).

[0116] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.

[0117] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0118] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 5 Not shown; usually referred to as a "hard drive"). Although Figure 5 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.

[0119] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.

[0120] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0121] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing the steps of a drawing migration method provided in this embodiment, the method including:

[0122] Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated;

[0123] Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format.

[0124] The second graphic file is parsed, and the parsed target vector graphics are rendered onto the first canvas;

[0125] Based on the user selection operation triggered on the first canvas and / or the primitive template matching method, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas;

[0126] Connect the target elements on the second canvas to obtain a logic drawing that is migrated to the graphical configuration software.

[0127] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the drawing migration method provided in any embodiment of the present invention.

[0128] This embodiment provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the drawing migration method steps provided in any embodiment of the present invention. The method includes:

[0129] Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated;

[0130] Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format.

[0131] The second graphic file is parsed, and the parsed target vector graphics are rendered onto the first canvas;

[0132] Based on the user selection operation triggered on the first canvas and / or the primitive template matching method, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas;

[0133] Connect the target elements on the second canvas to obtain a logic drawing that is migrated to the graphical configuration software.

[0134] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0135] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0136] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0137] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0138] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.

[0139] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for transferring drawings, characterized in that, include: Obtain the first drawing file in the first drawing file format corresponding to the drawing to be migrated; Based on the second graphic file format, the vector graphic elements in the first graphic file are converted to obtain a second graphic file in the second graphic file format. The second graphic file is parsed, and the parsed target vector graphics are rendered onto the first canvas; Based on the user selection operation triggered on the first canvas and / or the primitive template matching method, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas; Connect the target elements on the second canvas to obtain a logic drawing that is migrated to the graphical configuration software.

2. The method according to claim 1, characterized in that, The drawings to be migrated are CAD drawings created using CAD drawing software. The first graphic file format is DXF (Drawing Exchange File) format, and the second graphic file format is Scalable Vector Graphics (SVG) format.

3. The method according to claim 1, characterized in that, The step of converting the vector graphic elements in the first graphic file to obtain a second graphic file in the second graphic file format, based on the second graphic file format, includes: Based on the correspondence between the vector graphic element names in the first graphic file format and the vector graphic element names in the second graphic format, the element names of the vector graphic elements in the first graphic file are converted. Based on the first graphic coordinate system corresponding to the first graphic file format and the second graphic coordinate system corresponding to the second graphic file format, the element coordinate values ​​of the vector graphic elements in the first graphic file are transformed. The resulting graphic file after converting the element name and element coordinate values ​​is identified as the second graphic file in the second graphic file format.

4. The method according to claim 1, characterized in that, Based on the user selection operation triggered on the first canvas, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas, including: Based on the user selection operation triggered on the first canvas, determine the set of target elements selected by the user in the target vector graphic. The set of target elements is combined to determine the target primitive selected in this instance, and the target primitive selected in this instance is rendered onto the second canvas.

5. The method according to claim 4, characterized in that, After rendering the selected target primitives to the second canvas, the process also includes: The selected target graphic element is added as a graphic element template to the graphic element template library for storage.

6. The method according to claim 1 or 5, characterized in that, Based on the primitive template matching method, the target primitive corresponding to the target vector graphic is determined, and the target primitive is rendered onto the second canvas, including: Obtain the target graphic region in the target vector graphic that has not yet been rendered; The graphic templates in the graphic template library are matched in the target graphic area to determine the target graphic element that matches the graphic template, and the matching target graphic element is rendered onto the second canvas.

7. The method according to claim 6, characterized in that, The process involves performing template matching on the primitive templates in the primitive template library within the target graphic area to determine the target primitives that match the primitive templates, and then rendering the matching target primitives onto the second canvas, including: By matching tag attributes, the template tag documents corresponding to the graphic templates in the graphic template library are matched with the target graphic documents corresponding to the target graphic area through document traversal. Based on the target primitive document that matches the template tag document, the target primitive is rendered onto the second canvas.

8. The method according to claim 1, characterized in that, After rendering the target primitive onto the second canvas, the process also includes: Displays the primitive confirmation information corresponding to the target primitive after each rendering; In response to a user's error command triggered based on the element confirmation information, the target element confirmed by the user as incorrect is deleted.

9. A drawing transfer device, characterized in that, include: The first drawing file acquisition module is used to acquire the first drawing file in the first drawing file format corresponding to the drawing to be migrated. The first graphic file conversion module is used to convert the vector graphic elements in the first graphic file according to the second graphic file format to obtain a second graphic file in the second graphic file format. The target vector graphics rendering module is used to parse the second graphic file and render the parsed target vector graphics onto the first canvas; The target primitive rendering module is used to determine the target primitive corresponding to the target vector graphic based on the user selection operation triggered on the first canvas and / or the primitive template matching method, and render the target primitive onto the second canvas; The target element connection module is used to connect the various target elements on the second canvas to obtain a logical drawing that is migrated to the graphical configuration software.

10. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the drawing migration method as described in any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the drawing migration method as described in any one of claims 1-8.