If a Boolean fails, then make a note of it in the group's text
window screen, and remind the user that they could 'fix' the problem by working with meshes instead. [git-p4: depot-paths = "//depot/solvespace/": change = 1962]
This commit is contained in:
parent
842645d61f
commit
438d517c5a
@ -148,7 +148,10 @@ void Group::GenerateForBoolean(T *prevs, T *thiss, T *outs) {
|
||||
}
|
||||
}
|
||||
|
||||
void Group::GenerateShellAndMesh(void) {
|
||||
void Group::GenerateShellAndMesh(void) {
|
||||
bool prevBooleanFailed = booleanFailed;
|
||||
booleanFailed = false;
|
||||
|
||||
thisShell.Clear();
|
||||
thisMesh.Clear();
|
||||
runningShell.Clear();
|
||||
@ -292,6 +295,13 @@ void Group::GenerateShellAndMesh(void) {
|
||||
if(pg->runningMesh.IsEmpty() && thisMesh.IsEmpty() && !forceToMesh) {
|
||||
SShell *prevs = &(pg->runningShell);
|
||||
GenerateForBoolean<SShell>(prevs, &thisShell, &runningShell);
|
||||
|
||||
// If the Boolean failed, then we should note that in the text screen
|
||||
// for this group.
|
||||
booleanFailed = runningShell.booleanFailed;
|
||||
if(booleanFailed != prevBooleanFailed) {
|
||||
SS.later.showTW = true;
|
||||
}
|
||||
} else {
|
||||
SMesh prevm, thism;
|
||||
ZERO(&prevm);
|
||||
|
2
sketch.h
2
sketch.h
@ -145,6 +145,8 @@ public:
|
||||
Vector errorPointAt;
|
||||
} polyError;
|
||||
|
||||
bool booleanFailed;
|
||||
|
||||
SShell thisShell;
|
||||
SShell runningShell;
|
||||
|
||||
|
@ -454,6 +454,7 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *agnst, SShell *parent,
|
||||
ZERO(&poly);
|
||||
final.l.ClearTags();
|
||||
if(!final.AssemblePolygon(&poly, NULL, true)) {
|
||||
into->booleanFailed = true;
|
||||
DEBUGEDGELIST(&final, &ret);
|
||||
}
|
||||
poly.Clear();
|
||||
@ -530,6 +531,8 @@ void SShell::RewriteSurfaceHandlesForCurves(SShell *a, SShell *b) {
|
||||
// much faster than merging as union.
|
||||
//-----------------------------------------------------------------------------
|
||||
void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) {
|
||||
booleanFailed = false;
|
||||
|
||||
Vector t = Vector::From(0, 0, 0);
|
||||
Quaternion q = Quaternion::IDENTITY;
|
||||
int i = 0;
|
||||
@ -571,6 +574,8 @@ void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) {
|
||||
}
|
||||
|
||||
void SShell::MakeFromBoolean(SShell *a, SShell *b, int type) {
|
||||
booleanFailed = false;
|
||||
|
||||
a->MakeClassifyingBsps();
|
||||
b->MakeClassifyingBsps();
|
||||
|
||||
|
@ -626,6 +626,8 @@ void SShell::MakeFromCopyOf(SShell *a) {
|
||||
}
|
||||
|
||||
void SShell::MakeFromTransformationOf(SShell *a, Vector t, Quaternion q) {
|
||||
booleanFailed = false;
|
||||
|
||||
SSurface *s;
|
||||
for(s = a->surface.First(); s; s = a->surface.NextAfter(s)) {
|
||||
SSurface n;
|
||||
|
@ -278,6 +278,8 @@ public:
|
||||
IdList<SCurve,hSCurve> curve;
|
||||
IdList<SSurface,hSSurface> surface;
|
||||
|
||||
bool booleanFailed;
|
||||
|
||||
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
||||
int color);
|
||||
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
||||
|
@ -475,6 +475,12 @@ void TextWindow::ShowGroupInfo(void) {
|
||||
Printf(false,
|
||||
"%FtSURFACES%E %Fsas mesh%E");
|
||||
}
|
||||
|
||||
if(g->booleanFailed) {
|
||||
Printf(true, "The Boolean operation failed. It may be ");
|
||||
Printf(false, "possible to fix the problem by choosing ");
|
||||
Printf(false, "surfaces 'as mesh' instead of 'as NURBS'.");
|
||||
}
|
||||
}
|
||||
|
||||
// Leave more space if the group has configuration stuff above the req/
|
||||
|
Loading…
Reference in New Issue
Block a user