A forward solving method for pipe bending based on OCCT

CN117421833BActive Publication Date: 2026-08-14HOHAI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

Parasolid成本昂贵,且与之相关的学习资料较少

Benefits of technology

[0011]本发明设计了一种基于OCCT的弯管正解方法,基于OCCT,解决了对弯管轴线的提取、解析控制点以及XYZR数据到YBCR数据转换的正解算法。正解算法包括两部分:控制点获取以及坐标转换。本算法能够有效对于弯管加工效率与质量,具有广泛应用前景。由于该内核的开源性,也能很大程度上降低成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117421833B_ABST
    Figure CN117421833B_ABST
Patent Text Reader

Abstract

This invention discloses a forward bending algorithm for pipe bending based on OCCT. Based on the open-source geometric kernel OCCT, it addresses the challenges of pipe bending feature recognition and processing data conversion. Using OCCT as the geometric modeling engine and C++ as the programming language, a user interface is developed using QT architecture. First, the pipe geometric model defined by the B-Rep boundary representation is imported using OCCT's data exchange module. Basic pipe features are identified, and the axis is extracted to obtain key control points. Finally, based on coordinate transformation, the control point coordinates are converted to processing coordinates in the pipe bending machine coordinate system. Due to the open-source nature of OpenCASCADE, this algorithm reduces costs and enables more accurate and efficient completion of pipe bending processing requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of CAM software development, and specifically to a forward bend solution method for pipe bending based on OCCT. Background Technology

[0002] The geometry of a pipe is determined by the shape of its own axis. With the continuous development of modern technology, CNC pipe bending machines are gradually being applied to various industries. At present, most pipe bending machine manufacturers have not been able to realize CNC pipe bending machines and lack a complete CNC process for extracting the pipe axis. It is difficult to guarantee the processing accuracy in pipe bending. This invention will use the open-source geometry kernel OpenCASCADE (OCCT) to establish a complete axis extraction process, which can accurately identify the characteristics of pipe bending.

[0003] The design and development of traditional CNC pipe bending CAM systems paired with pipe bending machines mainly rely on secondary development of mainstream design software such as SolidWorks and UG. This development has significant drawbacks, such as being limited by the APIs provided by the developers and being difficult to modify underlying functions. From both a copyright perspective and in terms of development flexibility, secondary development is less effective than based on a geometric kernel. Currently, the mainstream 3D geometric kernels are ACIS, Parasolid, and OCCT. The first two are commercial geometric kernels. While ACIS is widely used in current technology, it has a high learning curve and is difficult to master. Parasolid is expensive, and there are relatively few related learning resources. Compared to the former two, OCCT, as an open-source geometric kernel, is based on the relatively mature B-Rep boundary representation method and can meet the requirements for creating 2D and 3D geometric models. Summary of the Invention

[0004] The purpose of this invention is to provide a forward bending method for pipe bending based on OCCT. This algorithm can improve the efficiency and quality of pipe bending and reduce the cost of pipe bending, and is applicable to CNC bending machines.

[0005] To achieve the above functions, this invention designs a forward bending solution method for pipe bending based on OCCT, which executes the following steps S1-S4 to complete the analysis of the target pipe and obtain its processing coordinates suitable for the bending machine:

[0006] Step S1: For the target pipe, use the OCCT data exchange module to import the pipe STEP geometric model defined by the B-Rep boundary representation method;

[0007] Step S2: For the STEP geometric model of the pipe, obtain the geometric information of the target pipe, including the geometric information of the end faces at both ends of the target pipe, as well as the geometric information of the straight and bent sections that make up the target pipe, and reconstruct the centerline of the target pipe based on the geometric information;

[0008] Step S3: For each bend of the target pipe, obtain the tangent points of the starting and ending points of the bend. Extend the two tangent lines that pass through the tangent points of the starting and ending points to intersect at one point to construct the control point of the bend. Further obtain the control points of each bend of the target pipe.

[0009] Step S4: Obtain the XYZ coordinates of the control points of each bend of the target pipe, convert them into YBC coordinates in the bending machine coordinate system, and complete the analysis of the processing coordinates of the target pipe suitable for the bending machine.

[0010] Beneficial effects: Compared with the prior art, the advantages of the present invention include:

