A method for quickly creating duct connectors using Revit software

By creating duct connector families in Revit software and utilizing a secondary development platform, the cumbersome duct connector creation process in existing technologies has been solved, achieving efficient duct connection operations.

CN114647406BActive Publication Date: 2026-04-03CHINA CONSTR THIRD ENG BUREAU GRP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The creation of duct connectors in existing Revit software is cumbersome, affecting modeling efficiency, especially when there are many duct connector styles, making it difficult to create them efficiently.

Method used

By using a secondary development platform based on Revit software, and utilizing Visual Studio 2017, Revit 2019 SDK, AddinManager, and RevitLookup tools, duct connector families are created, duct connector types are selected, positional relationships are determined, corresponding families are retrieved, and connectors are generated. Finally, the plug-in function is implemented within the Revit software.

Benefits of technology

It simplifies the creation process of duct connectors, improves the efficiency of duct connections in Revit software, and allows users to generate corresponding connectors simply by selecting the connection type and duct.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647406B_ABST
    Figure CN114647406B_ABST
Patent Text Reader

Abstract

This invention discloses a method for quickly creating duct connectors based on Revit software, specifically in the field of Building Information Modeling (BIM). The method includes the following steps: creating a duct connector family; setting up a Revit secondary development platform; selecting the duct connector type; selecting duct segments in a specific order; determining the duct positional relationships; retrieving the corresponding duct connector family; generating the duct connector upon successful retrieval; displaying an error message upon failed retrieval; and creating a duct connection plugin. This invention is simple to operate; users only need to select the required duct connection type and the ducts to be connected, and the plugin can generate the corresponding duct connectors, effectively improving the efficiency of Revit duct connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of building information modeling, and more particularly to a method for rapidly creating duct connectors based on Revit software. Background Technology

[0002] Revit is one of the BIM modeling software programs. In the process of creating BIM models for various architectural disciplines using Revit, the creation of duct systems in the MEP (Mechanical, Electrical, and Plumbing) discipline often takes a lot of time due to the large number of duct connector styles. The existing duct connection function in Revit first requires presetting the duct connection type in the duct system configuration interface, then creating the duct system and creating duct connectors according to the preset duct connection type, and finally replacing the preset duct connectors with the actual duct connector styles. When there are many duct connector styles, the operation is cumbersome and affects the modeling efficiency. Summary of the Invention

[0003] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for rapidly creating duct connectors based on Revit software.

[0004] To achieve the above objectives, the present invention adopts the following technical solution:

[0005] A method for quickly creating duct connectors using Revit software includes the following steps:

[0006] S1, Creation of the duct connector family;

[0007] Setting up a secondary development platform for S2 and Revit;

[0008] S3. Select the type of duct connector;

[0009] S4. Select duct sections in a certain order;

[0010] S5. Determine the positional relationship of the air ducts;

[0011] S6. Search for the corresponding duct connector family;

[0012] S7. Search successful, duct connector generated; search failed, error message displayed.

[0013] S8. Create a duct connection plugin.

[0014] The present invention is further configured such that, in step S1, the duct connector family includes:

[0015] Rectangular T-type tee, rectangular Y-type tee, rectangular right-angle tee, rectangular rounded corner tee, rectangular inlet tee, rectangular standard tee, rectangular right-angle cross, rectangular rounded corner cross, rectangular inlet cross; the alignment of duct rectangular tees and crosses can be center / left / right in the horizontal direction, and center / bottom / top in the vertical direction.

[0016] The present invention is further configured such that, in step S2, the setup of the Revit secondary development platform includes:

[0017] The tools used include Visual Studio 2017, Revit 2019 SDK, AddinManager, and RevitLookup. The Revit API enables software function extension operations through the interface of external commands. The interface contains only one abstract function, Execute, which is overridden to implement external commands.

[0018] The present invention is further configured such that, in step S3, the selection of the duct connector type includes:

[0019] Create a form control using WinForms and retrieve the name of the corresponding duct fitting based on the type of duct connector selected by the user on the form control.

[0020] The present invention is further configured such that, in step S4, selecting duct segments in a certain order includes:

