From 8d5f411b22d63b81c661497802ac4403dbad3760 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Fri, 16 Feb 2024 12:11:43 -0500 Subject: [PATCH] Toponaming/Part: Transfer makEPipeShell --- src/Mod/Part/App/TopoShape.h | 51 ++++++++++++++++++++++++- src/Mod/Part/App/TopoShapeExpansion.cpp | 1 + 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index 75d0b8f597..f6437ddb1e 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -134,8 +134,7 @@ enum class LinearizeFace linearizeFaces }; -enum class LinearizeEdge -{ +enum class LinearizeEdge { noEdges, linearizeEdges }; @@ -158,6 +157,29 @@ enum class IsClosed closed }; +/// Option to manage discontinuity in pipe sweeping +enum class TransitionMode { + /** Discontinuities are treated by modification of the sweeping mode. + * The pipe is "transformed" at the fractures of the spine. This mode + * assumes building a self-intersected shell. + */ + Transformed, + + /** Discontinuities are treated like right corner. Two pieces of the + * pipe corresponding to two adjacent segments of the spine are + * extended and intersected at a fracture of the spine. + */ + RightCorner, + + /** Discontinuities are treated like round corner. The corner is + * treated as rotation of the profile around an axis which passes + * through the point of the spine's fracture. This axis is based on + * cross product of directions tangent to the adjacent segments of the + * spine at their common point. + */ + RoundCorner +}; + /** The representation for a CAD Shape */ // NOLINTNEXTLINE cppcoreguidelines-special-member-functions @@ -720,6 +742,31 @@ public: } //@} + /* Make a shell or solid by sweeping profile wire along a spine + * + * @params sources: source shapes. The first shape is used as spine. The + * rest are used as section profiles. Can be of type edge, + * wire, face, or compound of those. For face, only outer + * wire is used. + * @params makeSolid: whether to create solid + * @param isFrenet: if true, then assume the profiles transition is Frenet, + * or else a corrected Frenet trihedron is used. + * @param transition: @sa TransitionMode + * @param op: optional string to be encoded into topo naming for indicating + * the operation + * @param tol3d: 3D tolerance + * @param tolBound: boundary tolerance + * @param tolAngular: angular tolerance + * + * @return The original content of this TopoShape is discarded and replaced + * with the new shape. The function returns the TopoShape itself as + * a self reference so that multiple operations can be carried out + * for the same shape in the same line of code. + */ + TopoShape &makEPipeShell(const std::vector &sources, const Standard_Boolean makeSolid, + const Standard_Boolean isFrenet, TransitionMode transition=TransitionMode::Transformed, + const char *op=nullptr, double tol3d=0.0, double tolBound=0.0, double tolAngluar=0.0); + /** Try to simplify geometry of any linear/planar subshape to line/plane * * @return Return true if the shape is modified diff --git a/src/Mod/Part/App/TopoShapeExpansion.cpp b/src/Mod/Part/App/TopoShapeExpansion.cpp index 4a3d3eb431..e1dec657bc 100644 --- a/src/Mod/Part/App/TopoShapeExpansion.cpp +++ b/src/Mod/Part/App/TopoShapeExpansion.cpp @@ -2592,6 +2592,7 @@ TopoShape& TopoShape::makeElementRefine(const TopoShape& shape, const char* op, return *this; } + /** * Encode and set an element name in the elementMap. If a hasher is defined, apply it to the name. *