Disclosure of Invention
In order to solve the technical problems, the invention aims to provide a method for simply, conveniently and completely importing the CATIA software data into the Process Designer software and generating a Process structure.
Another objective of the present invention is to provide a simple and complete system for importing the CATIA software data into the Process Designer software and generating the Process structure.
The technical scheme adopted by the method is as follows: a product process structure generation method comprises the following steps:
data format conversion step: converting the format of the product data of the CATIA into a data format conforming to the Process Designer software, and importing the product data with the converted data format into the Process Designer software;
and exporting CATIA software product structure information: importing product data into CATIA software, reading information in a product tree, and storing the read information in a first document;
automatically generating a product structure tree: and establishing a second document which meets the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, importing the compiled second document into the Process Designer software, and then automatically generating the product structure tree by combining the second document and the imported product data through the Process Designer software.
Further, the step of converting the format of the product data of the CATIA into the data format conforming to the Process Designer software specifically includes the steps of:
converting CATPArt or cgr format data of CATIA data into jt format data;
traversing all folders and files of CATIA data, detecting the jt format files one by one, and judging whether suffixes of the names of the parent folders of the jt format files are cojt;
if yes, detecting a next jt format file; otherwise, a file folder with the same name and the suffix of cojt is established under the same-level directory of the jt format file, and the jt format file is placed into the established file folder.
Further, the step of converting the format of the product data of the CATIA into a data format conforming to the Process Designer software further comprises the steps of:
and deleting the log file and other temporary files corresponding to the jt format file.
Further, the information in the product tree includes names of nodes in the product tree structure, coordinate matrix information of the nodes, and location information of the nodes, where the nodes include hierarchical nodes and resource nodes.
Further, the step of deriving the CATIA software product structure information specifically includes the following steps:
s11, after product data are imported into the CATIA software, establishing a first document, and reading information of all nodes of a tree structure of a product imported into the CATIA software;
s12, aiming at each node of the tree structure, judging that the node is a hierarchical node or a resource node, if the node is the resource node, executing steps S13 and S14, otherwise, if the node is the hierarchical node, executing steps S15 and S16;
s13, reading the node information, and writing the read information into a line of the first document in sequence;
s14, traversing the nodes of the first subset of the nodes, and executing the step S12 for each node obtained by traversal until the traversal is finished;
s15, reading node information, writing the read information into a row of the first document in sequence, reading the node names of the first subset of the nodes and the coordinate matrix information of the nodes one by one, and writing the node names and the coordinate matrix information of the nodes into the first document in sequence row by row;
s16, traversing the nodes of the first subset of the nodes, and executing the step S12 for each node obtained by traversing until the traversing is finished.
Further, the step of automatically generating the product structure tree specifically includes the following steps:
selecting a highest node of an imported product data item in Process Designer software, and exporting an xml file according to the highest node, wherein the xml file comprises basic attribute information of the imported product data;
after a second document which meets the requirements of the Process Designer software format is newly built, reading information in a product tree in the first document;
writing a second document by combining the information in the product tree in the first document and the basic attribute information in the xml file;
and importing the written second document into Process Designer software, and automatically generating a product structure tree by combining the second document and the imported product data through the Process Designer software.
Further, the step of writing a second document in combination with the information in the product tree in the first document and the basic attribute information in the xml file comprises the steps of:
s21, reading one by one to judge whether the nodes stored in the first document are resource nodes or hierarchy nodes, if the nodes are resource nodes, executing steps S22, S23 and S24, otherwise, if the nodes are hierarchy nodes, executing steps S25, S26 and S27;
s22, writing corresponding resource node information in the second document, wherein the resource node information comprises a node name, a node coordinate and coordinate matrix information converted into a Process Designer software rule;
s23, detecting a corresponding resource node in the xml file, acquiring the ID number of the resource node in the xml file, and writing the ID number into the corresponding position of the second document;
s24, traversing the nodes of the first subset of the nodes, and executing the step S1 for each node obtained by traversal until the traversal is finished;
s25, writing corresponding level node information in the second document, wherein the level node information comprises a node name, a node coordinate and coordinate matrix information converted into a Process Designer software rule;
s26, traversing the nodes of the first subset of the nodes, and after the coordinate information of the level nodes is superposed into the coordinate information of the nodes of the subset, removing the coordinate information of the level nodes and writing the node information of the subset into the node information;
s27, traversing the nodes of the first subset of the nodes, and executing the step S1 for each node obtained by traversing until the traversing is finished.
Further, the step of importing the product data in the CATIA software specifically includes: product data in a 3DMXL format or Product data format in a design mode is imported into CATIA software.
The technical scheme adopted by the system of the invention is as follows: a product process structure generation system, the system comprising:
the data format conversion module is used for converting the format of the product data of the CATIA into a data format conforming to the Process Designer software and importing the product data after the data format conversion into the Process Designer software;
the product structure information export module is used for importing product data into CATIA software, reading information in a product tree and storing the read information in a first document;
and the product structure tree generating module is used for establishing a second document which accords with the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, and automatically generating the product structure tree by combining the Process Designer software with the second document and the imported product data after importing the compiled second document into the Process Designer software.
The other technical scheme adopted by the system of the invention is as follows: a product process structure generation system, the system comprising:
a memory for storing a program;
a processor for executing the program to:
converting the format of the product data of the CATIA into a data format conforming to the Process Designer software, and importing the product data with the converted data format into the Process Designer software;
importing product data into CATIA software, reading information in a product tree, and storing the read information in a first document;
and establishing a second document which meets the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, importing the compiled second document into the Process Designer software, and then automatically generating the product structure tree by combining the second document and the imported product data through the Process Designer software.
The method has the beneficial effects that: according to the method, the resources and the structural information of the CATIA software are simply and conveniently led into the Process Designer software to generate the corresponding product structure tree, the huge workload of manually establishing the product structure is avoided on the premise that the relevant function module of the Process Designer software is not purchased, and the problem that most of product structural information is sacrificed to simplify the workload is solved. The data is greatly convenient for users to completely import from CATIA software to the Process Designer software.
The system has the beneficial effects that: the system simply and conveniently leads the resources and the structural information of the CATIA software into the Process Designer software and generates the corresponding product structure tree, and under the premise of not purchasing related functional modules of the Process Designer software, the system avoids the huge workload of manually establishing the product structure and also solves the problem of non-profession that the workload is simplified by sacrificing most of the structural information of the product. The data is greatly convenient for users to completely import from CATIA software to the Process Designer software.
Detailed Description
As shown in fig. 1, a method for generating a product process structure includes the following steps:
data format conversion step: converting the format of the product data of the CATIA into a data format conforming to the Process Designer software, and importing the product data with the converted data format into the Process Designer software;
and exporting CATIA software product structure information: importing product data into CATIA software, reading information in a product tree, and storing the read information in a first document;
automatically generating a product structure tree: and establishing a second document which meets the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, importing the compiled second document into the Process Designer software, and then automatically generating the product structure tree by combining the second document and the imported product data through the Process Designer software.
Further as a preferred embodiment, the step of converting the format of the product data of the CATIA into a data format conforming to the Process Designer software specifically includes the steps of:
converting CATPArt or cgr format data of CATIA data into jt format data;
traversing all folders and files of CATIA data, detecting the jt format files one by one, and judging whether suffixes of the names of the parent folders of the jt format files are cojt;
if yes, detecting a next jt format file; otherwise, a file folder with the same name and the suffix of cojt is established under the same-level directory of the jt format file, and the jt format file is placed into the established file folder.
Further as a preferred implementation, the step of converting the format of the product data of the CATIA into a data format conforming to the Process Designer software further includes the steps of:
and deleting the log file and other temporary files corresponding to the jt format file.
Further as a preferred embodiment, the information in the product tree includes names of nodes in the product tree structure, coordinate matrix information of the nodes, and location information of the nodes, and the nodes include hierarchical nodes and resource nodes.
Further as a preferred embodiment, the step of deriving the CATIA software product structure information specifically includes the following steps:
s11, after product data are imported into the CATIA software, establishing a first document, and reading information of all nodes of a tree structure of a product imported into the CATIA software;
s12, aiming at each node of the tree structure, judging that the node is a hierarchical node or a resource node, if the node is the resource node, executing steps S13 and S14, otherwise, if the node is the hierarchical node, executing steps S15 and S16;
s13, reading the node information, and writing the read information into a line of the first document in sequence;
s14, traversing the nodes of the first subset of the nodes, and executing the step S12 for each node obtained by traversal until the traversal is finished;
s15, reading node information, writing the read information into a row of the first document in sequence, reading the node names of the first subset of the nodes and the coordinate matrix information of the nodes one by one, and writing the node names and the coordinate matrix information of the nodes into the first document in sequence row by row;
s16, traversing the nodes of the first subset of the nodes, and executing the step S12 for each node obtained by traversing until the traversing is finished.
Further, as a preferred embodiment, the step of automatically generating the product structure tree specifically includes the following steps:
selecting a highest node of an imported product data item in Process Designer software, and exporting an xml file according to the highest node, wherein the xml file comprises basic attribute information of the imported product data;
after a second document which meets the requirements of the Process Designer software format is newly built, reading information in a product tree in the first document;
writing a second document by combining the information in the product tree in the first document and the basic attribute information in the xml file;
and importing the written second document into Process Designer software, and automatically generating a product structure tree by combining the second document and the imported product data through the Process Designer software.
Further as a preferred embodiment, the step of writing the second document in combination with the information in the product tree in the first document and the basic attribute information in the xml file comprises the steps of:
s21, reading one by one to judge whether the nodes stored in the first document are resource nodes or hierarchy nodes, if the nodes are resource nodes, executing steps S22, S23 and S24, otherwise, if the nodes are hierarchy nodes, executing steps S25, S26 and S27;
s22, writing corresponding resource node information in the second document, wherein the resource node information comprises a node name, a node coordinate and coordinate matrix information converted into a Process Designer software rule;
s23, detecting a corresponding resource node in the xml file, acquiring the ID number of the resource node in the xml file, and writing the ID number into the corresponding position of the second document;
s24, traversing the nodes of the first subset of the nodes, and executing the step S21 for each node obtained by traversal until the traversal is finished;
s25, writing corresponding level node information in the second document, wherein the level node information comprises a node name, a node coordinate and coordinate matrix information converted into a Process Designer software rule;
s26, traversing the nodes of the first subset of the nodes, and after the coordinate information of the level nodes is superposed into the coordinate information of the nodes of the subset, removing the coordinate information of the level nodes and writing the node information of the subset into the node information;
s27, traversing the nodes of the first subset of the nodes, and executing the step S21 for each node obtained by traversing until the traversing is finished.
Further as a preferred embodiment, the step of importing the product data in the CATIA software specifically includes: product data in a 3DMXL format or Product data format in a design mode is imported into CATIA software.
Specific examples of the method of the invention
The present embodiment is described below with reference to fig. 2 to 3;
s101, converting the format of the product data of the CATIA into a data format conforming to the Process Designer software, and importing the product data after the data format conversion into the Process Designer software. Referring to fig. 2, the specific steps of converting the format of the product data of the CATIA into the data format conforming to the Process Designer software are as follows:
s1011, converting the CATPArt or cgr format data of the CATIA data into jt format data.
S1012, traversing all folders and files of CATIA data, detecting the jt format files one by one, and judging whether suffixes of the parent folder names of the jt format files are cojt;
if yes, detecting a next jt format file; otherwise, a file folder with the same name and the suffix of cojt is established under the same-level directory of the jt format file, and the jt format file is placed in the file folder.
And S1013, deleting the log file and other temporary files corresponding to the jt format file.
Because the Process Designer software reads the folders by putting the jt format into the folders with the same name but the suffix of cojt, the format conversion is realized by third-party software by firstly converting CATPArt or cgr format data of CATIA data into jt format data and then putting the jt format file into the folders with the same name and the suffix of cojt. In this embodiment, a "jt 2 cojt" plug-in for converting data in jt format into cojt in batch is provided, and the specific operation method is as follows:
the "jt 2 cojt" plug-in is placed under the same directory or its higher level directory as the jt file to be converted into the cojt folder. After the plug-in is operated by double clicking, all the jt files are automatically converted into the cojt folder, wherein the conversion steps are the same as the steps, the files are converted after the jt is detected and judged, and meanwhile, the log files and other temporary files corresponding to the jt format files are deleted, and the files are deleted, so that the data are more concise. After the data format conversion is completed, the cojt folder is not repeatedly regenerated even if the plug-in is double-clicked again. And then manually importing the product data resources after the format conversion into the Process Designer software by one key through the self-contained function of the Process Designer software.
And S102, importing product data into CATIA software, reading information in a product tree, and storing the read information in a first document. The information in the product tree includes names of nodes in the product tree structure, coordinate matrix information of the nodes, and position information of the nodes, and the nodes include level nodes and resource nodes. Referring to fig. 3, the specific steps of reading the saved information are as follows:
s1021, after product data are imported into the CATIA software, a first document is established, and information of all nodes of a tree structure of a product imported into the CATIA software is read.
S1022, for each node of the tree structure, it is determined that the node is a hierarchical node or a resource node, if the node is a resource node, steps S1023 and S1024 are performed, otherwise, if the node is a hierarchical node, steps S1025 and S1026 are performed.
And S1023, reading the node information, and sequentially writing the read information into a line of the first document.
And S1024, traversing the nodes of the first subset of the nodes, and executing the step S1021 for each node obtained through traversal until the traversal is finished.
S1025, reading the node information, sequentially writing the read information into a row of the first document, reading the node names of the first subset of the nodes and the coordinate matrix information of the nodes one by one, and sequentially writing the node names and the coordinate matrix information of the nodes into the first document row by row.
S1026, traversing the nodes of the first subset of the nodes, and for each node obtained through the traversal, executing step S1021 until the traversal is finished.
The first document in the above steps may be in a variety of document formats, such as a Word document, an Excel document, or an xml document, and an Excel document is selected in this embodiment. In this embodiment, a CAITA plug-in is provided that operates in the form of a macro. Opening 3DMXL format data of a product in CATIA software, operating a plug-in, automatically generating an Excel table by operating the CATIA plug-in, reading the structure data of the product opened in the CATIA software, recording and storing other node information such as the name of each node in a product tree structure, a coordinate matrix of the node and the like in the Excel table, wherein the reading steps are the same as the steps.
S103, establishing a second document meeting the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, importing the compiled second document into the Process Designer software, and then automatically generating the product structure tree by combining the second document and the imported product data through the Process Designer software.
And S1031, selecting the highest node of the imported product data item in the Process Designer software, and exporting an xml file according to the highest node, wherein the xml file comprises basic attribute information of the imported product data. The basic attribute information includes related node physical information and location information.
S1032, after a second document which meets the requirements of the Process Designer software format is created, reading the information in the product tree in the first document.
And S1033, writing a second document by combining the information in the product tree in the first document and the basic attribute information in the xml file.
S1034, importing the written second document into Process Designer software, and automatically generating a product structure tree by combining the second document and the imported product data through the Process Designer software.
The step S1033 includes the following steps:
a1, reading one by one to judge whether the nodes stored in the first document are resource nodes or hierarchy nodes, if the nodes are resource nodes, executing the steps A2, A3 and A4, otherwise, if the nodes are hierarchy nodes, executing the steps A5, A6 and A7.
And A2, writing corresponding resource node information in the second document, wherein the resource node information comprises a node name, a node coordinate and coordinate matrix information converted into a Process Designer software rule.
A3, detecting the corresponding resource node in the xml file, obtaining the ID number of the resource node in the xml file, and writing the ID number into the corresponding position of the second document.
A4, traversing the nodes of the first subset of the nodes, and executing the step A1 for each node obtained by the traversal until the traversal is finished.
And A5, writing corresponding hierarchical node information in the second document, wherein the hierarchical node information comprises node names, node coordinates and coordinate matrix information converted into Process Designer software rules.
And A6, traversing the nodes of the first subset of the nodes, and after the coordinate information of the level node is superposed into the coordinate information of the nodes of the subset, clearing the coordinate information of the level node and writing the node information of the subset into the node information.
A7, traversing the nodes of the first subset of the nodes, and executing the step A1 for each node obtained by the traversal until the traversal is finished.
The second document in the above steps is an xml document in the present embodiment. The invention provides an import plug-in secondarily developed on Process Designer software. After selecting the highest-level node in any empty project in the Process Designer software, clicking to run an import plug-in, automatically popping up a selection window after clicking the plug-in, selecting the first document in the step S102 through the selection window, wherein the first document is an Excel form in the embodiment, importing the Excel form into the plug-in, and the plug-in program runs as follows: 1. and establishing an xml document which meets the format requirement of the Process Designer software. 2. Reading information in a product tree in an Excel table, and writing the read information into an xml document; reading and judging nodes stored in the Excel table one by one to be hierarchical nodes or resource nodes, and if the nodes are the resource nodes, writing corresponding resource node information in the xml document, wherein the resource node information comprises node names, node coordinates, coordinate matrixes converted into Process Designer software rules and other information; detecting a corresponding resource node in the xml file, acquiring the ID number of the node in the xml file in a name searching mode, and writing the ID number into the corresponding position of the xml file; nodes of the first subset of resource nodes are traversed. If the hierarchical nodes are hierarchical nodes, writing corresponding hierarchical structure node information in the xml document, wherein the hierarchical node information comprises information such as node names, node coordinates and coordinate matrixes converted into Process Designer software rules; traversing the node of the first subset of the node, and after the coordinate information of the node is superposed into the coordinate information of the node of the subset, removing the coordinate information of the node and writing the node information of the subset into the node information; nodes of the first subset of the hierarchy nodes are traversed. 3. And traversing all the nodes to finish writing the xml document. 4. And importing the written xml document into the Process Designer software. And the Process Designer software automatically generates a product structure tree in combination with the imported product data, and the product structure tree generated in the Process Designer software is consistent with the structure of the product in the CATIA software.
The method can conveniently, quickly and completely guide the product structure in the CATIA software into the Process Designer software and generate the corresponding product structure tree, thereby facilitating the design of engineers and improving the design quality.
In addition, for the position information, the program for importing the plug-in completes the conversion from the position matrix information in the CATIA software to the position matrix information in the Process Designer software. The plug-in program also adds the position information in the finished product structure into the resource position information and clears the position information of the product structure, so that the advantage of this is that the information in all the resource coordinate attributes is the information relative to the original point, and even if the user carelessly misplaces the resources relatively in the subsequent work, the adjustment to the original position is very convenient.
The contents of the above method embodiments are applicable to the following system embodiments.
As shown in fig. 4, for the above method, the corresponding software and hardware combination product process structure generation system includes:
the data format conversion module is used for converting the format of the product data of the CATIA into a data format conforming to the Process Designer software and importing the product data after the data format conversion into the Process Designer software;
the product structure information export module is used for importing product data into CATIA software, reading information in a product tree and storing the read information in a first document;
and the product structure tree generating module is used for establishing a second document which accords with the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, and automatically generating the product structure tree by combining the Process Designer software with the second document and the imported product data after importing the compiled second document into the Process Designer software.
For the above method, another product process structure generation system with corresponding software and hardware combination comprises:
a memory for storing a program;
a processor for executing the program to:
converting the format of the product data of the CATIA into a data format conforming to the Process Designer software, and importing the product data with the converted data format into the Process Designer software;
importing product data into CATIA software, reading information in a product tree, and storing the read information in a first document;
and establishing a second document which meets the format requirement of the Process Designer software, compiling the second document by combining the information in the first document and the information of the imported product data, importing the compiled second document into the Process Designer software, and then automatically generating the product structure tree by combining the second document and the imported product data through the Process Designer software.
The system of the invention can conveniently, quickly and completely guide the product structure in the CATIA software into the Process Designer software and generate the corresponding product structure tree, thereby facilitating the design of engineers and improving the design quality.
While the preferred embodiments of the present invention have been illustrated and described, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.