[0021] This program uses WinForms controls to display the connection order of ductwork connectors; it creates collectors and filters, and calls the ISelectionFilter interface to filter the ductwork in the user-selected elements; if the order of the selected ductwork is inconsistent with the order displayed by the form controls, it displays the message "The current ductwork position relationship does not support connection".

[0022] The present invention is further configured such that, in step S5, determining the positional relationship of the duct includes:

[0023] Based on the selected duct, obtain the element curves of the main duct and branch duct at that location; obtain the direction vector of the main duct perpendicular to the element curve; obtain the direction vector from the intersection of the branch duct and the main duct to the starting point of the branch duct; if the main duct is aligned on one side, the two direction vectors are the same, indicating left alignment; otherwise, they are right alignment; obtain the bounding box and connector of the selected duct segment; if the minimum height of the bounding box of the segment is consistent, the bottom is flat; if the maximum height of the bounding box is consistent, the top is flat; if the height of the connector's position points is consistent, the center is flat.

[0024] The present invention is further configured such that, in step S6, the retrieval of the corresponding duct connector family includes:

[0025] Obtain the config path of the plugin's supporting files; read the XML file containing the names of duct connector families from the config path; retrieve the names and attribute information of the duct connectors based on the connection method and alignment selected by the user from the XML file.

[0026] The present invention is further configured such that: in step S7, if the retrieval is successful, a duct connector is generated; if the retrieval fails, an error message is displayed, including:

[0027] If the search is successful, load the duct connector family based on the family name and Revit version path obtained from the search; obtain the elevation of the selected duct and offset the duct connector; calculate the angle between the direction of the connector and the direction of the duct, and rotate the connector to be in the same direction as the duct; set the duct connector parameters and connect the duct and the connector; if the search fails or there is a problem with the above steps, the message "The current duct position relationship does not support connection" will be displayed.

[0028] The present invention is further configured such that, in step S8, the creation of the duct connection plug includes:

[0029] In Visual Studio 2017, create a new class library that references the Revit interface definition files RevitAPI.DLL and RevitAPIUI.DLL (located in the Revit installation directory). Copy... Set the Local (copy to local) property to False; reference the namespace in the program header, create a transaction, and commit a series of operations that modify the Revit model to the document object; set the transaction start mode, create a new command class, derive from IExternalCommand, and override the Execute() method; compile the main code, writing the main functional code for connecting the ducts; create a plug-in button, first adding an embedded panel, then calling the PushButton class to add a button control, and finally calling the Uri class to import the corresponding icon into the button; register and run the extension module. After the button is created, write it into an addin file as an internal startup file. Place the addin file in the corresponding Revit version folder under the path C: / programdata / Autodesk / revit / addin / so that the button can be imported into the Revit software; write the path of the .dll file generated by the above duct connection plug-in function program, the plug-in namespace, and the class name into the file. Open the Revit software to obtain the "duct connection" plug-in, and click the button to perform duct connection.

[0030] The beneficial effects of this invention are as follows:

[0031] This invention is easy to operate. Users only need to select the required duct connection type and the duct to be connected, and the plugin can generate the corresponding duct connector, effectively improving the efficiency of Revit duct connection. Attached Figure Description

[0032] Figure 1 This is a schematic diagram of the plugin creation process of the present invention;

[0033] Figure 2 This is a schematic diagram of the duct connection process of the present invention;

[0034] Figure 3 This is a schematic diagram of the duct connection plug in this invention. Detailed Implementation

[0035] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0036] like Figure 1-3 As shown, a method for quickly creating duct connectors based on Revit software includes the following steps:

[0037] S1. Creating a duct connector family file: Use Revit software to create a duct connector family. The family file includes rectangular T-tees, rectangular Y-tees, rectangular right-angle tees, rectangular rounded corner tees, rectangular inlet tees, rectangular standard tees, rectangular right-angle crosses, rectangular rounded corner crosses, and rectangular inlet crosses.

[0038] S2. Revit Secondary Development Platform Setup: The Revit API enables software function extension operations through the interface of external commands. The interface contains only one abstract function, Execute. This function is overridden to implement external commands (IexternalCommand).

[0039] The tools used to build the Revit secondary development platform include Visual Studio 2017, Revit 2019 SDK, AddinManager, and Revit Lookup;

