Model parameter batch assignment method and system based on Revit secondary development

Through the model parameter batch assignment method based on Revit secondary development, using Excel files and C# development environment, the rapid and accurate batch assignment of Revit model component parameters is achieved, solving the problems of inefficiency and error-prone traditional manual operation, and improving construction and operation and maintenance efficiency, save costs and ensure data accuracy and consistency.

CN118940370APending Publication Date: 2024-11-12CHINA COMMUNICATIONS CONSTRUCTION
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410981506.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In BIM technology, traditional methods rely on manual operations for model parameters update and maintenance, which is inefficient and error-prone, resulting in inefficient and high cost during construction and operation and maintenance.

Method used

Provide a batch assignment method of model parameters based on Revit secondary development. It selects model components through a user-friendly interface, and uses Excel files to batch export and import data to achieve fast and accurate assignment of Revit model components parameters, using C# development environment and RevitAPI implements automated batch assignment.

Benefits of technology

Improve the efficiency and accuracy of parameter management, save time and labor costs, simplify the data preparation and import process, provide a simple and intuitive user interface, ensure data consistency and integrity, and have error detection and feedback mechanisms .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940370A_ABST
    Figure CN118940370A_ABST
Patent Text Reader

Abstract

The invention discloses a model parameter batch assignment method and system based on Revit secondary development, and relates to the technical field of building information model automation. Configuring a Revit secondary development environment based on C #; exporting parameterized batch-assigned model component family names, type names and component ID value data, and generating a local Excel file; performing data modification on the generated Excel file, importing the modified Excel file into Revit, matching with a model component in a Revit model according to a family ID value in Excel, and automatically completing parameter assignment of a batch family component model; according to the method, rapid and accurate assignment of a plurality of parameters in the Revit model component is realized, the problems of low efficiency of updating and maintaining the parameters of the Revit model component in construction and operation and maintenance stages and high error rate are well solved, and time and labor cost are saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of building information model automation, and more specifically to a model parameter batch assignment method and system based on Revit secondary development. Background Art

[0002] Currently, Revit is a building information modeling (BIM) software that provides a rich API interface that allows users to customize and expand the model programmatically.

[0003] In the application of BIM technology, parameters are one of the important attributes of model components. They can be used to represent various characteristics of model components, such as size, material, position, etc. In practical applications, it is often necessary to assign values ​​to a large number of parameters in the model to meet construction requirements. Therefore, the management of model parameters is a key link in the design, analysis and construction process.

[0004] However, in traditional methods, parameter updating and maintenance often rely on manual operations, which are cumbersome, inefficient and error-prone.

[0005] Therefore, how to provide an automated method to improve the efficiency and accuracy of parameter management is an urgent problem that those skilled in the art need to solve. Summary of the invention

[0006] In view of this, the present invention provides a method and system for batch assignment of model parameters based on Revit secondary development, which allows users to select model components through a user-friendly interface, and batch export lists and import data through Excel files, thereby realizing fast and accurate assignment of multiple parameters in Revit model components, and effectively solves the problem of inefficient and error-prone updating and maintenance of Revit model component parameters during construction and operation and maintenance stages, saving time and labor costs.

[0007] In order to achieve the above object, the present invention adopts the following technical solution:

[0008] On the one hand, a method for batch assignment of model parameters based on Revit secondary development is provided, including:

[0009] S1: Prepare the model components to be assigned in the Revit project and define the component instance parameters;

[0010] S2: Based on C#, configure the Revit secondary development environment, create a new project solution and define the interface and namespace for secondary development;

[0011] S3: Export the model component family name, type name, and component ID value data of parameterized batch assignment and generate a local Excel file;

[0012] S4: modify the data of the generated Excel file, and add parameter names and parameter data values ​​according to the family instance name and family ID;

[0013] S5: Import the modified Excel file into Revit, match the family ID value in Excel with the model components in the Revit model, and automatically complete the parameter assignment of batch family component model components.