[0011] This invention designs a forward bend algorithm based on OCCT (Optical Coordinate Transformation and Coordinate Calculation). Based on OCCT, it solves the problems of extracting the pipe bending axis, analyzing control points, and converting XYZR data to YBCR data. The forward bend algorithm consists of two parts: control point acquisition and coordinate transformation. This algorithm can effectively improve the efficiency and quality of pipe bending processes and has broad application prospects. Due to the open-source nature of its core, it can also significantly reduce costs. Attached Figure Description

[0012] Figure 1 This is a flowchart of a pipe bending forward solution method based on OCCT provided according to an embodiment of the present invention;

[0013] Figure 2 This is a three-dimensional model drawing of the target pipe provided in an embodiment of the present invention;

[0014] Figure 3 This is a schematic diagram of the starting end face of the target pipe provided according to an embodiment of the present invention;

[0015] Figure 4 This is a schematic diagram of the centerline of the reconstructed target pipe according to an embodiment of the present invention;

[0016] Figure 5 This is a schematic diagram of the bend control points in the target pipe according to an embodiment of the present invention;

[0017] Figure 6 This is a schematic diagram of a bending machine structure provided according to an embodiment of the present invention;

[0018] Figure 6 In the middle section: 1. Main clamp; 2. Jaw; 3. Tube material; 4. Wheel mold; 5. Anti-wrinkle mold; 6. Bundle clamp; 7. Guide rail; 8. Feeding trolley; 9. Mandrel; 10. Follow-up mold; 11. Machine head; 12. Guide clamp; 13. Bending arm;

[0019] Figure 7 This is a schematic diagram of the YBCR coordinates of the target pipe provided according to an embodiment of the present invention. Detailed Implementation

[0020] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0021] Reference Figure 1 The present invention provides an OCCT-based forward bending method for pipe bending, which performs the following steps S1-S4 to complete the analysis of the target pipe and obtain its processing coordinates suitable for a bending machine:

[0022] Step S1: Refer to Figure 2 For the target pipe, the STEP geometric model of the pipe defined by the B-Rep boundary representation method is imported using the data exchange module of OCCT; through the definition of the myOCCView class, the hybrid rendering of QT and OCCT is realized, thereby completing the display of the three-dimensional model of the target pipe.

[0023] Step S2: For the STEP geometric model of the pipe, convert the STEP geometric model into TopoDS_Shape, obtain the geometric information of the target pipe, including the end face geometric information of both ends of the target pipe, as well as the geometric information of the straight and bent sections that make up the target pipe, and reconstruct the centerline of the target pipe based on the geometric information;

[0024] The specific steps of step S2 are as follows:

[0025] Step S2.1: Obtain the geometric information of the target pipe, including the center and axis of both end faces, whether the target pipe is a solid or hollow round pipe, and if it is a hollow round pipe, calculate the inner and outer radii of the end faces; the geometric information of the straight section includes the endpoints and axis; the geometric information of the curved section includes the endpoints, tangents, local coordinate system, starting angle, and ending angle.

[0026] The TopExp_Explorer class is a tool from the TopoDS package for accessing topological data structures, used to traverse faces and edges in a model. Usage of this class:

[0027] (1) The shape to be traversed;

[0028] (2) The type to search for: such as point, line, or surface. Note that this type cannot be a shape (TopAbs_SHAPE);

[0029] (3) Types to avoid: If you only need to find Face, you need to avoid other shapes such as Edge.

[0030] Because there are containment relationships between various topologies, and each topology has a corresponding topological entity, the bending process indicates that the pipe has two end faces (starting end face and ending end face) after processing. After importing the pipe's STEP model, the STEP format model is converted into a TopoDS_Shape topology, and this TopoDS_Shape structure is traversed to find the TopoDS_Face sub-topology. Based on the principle that the end face is planar, two end faces are found, and one is chosen as the starting end face. Similarly, the TopoDS_Face structure is traversed to find the TopoDS_Edge sub-topology, and it is determined whether the Edge is a circle. Finally, the circle of the end face is obtained, and the geometric information of the circle, including its center and coordinates, is acquired.

[0031] Step S2.2: Refer to Figure 3 Take any end face as the starting end face, and start searching for its cross-sectional circle and center from the starting end face. Determine whether the current segment is a straight segment or a curved segment. If it is a straight segment, set the flag to 0; if it is a curved segment, set the flag to 1. After the target pipe cross-sectional circle and its center are obtained, determine the straight or curved segments based on the flags, reconstruct the center line of the target pipe, and the reconstructed center line must be consistent with the shape of the target pipe.