[0040] S3. Select Duct Connector Type: Create a form control using WinForms and obtain the name of the corresponding connector based on the duct connector type selected by the user on the form control;

[0041] S4. Select duct sections in a certain order:

[0042] ① Display the connection sequence of the duct connectors using WinForms form controls;

[0043] ② Create collectors and filters, and call the ISelectionFilter interface to filter the ducts in the user-selected elements; the core code is as follows:

[0044]

[0045] ③ When the order in which the selected ducts is inconsistent with the order displayed by the form controls, the message "The current duct position relationship does not support connection" is displayed; the core code is as follows:

[0046]

[0047] S5. Determine the positional relationship of the air ducts:

[0048] ① Obtain the element curves of the main and branch ducts at the selected duct location;

[0049] ② Obtain the direction vector of the main duct pipe perpendicular to the element curve; the core code is as follows:

[0050] XYZ normal0=line0.Direction.CrossProduct(XYZ.BasisZ);

[0051] double width0=mepcurve0.Width;

[0052] double width1=mepcurve1.Width;

[0053] if(Math.Abs(width0-width1)<0.001)

[0054] {return DuctHAAlignWay0.Center;}

[0055] Line line0New0=Line.CreateBound(line0.GetEndPoint(0)+width0*0.5*normal0,line0.GetEndPoint(1)+width0*0.5*normal0);

[0056] Line line0New1=Line.CreateBound(line0.GetEndPoint(0)-width0*0.5*normal0,line0.GetEndPoint(1)-width0*0.5*normal0);

[0057] ③ Obtain the direction vector from the intersection of the branch pipe and the main pipe to the starting point of the branch pipe; the core code is as follows:

[0058] XYZdirec2=(intersectPoint2-line2.GetEndPoint(0)).Normalize();

[0059] ④ If the supervisor is aligned on one side, left alignment is achieved if the two direction vectors are the same, and right alignment is achieved if they are different; the core code is as follows:

[0060]

[0061]

[0062] ⑤ Obtain the bounding box and connector of the selected duct segment. If the minimum height of the bounding box of the duct segment is the same, it is a bottom flat; if the maximum height of the bounding box is the same, it is a top flat; if the height of the position points of the connector of the duct segment is the same, it is a center flat. The core code is as follows:

[0063] Connectorcon0=CommandHelper.GetConnectorClosestTo(CommandHelper.GetConnectorSet(mepCurves[0]),pickPointS[0]);

[0064] Connectoron1=CommandHelper.GetConnectorClosestTo(CommandHelper.GetConnectorSet(mepCurves[1]),pickPointS[1]);

[0065] Connectorcon2=CommandHelper.GetConnectorClosestTo(CommandHelper.GetConnectorSet(mepCurves[2]),pickPointS[2]);

[0066] BoundingBoxXYZboxXYZ0=mepCurves[0].get_BoundingBox(null);

[0067] BoundingBoxXYZboxXYZ1=mepCurves[1].get_BoundingBox(null);

[0068] BoundingBoxXYZboxXYZ2=mepCurves[2].get_BoundingBox(null);

[0069] double minh=mepCurves.OrderBy(e=>e.Width).Select(e=>e.Width).First();

[0070] if(Math.Abs(con0.Origin.Z-con1.Origin.Z)<0.001&&Math.Abs(con0.Origin.Z-con2.Origin.Z)<0.001);

[0071] S6. Retrieve the corresponding duct connector family:

[0072] ① Obtain the config path for the plugin's accompanying files; the core code is as follows:

[0073] string dir=PathTool.GetAssemblyPath();

[0074] stringfathDir=newSystem.IO.DirectoryInfo(dir).Parent.FullName;

[0075] ② Read the XML file and retrieve the name and attribute information of the duct connectors based on the user-selected connection method and alignment; the core code is as follows:

[0076] string familyName=string.Empty;

[0077] string xmlPath = farthDir + "\\Config\\MEP system configuration.xml";

[0078] S7. Search successful, duct connector generated; search failed, error message displayed:

[0079] ① If the search is successful, load the duct connector family based on the retrieved family name and Revit version path; the core code is as follows:

[0080] string faPath=fathDir+"\\Family\\"+subFamilyFolder+"\\";

