Compare commits
3 Commits
768eed2f39
...
failed-fac
| Author | SHA1 | Date | |
|---|---|---|---|
| 1be782b88d | |||
| 3444e9e183 | |||
| fdd972b286 |
@@ -15,8 +15,11 @@
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <ShapeAnalysis_FreeBounds.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <BRepOffsetAPI_MakeFilling.hxx>
|
||||
#include <GeomAbs_Shape.hxx>
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QDebug>
|
||||
|
||||
SketchFeature::SketchFeature(const QString& name)
|
||||
: Feature(name)
|
||||
@@ -122,26 +125,28 @@ void SketchFeature::buildShape()
|
||||
}
|
||||
|
||||
if (!lineEdges.isEmpty()) {
|
||||
TopoDS_Compound compound;
|
||||
BRep_Builder builder;
|
||||
builder.MakeCompound(compound);
|
||||
for (const auto& edge : lineEdges) {
|
||||
builder.Add(compound, edge);
|
||||
qDebug() << "buildShape: processing" << lineEdges.size() << "line edges";
|
||||
|
||||
BRepOffsetAPI_MakeFilling faceMaker;
|
||||
for (const TopoDS_Edge& edge : lineEdges) {
|
||||
faceMaker.Add(edge, GeomAbs_C0);
|
||||
}
|
||||
faceMaker.Build();
|
||||
|
||||
ShapeAnalysis_FreeBounds freeBounds(compound, 1e-6, Standard_True);
|
||||
TopoDS_Compound closedWires = freeBounds.GetClosedWires();
|
||||
|
||||
TopExp_Explorer explorer(closedWires, TopAbs_WIRE);
|
||||
for (; explorer.More(); explorer.Next()) {
|
||||
TopoDS_Wire wire = TopoDS::Wire(explorer.Current());
|
||||
BRepBuilderAPI_MakeFace faceBuilder(sketchPlane, wire);
|
||||
if (faceBuilder.IsDone()) {
|
||||
faces.append(faceBuilder.Face());
|
||||
if (faceMaker.IsDone()) {
|
||||
TopExp_Explorer explorer(faceMaker.Shape(), TopAbs_FACE);
|
||||
int facesAdded = 0;
|
||||
for (; explorer.More(); explorer.Next()) {
|
||||
faces.append(TopoDS::Face(explorer.Current()));
|
||||
facesAdded++;
|
||||
}
|
||||
qDebug() << "buildShape: added" << facesAdded << "face(s) using MakeFilling";
|
||||
} else {
|
||||
qDebug() << "buildShape: MakeFilling failed";
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "buildShape: total faces created:" << faces.size();
|
||||
if (faces.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user