Testing for makeElementEvolve
This commit is contained in:
@@ -227,7 +227,8 @@ enum class Copy
|
||||
};
|
||||
|
||||
/// Filling style when making a BSpline face
|
||||
enum FillingStyle {
|
||||
enum FillingStyle
|
||||
{
|
||||
/// The style with the flattest patches
|
||||
stretch,
|
||||
/// A rounded style of patch with less depth than those of Curved
|
||||
@@ -236,6 +237,18 @@ enum FillingStyle {
|
||||
curved,
|
||||
};
|
||||
|
||||
enum class CoordinateSystem
|
||||
{
|
||||
relativeToSpine,
|
||||
global
|
||||
};
|
||||
|
||||
enum class Spine
|
||||
{
|
||||
notOn,
|
||||
on
|
||||
};
|
||||
|
||||
/** The representation for a CAD Shape
|
||||
*/
|
||||
// NOLINTNEXTLINE cppcoreguidelines-special-member-functions
|
||||
@@ -1262,6 +1275,8 @@ public:
|
||||
* An evolved shape is built from a planar spine (face or wire) and a
|
||||
* profile (wire). The evolved shape is the unlooped sweep (pipe) of the
|
||||
* profile along the spine. Self-intersections are removed.
|
||||
* Note that the underlying OCCT method is very finicky about parameters and
|
||||
* make throw "Unimplemented" exceptions for various types.
|
||||
*
|
||||
* @param spine: the spine shape, must be planar face or wire
|
||||
* @param profile: the profile wire, must be planar, or a line segment
|
||||
@@ -1277,8 +1292,14 @@ public:
|
||||
* a self reference so that multiple operations can be carried out
|
||||
* for the same shape in the same line of code.
|
||||
*/
|
||||
TopoShape &makEEvolve(const TopoShape &spine, const TopoShape &profile, JoinType join=JoinType::Arc,
|
||||
bool axeProf=true, bool solid=false, bool profOnSpine=false, double tol=0.0, const char *op=nullptr);
|
||||
TopoShape& makeElementEvolve(const TopoShape& spine,
|
||||
const TopoShape& profile,
|
||||
JoinType join = JoinType::arc,
|
||||
CoordinateSystem = CoordinateSystem::global,
|
||||
MakeSolid solid = MakeSolid::noSolid,
|
||||
Spine profOnSpine = Spine::notOn,
|
||||
double tol = 0.0,
|
||||
const char* op = nullptr);
|
||||
|
||||
/** Make an evolved shape using this shape as spine
|
||||
*
|
||||
@@ -1296,10 +1317,16 @@ public:
|
||||
*
|
||||
* @return Return the new shape. The TopoShape itself is not modified.
|
||||
*/
|
||||
TopoShape makEEvolve(const TopoShape &profile, JoinType join=JoinType::Arc,
|
||||
bool axeProf=true, bool solid=false, bool profOnSpine=false, double tol=0.0, const char *op=nullptr)
|
||||
TopoShape makeElementEvolve(const TopoShape& profile,
|
||||
JoinType join = JoinType::arc,
|
||||
CoordinateSystem axeProf = CoordinateSystem::global,
|
||||
MakeSolid solid = MakeSolid::noSolid,
|
||||
Spine profOnSpine = Spine::notOn,
|
||||
double tol = 0.0,
|
||||
const char* op = nullptr)
|
||||
{
|
||||
return TopoShape(0,Hasher).makEEvolve(*this, profile, join, axeProf, solid, profOnSpine, tol, op);
|
||||
return TopoShape(0, Hasher)
|
||||
.makeElementEvolve(*this, profile, join, axeProf, solid, profOnSpine, tol, op);
|
||||
}
|
||||
|
||||
/** Make an loft that is a shell or solid passing through a set of sections in a given sequence
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include <BRepAlgoAPI_Fuse.hxx>
|
||||
#include <BRepAlgoAPI_Section.hxx>
|
||||
#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRepBuilderAPI_FindPlane.hxx>
|
||||
#include <BRepBuilderAPI_GTransform.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
@@ -55,13 +56,14 @@
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepBuilderAPI_MakeSolid.hxx>
|
||||
#include <BRepBuilderAPI_NurbsConvert.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepFilletAPI_MakeChamfer.hxx>
|
||||
#include <BRepFilletAPI_MakeFillet.hxx>
|
||||
#include <BRepBuilderAPI_Transform.hxx>
|
||||
#include <BRepLib.hxx>
|
||||
#include <BRepOffsetAPI_DraftAngle.hxx>
|
||||
#include <BRepOffsetAPI_MakeFilling.hxx>
|
||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||
#include <BRepOffsetAPI_MakeEvolved.hxx>
|
||||
#include <BRepOffsetAPI_MakeThickSolid.hxx>
|
||||
#include <BRepPrimAPI_MakeRevol.hxx>
|
||||
#include <BRepPrimAPI_MakePrism.hxx>
|
||||
@@ -1857,26 +1859,28 @@ TopoShape TopoShape::getSubTopoShape(TopAbs_ShapeEnum type, int idx, bool silent
|
||||
return shapeMap.getTopoShape(*this, idx);
|
||||
}
|
||||
|
||||
TopoShape &TopoShape::makEEvolve(const TopoShape &spine,
|
||||
const TopoShape &profile,
|
||||
JoinType join,
|
||||
bool axeProf,
|
||||
bool solid,
|
||||
bool profOnSpine,
|
||||
double tol,
|
||||
const char *op)
|
||||
TopoShape& TopoShape::makeElementEvolve(const TopoShape& spine,
|
||||
const TopoShape& profile,
|
||||
JoinType join,
|
||||
CoordinateSystem axeProf,
|
||||
MakeSolid solid,
|
||||
Spine profOnSpine,
|
||||
double tol,
|
||||
const char* op)
|
||||
{
|
||||
if (!op)
|
||||
if (!op) {
|
||||
op = Part::OpCodes::Evolve;
|
||||
if (tol == 0.0)
|
||||
}
|
||||
if (tol == 0.0) {
|
||||
tol = 1e-6;
|
||||
}
|
||||
|
||||
GeomAbs_JoinType joinType;
|
||||
switch (join) {
|
||||
case JoinType::Arc:
|
||||
case JoinType::tangent:
|
||||
joinType = GeomAbs_Tangent;
|
||||
break;
|
||||
case JoinType::Intersection:
|
||||
case JoinType::intersection:
|
||||
joinType = GeomAbs_Intersection;
|
||||
break;
|
||||
default:
|
||||
@@ -1885,45 +1889,56 @@ TopoShape &TopoShape::makEEvolve(const TopoShape &spine,
|
||||
}
|
||||
|
||||
TopoDS_Shape spineShape;
|
||||
if (spine.countSubShapes(TopAbs_FACE) > 0)
|
||||
if (spine.countSubShapes(TopAbs_FACE) > 0) {
|
||||
spineShape = spine.getSubShape(TopAbs_FACE, 1);
|
||||
else if (spine.countSubShapes(TopAbs_WIRE) > 0)
|
||||
}
|
||||
else if (spine.countSubShapes(TopAbs_WIRE) > 0) {
|
||||
spineShape = spine.getSubShape(TopAbs_WIRE, 1);
|
||||
else if (spine.countSubShapes(TopAbs_EDGE) > 0)
|
||||
spineShape = BRepBuilderAPI_MakeWire(TopoDS::Edge(spine.getSubShape(TopAbs_EDGE, 1))).Wire();
|
||||
if (spineShape.IsNull() || !BRepBuilderAPI_FindPlane(spineShape).Found())
|
||||
FC_THROWM(Base::CADKernelError, "Expect the the spine to be a planar wire or face");
|
||||
}
|
||||
else if (spine.countSubShapes(TopAbs_EDGE) > 0) {
|
||||
spineShape =
|
||||
BRepBuilderAPI_MakeWire(TopoDS::Edge(spine.getSubShape(TopAbs_EDGE, 1))).Wire();
|
||||
}
|
||||
if (spineShape.IsNull() || !BRepBuilderAPI_FindPlane(spineShape).Found()) {
|
||||
FC_THROWM(Base::CADKernelError, "Expect the spine to be a planar wire or face");
|
||||
}
|
||||
|
||||
TopoDS_Shape profileShape;
|
||||
if (profile.countSubShapes(TopAbs_FACE) > 0 || profile.countSubShapes(TopAbs_WIRE) > 0)
|
||||
if (profile.countSubShapes(TopAbs_FACE) > 0 || profile.countSubShapes(TopAbs_WIRE) > 0) {
|
||||
profileShape = profile.getSubShape(TopAbs_WIRE, 1);
|
||||
else if (profile.countSubShapes(TopAbs_EDGE) > 0)
|
||||
profileShape = BRepBuilderAPI_MakeWire(TopoDS::Edge(profile.getSubShape(TopAbs_EDGE, 1))).Wire();
|
||||
}
|
||||
else if (profile.countSubShapes(TopAbs_EDGE) > 0) {
|
||||
profileShape =
|
||||
BRepBuilderAPI_MakeWire(TopoDS::Edge(profile.getSubShape(TopAbs_EDGE, 1))).Wire();
|
||||
}
|
||||
if (profileShape.IsNull() || !BRepBuilderAPI_FindPlane(profileShape).Found()) {
|
||||
if (profileShape.IsNull()
|
||||
|| profile.countSubShapes(TopAbs_EDGE) > 1
|
||||
|| !profile.getSubTopoShape(TopAbs_EDGE, 1).isLinearEdge())
|
||||
{
|
||||
FC_THROWM(Base::CADKernelError, "Expect the the profile to be a planar wire or face or a line");
|
||||
if (profileShape.IsNull() || profile.countSubShapes(TopAbs_EDGE) > 1
|
||||
|| !profile.getSubTopoShape(TopAbs_EDGE, 1).isLinearEdge()) {
|
||||
FC_THROWM(Base::CADKernelError,
|
||||
"Expect the the profile to be a planar wire or a face or a line");
|
||||
}
|
||||
}
|
||||
if (spineShape.ShapeType() == TopAbs_FACE) {
|
||||
BRepOffsetAPI_MakeEvolved maker(TopoDS::Face(spineShape),
|
||||
TopoDS::Wire(profileShape), joinType,
|
||||
axeProf ? Standard_True : Standard_False,
|
||||
solid ? Standard_True : Standard_False,
|
||||
profOnSpine ? Standard_True : Standard_False,
|
||||
tol);
|
||||
return makEShape(maker, {spine, profile}, op);
|
||||
BRepOffsetAPI_MakeEvolved maker(
|
||||
TopoDS::Face(spineShape),
|
||||
TopoDS::Wire(profileShape),
|
||||
joinType,
|
||||
axeProf == CoordinateSystem::global ? Standard_True : Standard_False,
|
||||
solid == MakeSolid::makeSolid ? Standard_True : Standard_False,
|
||||
profOnSpine == Spine::on ? Standard_True : Standard_False,
|
||||
tol);
|
||||
return makeElementShape(maker, {spine, profile}, op);
|
||||
}
|
||||
else {
|
||||
BRepOffsetAPI_MakeEvolved maker(TopoDS::Wire(spineShape),
|
||||
TopoDS::Wire(profileShape), joinType,
|
||||
axeProf ? Standard_True : Standard_False,
|
||||
solid ? Standard_True : Standard_False,
|
||||
profOnSpine ? Standard_True : Standard_False,
|
||||
tol);
|
||||
return makEShape(maker, {spine, profile}, op);
|
||||
BRepOffsetAPI_MakeEvolved maker(
|
||||
TopoDS::Wire(spineShape),
|
||||
TopoDS::Wire(profileShape),
|
||||
joinType,
|
||||
axeProf == CoordinateSystem::global ? Standard_True : Standard_False,
|
||||
solid == MakeSolid::makeSolid ? Standard_True : Standard_False,
|
||||
profOnSpine == Spine::on ? Standard_True : Standard_False,
|
||||
tol);
|
||||
return makeElementShape(maker, {spine, profile}, op);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user