[0081] faPath=faPath+familyName+".rfa";

[0082] doc.LoadFamily(faPath,out ductFitFa);

[0083] ② Obtain the selected duct elevation and offset the duct connectors; the core code is as follows:

[0084] Levellevel=doc.GetElement(mepcurve1.get_Parameter(Built InParameter.

[0085] RBS_START_LEVEL_PARAM).AsElementId())as Level;

[0086] doubleoffset=line1.GetEndPoint(0).Z-mainCon1.Origin.Z;

[0087] teeFitting.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).Set(offset);

[0088] ③ Calculate the angle between the direction of the connector and the direction of the duct, and rotate the connector to align with the direction of the duct; the core code is as follows:

[0089] XYZinterToLine3direction=(line3.GetEndPoint(0).ProjectOnZ(line1.GetEndPoint(0).Z)-interPoint).Normalize();

[0090] doubleangle3=branchCon.CoordinateSystem.BasisZ.AngleTo(interToLine3direction);

[0091] XYZdirection3=branchCon.CoordinateSystem.BasisZ.CrossProduct(interToLine3direction);

[0092] if(direction3.IsAlmostEqualTo(XYZ.Zero))

[0093] {direction3 = XYZ.BasisZ;}

[0094] XYZlocationPoint=(teeFitting.LocationasLocationPoint).Point;

[0095] Lineaxis3=Line.CreateUnbound(locationPoint,direction3);

[0096] (teeFitting.Location as LocationPoint).Rotate(axis3,angle3);

[0097] doc.Regenerate();

[0098] ④ Set the parameters for the duct connectors and connect the ducts and connectors;

[0099] ⑤ If the search fails or there is a problem with the above steps, the message "The current duct location relationship does not support connection" will be displayed; the core code is as follows:

[0100] catch(Exception ex)

[0101] {

[0102] TaskDialog.Show("Prompt","The current duct location does not support connection"));

[0103] transaction.RollBack();

[0104] }

[0105] S8. Create a duct connection plugin:

[0106] The duct connection plugin extends functionality through external commands. On the Visual Studio 2017 platform, it references the Revit interface definition files RevitAPI.dll and RevitAPIUI.dll, and is developed using the C# language. It is launched from within the Revit software via an addin file.

[0107] ① Create a new class library in Visual Studio 2017, referencing the Revit interface definition files RevitAPI.DLL and RevitAPIUI.DLL (files located in the Revit installation directory), and set the Copy Local property to False.

[0108] ② In the program header, reference the namespace, create a transaction, and commit a series of operations that modify the Revit model to the document object; the core code is as follows:

[0109] Using Autodesk Revit UI;

[0110] Using Autodesk.Revit.DB;

[0111] Using Autodesk.Revit.UI.Selection;

[0112] Using Autodesk.Revit.DB.Mechanical;

[0113] Using System.Windows.Forms;

[0114] ③ Set the transaction start mode, create a new command class, derive from IExternalCommand, and override the Execute() method;

[0115] ④ Main code compilation: Write the main functional codes for the above-mentioned connecting air ducts;

[0116] ⑤ To create a plugin button, first add an embedded panel, then call the PushButton class to add a button control, and finally call the Uri class to import the corresponding icon into the button;

[0117] ⑥ Register and run the extension module. After the button is created, write it into the addin file as the internal startup file. Place the addin file in the corresponding Revit version folder under the path C: / programdata / Autodesk / revit / addin / so that the button can be imported into the Revit software.

[0118] ⑦ Write the path of the .dll file generated by the above duct connection plugin program, the plugin's namespace, and the class name into the file. Open the Revit software to obtain the "Duct Connection" plugin, and click the button to perform duct connection.

[0119] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.

Claims

