Disclosure of Invention
In view of the above-mentioned problems in the background art, the present invention provides a difference comparison method based on different phases of the BIM model of REVIT, comprising the following steps:
s1, establishing a form database;
s2, window construction, including foreground opening new version model, background opening old version model needing comparison;
s3, processing the document;
s4, object screening, including user screening model elements to be compared and collecting new and old version model element sets;
s5, file comparison, including comparison element collection content, and collection comparison results;
s6, forming a list, and displaying a comparison result by a foreground file;
and S7, result display processing.
Further, the step S2 specifically includes the following steps:
s21, creating a user form: acquiring a commandData object of a current document through an IExternalCommand interface, and calling a window designed in a UI module to display;
s22, generating a file selection form: utilizing openFileDialog to create a selection window instance;
s23, judging the file acquisition condition;
s24, returning a file path selected by the user: returning the path name of the RVT file selected by the user through openFileDialog;
s25, calling a document processing module: and assigning the acquired path name to a document calling module for further processing.
Further, according to the judgment result of the step S23, if a result is obtained, performing step S24; and if the acquisition fails, performing exception handling and returning to the windows.
Further, the step S3 specifically includes:
s31, acquiring document path: selecting a document path by a user acquired by a file selection module;
s32, acquiring an application program instance: acquiring an APPLICATION instance of a current active RVT document;
s33, background loading of documents: calling an application program instance document loading method, assigning the user-selected document path to the application program instance, and loading the user-selected document to a background;
s34, judging the loading condition;
s35, calling a screening module: and the user selected document opened in the background and the current active document are assigned to the screening module for further processing.
Further, according to the loading result of the step S34, if the loading is successful, the step S35 is performed, and if the loading is failed, the exception handling is performed, and the exception is obtained and returned to the user.
Further, the step S4 specifically includes the following steps:
s41, obtaining the name of the screening object selected by the user: acquiring a screening object name character string selected by a user in a window;
s42, converting object names: obtaining a name character string object and converting the name character string object into a built-in name of a corresponding object of revit;
s43, creating a filter rule: creating different types of class filters and Category filters corresponding to the object names;
s44, creating an object collector: respectively creating a document content object collector for the current active document and the user selected document;
s45, adding a filter rule: adding the filter rules of the step S43 to the current active document and the document collector selected by the user;
s46, generating a filtering result: filtering the collector to generate a current active document and a filter result of the document selected by the user;
s47, calling a comparison module: and assigning the filter results of the current active document and the document selected by the user to a comparison module for further processing.
Further, the step S5 specifically includes:
s51, acquiring result object characteristic values: extracting characteristic IDs in the filter result of the A, B document;
s52, comparing by the comparator: carrying out difference arrangement comparison on the A, B result to generate a comparison result array;
s53, judging a comparison result;
s54, calling a list generation module: and assigning the comparison result to a list generation module for further processing.
Further, according to the determination result of the step S53, if the comparison is successful, the step S54 is performed, and if the comparison is failed, the exception handling is performed, and the comparison failure result is returned to the system program.
Further, the step S6 specifically includes:
s61, generating a list example: creating a manifest style instance;
s62, screening result parameters: traversing object parameters in the result list, and screening according to the importance degree;
s63, judging a screening result: according to the screening result, if the screening is successful, the step S64 is carried out, if the screening is failed, the exception processing is carried out, and the screening parameter exception value is returned to the system program for processing;
s64, generating the list content: the content and the parameters of the sorting result are displayed according to the list style;
s65, calling a result display module: and assigning the list to a result display module for further processing.
Further, step S7 specifically includes:
s71, display list: calling a design window in the UI module to draw, and displaying all comparison results;
s72, acquiring a display mode selected by a user: acquiring a display mode selected by a user in a window;
s73, displaying: all results in the list are displayed;
s74, highlighting display: highlighting only the results selected by the user;
s75, hiding all objects in the non-list: calling an IsopateElementTemporary method to hide all objects except the result;
s76, highlighting all objects in the list: calling a SetElementIds method to display all objects in the list;
s77, acquiring the user selected object: acquiring an object of a name clicked by a user in a list;
s78, highlighting the user selected object: the SetElementIds method is invoked to display the user selected object.
The difference comparison method of the BIM models in different stages based on the REVIT is based on the secondary development of REVIT software, and provides a difference comparison method according to the BIM models in different stages. More specific beneficial effects are explained as follows: native comparison in software is realized, the requirement of file comparison is met, complicated operation is reduced, the working efficiency of designers is improved, and the design quality is improved; compared with the prior implementation mode, the method shortens the running time; compared with the existing implementation mode, the method has the advantages that the flexibility is improved, and the running time is shortened; the comparison result is displayed by a list, so that readability and practicability are improved; the prominent highlighting of single or multiple objects increases readability.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described below with reference to the accompanying drawings and examples. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides a difference comparison method of BIM models in different stages based on REVIT, which comprises the following steps:
s1, establishing a form database; the method is mainly established according to the requirement engineering design requirement.
S2, window construction, including foreground opening new version model, background opening old version model needing comparison; referring to the flowchart of the step shown in fig. 1, step S2 specifically includes the following steps: s21, creating a user form: acquiring a commandData object of a current document through an IExternalCommand interface, and calling a window designed in a UI module to display; s22, generating a file selection form: utilizing openFileDialog to create a selection window instance; s23, judging the file acquisition condition; s24, returning a file path selected by the user: returning the path name of the RVT file selected by the user through openFileDialog; s25, calling a document processing module: and assigning the acquired path name to a document calling module for further processing.
If a result is obtained, the process proceeds to step S24, based on the determination result of step S23; and if the acquisition fails, performing exception handling and returning to the windows. The method belongs to stage file selection, two files need to be compared, two files for comparison are needed at first, the foreground and the background files are used for comparison in the patent step, a window is created in the foreground file, and the stage file selector is used for selecting the background file, so that the content of the files needing to be compared can be confirmed in the foreground file, and the error probability is reduced.
S3, processing the document; after the file path is obtained in the previous stage (step), the file needs to be loaded into the cache in this stage (step), and with reference to the flowchart of this step in fig. 2, step S3 specifically includes: s31, acquiring document path: selecting a document path by a user acquired by a file selection module; s32, acquiring an application program instance: acquiring an APPLICATION instance of a current active RVT document; s33, background loading of documents: calling an application program instance document loading method, assigning the user-selected document path to the application program instance, and loading the user-selected document to a background; s34, judging the loading condition; s35, calling a screening module: and the user selected document opened in the background and the current active document are assigned to the screening module for further processing.
Based on the loading result in step S34, if the loading is successful, step S35 is performed, and if the loading is failed, exception handling is performed, and the exception is obtained and returned to the user. Compared with the method that two files are opened simultaneously, the efficiency can be effectively improved by comparing the files in the cache.
S4, object screening, including user screening model elements to be compared and collecting new and old version model element sets; in this stage, a comparison rule and a collector are created according to the type of the comparison object selected in the user interface, and two files respectively compare and collect objects of the same type, with reference to the flowchart of the step shown in fig. 3, step S4 specifically includes the following steps: s41, obtaining the name of the screening object selected by the user: acquiring a screening object name character string selected by a user in a window; s42, converting object names: obtaining a name character string object and converting the name character string object into a built-in name of a corresponding object of revit; s43, creating a filter rule: creating different types of class filters and Category filters corresponding to the object names; s44, creating an object collector: respectively creating a document content object collector for the current active document and the user selected document; s45, adding a filter rule: adding the filter rules of the step S43 to the current active document and the document collector selected by the user; s46, generating a filtering result: filtering the collector to generate a current active document and a filter result of the document selected by the user; s47, calling a comparison module: and assigning the filter results of the current active document and the document selected by the user to a comparison module for further processing. The step does not need to compare all types, effectively reduces the comparison range and reduces the comparison time.
S5, file comparison, including comparison element collection content, and collection comparison results; referring to the flowchart of fig. 4, step S5 specifically includes: s51, acquiring result object characteristic values: extracting characteristic IDs in the filter result of the A, B document; s52, comparing by the comparator: carrying out difference arrangement comparison on the A, B result to generate a comparison result array; s53, judging a comparison result; s54, calling a list generation module: and assigning the comparison result to a list generation module for further processing.
If the comparison is successful, the determination result of step S53 goes to step S54, and if the comparison is failed, exception handling is performed, and the comparison failure result is returned to the system program. Compared with the existing implementation mode, the method has the advantages that the flexibility is increased, and the running time is shortened.
S6, forming a list, and displaying a comparison result by a foreground file; referring to the flowchart of fig. 5, step S6 specifically includes: s61, generating a list example: creating a manifest style instance; s62, screening result parameters: traversing object parameters in the result list, and screening according to the importance degree; s63, judging a screening result: according to the screening result, if the screening is successful, the step S64 is carried out, if the screening is failed, the exception processing is carried out, and the screening parameter exception value is returned to the system program for processing; s64, generating the list content: the content and the parameters of the sorting result are displayed according to the list style; s65, calling a result display module: and assigning the list to a result display module for further processing. The comparison result is displayed by a list, and readability is improved.
And S7, result display processing. Referring to the flowchart of fig. 6, step S7 specifically includes: s71, display list: calling a design window in the UI module to draw, and displaying all comparison results; s72, acquiring a display mode selected by a user: acquiring a display mode selected by a user in a window; s73, displaying: all results in the list are displayed; s74, highlighting display: highlighting only the results selected by the user; s75, hiding all objects in the non-list: calling an IsopateElementTemporary method to hide all objects except the result; s76, highlighting all objects in the list: calling a SetElementIds method to display all objects in the list; s77, acquiring the user selected object: acquiring an object of a name clicked by a user in a list; s78, highlighting the user selected object: the SetElementIds method is invoked to display the user selected object. The prominent highlighting of single or multiple objects increases readability.
The difference comparison method of the BIM models in different stages based on the REVIT does not need to convert formats, export or upload in application, and realizes stage version comparison, content filtering and display in REVIT software. More specific beneficial effects are explained as follows: native comparison in software is realized, the requirement of file comparison is met, complicated operation is reduced, the working efficiency of designers is improved, and the design quality is improved;
although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.