[0032] In this embodiment, after obtaining all TopoDS_Face on TopoDS_Shape, starting from the initial end face, the center of the end face circle is obtained and stored. The process continues to search for connecting surfaces. After finding a connecting surface, the edge of the connecting surface is determined. The connecting surface between a circular surface and a cylindrical surface is still a circular surface. The edge at the junction of two cylindrical surfaces is the generatrix of the cylinder. After obtaining the overlapping edge of the connecting surface, it is determined whether it is a straight line. If it is a straight line, this segment is determined to be a straight segment of the pipe. The center of the current cross-sectional circle is obtained, and the flag is refreshed to 1 (the flag for straight segments is 1, and the flag for curved segments is 0). If the overlapping edge of the connecting surface is not a straight line, the segment is determined to be a curved segment. The center of the current cross-sectional circle is obtained, and the flag is refreshed to 0. The inner and outer radii of the cross-sectional circle are obtained and determined whether they are the same as the pipe diameter (inner and outer radii of the end face circle). If they are the same, the face and center of the cross-sectional circle are obtained and stored. If they are different, the cross-sectional circle needs to be reconstructed using three points.

[0033] Sequentially obtain the remaining intersecting surfaces and cross-sectional circles, remove duplicate circle centers, obtain all cross-sectional circles and their centers, and refresh the straight and curved segment flags.

[0034] The specific steps of step S2.2 are as follows:

[0035] Starting with the straight section, the next section of the tube is identified sequentially based on the marker positions.

[0036] If the current pipe section and the next pipe section are in a straight-bend transition, then take the straight section as the tangent direction of the next bend section, and use the centers of the two cross-sections of the next bend section as the starting and ending points of the center line of the bend section to draw arcs, thereby completing the reconstruction of the center line of the bend section in the straight-bend transition.

[0037] If the current pipe section and the next pipe section are in a bend transition, take the end point of the current bend and obtain the tangent direction of the end point. Use the centers of the two cross-sections of the next bend as the start and end points of the center line of the next bend to draw arcs, thereby completing the reconstruction of the center line of the bend transition.

[0038] If the current pipe section and the next pipe section are in a straight-bend transition, take the center of the two adjacent cross-sections of the current section and the next section, connect them and draw a straight line to complete the reconstruction of the center line of the straight-bend transition line segment.

[0039] Reference Figure 4 Connect the centerlines of each straight and curved section in sequence to complete the reconstruction of the centerline of the target pipe.

[0040] Step S3: For each bend of the target pipe, obtain the tangent points of the starting and ending points of the bend. Extend the two tangent lines that pass through the tangent points of the starting and ending points to intersect at one point to construct the control point of the bend. Further obtain the control points of each bend of the target pipe.

[0041] Reference Figure 5 The specific method for step S3 is as follows:

[0042] Obtain the start and end points of each bend, and obtain the tangent points at the start and end points respectively. Extend the two tangent lines that pass through the tangent points at the start and end points respectively to intersect at a point. Define the intersection point as the control point of the bend. At the same time, obtain the bending radius of the bend as the R data of the bend. Obtain the control points of each bend in sequence and store them.

[0043] After obtaining the control points for each bend, the center of the end face circle of the first and last ends of the target pipe is inserted as the first and last control points into the control point list, thus completing the acquisition of all control points for the target pipe.

[0044] Step S4: Obtain the XYZ coordinates of the control points of each bend of the target pipe, convert them into YBC coordinates in the bending machine coordinate system, and complete the analysis of the processing coordinates of the target pipe suitable for the bending machine.

[0045] The specific steps of step S4 are as follows:

[0046] Step S4.1: Based on the XYZ coordinates of two adjacent control points, construct the vector between the two control points and obtain the direction of the vector. With n control points, (n-1) direction vectors will be obtained, such as... Figure 7 As shown, this pipe fitting can form a direction vector. , , Find them separately. , , The length and direction cosine of the vector. The length of the vector between two control points is expressed as follows:

[0047] ;

[0048] In the formula, , These represent the i-th and (i+1)-th adjacent control points, respectively. and control points The XYZ coordinates are respectively , n is the number of control points. Control points , The vector formed;

