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:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user