1. A method for rapidly creating duct connectors based on Revit software, characterized in that, Includes the following steps: S1, Creation of the duct connector family; Setting up a secondary development platform for S2 and Revit; S3. Select the type of duct connector; S4. Select duct sections in a certain order; In step S4, selecting duct segments in a certain order includes: displaying the connection order of duct connectors through a WinForm window control; creating a collector and a filter, and calling the ISelectionFilter interface to filter the ducts in the user-selected elements; if the order of selecting ducts is inconsistent with the order displayed by the window control, prompting "The current duct position relationship does not support connection"; S5. Determine the positional relationship of the ducts; In step S5, determining the positional relationship of the ducts includes: obtaining the element curves of the main duct and branch ducts at the selected duct; obtaining the direction vector of the main duct perpendicular to the element curve; obtaining the direction vector from the intersection of the branch duct and the main duct to the starting point of the branch duct; if one side of the main duct is aligned, the two direction vectors are the same, indicating left alignment, otherwise right alignment; obtaining the bounding box and connector of the selected duct segment; if the minimum point height of the duct segment bounding box is consistent, the bottom is flat; if the maximum point height is consistent, the top is flat; if the position points of the duct segment connector are consistent, the center is flat. S6. Search for the corresponding duct connector family; S7. Search successful, duct connector generated; search failed, error message displayed. S8. Create a duct connection plugin; In step S8, creating a duct connection plugin includes: creating a new class library in Visual Studio 2017, referencing the Revit interface definition files RevitAPI.DLL and RevitAPIUI.DLL (files located in the Revit installation directory), copying CopyLocal to the local machine, and setting its property to False; referencing the namespace in the program header, creating a transaction, and committing a series of operations modifying the Revit model to the document object; setting the transaction start mode, creating a new command class, deriving from IExternalCommand, and overriding the Execute method; writing the main code, including the core functional code for connecting the ducts; creating... To create a plugin button, first add an embedded panel, then call the PushButton class to add a button control, and finally call the Uri class to import the corresponding icon into the button. Register and run the extension module. After the button is created, write it into an addin file as an internal startup file. Place the addin file in the corresponding Revit version folder under the path C: / programdata / Autodesk / revit / addin / to import the button into the Revit software. Write the path of the .dll file generated by the duct connection plugin program, the plugin's namespace, and class name into the file. Open the Revit software to obtain the "Duct Connection" plugin, and click the button to connect the ducts.

2. The method for quickly creating duct connectors based on Revit software according to claim 1, characterized in that, In step S1, the duct connector family includes: rectangular T-type tee, rectangular Y-type tee, rectangular right-angle tee, rectangular rounded corner tee, rectangular insert tee, rectangular ordinary tee, rectangular right-angle cross, rectangular rounded corner cross, and rectangular insert cross; the alignment of the duct rectangular tee and cross family is center / left / right alignment in the horizontal direction and center / bottom / top alignment in the vertical direction.

3. The method for quickly creating duct connectors based on Revit software according to claim 1, characterized in that, In step S2, the Revit secondary development platform setup includes: the tools used include Visual Studio 2017, Revit 2019 SDK, AddinManager, and RevitLookup; the Revit API implements software function extension operations through the interface of external commands, which contains only one abstract function Execute, and this function is overridden to implement external commands.

4. The method for quickly creating duct connectors based on Revit software according to claim 1, characterized in that, In step S3, selecting the duct connector type includes: creating a form control using WinForms, and obtaining the name of the corresponding duct connector based on the duct connector type selected by the user on the form control.

5. The method for rapidly creating duct connectors based on Revit software according to claim 1, characterized in that, In step S6, retrieving the corresponding duct connector family includes: obtaining the config path of the plug-in supporting file; reading the XML file containing the duct connector family name in the config path; and retrieving the name and attribute information of the duct connector according to the connection method and alignment method selected by the user from the XML file.

6. The method for rapidly creating duct connectors based on Revit software according to claim 1, characterized in that, In step S7, if the search is successful, a duct connector is generated; if the search fails, an error message is displayed, including: if the search is successful, loading the duct connector family based on the family name and Revit version path obtained from the search; obtaining the selected duct elevation and offsetting the duct connector; calculating the angle between the direction of the connector and the direction of the duct, and rotating the connector to be consistent with the direction of the duct; setting the duct connector parameters and connecting the duct and the connector; if the search fails or there is a problem in the above steps, the message "The current duct position relationship does not support connection" is displayed.

Citation Information

Patent Citations

  • Revit model processing method applied to Houdini

    CN111402383A

  • Method for realizing non-standard part rapid modeling in cement plant BIM design by utilizing Dynamo

    CN111597610A