fix: Correct sketch face rendering, orientation, and complex wire generation

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-18 11:42:24 -07:00
parent ce6975cc44
commit 0798cd2a6c
2 changed files with 24 additions and 17 deletions

View File

@@ -13,6 +13,7 @@
#include <gp_Circ.hxx>
#include <gp_Ax2.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
#include <QJsonArray>
@@ -113,21 +114,22 @@ void SketchFeature::buildShape()
}
if (!lineEdges.isEmpty()) {
BRepBuilderAPI_MakeWire wireBuilder;
TopoDS_Compound compound;
BRep_Builder builder;
builder.MakeCompound(compound);
for (const auto& edge : lineEdges) {
wireBuilder.Add(edge);
builder.Add(compound, edge);
}
if (wireBuilder.IsDone()) {
TopoDS_Shape wiresShape = wireBuilder.Shape();
TopExp_Explorer explorer(wiresShape, TopAbs_WIRE);
for (; explorer.More(); explorer.Next()) {
TopoDS_Wire wire = TopoDS::Wire(explorer.Current());
if (wire.Closed()) {
BRepBuilderAPI_MakeFace faceBuilder(wire);
if (faceBuilder.IsDone()) {
faces.append(faceBuilder.Face());
}
}
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(wire);
if (faceBuilder.IsDone()) {
faces.append(faceBuilder.Face());
}
}
}