[0014] Optionally, it also includes S6: using WinForms form to implement the user interaction interface, internalizing the complex logic to form a concise and clear operation interface, which is easy for operators to understand and use.

[0015] Optionally, the specific steps of S1 are:

[0016] S11: Add corresponding instance parameter items to the model components that need to be parameterized in batches in Revit;

[0017] S12: According to the data type to be batch assigned, specify the data type of the instance parameter of the model component that needs to be parameterized batch assigned in Revit, where the instance parameter name and data type of the model component should be consistent with the custom parameter name and parameter data type filled in the subsequently generated Excel file.

[0018] Optionally, the specific steps of S2 are:

[0019] S21: Use Microsoft Visual Studio as the development tool, create a new project solution, and select "Class Library (.NET Framework)" as the project template;

[0020] S22: Introduce two dynamic link libraries, RevitAPI.dll and RevitAPIUI.dll, into the project solution for the interface of secondary development;

[0021] S23: Reference the following main namespaces in the main program code: Autodesk.Revit.Attributes (Revit's attribute-related namespace, used to define the characteristics of the Revit plug-in); Autodesk.Revit.DB (Revit's database-related namespace, used to operate Revit's database objects); Autodesk.Revit.UI (Revit's user interface-related namespace, used to operate Revit's user interface); System.Windows.Forms (Windows form namespace, used to create and manage Windows forms); OfficeOpenXml (used to implement data interaction with Excel).

[0022] S24: Define a main program class to implement Revit's IExternalCommand interface.

[0023] Optionally, the specific steps of S3 are:

[0024] S31: Get the IList referenced by the Revit model component references of the parameters to be assigned selected by the user through the uIDocument.Selection.PickObjects() method <reference>gather;

[0025] S32: Traversing IList <reference>Collection, get the actual object of the selected component through document.GetElement() method;

[0026] S33: obtain the family name of the component through the Symbol.Family.Name property of the actual object of the model component; obtain the type name of the component through the Name property of the actual object of the component; obtain the type name of the component through the Id property of the actual object of the component; and concatenate the family name and type name character strings to form a "family instance name";

[0027] S34: By using the Cells property of the ExcelWorksheet class of the OfficeOpenXml namespace, assign "name" to excelWorksheet.Cells[1,1].Value; assign "family ID" to excelWorksheet.Cells[1,2].Value; traverse the family instance names of the model components and assign them to excelWorksheet.Cells[2+i,1].Value; traverse the IDs of the model components and assign them to excelWorksheet.Cells[2+i,2].Value; thereby saving the family instance name data and ID data of the model components in ExcelWorksheet;

[0028] S35: by using the Save(D:\family parameter table.xlsx) method of the ExcelPackage class of the OfficeOpenXml namespace, the generated ExcelWorksheet is saved locally in the form of Excel spreadsheet data, thereby completing the data export operation;

[0029] S36: After the data export operation is completed, through the TaskDialog.Show("Prompt","Data export successful! \nBy default, export to the family parameter table.xlsx in the root directory of disk D! \nModify Excel and then import this plug-in!"") method, a completion dialog box pops up and prompts the user to the local location of the exported file.

[0030] Optionally, the specific steps of S4 are:

[0031] S41: Open the generated Excel file, and enter the custom parameter name of the model component in the first row of each column starting from the first row of the third column; the parameter name should be consistent with the corresponding instance parameter name added in Revit for the model component that needs to be parameterized in batches;

[0032] S42: Starting from the second row of the third column, enter the parameter data value of the custom parameter in the third column according to the family instance name and family ID of the corresponding row in the column. After completing this column, complete the entry of the parameter data values ​​of the custom parameters in the subsequent columns in sequence. The data type of the parameter data value should be consistent with the data type of the corresponding instance parameter added in Revit for the model component that needs to be parameterized in batches.

[0033] S43: thereby completing the modification operation of the Excel file, and completing the data preparation work for batch assignment of model components.

[0034] Optionally, the specific steps of S5 are:

[0035] S51: Open the modified Excel file by using the ExcelPackage() method of the ExcelPackage class of the OfficeOpenXml namespace;

[0036] S52: Get the worksheet named "Sheet1" in the Excel file by using ExcelPackage.Workbook.Worksheets["Sheet1"] of the ExcelPackage class in the OfficeOpenXml namespace; get the number of columns in the worksheet by using ExcelWorksheet.Dimension.Columns; get the number of rows in the worksheet by using ExcelWorksheet.Dimension.Rows;

[0037] S53: Traverse the column data in the worksheet, obtain the custom parameter name in the Excel table through excelWorksheet.Cells[1,i+3].Value of the OfficeOpenXml namespace, and store the obtained parameter name in List <string>In the parametername collection;

[0038] S54: traverse the row and column data in the worksheet, obtain the custom parameter data value in the Excel table through excelWorksheet.Cells[2+i,2+j].Value of the OfficeOpenXml namespace, and store the family component ID value and the corresponding family component parameter data value of each row in the List <string>para metervalues, and then store all rows of parametervalues ​​data in List <List <string>>para meterset two-dimensional set, thereby completing the extraction of Excel table data;

[0039] S55: Use the Start() method of the Transaction class in the Autodesk.Revit.DB namespace to start the Revit transaction for subsequent modification work;

[0040] S56: traverse the parametervalues ​​set in the parameterset two-dimensional set, and obtain the model component ID value through parametervalues[0], and then obtain the model components to be assigned parameters in batches through document.GetElement(new ElementId(Convert.ToInt32(parametervalues[0]));

[0041] S57: In the above traversal loop, the parametername collection is traversed again, and the parameter with the specified custom parameter name in the model component is obtained through the LookupParameter(parametername[i]) method of the model component, and assigned to the parameter variable. It should be noted that an if judgment is required here. If the parameter with the specified custom parameter name is not found in the model component, the parameter variable is null. At this time, an error prompt dialog box is popped up through TaskDialog.Show();

[0042] S58: In the above traversal loop, the parameter data value is assigned to the parameter of the model component through the Set(parametervalues[i+1]) method of the parameter variable, thereby completing the assignment of the parameter of the model component;

[0043] S59: Complete the double-layer nested loop traversal in sequence, thereby completing the assignment of all parameters of this model component and the assignment of all parameters of all model components in sequence; and after completion, through the TaskDialo g.Show("prompt","Parameter assignment successful!\nTotal assignment"+parameterset.Count.ToString()+"instances!"") method, a completion dialog box pops up and displays the number of model component instances for which batch parameter assignment has been completed.

[0044] It is worth noting that the parameters of the Revit model components in the construction phase will continue to change and adjust with the progress of the construction implementation. Through this method, you only need to modify the specific values ​​of the corresponding family component parameters in the Excel file, and then complete the above data import operation, you can update and modify the model components with one click, which greatly facilitates the update and modification of the parameter information of the Revit model components.

[0045] Optionally, the specific steps of S6 are:

[0046] S61: The user interaction interface design uses Windows Forms technology to create a Form, which consists of function buttons and function descriptions;

[0047] S62: In the function button part, two buttons are added through the System.Windows.Forms.Button() method, and their names are "Generate Table" and "Load Table", which correspond to the above-mentioned data export function and data import function respectively;

[0048] S63: Add click events to the "Generate Table" and "Load Table" buttons through the button_Click(object sender,EventArgs e) method, and implement the operations of reading and writing local directory files through the System.Windows.Forms.OpenFileDialog() method in the event, so as to realize linkage operations with the data export and data import functions;

[0049] S64: The function description section is a brief description of the use of the system and usage precautions, which is used to provide prompts and help to users during use.

[0050] On the other hand, a model parameter batch assignment system based on Revit secondary development is provided, including:

[0051] Component preparation module, which prepares the model components to be assigned in the Revit project and defines and sets the component instance parameters;

[0052] Environment configuration module, based on C# Revit secondary development environment configuration, creates new project solutions and defines secondary development interfaces and namespaces;

[0053] Data export module, which exports the model component family name, type name, and component ID value data of parameterized batch assignment and generates a local Excel file;

[0054] The data modification module modifies the data in the generated Excel file and adds parameter names and parameter data values ​​according to the family instance name and family ID;

[0055] The parameter assignment module imports the modified Excel file into Revit, matches the family ID values ​​in Excel with the model components in the Revit model, and automatically completes the parameter assignment of batch family component model components.

[0056] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses a method and system for batch assignment of model parameters based on Revit secondary development, which has the following beneficial effects:

[0057] 1. Automated data import: Using Excel files as data sources simplifies the data preparation and import process.

[0058] 2. User interface design: It provides a simple and intuitive user interface, which makes it easy for non-technical users to operate.

[0059] 3. Parameter batch processing: supports batch assignment of multiple parameters of multiple Revit model components.

[0060] 4. Automatic transaction management: Use Revit's transaction mechanism to ensure data consistency and integrity.

[0061] 5. Error handling and feedback: The system has error detection and user feedback mechanisms to improve the reliability of operations. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0063] Figure 1 An implementation flow chart provided for the present invention;

[0064] Figure 2 A schematic diagram of the Revit family environment definition parameters provided by the present invention;

[0065] Figure 3 A schematic diagram of model component parameters in the Revit project environment provided by the present invention;

[0066] Figure 4 A schematic diagram of the main program interface provided by the present invention;

[0067] Figure 5 A schematic diagram of a dialog box prompting after exporting model data to a local Excel file provided by the present invention;

[0068] Figure 6 This is a schematic diagram of an Excel file after importing and modifying the file provided by the present invention;

[0069] Figure 7 A schematic diagram of a prompt dialog box after completing the batch assignment operation of all components provided by the present invention;

[0070] Figure 8 This is a schematic diagram showing parameter data after the model component provided by the present invention has been assigned values. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0072] The embodiment of the present invention discloses a method for batch assignment of model parameters based on Revit secondary development, such as Figure 1 As shown, the specific steps include:

[0073] S1: Prepare the model components to be assigned in the Revit project and define the component instance parameters.

[0074] The specific operation of S1 is: select the component to be assigned in the Revit project, double-click the component to enter the family editor interface, and add custom parameters and define the data type for this type of component. Figure 2 As shown in the figure, it is a screenshot of the interface for adding model component parameters and defining parameter types; Figure 3 The following is a screenshot of the model component after the model component parameters are added and loaded into the project (adding the "mixing plant manufacturer name" parameter, "concrete strength" parameter, and "responsible team" parameter);

[0075] S2: Revit secondary development environment configuration based on C#

[0076] The specific operation of S2 is: add reference dll files and add related namespaces in the Microsof Visual Studio solution. The Revit secondary development environment configuration interface is shown below.

[0077]

[0078] S3: The model component family name, type name, and component ID value data of the parametric batch assignment are exported and generated into a local Excel file.

[0079] The specific operation of S3 is: open the main interface of the program in the Revit project environment, click the "Generate Table" button, such as Figure 4 As shown; click to select the model component that needs to be assigned a value. After the selection is completed, a prompt box pops up, such as Figure 5 As shown; export the family instance name and ID of the model component to the local D:\family parameter table.xlsx file, as shown in Table 1.

[0080] Table 1 Contents of the Excel file exported to the local computer

[0081]

[0082] S4: Modify the data of the generated Excel file and add parameter names and parameter data values ​​according to the family instance name and family ID.

[0083] The specific operations of S4 are:

[0084] After opening the exported Excel, add the "mixing station manufacturer name" parameter, "concrete strength" parameter, "responsible team" parameter, and parameter data values ​​in the third, fourth, and fifth columns respectively. Save after completion, as shown in Table 2.

[0085] Table 2 Contents of the local Excel file after modification

[0086]

[0087] S5: Import the modified Excel file into Revit, match the family ID value in Excel with the model components in the Revit model, and automatically complete the parameter assignment of batch family component models.

[0088] The specific operation of S5 is: open the main interface of the program in the Revit project environment, click the "Generate Table" button; after clicking, select the modified Excel file (family parameter table.xlsx), such as Figure 6 As shown; after clicking Open, the automatic assignment operation is performed. After all model components are assigned, a prompt box pops up, such as Figure 7 ; At this time, the corresponding instance parameters of all model components are automatically assigned, such as Figure 8 shown.

[0089] S6: Use WinForms to implement the user interaction interface, internalize the complex logic, and form a simple and clear operation interface, which is easy for operators to understand and use

[0090] The specific form of S6 is: adopting a simple design, including 2 main function buttons and main precautions during use, such as Figure 4 shown.

[0091] On the other hand, a model parameter batch assignment system based on Revit secondary development is provided, including:

[0092] Component preparation module, which prepares the model components to be assigned in the Revit project and defines and sets the component instance parameters;

[0093] Environment configuration module, based on C# Revit secondary development environment configuration, creates new project solutions and defines secondary development interfaces and namespaces;

[0094] Data export module, which exports the model component family name, type name, and component ID value data of parameterized batch assignment and generates a local Excel file;

[0095] The data modification module modifies the data in the generated Excel file and adds parameter names and parameter data values ​​according to the family instance name and family ID;

[0096] The parameter assignment module imports the modified Excel file into Revit, matches the family ID values ​​in Excel with the model components in the Revit model, and automatically completes the parameter assignment of batch family component model components.

[0097] In the present invention, the conventional manual method of adding parameter information to the Revit model in sequence is changed, and the later modification and maintenance are extremely cumbersome and prone to business trips, which is a huge workload for the Revit model in the construction stage. However, through this method, it is possible to use Excel files to batch import data, and to achieve fast and accurate assignment of multiple parameters in the Revit model. Especially for parameters that are frequently changed in the later stage, it is only necessary to modify them in the corresponding Excel and directly update the model parameters through the program. In the past, it took an average of 5 minutes to add and modify parameters of a single model component manually; after using the automatic assignment of the present invention, it only takes 20 seconds to add and modify parameters manually. For large-scale construction projects, it reduces the manual input and proofreading of family parameters of a single model file in Revit and the later model information update work. The enterprise can save labor costs, while reducing the potential costs caused by errors, reducing the possibility of human errors, and improving the accuracy of model data, which is crucial for subsequent engineering analysis and construction management, thereby improving the productivity of the design and construction team.

[0098] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0099] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.< / string> < / string> < / string> < / reference> < / reference>

Claims

1. A model parameter batch assignment method based on Revit secondary development, characterized in that: include: S1: Prepare the model components to be assigned in the Revit project and define the component instance parameters; S2: Based on C#, configure the Revit secondary development environment, create a new project solution and define the interface and namespace for secondary development; S3: Export the model component family name, type name, and component ID value data of parameterized batch assignment and generate a local Excel file; S4: modify the data of the generated Excel file, and add parameter names and parameter data values ​​according to the family instance name and family ID; S5: Import the modified Excel file into Revit, match the family ID value in Excel with the model components in the Revit model, and automatically complete the parameter assignment of batch family component model components.

2. According to the method of batch assignment of model parameters based on Revit secondary development according to claim 1, it is characterized in that: It also includes S6: Use WinForms forms to implement the user interaction interface, internalize complex logic, and form a simple and clear operation interface that is easy for operators to understand and use.

3. The method for batch assignment of model parameters based on Revit secondary development according to claim 1 is characterized in that: The specific steps of S1 are: S11: Add corresponding instance parameter items to the model components that need to be parameterized in batches in Revit; S12: According to the data type to be batch assigned, specify the data type of the instance parameter of the model component that needs to be parameterized batch assigned in Revit, where the instance parameter name and data type of the model component should be consistent with the custom parameter name and parameter data type filled in the subsequently generated Excel file.

4. The method for batch assignment of model parameters based on Revit secondary development according to claim 1 is characterized in that: The specific steps of S2 are: S21: Use Microsoft Visual Studio as the development tool, create a new project solution, and select "Class Library" as the project template; S22: Introduce two dynamic link libraries, RevitAPI.dll and RevitAPIUI.dll, into the project solution for the interface of secondary development; S23: The following namespaces are referenced in the main program code: Revit property-related namespaces, used to define the characteristics of Revit plug-ins; Revit database-related namespaces, used to operate Revit database objects; Revit user interface-related namespaces, used to operate Revit user interfaces; Windows form namespaces, used to create and manage Windows forms; OfficeOpenXml is used to implement data interaction with Excel; S24: Define a main program class to implement Revit's IExternalCommand interface.

5. The method for batch assignment of model parameters based on Revit secondary development according to claim 1 is characterized in that: The specific steps of S3 are: S31: Get the IList referenced by the Revit model component references of the parameters to be assigned selected by the user through the uIDocument.Selection.PickObjects() method <reference> gather;< / reference> S32: Traversing IList <reference> Collection, get the actual object of the selected component through document.GetElement() method;< / reference> S33: obtain the family name of the component through the Symbol.Family.Name property of the actual object of the model component; obtain the type name of the component through the Name property of the actual object of the component; obtain the type name of the component through the Id property of the actual object of the component; and concatenate the family name and type name character strings to form a "family instance name"; S34: By using the Cells property of the ExcelWorksheet class of the OfficeOpenXml namespace, assign "name" to excelWorksheet.Cells[1,1].Value; assign "family ID" to excelWorksheet.Cells[1,2].Value; traverse the family instance names of the model components and assign them to excelWorksheet.Cells[2+i,1].Value; traverse the IDs of the model components and assign them to excelWorksheet.Cells[2+i,2].Value; thereby saving the family instance name data and ID data of the model components in ExcelWorksheet; S35: by using the Save method of the ExcelPackage class of the OfficeOpenXml namespace, the generated ExcelWorksheet is saved locally in the form of Excel spreadsheet data, thereby completing the data export operation; S36: After the data export operation is completed, through the TaskDialog.Show("Prompt","Data export successful! \nBy default, export to the family parameter table.xlsx in the root directory of disk D! \nModify Excel and then import this plug-in!"") method, a completion dialog box pops up and prompts the user to the local location of the exported file.

6. The method for batch assignment of model parameters based on Revit secondary development according to claim 1 is characterized in that: The specific steps of S4 are: S41: Open the generated Excel file, and enter the custom parameter name of the model component in the first row of each column starting from the first row of the third column; the parameter name should be consistent with the corresponding instance parameter name added in Revit for the model component that needs to be parameterized in batches; S42: Starting from the second row of the third column, in the column, according to the family instance name and family ID of the corresponding row, the parameter data value of the custom parameter of the third column is input, and after completing the column, the parameter data value of the custom parameter of the subsequent columns is input in sequence; The data type of the parameter data value should be consistent with the data type of the corresponding instance parameter added in Revit for the model component that needs to be parameterized and batch assigned; S43: thereby completing the modification operation of the Excel file, and completing the data preparation work for batch assignment of model components.

7. The method for batch assignment of model parameters based on Revit secondary development according to claim 1 is characterized in that: The specific steps of S5 are: S51: Open the modified Excel file by using the ExcelPackage() method of the ExcelPackage class of the OfficeOpenXml namespace; S52: Get the worksheet named "Sheet1" in the Excel file by using ExcelPackage.Workbook.Worksheets["Sheet1"] of the ExcelPackage class in the OfficeOpenXml namespace; get the number of columns of the worksheet by using ExcelWorksheet.Dimension.Columns; get the number of rows of the worksheet by using ExcelWorksheet.Dimension.Rows; S53: Traverse the column data in the worksheet, obtain the custom parameter name in the Excel table through excelWorksheet.Cells[1,i+3].Value of the OfficeOpenXml namespace, and store the obtained parameter name in List <string> In the parametername collection;< / string> S54: traverse the row and column data in the worksheet, obtain the custom parameter data value in the Excel table through excelWorksheet.Cells[2+i,2+j].Value of the OfficeOpenXml namespace, and store the family component ID value and the corresponding family component parameter data value of each row in the List <string>para metervalues, and then store all rows of parametervalues ​​data in List <List <string> >para meterset two-dimensional set, thereby completing the extraction of Excel table data;< / string> < / string> S55: Use the Start() method of the Transaction class in the Autodesk.Revit.DB namespace to start the Revit transaction for subsequent modification work; S56: traverse the parametervalues ​​set in the parameterset two-dimensional set, and obtain the model component ID value through parametervalues[0], and then obtain the model component to be assigned parameters in batches through document.GetElement(new ElementId(Convert.ToInt32(parametervalues[0])); S57: In the above traversal loop, the parametername collection is traversed again, and the parameter with the specified custom parameter name in the model component is obtained through the LookupParameter(parametername[i]) method of the model component, and assigned to the parameter variable. It should be noted that an if judgment is required here. If the parameter with the specified custom parameter name is not found in the model component, the parameter variable is null. At this time, an error prompt dialog box is popped up through TaskDialog.Show(); S58: In the above traversal loop, the parameter data value is assigned to the parameter of the model component through the Set(parametervalues[i+1]) method of the parameter variable, thereby completing the assignment of the parameter of the model component; S59: Complete the double-layer nested loop traversal in sequence, thereby completing the assignment of all parameters of this model component and the assignment of all parameters of all model components in sequence; and after completion, through the TaskDialo g.Show("prompt","Parameter assignment successful!\nTotal assignment"+parameterset.Count.ToString()+"instances!"") method, a completion dialog box pops up and displays the number of model component instances for which batch parameter assignment has been completed.

8. The method for batch assignment of model parameters based on Revit secondary development according to claim 2 is characterized in that: The specific steps of S6 are: S61: The user interaction interface design uses Windows Forms technology to create a Form, which consists of function buttons and function descriptions; S62: In the function button part, two buttons are added through the System.Windows.Forms.Button() method, and their names are "Generate Table" and "Load Table", which correspond to the above-mentioned data export function and data import function respectively; S63: Add click events to the "Generate Table" and "Load Table" buttons through the button_Click(object sender, EventArgs e) method, and implement the operations of reading and writing local directory files through the System.Windows.Forms.OpenFileDialog() method in the event, so as to realize linkage operations with the data export and data import functions; S64: The function description section is a brief description of the use of the system and usage precautions, which is used to provide prompts and help to users during use.

9. A model parameter batch assignment system based on Revit secondary development, characterized in that: A method for batch assignment of model parameters based on Revit secondary development as described in any one of claims 1 to 8 is applied, comprising: Component preparation module, which prepares the model components to be assigned in the Revit project and defines and sets the component instance parameters; Environment configuration module, based on C# Revit secondary development environment configuration, creates new project solutions and defines secondary development interfaces and namespaces; Data export module, which exports the model component family name, type name, and component ID value data of parameterized batch assignment and generates a local Excel file; The data modification module modifies the data in the generated Excel file and adds parameter names and parameter data values ​​according to the family instance name and family ID; The parameter assignment module imports the modified Excel file into Revit, matches the family ID values ​​in Excel with the model components in the Revit model, and automatically completes the parameter assignment of batch family component model components.

Citation Information

Cited By

  • A parameterized design method of distribution transformer

    CN122886102A

  • A parametric design method for distribution transformers

    CN122886102B