A method for dynamic tailoring of an industrial flow diagram
Patent Information
- Application Number
- CN202211694008.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2042-12-28
AI Technical Summary
但是当删除的元素较多时,工程师需要操作删除较多元素,做出大量重复删除的操作,工作量较大,并且需要在流程图上查找需要删除的元素节点,有误删的情况,常会需要撤回删除重新操作,进一步的加大了工作量;因此某些情况下,我们并不希望直接对流程图进行随意操作,此时就需要一种可以操作指定范围的元素来进行对流程图裁剪的方法
Smart Images

Figure CN115731322B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer network technology, and in particular to a method for dynamically cropping industrial flowcharts. Background Technology
[0002] In industrial applications, flowcharts are often used to analyze relationships between components or to aid in the analysis of innovative thinking strategies. Generally, we can freely manipulate the flowchart canvas, adding, deleting, and modifying elements to create a revised flowchart. However, deletion requires engineers to manually delete elements sequentially, which is suitable when deleting a small number of elements. When deleting a large number of elements, engineers need to perform numerous repetitive deletion operations, resulting in a significant workload. Furthermore, locating the nodes to be deleted on the flowchart is crucial, and accidental deletions often necessitate undoing the deletion and retrying, further increasing the workload. Therefore, in some cases, we do not want to manipulate the flowchart arbitrarily. In such situations, a method that allows manipulation of a specified range of elements to trim the flowchart is needed. Summary of the Invention
[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for dynamic trimming of industrial process diagrams.
[0004] To achieve the above objectives, the present invention adopts the following technical solution: A method for dynamic cropping of industrial process diagrams, based on a cropping system, the cropping system including a cropping page and a server; Includes the following steps: S1: Obtain the flowchart; Enter the trimming page and send a request to the server to obtain the JSON data of the flowchart, then select the flowchart to be trimmed; S2: Process the flowchart data and display the node data in the drop-down menu on the clipping page; The flowchart data includes node data and connection data; S3: Trim nodes and generate a new flowchart; Select the node you want to cut from the drop-down list, use JavaScript to filter the selected node data and the connection data at both ends of the node, and save it as new JSON data. After saving, open the flowchart page through the drawing software. The drawing software renders the flowchart based on the new JSON data and displays the cut flowchart.
[0005] Furthermore, the flowchart in step S1 is a flowchart file drawn by drawing software, the server includes a database, and the flowchart file is stored in the database; the flowchart file is a JSON data format file. The JSON data is an array; the array includes a shape attribute, and each data item in the array has a shape attribute. Based on the shape attribute of the data, the array is divided into node data and connection data.
[0006] Furthermore, step S2 specifically includes the following steps: S21: Process flowchart data; The array is divided into node data and connection data based on the shape attribute of each data item, and the node data and connection data are obtained separately. The connection data consists of data with the shape attribute set to edge or double-edge; the remaining data consists of node data. S22: Generate node data table and connection data table; The server also stores a node template table and a connection template table. The obtained node data is written into the node template table to generate a node data table; the obtained connection data is written into the connection template table to generate a connection data table. S23: Generate a dropdown list; The dropdown list is generated and displayed on the clipping page using a column of the node text from the node data table generated in S22 as the original data source.
[0007] Furthermore, the node data includes shape attribute, ID, and node label; the node label includes node text; the ID is a unique identifier for the node, and the ID includes the node's own ID and the ID of the dot-connecting stakes on the node; The connection data includes a connection ID, a starting point, and a target point; the connection ID is a unique identifier for the connection; the starting point includes a starting cell value and a starting port value; the target point includes a target cell value and a target port value. The starting cell value is the ID of the node connected to the starting point, and the starting port value is the ID of the dot stub on the node connected to the starting point. The target cell value is the ID of the node to which the target point is connected, and the target port value is the ID of the dot-connection stake on the node to which the target point is connected; The node template table includes node text, node ID, ID of dot connection stake, and shape attribute; Furthermore, step S3 specifically includes: S31: Obtain the node data that needs to be clipped; Select the node text to be displayed in the drop-down box, and search for the node text in the node data table to obtain the node ID of the corresponding node text and the ID of the dot connection stake on the node. S32: Get the connection ID on the node that needs to be pruned; Based on the ID of the dot connection stake obtained in S31, the starting port value and target port value in the connection data table are searched in a loop to obtain the connection ID corresponding to the starting port value and target port value that are consistent with the ID of the dot connection stake. S33: Filter connections and nodes to generate new JSON data; Based on the obtained node ID and connection ID, the JavaScript filter method is used to obtain an array of node IDs and related connection IDs. This array is then compared with the JSON data, filtering out the ID-related data and generating new JSON data.
[0008] Furthermore, the shape attribute of the node includes rectangle, rhombus, and ellipse.
[0009] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) The present invention separates the data and view operations through data processing. When we want to perform local operations on a flowchart with a pre-set structure, in order to prevent personnel from arbitrarily operating the flowchart and destroying the original structure, we can use a separate form page to operate from the data trimming level to get the desired effect. (2) The present invention can trim nodes by simply selecting the node text to be trimmed in the drop-down box. Users do not need to manually trim on the flowchart, which reduces the time users spend trimming a large number of node elements and greatly reduces the workload of repetitive work required by manual trimming. (3) The present invention does not require knowing the specific location of the node on the flowchart, which reduces the time users spend searching for the location of the node text on the flowchart when manually trimming and also reduces the phenomenon of wrong deletion. At the same time, the node text is trimmed as needed, and the trimmed nodes and the connections on the nodes are filtered out at the data level, reducing redundant data in the flowchart data and making the flowchart data lighter. It solves the rendering pressure when the drawing software opens a new flowchart, reduces the GPU rendering pressure, makes rendering faster, and has lower performance requirements for the running device. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating the steps of a method for dynamically trimming industrial process diagrams according to the present invention. Detailed Implementation
[0011] To provide a further understanding of the purpose, structure, features, and functions of the present invention, detailed descriptions are provided below with reference to specific embodiments.
[0012] A method for dynamically trimming industrial flowcharts, based on a trimming system, the trimming system including a trimming page and a server; the trimming page includes a selection control and a drop-down list, the drop-down list being titled "Components to be Trimmed," and the selection control being used to send a request to the server to select a flowchart file; the method includes the following steps: S1: Obtain the flowchart; Enter the trimming page and send a request to the server to obtain the JSON data of the pre-configured flowchart, then select the flowchart to be trimmed; The flowchart is a flowchart file drawn by drawing software, and the server includes a database, in which the flowchart file is stored; the flowchart file is a JSON data format file.
[0013] The diagramming software is built using X6, a diagram editing engine from AntV. X6 provides a series of out-of-the-box interactive components and easy-to-use node customization capabilities, making it convenient to quickly build flowcharts, DAGs, ER diagrams, and other diagram applications. Users input nodes according to the type they need.
[0014] S2: Process the flowchart data and display the node data in the drop-down menu on the clipping page; Specifically, the following steps are included: S21: Process flowchart data; The JSON data is an array; the array includes a shape attribute, and each data item in the array has a shape attribute. Based on the shape attribute of the data, the array is divided into node data and connection data. The node data is data whose shape attribute is not edge, or is double-edge. The data whose shape attribute is edge, or is double-edge, is connection data.
[0015] Based on the shape attribute of the array, retrieve the node data whose shape attribute is not edge or double-edge, and the connection data whose shape attribute is edge or double-edge.
[0016] The node data includes shape attributes, ID, node labels, etc., and the node labels include node text, etc.; the ID is a unique identifier for the node, and the ID includes the node's own ID and the ID of the dot-connector on the node; The shape attribute of the node includes rectangle, rhombus, ellipse, etc.
[0017] The node text is the text content entered on the node; The connection data includes connection ID, starting point, and target point. The connection ID is a unique identifier for the connection, and the starting point includes the starting cell value and the starting port value. The starting cell value is the ID of the node connected to the starting point, and the starting port value is the ID of the dot stub on the node connected to the starting point. The target point includes a target cell value and a target port value; the target cell value is the ID of the node to which the target point is connected, and the target port value is the ID of the dot stub on the node to which the target point is connected; S22: Generate node data table and connection data table; The server also stores a node template table and a connection template table. The node template table includes node text, node ID, ID of dot connection stake, shape attribute, etc. The acquired node data is written into the node template table to generate a node data table.
[0018] The connection template table includes connection ID, starting cell value, starting port value, target cell value, and target port value; the acquired connection data is written into the connection template table to generate a connection data table.
[0019] S23: Generate a dropdown list; The dropdown list is generated and displayed on the clipping page using a column of node text from the node data table generated in S22 as the original data source.
[0020] S3: Trim nodes and generate a new flowchart; Select the node you want to cut from the drop-down list, use JavaScript to filter the selected node data and the connection data at both ends of the node, and save it as new JSON data. After saving, open the flowchart page through the drawing software. The drawing software renders the flowchart based on the new JSON data and displays the cut flowchart.
[0021] Specifically, the following steps are included: S31: Obtain the node data that needs to be clipped; Select the node text to be displayed in the drop-down list, and search for the node text in the node data table to obtain the node ID of the corresponding node text and the ID of the dot connection stake on the node.
[0022] S32: Get the connection ID on the node that needs to be pruned; Based on the ID of the dot connection stake obtained in S31, the starting port value and target port value in the connection data table are searched in a loop to obtain the connection ID corresponding to the starting port value and target port value that are consistent with the ID of the dot connection stake. S33: Filter connections and nodes to generate new JSON data; Based on the obtained node ID and connection ID, the JavaScript filter method is used to obtain an array of node IDs and IDs of related connections. This array is then compared with the JSON data, filtering out the ID-related data and generating new JSON data.
[0023] The present invention has been described in the above-described embodiments; however, these embodiments are merely examples for implementing the present invention. It must be noted that the disclosed embodiments do not limit the scope of the present invention. Conversely, any modifications and refinements made without departing from the spirit and scope of the present invention are within the scope of patent protection of the present invention.
Claims
1. A method for dynamically trimming industrial process diagrams, characterized in that: Based on the cropping system, the cropping system includes cropping pages and a server; Includes the following steps: S1: Obtain the flowchart; Enter the trimming page and send a request to the server to obtain the JSON data of the flowchart, then select the flowchart to be trimmed; S2: Process the flowchart data and display the node data in the drop-down menu on the clipping page; The flowchart data includes node data and connection data; S21: Process flowchart data; The array is divided into node data and connection data based on the shape attribute of each data item, and the node data and connection data are obtained separately. The connection data consists of data with the shape attribute set to edge or double-edge; the remaining data consists of node data. S22: Generate node data table and connection data table; The server also stores a node template table and a connection template table. The obtained node data is written into the node template table to generate a node data table; the obtained connection data is written into the connection template table to generate a connection data table. S23: Generate a dropdown list; Use a column of node text from the node data table generated by S22 as the original data source for the drop-down list to generate a drop-down list and display it on the clipping page; S3: Trim nodes and generate a new flowchart; Select the node you want to cut from the drop-down list, use JavaScript to filter the selected node data and the connection data at both ends of the node, and save it as new JSON data. After saving, enter the flowchart page through the drawing software. The drawing software renders the flowchart based on the new JSON data and displays the cut flowchart. S31: Obtain the node data that needs to be clipped; Select the node text to be displayed in the drop-down box, and search for the node text in the node data table to obtain the node ID of the corresponding node text and the ID of the dot connection stake on the node. S32: Get the connection ID on the node that needs to be pruned; Based on the ID of the dot connection stake obtained in S31, the starting port value and target port value in the connection data table are searched in a loop to obtain the connection ID corresponding to the starting port value and target port value that are consistent with the ID of the dot connection stake. S33: Filter connections and nodes to generate new JSON data; Based on the obtained node ID and connection ID, the JavaScript filter method is used to obtain an array of node IDs and related connection IDs. This array is then compared with the JSON data, filtering out the ID-related data and generating new JSON data.
2. The method for dynamically trimming industrial process diagrams as described in claim 1, characterized in that: The flowchart in step S1 is a flowchart file drawn by drawing software. The server includes a database, and the flowchart file is stored in the database. The flowchart file is a JSON data format file. The JSON data is an array; the array includes a shape attribute, and each data item in the array has a shape attribute. Based on the shape attribute of the data, the array is divided into node data and connection data.
3. The method for dynamic trimming of industrial process diagrams as described in claim 2, characterized in that: The node data includes shape attributes, ID, and node labels; the node labels include node text; the ID is a unique identifier for the node, and the ID includes the node's own ID and the ID of the dot-connector on the node; The connection data includes connection ID, starting point, and target point; The connection ID is a unique identifier for the connection; the starting point includes the starting cell value and the starting port value; the target point includes the target cell value and the target port value. The starting cell value is the ID of the node connected to the starting point, and the starting port value is the ID of the dot stub on the node connected to the starting point. The target cell value is the ID of the node to which the target point is connected, and the target port value is the ID of the dot-connection stake on the node to which the target point is connected; The node template table includes node text, node ID, ID of dot connection stakes, and shape attribute.
4. The method for dynamic trimming of industrial process diagrams as described in claim 3, characterized in that: The shape attribute of the node includes rectangle, rhombus, and ellipse.
Citation Information
Patent Citations
Flow chart creation method and system, flow chart display method and system and storage medium
CN109816754A
Method, system and device for modifying colors of digital-analog parts in batches and storage medium
CN115422621A
