Path: add some diagnostic trace in Area

This commit is contained in:
Zheng, Lei
2020-01-24 07:58:57 +08:00
parent 28b98f752c
commit ec10b5e62e
2 changed files with 25 additions and 1 deletions

View File

@@ -135,6 +135,20 @@ AreaParams::AreaParams()
:PARAM_INIT(PARAM_FNAME,AREA_PARAMS_AREA)
{}
void AreaParams::dump(const char *msg) const {
#define AREA_PARAM_PRINT(_param) \
ss << PARAM_FNAME_STR(_param) << " = " << PARAM_FNAME(_param) << '\n';
if(FC_LOG_INSTANCE.level()>FC_LOGLEVEL_TRACE) {
std::ostringstream ss;
ss << msg << '\n';
PARAM_FOREACH(AREA_PARAM_PRINT, AREA_PARAMS_AREA)
FC_MSG(ss.str());
}
}
CAreaConfig::CAreaConfig(const CAreaParams &p, bool noFitArcs)
{
#define AREA_CONF_SAVE_AND_APPLY(_param) \
@@ -877,7 +891,9 @@ struct WireJoiner {
if(info.p1.SquareDistance(info.p2)<tol)
#endif
{
builder.Add(comp,BRepBuilderAPI_MakeWire(info.edge).Wire());
auto wire = BRepBuilderAPI_MakeWire(info.edge).Wire();
Area::showShape(wire,"closed");
builder.Add(comp,wire);
++count;
continue;
}
@@ -1002,6 +1018,7 @@ struct WireJoiner {
TopoDS_Wire wire = makeCleanWire(wireData,0.01);
if(!BRep_Tool::IsClosed(wire)) {
FC_WARN("failed to close some projection wire");
Area::showShape(wire,"failed");
++skips;
}else{
for(auto &r : stack) {
@@ -1271,6 +1288,8 @@ int Area::project(TopoDS_Shape &shape_out,
int skips = joiner.findClosedWires();
FC_TIME_LOG(t1,"WireJoiner findClosedWires");
showShape(joiner.comp,"pre_project");
Area area(params);
area.myParams.SectionCount = 0;
area.myParams.Offset = 0.0;
@@ -1284,6 +1303,9 @@ int Area::project(TopoDS_Shape &shape_out,
area.myProjecting = true;
area.add(joiner.comp, OperationUnion);
const TopoDS_Shape &shape = area.getShape();
area.myParams.dump("project");
showShape(shape,"projected");
FC_TIME_LOG(t1,"Clipper wire union");

View File

@@ -68,6 +68,8 @@ struct PathExport AreaParams: CAreaParams {
return !(*this == other);
}
void dump(const char *) const;
AreaParams();
};