[0049] Find the direction cosine as follows:

[0050] ;

[0051] Step S4.2: Calculate the planar bending angle composed of vectors. Planar bending is a bending forming action in the bending process, and the angle between the two vectors is the bending angle C. For example... Figure 7 As shown, and The angle between the two vectors in the plane is C1. and The angle between the two vectors is C2. The angle between the two vectors can be obtained by multiplying the dot product of the two vectors and their magnitudes, as shown in the following formula:

[0052] ;

[0053] In the formula, Control points , The vector formed and control points , The vector formed The angle between them;

[0054] Step S4.3: For each curve segment, calculate the distance Y to be sent. Each curve segment corresponds to a straight segment, which is the distance Y to be sent. The length of the distance Y to be sent is the length of the vector formed by two adjacent control points minus the loss length. The loss length is the length from the control point to the tangent point between the straight segment and the curve segment. The curve segment includes the starting segment Y1, the middle segment Y2, and the ending segment Y3. The loss length at the starting segment and the ending segment is different from the loss length of the straight-curve transition segment and requires different calculations.

[0055] by Figure 7 For example, the initial segment Y1 is calculated as follows, which represents the initial segment minus the loss length of the arc segment:

[0056] ;

[0057] In the formula, The radius of the first arc in the curved segment;

[0058] The calculation for the middle segment Y2 is as follows, which requires subtracting not only the loss length of this arc segment but also the loss length of the previous arc segment:

[0059] ;

[0060] In the formula, The radius of the second arc in the curved segment;

[0061] The calculation for the termination segment Y3 is as follows, only requiring the subtraction of the lost length of the arc segment:

[0062] ;

[0063] In the formula, The radius of the third arc in the curved segment;

[0064] Step S4.4: Calculate the spatial rotation angle of the bend. The straight and curved sections of the pipe are not necessarily on the same horizontal plane; the transition between straight and curved sections often forms a spatial angle, which is the spatial rotation angle B. The spatial rotation angle of the i-th bend is equal to... , , The plane formed by the three points and , , The included angle formed by the plane composed of three points; the general equation of the i-th plane is:

[0065] ;

[0066] Plane normal vector ,in:

[0067] ;

[0068] ;

[0069] ;

[0070] Since the angle between the two planes is equal to the angle between the normal vectors of the two planes, the spatial rotation angle B of the i-th bend segment can be obtained. i As shown in the following formula:

[0071] ;

[0072] In the actual processing, the tube clamp of the feeding trolley can hold the tube and rotate it clockwise or counterclockwise. Therefore, further adjustments to the spatial rotation angle B are needed. i The sign is used to determine the spatial rotation angle B. i The direction of rotation is as follows:

[0073] ;

[0074] In the formula, d is the direction factor;

[0075] Step S4.5: Repeat steps S4.1-S4.4 until the coordinate transformation of all control points is completed, further refining the processing coordinates of the target pipe suitable for the bending machine. (See the three-axis bending machine structure reference.) Figure 6 The coordinate-transformed machining data is imported into the CNC machine tool of the three-axis bending machine, which controls the three-axis motion of the bending machine to process the pipe, thereby obtaining the target pipe. A schematic diagram of the YBCR coordinates of the target pipe is provided below. Figure 7 .

[0076] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. A forward bend solution method for pipes based on OCCT, characterized in that, Perform the following steps S1-S4 to complete the analysis of the target pipe and obtain its processing coordinates suitable for the bending machine: Step S1: For the target pipe, use the OCCT data exchange module to import the pipe STEP geometric model defined by the B-Rep boundary representation method; Step S2: For the STEP geometric model of the pipe, obtain the geometric information of the target pipe, including the geometric information of the end faces at both ends of the target pipe, as well as the geometric information of the straight and bent sections that make up the target pipe, and reconstruct the centerline of the target pipe based on the geometric information; The specific steps of step S2 are as follows: Step S2.1: Obtain the geometric information of the target pipe, including the center and axis of both end faces, whether the target pipe is a solid or hollow round pipe, and if it is a hollow round pipe, calculate the inner and outer radii of the end faces; the geometric information of the straight section includes the endpoints and axis; the geometric information of the curved section includes the endpoints, tangents, local coordinate system, starting angle, and ending angle. Step S2.2: Take any end face as the starting end face, start searching for its cross-sectional circle and center from the starting end face, and determine whether the current segment is a straight segment or a curved segment. If it is a straight segment, set the flag to 0; if it is a curved segment, set the flag to 1. After the target pipe cross-sectional circle and its center are obtained, determine the straight and curved segments according to the flag, reconstruct the center line of the target pipe, and the reconstructed center line must be consistent with the shape of the target pipe. Step S3: For each bend of the target pipe, obtain the tangent points of the starting and ending points of the bend. Extend the two tangent lines that pass through the tangent points of the starting and ending points to intersect at one point to construct the control point of the bend. Further obtain the control points of each bend of the target pipe. Step S4: Obtain the XYZ coordinates of the control points of each bend of the target pipe, convert them into YBC coordinates in the bending machine coordinate system, and complete the analysis of the processing coordinates of the target pipe suitable for the bending machine.

