mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
#823 fallback to BRepBuilderAPI_Transformed in case of errors
This commit is contained in:
@@ -1191,13 +1191,25 @@ namespace {
|
||||
result = BRepPrimAPI_MakeRevol(section, circ->Axis(), depth).Shape();
|
||||
}
|
||||
|
||||
void process_sweep_as_pipe(const TopoDS_Wire& wire, const TopoDS_Wire& section, TopoDS_Shape& result) {
|
||||
void process_sweep_as_pipe(const TopoDS_Wire& wire, const TopoDS_Wire& section, TopoDS_Shape& result, bool force_transformed=false) {
|
||||
// This tolerance is fairly high due to the linear edge substitution for small (or large radii) conical curves.
|
||||
const bool is_continuous = wire_is_c1_continuous(wire, 1.e-2);
|
||||
static int i = 0;
|
||||
std::string fn = "pipe-wire-" + boost::lexical_cast<std::string>(i++) + ".brep";
|
||||
BRepTools::Write(wire, fn.c_str());
|
||||
BRepOffsetAPI_MakePipeShell builder(wire);
|
||||
builder.Add(section);
|
||||
builder.SetTransitionMode(is_continuous ? BRepBuilderAPI_Transformed : BRepBuilderAPI_RightCorner);
|
||||
builder.Build();
|
||||
builder.SetTransitionMode(is_continuous || force_transformed ? BRepBuilderAPI_Transformed : BRepBuilderAPI_RightCorner);
|
||||
try {
|
||||
builder.Build();
|
||||
} catch (Standard_Failure& e) {
|
||||
// We fallback to BRepBuilderAPI_Transformed, but likely with visual artefacts.
|
||||
if (!(is_continuous || force_transformed)) {
|
||||
return process_sweep_as_pipe(wire, section, result, true);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
builder.MakeSolid();
|
||||
result = builder.Shape();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user