Ancient building cornice parametric modeling method based on Revit secondary development
By designing a graphical user interface that conforms to domestic design standards and using Revit secondary development, a model of the bracket system of ancient buildings that conforms to the "Yingzao Fashi" (Building Standards) can be quickly generated, solving the problems of cumbersome and inefficient traditional modeling steps and achieving efficient and accurate digital protection of ancient buildings.
Patent Information
- Application Number
- CN202510922321.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-11-11
AI Technical Summary
Traditional ancient building modeling is cumbersome, inaccurate, and inefficient. Autodesk Revit software does not adequately support the uniqueness of Chinese ancient architecture and lacks the ability to accurately express non-standard designs and traditional techniques, leading to challenges for designers in terms of adaptability and efficiency.
The system designs a graphical user interface (GUI) that conforms to domestic design standards. It quickly generates ancient building bracket sets that conform to the "Yingzao Fashi" (Building Standards) specifications through parametric input. Combined with intelligent verification and parameter association, it utilizes Revit secondary development to achieve high-precision 3D modeling of the bracket sets.
It enables efficient and accurate modeling of ancient building brackets, improves design efficiency, meets the needs of designers, and generates models that conform to traditional construction standards, providing a standardized digital modeling tool.
Smart Images

Figure CN120930216A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of building information modeling technology, specifically involving a parametric modeling method for the bracket sets of ancient buildings based on Revit secondary development. Background Technology
[0002] With the development of digital technology, domestic ancient building data has achieved technological upgrades such as 3D modeling and electronic storage. However, the discrete management methods of text, drawings, models, and images have led to information fragmentation. The problem of the dispersion of traditional paper media has not been fundamentally solved in the digital age, seriously restricting the efficiency of protection and the depth of academic research. There is an urgent need to build an integrated information management platform with 3D models as the spatial carrier. Through standardized and parametric data integration technology, the organic integration of the physical ancient buildings and multi-dimensional management information can be achieved, thereby breaking through the dilemma of information silos and improving the systematicness, coordination, and sustainability of domestic ancient building protection work.
[0003] BIM technology, with its integrated information management, 3D visualization, and data collaboration advantages, can overcome the limitations of traditional restoration and digital storage. By constructing a full lifecycle information model, it can achieve deep integration of the protection of ancient buildings with historical data, surveying results, and multi-dimensional archives. Through research on the information data structure of ancient buildings in China, combined with ancient Chinese architectural theories, high-precision digital modeling and parametric analysis of the bracket sets of ancient buildings based on Revit secondary development are not only an urgent need to improve information protection efficiency and reconstruct a systematic protection framework, but also a key path to promote the deep application of BIM technology in the field of cultural heritage, facilitate technological iteration, and drive industry transformation.
[0004] The principle of parametric design is to achieve the correlation and change of a digital model through input parameters and preset constraints. Based on this, changing some parameters of the model enables automatic model updates. The preset constraints can be structural patterns between architectural elements or modular relationships between architectural components. The construction method of the dougong (bracket set) in ancient Chinese architecture and its material-based system provide a logical framework for parametric design modeling. On the one hand, the components of the bracket sets of ancient buildings, as the smallest units for information transmission and sharing, model assembly and modification, have the characteristics of reusability, independence, scalability and connectability, which determines the feasibility of using the BIM component library to accurately record the data information of the components and implement independent editing and unified management. On the other hand, the dougong (bracket sets) of ancient buildings have characteristics such as modular scale, modular assembly, and modular combination features, which determine that they can be parametrically modeled by computers. Computer programs can complete the parametric transformation of the model by writing different functional constraint relationships between the components and setting and modifying key parameters, and finally establish a dynamically updatable parametric information model.
[0005] In the context of the information age, it is necessary to use digital methods to accurately record and preserve the dougong (bracket sets) of ancient buildings. Furthermore, parametric modeling of dougong enables the digitization of information, making it feasible to handle potential CNC construction through data conversion and transmission. Summary of the Invention
[0006] The main purpose of this invention is to overcome the shortcomings of the existing technology and solve the technical problems of cumbersome steps, poor accuracy and low efficiency in traditional ancient building modeling. This invention provides a parametric modeling method for ancient building brackets based on Revit secondary development.
[0007] The design concept of this invention is as follows: 1) A GUI interface that conforms to architectural design principles; Autodesk Revit, as a crucial tool in Building Information Modeling (BIM), offers significant advantages in collaboration, parametric design, and visualization for architectural, MEP, and HVAC professionals. However, its support for the complexity and cultural uniqueness of ancient Chinese architecture is limited. To efficiently complete ancient building projects, it's necessary to combine plugin development, customized family libraries, and user interface configuration. Key issues include: insufficient support for non-standardized designs (such as the unique proportions and irregularly shaped components of ancient Chinese architecture), requiring manual adjustments or plugin design; a lack of traditional Chinese architectural components in the built-in family library, necessitating user creation or importing external resources; and the need for precise representation of traditional techniques (such as mortise and tenon joints) in the 3D model, relying on high-precision modeling technology, which presents challenges to designers in terms of adaptability and efficiency.
[0008] To address the above issues, this invention features a graphical user interface (GUI) specifically designed to meet domestic design standards and designer needs. Through parametric input, it can quickly generate Tang Dynasty example bracket sets (including column-head brackets, intercolumnar brackets, and corner brackets) conforming to the ancient Chinese architectural code, *Yingzao Fashi*. It establishes a system encompassing key bracket set parameters, and with intelligent verification and parameter association, it can rapidly generate and optimize 3D models containing sub-components such as column-head brackets and mortise and tenon details, while maintaining high compatibility with Revit and other design software.
[0009] 2) Generate parameterized models of each component of the bracket set and the overall assembly model based on literature data; Tang Dynasty architecture represents the pinnacle of ancient Chinese timber-framed architecture. Its dougong (bracket set) structure, as the core load-bearing and decorative component, is characterized by its complex form and rigorous assembly rules. For example, the form and materials of Tang Dynasty dougong components were highly standardized, achieving parametric design of component dimensions through the "material division system," embodying the unity of mechanics and aesthetics. Dougong components are numerous and complex, but can actually be divided into two main categories based on their performance: one category consists of the main load-bearing components, such as huagong, ang, and ludou; the other category mainly consists of balancing components that provide stability, including luohan fang, zhutou fang, guazi gong, man gong, and ling gong, which intersect with the load-bearing components in a cross shape. These two categories form a composite structure, resting on the column heads, and further supported by beams, purlins, and fang, creating a relatively stable load-bearing support system. Dougong (bracket sets) are classified into three types based on their location and structural function: column-head dougong, intercolumnar dougong, and corner dougong.
[0010] Taking the bracket sets on the outer eaves of the East Hall of Foguang Temple as an example, its form is a seven-tiered bracket set with a hidden core and double lower brackets. Two tiers of bracket sets extend from the bracket set. The first tier is a hidden core structure, without a horizontal bracket intersecting the top of the bracket set; the melon-seed bracket and the melon-seed-slow bracket are placed on the second tier to support the arhat beam above it. The third and fourth tiers are both lower brackets. The third tier is a hidden core structure, with the wing-shaped bracket head and the lintel bracket intersecting on the top of the fourth tier. A substitute beam is placed on the lintel bracket to support the eaves purlin. The rear section features a single tier of bracket sets; the second tier is a prominent purlin, with its head extending beyond the eaves to form a second tier of bracket sets; the third tier is a single piece, with its rear end forming a half-hump on the prominent purlin, upon which interlocking brackets are placed, and above it, the bracket sets intersect with the concealed bracket sets in a cross shape to support the flat beam; the fourth tier of the bracket set is a single beam, with concealed bracket sets on both sides, and a bracket set on the top of the bracket set, placed below the flat beam. The downward-facing angle of the lower bracket is 24.08 degrees, projecting upwards. A mud-lined bracket set is placed at the center of the bracket set, above which four layers of column-head beams are stacked, with concealed mud-lined bracket sets and slow-moving bracket sets on the column-head beams.
[0011] Creating bracket sets directly in Revit requires first creating components with numerous parameters and then assembling them, which undoubtedly increases the complexity of the process. In contrast, by creating each type of bracket set as a family using a secondary development approach, reference point information is easily obtained from drawings. The plugin automatically identifies the bracket set type based on user-inputted key parameters and selects the appropriate calculation method, then automatically generates the bracket set model. All bracket sets are loaded into the project as a single family, greatly simplifying the modeling process and facilitating family management.
[0012] This invention is achieved through the following technical solution: a parametric modeling method for ancient building brackets based on Revit secondary development, comprising the following steps: S1. First, in the MainWindow.xaml window of the WPF application, a 3D visualization model is used to display the view, and StackPanel, GroupBox, Label, TextBox, ComboBox and Button controls are added for inputting key parameters and controlling the parameterization of the overall technology; then, InitializeComponent() is used to initialize the graphical user interface defined by XAML; in this window class, the basic parameters and position parameters required by the brackets and sub-components are interactively designed with the encapsulated bracket construction design algorithm, and the external event ZTDG class is called to complete the parameterization design of the brackets; S2. First, create the DGWindow class so that when the user passes this invention to Revit, the GUI window in the plugin can be invoked. Add the TransactionAttribute(TransactionMode.Manual) command to the DGWindow class and set this command to manually control transactions. Then, add the IExternalCommand external command interface. External commands allow operations to be executed from external applications in Revit. Use the Execute method in the IExternalCommand external command interface as the entry point for external commands, accepting three parameters: commandData, message, and elements. Create a new window instance MainWindow (the GUI interface) in the DGWindow class and display it. Finally, add the returnResult.Succeeded command to indicate that the command was executed successfully. S3, Model Assembly; S3-1. Create the ZTDG class as an external event handler class to encapsulate the parameterized calculation method for the dougong (bracket set). S3-2. Add the IExternalEventHandler interface to the ZTDG class. This interface is used to perform operations outside the Revit application. S3-3. Use the Execute method in the IExternalEventHandler interface to execute when an external event is triggered. The Execute method takes a UIApplication object as a parameter, which provides access to the Revit application. S3-4. In the Execute method, obtain the current document (Document), the current selection (Selection), and the active view (View). Create a TransactionGroup (used to create multiple sub-transactions and merge them into a group). The TransactionGroup includes sub-transactions transaction1, transaction2, transaction3, transaction4, transaction5, transaction6, and transaction7, where: In sub-transaction1, the model generation and positioning point formula calculation of the sump are designed, and the calculation of the model CreateExtrusionProfile and CreateSweepProfile are performed, and designed and encapsulated as methods. In sub-transaction2, the model generation and positioning point formula calculation of the mud arch are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction3, the model generation and positioning point formula calculation of the first jump Huagong are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction4, the model generation and positioning point formula calculation of the scatter bucket are designed, and the model CreateExtrusionProfile and CreateSweepProfile calculations are performed, which are designed and encapsulated as methods. In sub-transaction5, the model generation and positioning point formula calculation of column head beam are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction6, the model generation and positioning point formula calculation for the lower ridge are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction7, the model generation and positioning point formula calculation of the arch are designed, and the calculation of the model CreateExtrusionProfile, CreateBlendtopProfile, and CreateBlendbaseProfile are performed and designed and encapsulated as methods. S3-5, Repeat steps S3-1 to S3-4 above to complete the model construction and assembly of column head brackets, intercolumnar brackets, and corner brackets; S4. Design of the graphical GUI interface; The creation of Revit families relies on basic modeling commands such as extrude, blend, revolve, loft, loft blend, and hollow shape operations. Models are generated by manually editing contours and configuring parameters. Due to the lack of a pre-built GUI interface, designers must build their own, resulting in a cumbersome and inefficient modeling process. To address this issue, this invention, combined with the professional requirements of parametric modeling of ancient architectural bracket sets, designs a more practical GUI interface, including the following steps: S4-1. Creating a 3D visualization window: In the DGWindow class, use the Preview Control function to get the two parameters document and viewld. Then, bind the two parameters document and viewld to the WPF control in MainWindow to display the 3D visualization effect, which can be used to link with the design parameters in the interface. S4-2, Algorithm parameter binding for the constructor function of bracket components and their assembly: First, in the MainWindow.xaml window class, define the Label and TextBox controls required for the bracket set. The Label is used to record the name of the geometric parameter, and the TextBox is used to record the value of the component's geometric parameter. Secondly, for ComboBoxes with non-geometric parameters, select to add a drop-down list box and fill in the corresponding parameters for selection; Next, in the MainWindow.xaml.cs file, the ExternalEvent external command method is first called to import the encapsulated dougong model generation calculation method, and then the user-input dougong score, column head beam layer number, column head beam length, eaves purlin length, dougong type, material and position parameters are passed into the calculation method. Finally, after adding the corresponding parameters, bind the parameter names in WPF with the parameters of the ZTDG class to complete the binding between the user interface and the parameter variables; S4-3, Create the various sub-components of the bracket set; S4-3-1. Construct the extrusion profile of the bracket set and mortise: CreateExtrusionProfile; ① Create the basic extruded solid outline of the dougong (column). First, the basic parameter dimensions of the doug are controlled by defining and calculating the upper depth variable douL, upper width variable douW, and doug height variable douH of the doug through parameter scores fenzhi. Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. Here, all points are in the Z=0 plane. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the dougong (a type of ancient Chinese dougong). Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the spruce, forming a single closed contour, which is then encapsulated as a calculation method. ② Create the hollow mortise outline in the width direction of the bracket set; First, the variables GEW (width of the bracket set's outer ear), GEH (height of the outer ear), and HGMW (width of the bracket set's mortise) are defined and calculated using parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretch mortise in the bracket set's width direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane X = -(douL / 2 -dkmkL) and parallel to YZ, where dkmkL represents the width of the mortise and tenon. The Line.createBound method is used to create six straight lines to form a closed two-dimensional contour boundary line of the mortise and tenon. Finally, a CurveArray is constructed to store the two-dimensional contour boundary line of the mortise and tenon joint, forming a single closed contour, which is then encapsulated as a calculation method. ③ Create the hollow stretched mortise profile in the depth direction of the mortise; First, the variable EH of the dougong ear and the width NDGMW of the mortise of the mud-placement channel are defined and calculated through parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretching mortise in the dougong depth direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane Z=mkH and parallel to XY, where mkH represents the mortise height. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the mortise of the mud-laying arch. Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the mortise and tenon joint of the mud channel, forming a single closed contour, which is then encapsulated as a calculation method. S4-3-2, Construct the inner curve chamfer profile of the hollow loft of the bracket set: CreateSweepProfile; First, the variable QH of the buoy tilt height and the variable QW of the buoy bottom tilt are defined and calculated through parameter scores fenzhi, thereby controlling the basic parameter dimensions of the buoy tilting part; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points are in the Z=0 plane. The Arc.Create method is used to define an arc with the start point, end point and control points on the arc. The Line.createBound method is used to create two straight lines to form a closed inner curve chamfered two-dimensional contour boundary line of the dougong leaning part. Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the inner curve chamfer of the dougong leaning part, forming a single closed contour, which is encapsulated as a calculation method; S4-3-3, Generate the dougong (column) model; ① Based on the calculation methods encapsulated in the CreateExtrusionProfile function of the dougong and mortise constructed in step S4-3-1 and the CreateSweepProfile function of the hollow loft inner curve chamfer profile of the dougong tilted part constructed in step S4-3-2, define the dougong itself and all mortises, then create a transaction, start the transaction1.Start(), call the extrusion and loft profiles in the four encapsulated function calculation methods, add the tilted part inner curve chamfer loft profile by defining the SweepProfile through the NewCurveLoopsProfile function, create the coordinates of the four corner points of the dougong bottom, define four loft paths Curve by the Line.CreateBound method, and add the four Curves in the set order by the CurveArray to form a closed loop; ② The CreateByNormalAndOrigin function creates planes plane1, plane2, and plane3 based on the X-axis, Y-axis, and Z-axis respectively, and adds them to the SketchPlane parameter; ③ Create the NewExtrusion function to define the solid extruded bracket itself, the mortise in the width direction of the hollow extruded bracket, and the mortise in the depth direction of the hollow extruded bracket. Input the extrusion profile CreateExtrusionProfile, extrusion plane SketchPlane, bracket height douH, bracket mortise width HGMW, and ear height EH parameters of the bracket and mortise constructed in S4-3-1 into the NewExtrusion function to generate the bracket model. ④ Create the NewSweep function to define the hollow lofted bracket set leaning part. Input the hollow lofted inner curve chamfer profile SweepProfile, extrusion plane SketchPlane, and lofting path Curve parameters of the bracket set leaning part constructed in S4-3-2 into the NewSweep function to generate the bracket set model. ⑤ By using the function GeomCombination Document.Combine Elements(CombinableElementArray members), the solid stretched doug body itself, the mortise in the width direction of the hollow stretched doug body, the mortise in the depth direction of the hollow stretched doug body, and the tilted part of the hollow lofted doug body are added in sequence to achieve the hollow shearing of the mortise and the tilted part with the doug body itself. S4-3-4. Adding materials to the dougong model: Create an element collector using new FilteredElementCollector to traverse the current Revit document. Use the 0fclass function to filter out all elements belonging to the Material1 class (i.e., all materials). Use the FirstOrDefault function to query using LINQ and return the name of the material. Explicitly convert the type using as Material to ensure that the result type is Material. S4-3-5. After determining the material of the dougong model, use the LookupParameter function to set the material of the dougong. At this point, the dougong model is generated. S4-4, Assembly of the Dougong Model: Based on step S4-3 above, after generating the Dougong model, the model calculations for sub-components such as Nidaogong, Huagong, Linggong, Xia'ang, Sandou, and Fanglei are performed, using methods similar to Dougong generation. In this invention, referencing documents such as the *Yingzao Fashi*, the regulations governing the components and their inter-component relationships in column-head Dougong, intercolumnar Dougong, and corner Dougong have been organized and digitized, and expressed using mathematical formulas. S4-4-1. In the ZTDG class, the TransactionGroup is used to integrate the sub-transactions created by all components of the bracket set into a single transaction group. S4-4-2, The positioning point of the bracket set is XYZ LDnewPlace = new XYZ(X, Y, Z). The bracket set is the lowest component in the entire bracket set, so the positioning point of the center of the bottom surface of the bracket set is chosen as the basis to calculate the positioning points of other sub-components. S4-4-3. Use the ElementTransformUtils.MoveElement function to add the bracket set ID and bracket set positioning point parameters, and then move the component to the set position; S4-4-4, Translate the positional relationship between the transverse structural members, the mud-channel arch and the bracket set, into a mathematical formula: XYZ NDGnewPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (1) Then, the ElementTransformUtils.MoveElement function adds the mud arch component ID and mud arch positioning point parameters, and moves the component to the set position; The positional relationship between the first tier of the longitudinal structural member, the bracket arm, and the dougong bracket is translated into a mathematical formula: XYZ HG1newPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (2) In equations (1) and (2), NDGnewPlace is the positioning point of the mud-brick arch, HG1newPlace is the positioning point of the first jump arch, LDnewPlace(X, Y, Z) is the positioning point of the bracket set, and fenzhi is the score. Then, the ElementTransformUtils.MoveElement function adds the ID of the first-jump bracket set and the positioning point parameters of the first-jump bracket set, and moves the component to the set position; During the movement of the transverse and longitudinal components, the rotation axis is defined using the method Line axis = Line.CreateBound(LDnewPlace, new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z + 1)). S4-4-5. Use the ElementTransformUtils.RotateElement function to add the ID of the first-jump bracket set, the axis of rotation, and the rotation angle to determine the positioning point of the first-jump bracket set; S4-4-6. Repeat steps S4-4-1 to S4-4-5 above to determine the positioning points of the mortise beam, the column head beam, the lower purlin, and the purlin. S4-4-7. Based on the positioning points of the slatted bucket and column head beam in step S4-4-6, use the CopyElement function in ElementTransformUtils to add the component ID and move the position point for copying. S4-4-8. Assemble the bracket set model based on the positioning points of the bracket set, the first bracket set, the mud arch, the lower ang, and the ling arch, as well as the set position points after copying the bracket set and column head beam in step S4-4-7.
[0013] Furthermore, in step S4-3-3, the NewExtrusion function includes the following four parameters: The first parameter is a boolean isSolid parameter. Boolean values are usually used to represent switches or states, indicating whether the generated extruded body is a solid, thereby controlling the type of generated geometry. If the geometry type is solid, isSolid outputs true; otherwise, if the geometry type is hollow, isSolid outputs false. The second parameter is a profile parameter of type CurveArrArray, which is used to determine the two-dimensional profile of the tensile section and store the profile of the solid tensile mortise itself and the hollow tensile mortise. The third parameter is the SketchPlane parameter of type SketchPlane. This is the sketch plane, which is the reference plane for the extrusion operation. In 3D modeling, it is usually necessary to specify a plane to draw the outline, and then extrude along the normal direction of the plane or a specified direction. The SketchPlane contains the origin of the plane and the normal vector information (such as extrude along the Z direction when the normal is the Z axis), which is used to determine the extrusion direction and position. The fourth parameter is a double-precision floating-point number of type `double`, which is used to represent the end distance of the extrusion, that is, the distance along the normal direction of the sketch plane (usually using absolute values to represent length, with positive and negative values controlling the direction). Furthermore, in step S4-3-3, the NewSweep function includes the following six parameters: The first parameter is a boolean isSolid parameter. Boolean values are usually used to represent switches or states, indicating whether the generated extruded body is a solid, thereby controlling the type of generated geometry. If the geometry type is solid, isSolid outputs true; otherwise, if the geometry type is hollow, isSolid outputs false. The second parameter is the CurveArray parameter, which defines the trajectory path for lofting. The trajectory path can include open curves (such as straight lines and arcs) or closed curves (such as circles and polygons). The third parameter is the SketchPlane parameter, which is used to define the reference plane of the path curve and determine the spatial orientation of the path. The coordinates of the path curve are based on the reference plane definition (for example, when the plane is the XY plane, the path is drawn in this plane). During the path drawing process, the cross section may dynamically adjust its direction according to the path's direction (which needs to be combined with the profile PlaneLocation parameter). The fourth parameter is the SweepProfile parameter, which is used to define the cross-sectional profile (i.e., the two-dimensional shape that moves along the path) of the lofted bracket set. The cross-sectional profile is a closed curve. The fifth parameter, profileLocationCurveIndex, is used to specify the location point of the cross-section profile on the path (usually the index point of the path curve). If the path is a polyline (composed of multiple line segments), the profileLocationCurveIndex parameter indicates which line segment the cross-section starts scanning from. The index usually starts from 0, and it must be ensured that it does not exceed the limit. The sixth parameter is the profilePlaneLocation parameter, which controls the orientation rules of the cross-section during the scanning process.
[0014] Further, in step S4-3-1, the mirror image generation of the other septum opening of the dougong (a type of ancient Chinese vessel) includes the following steps: First, the CanMirrorElement function in ElementTransformUtils is used to add Dkmk.Id to determine whether the element can be mirrored. A mirror plane based on the center point of the bottom surface of the bracket set is defined as Plane p1 = Plane.CreateByNormalAndOrigin(new XYZ(0, 1, 0), LDnewPlace; Then, the MirrorElement function (including Document document, Element elementToMirror, and Plane plane) is used to add the Dkmk.Id and the mirror plane p1 parameter to complete the mirror generation of the other spruce opening of the dougong.
[0015] The beneficial effects of this invention are as follows: Compared to traditional BIM modeling technology, this invention constructs a brand-new digital bracket system for ancient buildings, whose core advantages are reflected in the following aspects: 1. Convenient and Efficient: This invention leverages the deep integration of the C# programming language and the Revit API interface to construct an easy-to-use interactive parametric input interface and develops the core function of intelligent one-click generation of dougong (bracket set) models. Designers only need to input key design parameters such as the score dimensions, the number of column head beam layers, and the column head beam length. The system can then automatically generate a high-precision 3D model of dougong conforming to the "Yingzao Fashi" (Building Standards) based on its self-designed ancient building modular rules and geometric algorithms. This solution transforms the traditional architectural component design process into a parametric-driven intelligent modeling mode, significantly improving modeling efficiency and effectively reducing the time designers spend on repetitive modeling work. It provides an efficient technical solution for the digital preservation of ancient buildings and innovative design of modern architecture. 2. Conforms to the design principles and drafting standards of the *Yingzao Fashi* (Building Standards): The technical solution of this invention deeply integrates the traditional construction logic of the ancient Chinese *Yingzao Fashi*, transforming its modular system regarding the form of the bracket set (such as the material division system and the rules for the construction of bracket set layers), the proportional relationships of components (such as the weighted proportions of the unit dimensions and the balance of each component), and drafting standards (such as the expression of front and side elevations and the drawing standards for mortise and tenon joints) into a quantifiable parametric rule library. This ensures that the generated BIM model fully conforms to traditional construction standards in terms of form characteristics, structural details, and drawing representation, fundamentally improving the professionalism and standardization of the design results, and providing a standardized digital modeling tool for the restoration design of ancient buildings and the creation of traditional style buildings. 3. Filling a technological gap: This invention, through its independently designed overall framework and algorithm code, enables one-click generation of these complex bracket set types, effectively filling this technological gap and meeting the needs of designers.
[0016] In summary, the parametric modeling plugin for dougong (bracket sets) of this invention, through deep integration of C# and Revit API, constructs an innovative solution that integrates parametric interactive input, intelligent rule verification, and automated generation of complex components. This solution uses the material distribution system from the *Yingzao Fashi* (Building Standards) as its core design logic, transforming the modular rules, component proportions, and drafting standards of traditional dougong into a quantifiable parameter-driven model, achieving full automation from design parameter input to output of a BIM model conforming to national standards. Attached Figure Description
[0017] Figure 1 This is a block diagram of the overall system structure. Figure 2 This is a schematic diagram of the method library; Figure 3 Flowchart for plugin development; Figure 4 A schematic diagram of the Revit menu panel buttons; Figure 5 This is a GUI interface diagram; Figure 6 This is a schematic diagram of the three-dimensional structure of the bracket set model of the outer eaves column head generated using the present invention; Figure 7 for Figure 6 Schematic diagram of the front elevation of the model of the bracket set at the top of the outer eaves column; Figure 8 for Figure 6 Schematic diagram of the side elevation structure of the bracket set model of the outer and middle eaves columns. Detailed Implementation
[0018] This embodiment uses a WPF application based on the .NET Framework 4.7.2 framework as its development platform. It features a modern and highly scalable UI system, supporting the creation of applications with rich interactive experiences and outstanding visual effects. This characteristic greatly facilitates research into secondary development techniques for Revit software, while also aiding in the design and implementation of parametric calculation techniques and optimizing the user experience.
[0019] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0020] like Figures 1 to 3 The parametric modeling method for ancient building brackets based on Revit secondary development, as shown, includes the following steps: S1. First, in the MainWindow.xaml window of the WPF application, a 3D visualization model is used to display the view, and StackPanel, GroupBox, Label, TextBox, ComboBox and Button controls are added for inputting key parameters and controlling the parameterization of the overall technology. Then, InitializeComponent() is used to initialize the graphical user interface defined by XAML. In this window class, the basic parameters and position parameters required by the brackets and sub-components are interactively designed with the encapsulated bracket construction design algorithm, and the external event ZTDG class is called to complete the parameterization design of the brackets.
[0021] S2. First, create the DGWindow class, add the TransactionAttribute(TransactionMode.Manual) command to the DGWindow class, and set this command to manually control transactions. Then, add the IExternalCommand external command interface. External commands allow operations to be executed from external applications in Revit. Use the Execute method in the IExternalCommand external command interface as the entry point for external commands, accepting three parameters: commandData, message, and elements. Create a new window instance MainWindow (the GUI interface) in the DGWindow class and display it. Finally, add the return Result.Succeeded command, indicating that the command was executed successfully.
[0022] S3, Model Assembly; S3-1. Create the ZTDG class as an external event handler class to encapsulate the parameterized calculation method for the dougong (bracket set). S3-2. Add the IExternalEventHandler interface to the ZTDG class. This interface is used to perform operations outside the Revit application. S3-3. Use the Execute method in the IExternalEventHandler interface to execute when an external event is triggered. The Execute method takes a UIApplication object as a parameter, which provides access to the Revit application. S3-4. In the Execute method, obtain the current document (Document), the current selection (Selection), and the active view (View). Create a TransactionGroup, which includes sub-transactions Transaction1, Transaction2, Transaction3, Transaction4, Transaction5, Transaction6, and Transaction7, where: In sub-transaction1, the model generation and positioning point formula calculation of the sump are designed, and the calculation of the model CreateExtrusionProfile and CreateSweepProfile are performed, and designed and encapsulated as methods. In sub-transaction2, the model generation and positioning point formula calculation of the mud arch are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction3, the model generation and positioning point formula calculation of the first jump Huagong are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction4, the model generation and positioning point formula calculation of the scatter bucket are designed, and the model CreateExtrusionProfile and CreateSweepProfile calculations are performed, which are designed and encapsulated as methods. In sub-transaction5, the model generation and positioning point formula calculation of column head beam are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction6, the model generation and positioning point formula calculation for the lower ridge are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction7, the model generation and positioning point formula calculation of the arch are designed, and the calculation of the model CreateExtrusionProfile, CreateBlendtopProfile, and CreateBlendbaseProfile are performed and designed and encapsulated as methods. S3-5, Repeat steps S3-1 to S3-4 above to complete the construction and assembly of the column head brackets, intercolumnar brackets, and corner brackets models.
[0023] S4. Design of the graphical GUI interface; S4-1. Creating a 3D visualization window: In the DGWindow class, use the Preview Control function to get the two parameters document and viewld. Then, bind the two parameters document and viewld to the WPF control in MainWindow to display the 3D visualization effect, which can be used to link with the design parameters in the interface. S4-2, Algorithm parameter binding for the constructor function of bracket components and their assembly: First, in the MainWindow.xaml window class, define the Label and TextBox controls required for the bracket set. The Label is used to record the name of the geometric parameter, and the TextBox is used to record the value of the component's geometric parameter. Secondly, for ComboBoxes with non-geometric parameters, select to add a drop-down list box and fill in the corresponding parameters for selection; Next, in the MainWindow.xaml.cs file, the ExternalEvent external command method is first called to import the encapsulated dougong model generation calculation method, and then the user-input dougong score, column head beam layer number, column head beam length, eaves purlin length, dougong type, material and position parameters are passed into the calculation method. Finally, after adding the corresponding parameters, bind the parameter names in WPF with the parameters of the ZTDG class to complete the binding between the user interface and the parameter variables; The specific code is as follows: InitializeComponent(); / / Initialize external events to create brackets DouGongCommand1 = new ZTDG(); DouGongEvent1 = ExternalEvent.Create(DouGongCommand1); / / Passing attribute values DouGongCommand1.Fenzhi = Convert.ToDouble(this.fenzhi.Text); DouGongCommand1.FS = Convert.ToInt32(this.FS.Text); DouGongCommand1.FangL = Convert.ToDouble(this.fangl.Text); DouGongCommand1.TuanL = Convert.ToDouble(this.tuanl.Text); DouGongCommand1.Xp = Convert.ToDouble(this.XText.Text); DouGongCommand1.Yp = Convert.ToDouble(this.YText.Text); DouGongCommand1.Zp = Convert.ToDouble(this.ZText.Text); DouGongCommand1.CZ = Convert.ToString(this.Material.Text); S4-3. Create the sub-components of the bracket set (taking the design of the bracket set as an example). S4-3-1. Construct the extrusion profile of the bracket set and mortise: CreateExtrusionProfile; The *Yingzao Fashi* (Building Standards) clearly stipulates that the modular system for building components is the "Caifen system." Specifically, the cross-sectional dimension of the *gong* (a type of bracket set) is one *cai*, and the cross-sectional dimension of the timber filling between the *gong* is one *qi*. One *cai* plus one *qi* equals one *zucai*. There is a corresponding mathematical relationship between *cai*, *qi*, and their respective values: one *cai* = value × 15, one *qi* = value × 6.
[0024] According to the material division system, the dimensions of all components in the bracket set can be expressed using multiples of the material division value, and the positional relationship between the components can also be determined using multiples of the material division value.
[0025] ① Create the basic extruded solid outline of the dougong (column). First, the basic parameter dimensions of the doug are controlled by defining and calculating the upper depth variable douL, upper width variable douW, and doug height douH of the doug using parameter scores fenzhi. Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. Here, all points are in the Z=0 plane. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the dougong (a type of ancient Chinese dougong). Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the spruce, forming a single closed contour, which is encapsulated as a calculation method; the CurveArrArray in the CurveArray can store multiple contours (such as stretching the same cross section), and in this embodiment, only one two-dimensional closed contour of the spruce is added; The specific code is as follows: double douL = fenzhi *32; double douW = fenzhi *32; double douH = fenzhi *20; / / Create the outline of the spruce. var line1 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-douL / 2,douW / 2, 0), new XYZ(douL / 2, douW / 2, 0)); var line2 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(douL / 2, douW / 2, 0), new XYZ(douL / 2, -douW / 2, 0)); var line3 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(douL / 2, -douW / 2, 0), new XYZ(-douL / 2, -douW / 2, 0)); var line4 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-douL / 2, -douW / 2, 0), new XYZ(-douL / 2, douW / 2, 0)); CurveArray DcurveArray = new CurveArray(); DcurveArray.Append(line1); DcurveArray.Append(line2); DcurveArray.Append(line3); DcurveArray.Append(line4); / / Define the outline of the sprue CurveArrArray DcurveArrArray = new CurveArrArray(); DcurveArrArray.Append(DcurveArray); ② Create the hollow mortise outline in the width direction of the bracket set; First, the variables GEW (width of the bracket set's outer ear), GEH (height of the outer ear), and HGMW (width of the bracket set's mortise) are defined and calculated using parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretch mortise in the bracket set's width direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane X = -(douL / 2 -dkmkL) and parallel to YZ, where dkmkL represents the width of the mortise and tenon. The Line.createBound method is used to create six straight lines to form a closed two-dimensional contour boundary line of the mortise and tenon. Finally, a CurveArray is constructed to store the two-dimensional contour boundary line of the mortise and tenon joint, forming a single closed contour, which is encapsulated as a calculation method; in this embodiment, CurveArray only adds a two-dimensional closed contour of the mortise and tenon joint in the width direction; The specific code is as follows: double dkmkL = fenzhi *11; double dkmkW = fenzhi *11; double dkmkH1 = fenzhi *20; double dkmkH2 = fenzhi *12; double GEW = fenzhi *3; double GEH = fenzhi *4; double HGMW = fenzhi *10; / / Create the mortise profile in the bucket width direction var DKMKline1 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2 - dkmkL), -(douW / 2 - dkmkW), dkmkH1), new XYZ(-(douL / 2 - dkmkL), -(douW / 2), dkmkH1)); var DKMKline2 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2 - dkmkL), -(douW / 2), dkmkH1), new XYZ(-(douL / 2 - dkmkL), -(douW / 2), dkmkH2)); var DKMKline3 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2 - dkmkL), -(douW / 2), dkmkH2), new XYZ(-(douL / 2 - dkmkL), -(GEW + fenzhi * 5), dkmkH2)); var DKMKline4 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2 - dkmkL), -(GEW + fenzhi * 5), dkmkH2), new XYZ(-(douL / 2 - dkmkL), -(GEW + fenzhi * 5), dkmkH2 + GEH)); var DKMKline5 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2 - dkmkL), -(GEW + fenzhi * 5), dkmkH2 + GEH), new XYZ(-(douL / 2 - dkmkL), -(douW / 2 - dkmkW), dkmkH2 + GEH)); var DKMKline6 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(douL / 2- dkmkL), -(douW / 2 - dkmkW), dkmkH2 + GEH), new dkmkH1)); CurveArray DKMKcurveArray = new CurveArray(); DKMKcurveArray.Append(DKMKline1); DKMKcurveArray.Append(DKMKline2); DKMKcurveArray.Append(DKMKline3); DKMKcurveArray.Append(DKMKline4); DKMKcurveArray.Append(DKMKline5); DKMKcurveArray.Append(DKMKline6); / / Define the hollow stretch mortise profile in the bucket width direction CurveArrArray DKMKcurveArrArray = new CurveArrArray(); DKMKcurveArrArray.Append(DKMKcurveArray); ③ Create the hollow stretched mortise profile in the depth direction of the mortise; First, the variable EH of the dougong ear and the width NDGMW of the mortise of the mud-placement channel are defined and calculated through parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretching mortise in the dougong depth direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane Z=mkH and parallel to XY, where mkH represents the mortise height. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the mortise of the mud-laying arch. Finally, a CurveArray is constructed to store the two-dimensional contour boundary line of the mortise and tenon joint of the mud-laying channel, forming a single closed contour, which is encapsulated as a calculation method; in this embodiment, CurveArrArray only adds a two-dimensional closed contour of the mortise and tenon joint in the depth direction. The specific code is as follows: double dsmkL = fenzhi * 32; double NDGMW = fenzhi * 10; double mkH = fenzhi * 12; double EH = fenzhi * 8; / / Create the mortise outline in the bucket depth direction var DSMKline1 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(dsmkL / 2), (NDGMW / 2), mkH), new XYZ(dsmkL / 2, (NDGMW / 2), mkH)); var DSMKline2 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(dsmkL / 2, (NDGMW / 2), mkH), new XYZ(dsmkL / 2, -(NDGMW / 2), mkH)); var DSMKline3 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(dsmkL / 2, -(NDGMW / 2), mkH), new XYZ(-(dsmkL / 2), -(NDGMW / 2), mkH)); var DSMKline4 = Autodesk.Revit.DB.Line.CreateBound(new XYZ(-(dsmkL / 2), -(NDGMW / 2), mkH), new XYZ(-(dsmkL / 2), (NDGMW / 2), mkH)); CurveArray DSMKcurveArray = new CurveArray(); DSMKcurveArray.Append(DSMKline1); DSMKcurveArray.Append(DSMKline2); DSMKcurveArray.Append(DSMKline3); DSMKcurveArray.Append(DSMKline4); / / Define the hollow stretch mortise profile in the bucket depth direction CurveArrArray DSMKcurveArrArray = new CurveArrArray(); DSMKcurveArrArray.Append(DSMKcurveArray); S4-3-2, Construct the inner curve chamfer profile of the hollow loft of the bracket set: CreateSweepProfile; First, the variable QH of the buoy tilt height and the variable QW of the buoy bottom tilt are defined and calculated through parameter scores fenzhi, thereby controlling the basic parameter dimensions of the buoy tilting part; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points are in the Z=0 plane. The Arc.Create method is used to define an arc with the start point, end point and control points on the arc. The Line.createBound method is used to create two straight lines to form a closed inner curve chamfered two-dimensional contour boundary line of the dougong leaning part. Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the inner curve chamfer of the inclined part of the stag bead, forming a single closed contour, which is encapsulated as a calculation method; in this embodiment, CurveArrArray only adds one two-dimensional closed contour of the inner curve chamfer of the inclined part of the stag bead. The specific code is as follows: double QH = fenzhi *8; double QW = fenzhi *4; / / Create the chamfered inner curve of the spruce bracket XYZ end0 = new XYZ(QW, 0, 0); / / Starting point of the arc XYZ end1 = new XYZ(0, QH, 0); / / End point of the arc XYZ pointOnCurve = new XYZ(fenzhi *2.19, fenzhi *5.619, 0); / / Point on the arc Arc arc = Arc.Create(end0, end1, pointOnCurve); Line line5 = Line.CreateBound(new XYZ(0, 0, 0), new XYZ(QW, 0, 0)); Line line6 = Line.CreateBound(new XYZ(0, QH, 0), new XYZ(0, 0, 0)); / / Create the inner curve chamfer profile of the bracket arm leaning section CurveArray QicurveArray = new CurveArray(); QicurveArray.Append(line5); QicurveArray.Append(arc); QicurveArray.Append(line6); / / Define the inner curve chamfer profile of the hollow lofted part of the slab. CurveArrArray QicurveArrArray = new CurveArrArray(); QicurveArrArray.Append(QicurveArray); S4-3-3, Generate the dougong (column) model; ① Based on the calculation methods encapsulated in the CreateExtrusionProfile function of the dougong and mortise constructed in step S4-3-1 and the CreateSweepProfile function of the hollow loft inner curve chamfer profile of the dougong tilted part constructed in step S4-3-2, define the dougong itself and all mortises, then create a transaction, start the transaction1.Start(), call the extrusion and loft profiles in the four encapsulated function calculation methods, add the tilted part inner curve chamfer loft profile by defining the SweepProfile through the NewCurveLoopsProfile function, create the coordinates of the four corner points of the dougong bottom, define four loft paths Curve by the Line.CreateBound method, and add the four Curves in the set order by the CurveArray to form a closed loop; ② The CreateByNormalAndOrigin function creates planes plane1, plane2, and plane3 based on the X-axis, Y-axis, and Z-axis respectively, and adds them to the SketchPlane parameter; ③ Create the NewExtrusion function to define the solid extruded bracket itself, the mortise in the width direction of the hollow extruded bracket, and the mortise in the depth direction of the hollow extruded bracket. Input the extrusion profile CreateExtrusionProfile, extrusion plane SketchPlane, bracket height douH, bracket mortise width HGMW, and ear height EH parameters of the bracket and mortise constructed in S4-3-1 into the NewExtrusion function to generate the bracket model. The NewExtrusion function includes the following four parameters: The first parameter is a boolean isSolid parameter, which indicates whether the generated extruded body is a solid, thereby controlling the type of generated geometry; if the geometry type is solid, isSolid outputs true, otherwise if the geometry type is hollow, isSolid outputs false. The second parameter is a profile parameter of type CurveArrArray, which is used to determine the two-dimensional profile of the tensile section and store the profile of the solid tensile mortise itself and the hollow tensile mortise. The third parameter is the SketchPlane parameter of type SketchPlane. This is the sketch plane, which is the reference plane for the extrusion operation. In 3D modeling, it is usually necessary to specify a plane to draw the outline, and then extrude along the normal direction of the plane or a specified direction. The SketchPlane contains the origin of the plane and the normal vector information (such as extrude along the Z direction when the normal is the Z axis), which is used to determine the extrusion direction and position. The fourth parameter is a double-precision floating-point number of type `double`, which is used to represent the end distance of the extrusion, that is, the distance along the normal direction of the sketch plane (usually using absolute values to represent length, with positive and negative values controlling the direction). ④ Create the NewSweep function to define the hollow lofted bracket set leaning part. Input the hollow lofted inner curve chamfer profile SweepProfile, extrusion plane SketchPlane, and lofting path Curve parameters of the bracket set leaning part constructed in S4-3-2 into the NewSweep function to generate the bracket set model. The NewSweep function includes the following six parameters: The first parameter is a boolean isSolid parameter. Boolean values are usually used to represent switches or states, indicating whether the generated extruded body is a solid, thereby controlling the type of generated geometry. If the geometry type is solid, isSolid outputs true; otherwise, if the geometry type is hollow, isSolid outputs false. The second parameter is the CurveArray parameter, which defines the trajectory path for lofting. The trajectory path can include open curves (such as straight lines and arcs) or closed curves (such as circles and polygons). The third parameter is the SketchPlane parameter, which is used to define the reference plane of the path curve and determine the spatial orientation of the path. The coordinates of the path curve are based on the reference plane definition (for example, when the plane is the XY plane, the path is drawn in this plane). During the path drawing process, the cross section may dynamically adjust its direction according to the path's direction (which needs to be combined with the profile PlaneLocation parameter). The fourth parameter is the SweepProfile parameter, which is used to define the cross-sectional profile (i.e., the two-dimensional shape that moves along the path) of the lofted bracket set. The cross-sectional profile is a closed curve. The fifth parameter, profileLocationCurveIndex, is used to specify the location point of the cross-section profile on the path (usually the index point of the path curve). If the path is a polyline (composed of multiple line segments), the profileLocationCurveIndex parameter indicates which line segment the cross-section starts scanning from. The index usually starts from 0, and it must be ensured that it does not exceed the limit. The sixth parameter is the profilePlaneLocation parameter, which is used to control the orientation rules of the cross-section during the scanning process; ⑤ By using the function GeomCombination Document.Combine Elements(CombinableElementArray members), the solid stretched doug body itself, the mortise in the width direction of the hollow stretched doug body, the mortise in the depth direction of the hollow stretched doug body, and the tilted part of the hollow lofted doug body are added in sequence to achieve the hollow shearing of the mortise and the tilted part with the doug body itself. To generate a mirror image of the ear flaps on the other side of the dougong (a type of ancient Chinese vessel), the following steps are included: First, the CanMirrorElement function in ElementTransformUtils is used to add Dkmk.Id to determine whether the element can be mirrored. A mirror plane based on the center point of the bottom surface of the bracket set is defined as Plane p1 = Plane.CreateByNormalAndOrigin(new XYZ(0, 1, 0), LDnewPlace; Then, the MirrorElement function (including Document document, ElementElementToMirror, and Plane plane) is used to add the Dkmk.Id and the mirror plane p1 parameter to complete the mirror generation of the other spruce opening of the dougong. S4-3-4. Adding materials to the dougong model: Create an element collector using new FilteredElementCollector to traverse the current Revit document. Use the 0fclass(typeof(Material)) function to filter out all elements belonging to the Material1 class (i.e., all materials). Use the FirstOrDefault(x =>x.Name == "Hardwood Pine") function to query using LINQ and return the material name (Name) as "Hardwood Pine". Explicitly convert the type using as Material to ensure that the result type is Material. S4-3-5. After determining the material of the dougong model, use the LookupParameter function to set the material of the dougong. At this point, the dougong model is generated. S4-4. Assembly of the bracket set model: Based on step S4-3 above, after generating the bracket set model, the model calculations for sub-components such as the mud-path bracket, the pedestal bracket, the lintel bracket, the lower ang, the scattered bracket, and the beam are performed, using methods similar to those for generating the bracket set. In this invention, in conjunction with references to documents such as the *Yingzao Fashi* (Building Standards), the regulations governing the components and their inter-component relationships in column-head bracket sets, intercolumnar bracket sets, and corner bracket sets have been organized, digitized, and expressed using mathematical formulas.
[0026] Taking the column-head bracket set as an example, according to the rules of the material division system, the first tier of the bracket set has an inner and outer tier of 26 points, and the total length of the first tier of the bracket set is 62 points. Each subsequent tier of the bracket set is 21 points longer than the previous tier (on one side), and its length is equal to one foot of material. The double lower tier has an outer tier of 47 points, and its outer tier is equivalent to the double top.
[0027] S4-4-1. In the ZTDG class, the TransactionGroup is used to integrate the sub-transactions created by all components of the bracket set into a single transaction group. S4-4-2, The positioning point of the bracket set is XYZ LDnewPlace = new XYZ(X, Y, Z). The bracket set is the lowest component in the entire bracket set, so the positioning point of the center of the bottom surface of the bracket set is chosen as the basis to calculate the positioning points of other sub-components. S4-4-3. Use the ElementTransformUtils.MoveElement function to add the bracket set ID and bracket set positioning point parameters, and then move the component to the set position; S4-4-4, Translate the positional relationship between the transverse structural members, the mud-channel arch and the bracket set, into a mathematical formula: XYZ NDGnewPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (1) Then, the ElementTransformUtils.MoveElement function adds the mud arch component ID and mud arch positioning point parameters, and moves the component to the set position; The positional relationship between the first tier of the longitudinal structural member, the bracket arm, and the dougong bracket is translated into a mathematical formula: XYZ HG1newPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (2) In equations (1) and (2), NDGnewPlace is the positioning point of the mud-brick arch, HG1newPlace is the positioning point of the first jump arch, LDnewPlace(X, Y, Z) is the positioning point of the bracket set, and fenzhi is the score. Then, the ElementTransformUtils.MoveElement function adds the ID of the first-jump bracket set and the positioning point parameters of the first-jump bracket set, and moves the component to the set position; During the movement of the transverse and longitudinal components, the rotation axis is defined using the method Line axis = Line.CreateBound(LDnewPlace, new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z + 1)). S4-4-5. Use the ElementTransformUtils.RotateElement function to add the ID of the first-jump bracket set, the axis of rotation, and the rotation angle to determine the positioning point of the first-jump bracket set; S4-4-6. Repeat steps S4-4-1 to S4-4-5 above to determine the positioning points of the mortise beam, the column head beam, the lower purlin, and the purlin. S4-4-7. Based on the positioning points of the slatted bucket and column head beam in step S4-4-6, use the CopyElement function in ElementTransformUtils to add the component ID and move the position point for copying. S4-4-8. Assemble the bracket set model based on the positioning points of the bracket set, the first bracket set, the mud arch, the lower ang, and the ling arch, as well as the set position points after copying the bracket set and column head beam in step S4-4-7.
[0028] The schematic diagrams of the three-dimensional structure, front elevation structure, and side elevation structure of the bracket set model generated using this invention are as follows: Figures 6-8 As shown. For modeling other bracket set components, targeted modifications can be made based on this invention to complete the overall modeling of the ancient building bracket set.
[0029] In summary, the following four points are the core innovations of this invention, which together constitute the complete technical solution system of this invention. This system has important application value for improving the work efficiency of designers, optimizing design quality, and meeting the needs of rapid parametric modeling of complex bracket sets.
[0030] 1. Technology adapted to Chinese ancient building codes: The software of this invention fully considers the application of the Chinese "Yingzao Fashi" (Building Standards) code in the design of dougong (bracket sets). Based on the Revit platform, it provides a standardized and efficient solution for the digital design of dougong in Chinese ancient buildings, and provides certain reference value in the field of digital application of BIM technology in traditional building codes.
[0031] 2. Unique interface design technology: The technology of this invention can intelligently retrieve the appropriate calculation method for the required bracket set according to the user's actual needs, and perform accurate and efficient calculations. It has successfully realized rapid parametric modeling of complex bracket set types such as column head bracket set, intercolumnar bracket set, and corner bracket set, effectively filling the gap in the field of parametric modeling of complex bracket sets in the existing technology.
[0032] 3. Algorithm Design of Dougong (bracket set) Components and Families Based on Revit Secondary Development using C#: This aspect utilizes C# and the APIs provided by Revit 2018. During development, algorithmic innovations were implemented, resulting in a series of original calculation formulas and modification methods. These formulas and methods closely integrate the structural characteristics and design specifications of traditional Chinese architectural dougong, covering key aspects such as the calculation of the dimensions of each dougong component, the determination of spatial relationships, and the connection methods between components. Through precise calculation and processing of these complex parameters, the geometric shape and dimensional information of each dougong component can be accurately determined.
[0033] After completing the precise calculation of individual components, it can combine the components in the correct order and manner according to the overall structure and design requirements of the bracket set, ensuring tight connection and precise fit between components, and achieving seamless assembly of the bracket set as a whole. It demonstrates extremely high accuracy and reliability, and greatly improves the efficiency and quality of bracket set design and modeling.
[0034] 4. User-friendly parametric input interface: The software of this invention creates an intuitive and easy-to-use parametric interactive interface. Designers only need to input key design parameters (such as shape and size, component proportions, structural positions, etc.), and the system can efficiently generate a precise bracket set model that conforms to design specifications based on the built-in algorithm, realizing full automation from parameter input to model formation, and significantly improving the efficiency and accuracy of traditional bracket set design.
[0035] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A parametric modeling method for ancient building brackets based on Revit secondary development, characterized in that, Includes the following steps: The parametric modeling method for ancient building brackets based on Revit secondary development includes the following steps: S1. First, in the MainWindow.xaml window of the WPF application, a 3D visualization model is used to display the view, and StackPanel, GroupBox, Label, TextBox, ComboBox and Button controls are added for inputting key parameters and controlling the parameterization of the overall technology; then, InitializeComponent() is used to initialize the graphical user interface defined by XAML; in this window class, the basic parameters and position parameters required by the brackets and sub-components are interactively designed with the encapsulated bracket construction design algorithm, and the external event ZTDG class is called to complete the parameterization design of the brackets; S2. First, create a DGWindow class, add the TransactionAttribute (TransactionMode.Manual) command to the DGWindow class, and set this command to manually control transactions; then, add the IExternalCommand external command interface. External commands allow operations to be executed from external applications in Revit. Use the Execute method in the IExternalCommand external command interface as the entry point for external commands, accepting three parameters: commandData, message, and elements. Create a new window instance MainWindow (the GUI interface) in the DGWindow class and display it; finally, add the return Result.Succeeded command, indicating that the command was executed successfully. S3, Model Assembly; S3-1. Create the ZTDG class as an external event handler class to encapsulate the parameterized calculation method for the dougong (bracket set). S3-2. Add the IExternalEventHandler interface to the ZTDG class. This interface is used to perform operations outside the Revit application. S3-3. Use the Execute method in the IExternalEventHandler interface to execute when an external event is triggered. The Execute method takes a UIApplication object as a parameter, which provides access to the Revit application. S3-4. In the Execute method, obtain the current document (Document), the current selection (Selection), and the active view (View). Create a TransactionGroup, which includes sub-transactions Transaction1, Transaction2, Transaction3, Transaction4, Transaction5, Transaction6, and Transaction7, where: In sub-transaction1, the model generation and positioning point formula calculation of the sump are designed, and the calculation of the model CreateExtrusionProfile and CreateSweepProfile are performed, and designed and encapsulated as methods. In sub-transaction2, the model generation and positioning point formula calculation of the mud arch are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction3, the model generation and positioning point formula calculation of the first jump Huagong are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction4, the model generation and positioning point formula calculation of the scatter bucket are designed, and the model CreateExtrusionProfile and CreateSweepProfile calculations are performed, which are designed and encapsulated as methods. In sub-transaction5, the model generation and positioning point formula calculation of column head beam are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction6, the model generation and positioning point formula calculation for the lower ridge are designed, and the model CreateExtrusionProfile calculation is performed. These are designed and encapsulated as methods. In sub-transaction7, the model generation and positioning point formula calculation of the arch are designed, and the calculation of the model CreateExtrusionProfile, CreateBlendtopProfile, and CreateBlendbaseProfile are performed and designed and encapsulated as methods. S3-5, Repeat steps S3-1 to S3-4 above to complete the model construction and assembly of column head brackets, intercolumnar brackets, and corner brackets; S4. Design of the graphical GUI interface; S4-1. Creating a 3D visualization window: In the DGWindow class, use the Preview Control function to get the two parameters document and viewld. Then, bind the two parameters document and viewld to the WPF control in MainWindow to display the 3D visualization effect, which can be used to link with the design parameters in the interface. S4-2, Algorithm parameter binding for the constructor function of bracket components and their assembly: First, in the MainWindow.xaml window class, define the Label and TextBox controls required for the bracket set. The Label is used to record the name of the geometric parameter, and the TextBox is used to record the value of the component's geometric parameter. Secondly, for ComboBoxes with non-geometric parameters, select to add a drop-down list box and fill in the corresponding parameters for selection; Next, in the MainWindow.xaml.cs file, the ExternalEvent external command method is first called to import the encapsulated dougong model generation calculation method, and then the user-input dougong score, column head beam layer number, column head beam length, eaves purlin length, dougong type, material and position parameters are passed into the calculation method. Finally, after adding the corresponding parameters, bind the parameter names in WPF with the parameters of the ZTDG class to complete the binding between the user interface and the parameter variables; S4-3, Create the various sub-components of the bracket set; S4-3-1. Construct the extrusion profile of the bracket set and mortise: CreateExtrusionProfile; ① Create the basic extruded solid outline of the dougong (column). First, the basic parameter dimensions of the doug are controlled by defining and calculating the upper depth variable douL, upper width variable douW, and doug height variable douH of the doug through parameter scores fenzhi. Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. Here, all points are in the Z=0 plane. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the dougong (a type of ancient Chinese dougong). Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the spruce, forming a single closed contour, which is then encapsulated as a calculation method. ② Create the hollow mortise outline in the width direction of the bracket set; First, the variables GEW (width of the bracket set's outer ear), GEH (height of the outer ear), and HGMW (width of the bracket set's mortise) are defined and calculated using parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretch mortise in the bracket set's width direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane X = -(douL / 2 -dkmkL) and parallel to YZ, where dkmkL represents the width of the mortise and tenon. The Line.createBound method is used to create six straight lines to form a closed two-dimensional contour boundary line of the mortise and tenon. Finally, a CurveArray is constructed to store the two-dimensional contour boundary line of the mortise and tenon joint, forming a single closed contour, which is then encapsulated as a calculation method. ③ Create the hollow stretched mortise profile in the depth direction of the mortise; First, the variable EH of the dougong ear and the width NDGMW of the mortise of the mud-placement channel are defined and calculated through parameter scores fenzhi, respectively, to control the basic parameter dimensions of the hollow stretching mortise in the dougong depth direction; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points here are based on the plane Z=mkH and parallel to XY, where mkH represents the mortise height. The Line.create Bound method is used to create four straight lines to form a closed two-dimensional contour boundary line of the mortise of the mud-laying arch. Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the mortise and tenon joint of the mud channel, forming a single closed contour, which is then encapsulated as a calculation method. S4-3-2, Construct the inner curve chamfer profile of the hollow loft of the bracket set: CreateSweepProfile; First, the variable QH of the buoy tilt height and the variable QW of the buoy bottom tilt are defined and calculated through parameter scores fenzhi, thereby controlling the basic parameter dimensions of the buoy tilting part; Then, the XYZ class defines the three-dimensional coordinates of the contour boundary line points. All points are in the Z=0 plane. The Arc.Create method is used to define an arc with the start point, end point and control points on the arc. The Line.createBound method is used to create two straight lines to form a closed inner curve chamfered two-dimensional contour boundary line of the dougong leaning part. Finally, a CurveArray is constructed to store the two-dimensional contour boundary lines of the inner curve chamfer of the dougong leaning part, forming a single closed contour, which is encapsulated as a calculation method; S4-3-3, Generate the dougong (column) model; ① Based on the calculation methods encapsulated in the CreateExtrusionProfile function of the dougong and mortise constructed in step S4-3-1 and the CreateSweepProfile function of the hollow loft inner curve chamfer profile of the dougong tilted part constructed in step S4-3-2, define the dougong itself and all mortises, then create a transaction, start the transaction1.Start(), call the extrusion and loft profiles in the four encapsulated function calculation methods, define the SweepProfile through the NewCurveLoopsProfile function, add the inner curve chamfer loft profile of the tilted part, create the coordinates of the four corner points of the dougong bottom, define four loft paths Curve through the Line.CreateBound method, and add the four Curves in the set order by the CurveArray to form a closed loop; ② The CreateByNormalAndOrigin function creates planes plane1, plane2, and plane3 based on the X-axis, Y-axis, and Z-axis respectively, and adds them to the SketchPlane parameter; ③ Create the NewExtrusion function to define the solid extruded bracket itself, the mortise in the width direction of the hollow extruded bracket, and the mortise in the depth direction of the hollow extruded bracket. Input the extrusion profile CreateExtrusionProfile, extrusion plane SketchPlane, bracket height douH, bracket mortise width HGMW, and ear height EH parameters of the bracket and mortise constructed in S4-3-1 into the NewExtrusion function to generate the bracket model. ④ Create the NewSweep function to define the hollow lofted bracket set leaning part. Input the hollow lofted inner curve chamfer profile SweepProfile, extrusion plane SketchPlane, and lofting path Curve parameters of the bracket set leaning part constructed in S4-3-2 into the NewSweep function to generate the bracket set model. ⑤ By using the function GeomCombination Document.Combine Elements(CombinableElementArray members), the solid stretched doug body itself, the mortise in the width direction of the hollow stretched doug body, the mortise in the depth direction of the hollow stretched doug body, and the tilted part of the hollow lofted doug body are added in sequence to achieve the hollow shearing of the mortise and the tilted part with the doug body itself. S4-3-4 Adding materials to the dougong model: Create an element collector using new FilteredElementCollector to traverse the current Revit document, use the 0fclass function to filter out all elements belonging to the Material1 class, use the FirstOrDefault function to query using LINQ to return the material name, and use as Material to explicitly convert the type to ensure that the result type is Material; S4-3-5. After determining the material of the dougong model, use the LookupParameter function to set the material of the dougong. At this point, the dougong model is generated. S4-4, Assembly of the bracket set model; S4-4-1. In the ZTDG class, the TransactionGroup is used to integrate the sub-transactions created by all components of the bracket set into a single transaction group. S4-4-2, The positioning point of the dougong is XYZ LDnewPlace = new XYZ(X, Y, Z), and the center positioning point of the bottom surface of the dougong is selected as the basis; S4-4-3. Use the ElementTransformUtils.MoveElement function to add the bracket set ID and bracket set positioning point parameters, and then move the component to the set position; S4-4-4, Translate the positional relationship between the transverse structural members, the mud-channel arch and the bracket set, into a mathematical formula: XYZ NDGnewPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (1) Then, the ElementTransformUtils.MoveElement function adds the mud arch component ID and mud arch positioning point parameters, and moves the component to the set position; The positional relationship between the first tier of the longitudinal structural member, the bracket arm, and the dougong bracket is translated into a mathematical formula: XYZ HG1newPlace = new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z +fenzhi *12); (2) In equations (1) and (2), NDGnewPlace is the positioning point of the mud-brick arch, HG1newPlace is the positioning point of the first jump arch, LDnewPlace(X, Y, Z) is the positioning point of the bracket set, and fenzhi is the score. Then, the ElementTransformUtils.MoveElement function adds the ID of the first-jump bracket set and the positioning point parameters of the first-jump bracket set, and moves the component to the set position; During the movement of the transverse and longitudinal components, the rotation axis is defined using the method Line axis = Line.CreateBound(LDnewPlace,new XYZ(LDnewPlace.X, LDnewPlace.Y, LDnewPlace.Z + 1)). S4-4-5. Use the ElementTransformUtils.RotateElement function to add the ID of the first-jump bracket set, the axis of rotation, and the rotation angle to determine the positioning point of the first-jump bracket set; S4-4-6. Repeat steps S4-4-1 to S4-4-5 above to determine the positioning points of the mortise beam, the column head beam, the lower purlin, and the purlin. S4-4-7. Based on the positioning points of the slatted bucket and column head beam in step S4-4-6, use the CopyElement function in ElementTransformUtils to add the component ID and move the position point for copying. S4-4-8. Assemble the bracket set model based on the positioning points of the bracket set, the first bracket set, the mud arch, the lower ang, and the ling arch, as well as the set position points after copying the bracket set and column head beam in step S4-4-7.
2. The parametric modeling method for ancient building brackets based on Revit secondary development according to claim 1, characterized in that, In step S4-3-3, the NewExtrusion function includes the following four parameters: The first parameter is a boolean isSolid parameter, which indicates whether the generated extrusion is a solid, and thus controls the type of geometry generated; The second parameter is a profile parameter of type CurveArrArray, which is used to determine the two-dimensional profile of the tensile section and store the profile of the solid tensile mortise itself and the hollow tensile mortise. The third parameter is the SketchPlane parameter of type SketchPlane. The SketchPlane contains the origin and normal vector information of the plane, which is used to determine the stretching direction and position. The fourth parameter is a double-precision floating-point number of type `double`, which represents the end distance of the stretch, i.e., the distance along the normal direction of the sketch plane.
3. The parametric modeling method for ancient building brackets based on Revit secondary development according to claim 1, characterized in that, In step S4-3-3, the NewSweep function includes the following six parameters: The first parameter is a boolean isSolid parameter, which indicates whether the generated extrusion is a solid, and thus controls the type of geometry generated; The second parameter is the CurveArray parameter, which defines the loft trajectory path, including open curves or closed curves; The third parameter is the SketchPlane parameter, which is used to define the reference plane of the path curve and determine the spatial orientation of the path; The fourth parameter is the SweepProfile parameter, which is used to define the cross-sectional profile of the staking out of the bracket set. The cross-sectional profile is a closed curve. The fifth parameter, profileLocationCurveIndex, is used to specify the location point of the cross-sectional profile on the path. The sixth parameter is the profilePlaneLocation parameter, which controls the orientation rules of the cross-section during the scanning process.
4. The parametric modeling method for ancient building brackets based on Revit secondary development according to claim 1, characterized in that, In step S4-3-1, the mirror image generation of the other septum opening of the spruce is performed, including the following steps: First, the CanMirrorElement function in ElementTransformUtils is used to add Dkmk.Id to determine whether the element can be mirrored. A mirror plane based on the center point of the bottom surface of the bracket set is defined as Plane p1 = Plane.CreateByNormalAndOrigin(new XYZ(0, 1, 0), LDnewPlace; Then, the MirrorElement function is used to add Dkmk.Id and the mirror plane p1 parameter to complete the mirror generation of the other septum of the dougong.
Citation Information
Cited By
BIM ancient building component parameterization design method and system fusing historical shape and system
CN121637626A