2. The OCCT-based forward bend solution method for pipe bending according to claim 1, characterized in that, The specific steps of step S2.2 are as follows: Starting with the straight section, the next section of the tube is identified sequentially based on the marker positions. If the current pipe section and the next pipe section are in a straight-bend transition, then take the straight section as the tangent direction of the next bend section, and use the centers of the two cross-sections of the next bend section as the starting and ending points of the center line of the bend section to draw arcs, thereby completing the reconstruction of the center line of the bend section in the straight-bend transition. If the current pipe section and the next pipe section are in a bend transition, take the end point of the current bend and obtain the tangent direction of the end point. Use the centers of the two cross-sections of the next bend as the start and end points of the center line of the next bend to draw arcs, thereby completing the reconstruction of the center line of the bend transition. If the current pipe section and the next pipe section are in a straight-bend transition, take the center of the two adjacent cross-sections of the current section and the next section, connect them and draw a straight line to complete the reconstruction of the center line of the straight-bend transition line segment. Connect the centerlines of each straight and curved section in sequence to complete the reconstruction of the centerline of the target pipe.

3. The OCCT-based forward bend solution method for pipe bending according to claim 1, characterized in that, The specific method for step S3 is as follows: Obtain the start and end points of each bend, and obtain the tangent points at the start and end points respectively. Extend the two tangent lines passing through the tangent points at the start and end points to intersect at a point, and define the intersection point as the control point of the bend. At the same time, obtain the bending radius of the bend as the R data of the bend. Sequentially obtain the control points of each bend and store them in the control point list. After obtaining the control points for each bend, the center of the end face circle of the first and last ends of the target pipe is inserted as the first and last control points into the control point list, thus completing the acquisition of all control points for the target pipe.

4. The OCCT-based forward bend solution method for pipe bending according to claim 1, characterized in that, The specific steps of step S4 are as follows: Step S4.1: Based on the XYZ coordinates of two adjacent control points, construct the vector between the two control points and obtain the direction of the vector. The length of the vector between the two control points is expressed by the following formula: ; In the formula, , These represent the i-th and (i+1)-th adjacent control points, respectively. and control points The XYZ coordinates are respectively , n is the number of control points. Control points , The vector formed; Find the direction cosine as follows: ; Step S4.2: Calculate the plane bending angle composed of vectors as follows: ; In the formula, Control points , The vector formed and control points , The vector formed The angle between them; Step S4.3: For the curved segment, calculate the distance Y. The curved segment includes the starting segment Y1, the middle segment Y2, and the ending segment Y3. The calculation of the starting segment Y1 is as follows: ; In the formula, The radius of the first arc in the curved segment; The middle segment Y2 is calculated as follows: ; In the formula, The radius of the second arc in the curved segment; The calculation of the terminal segment Y3 is as follows: ; In the formula, The radius of the third arc in the curved segment; Step S4.4: Calculate the spatial rotation angle of the bend segment. The spatial rotation angle of the i-th bend segment is equal to... , , The plane formed by the three points and , , The included angle formed by the plane composed of three points; the general equation of the i-th plane is: ; Plane normal vector ,in: ; ; ; The spatial rotation angle B of the i-th bend can be obtained. i As shown in the following formula: ; Determine the spatial rotation angle B i The direction of rotation is as follows: ; In the formula, d is the direction factor; Step S4.5: Repeat steps S4.1-S4.4 until the coordinate transformation of all control points is completed, and further complete the analysis of the processing coordinates of the target pipe suitable for the bending machine.