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
@ -149,6 +149,9 @@ void Group::GenerateForBoolean(T *prevs, T *thiss, T *outs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Group::GenerateShellAndMesh(void) {
|
void Group::GenerateShellAndMesh(void) {
|
||||||
|
bool prevBooleanFailed = booleanFailed;
|
||||||
|
booleanFailed = false;
|
||||||
|
|
||||||
thisShell.Clear();
|
thisShell.Clear();
|
||||||
thisMesh.Clear();
|
thisMesh.Clear();
|
||||||
runningShell.Clear();
|
runningShell.Clear();
|
||||||
@ -292,6 +295,13 @@ void Group::GenerateShellAndMesh(void) {
|
|||||||
if(pg->runningMesh.IsEmpty() && thisMesh.IsEmpty() && !forceToMesh) {
|
if(pg->runningMesh.IsEmpty() && thisMesh.IsEmpty() && !forceToMesh) {
|
||||||
SShell *prevs = &(pg->runningShell);
|
SShell *prevs = &(pg->runningShell);
|
||||||
GenerateForBoolean<SShell>(prevs, &thisShell, &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 {
|
} else {
|
||||||
SMesh prevm, thism;
|
SMesh prevm, thism;
|
||||||
ZERO(&prevm);
|
ZERO(&prevm);
|
||||||
|
2
sketch.h
2
sketch.h
@ -145,6 +145,8 @@ public:
|
|||||||
Vector errorPointAt;
|
Vector errorPointAt;
|
||||||
} polyError;
|
} polyError;
|
||||||
|
|
||||||
|
bool booleanFailed;
|
||||||
|
|
||||||
SShell thisShell;
|
SShell thisShell;
|
||||||
SShell runningShell;
|
SShell runningShell;
|
||||||
|
|
||||||
|
@ -454,6 +454,7 @@ SSurface SSurface::MakeCopyTrimAgainst(SShell *agnst, SShell *parent,
|
|||||||
ZERO(&poly);
|
ZERO(&poly);
|
||||||
final.l.ClearTags();
|
final.l.ClearTags();
|
||||||
if(!final.AssemblePolygon(&poly, NULL, true)) {
|
if(!final.AssemblePolygon(&poly, NULL, true)) {
|
||||||
|
into->booleanFailed = true;
|
||||||
DEBUGEDGELIST(&final, &ret);
|
DEBUGEDGELIST(&final, &ret);
|
||||||
}
|
}
|
||||||
poly.Clear();
|
poly.Clear();
|
||||||
@ -530,6 +531,8 @@ void SShell::RewriteSurfaceHandlesForCurves(SShell *a, SShell *b) {
|
|||||||
// much faster than merging as union.
|
// much faster than merging as union.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) {
|
void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) {
|
||||||
|
booleanFailed = false;
|
||||||
|
|
||||||
Vector t = Vector::From(0, 0, 0);
|
Vector t = Vector::From(0, 0, 0);
|
||||||
Quaternion q = Quaternion::IDENTITY;
|
Quaternion q = Quaternion::IDENTITY;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -571,6 +574,8 @@ void SShell::MakeFromAssemblyOf(SShell *a, SShell *b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SShell::MakeFromBoolean(SShell *a, SShell *b, int type) {
|
void SShell::MakeFromBoolean(SShell *a, SShell *b, int type) {
|
||||||
|
booleanFailed = false;
|
||||||
|
|
||||||
a->MakeClassifyingBsps();
|
a->MakeClassifyingBsps();
|
||||||
b->MakeClassifyingBsps();
|
b->MakeClassifyingBsps();
|
||||||
|
|
||||||
|
@ -626,6 +626,8 @@ void SShell::MakeFromCopyOf(SShell *a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SShell::MakeFromTransformationOf(SShell *a, Vector t, Quaternion q) {
|
void SShell::MakeFromTransformationOf(SShell *a, Vector t, Quaternion q) {
|
||||||
|
booleanFailed = false;
|
||||||
|
|
||||||
SSurface *s;
|
SSurface *s;
|
||||||
for(s = a->surface.First(); s; s = a->surface.NextAfter(s)) {
|
for(s = a->surface.First(); s; s = a->surface.NextAfter(s)) {
|
||||||
SSurface n;
|
SSurface n;
|
||||||
|
@ -278,6 +278,8 @@ public:
|
|||||||
IdList<SCurve,hSCurve> curve;
|
IdList<SCurve,hSCurve> curve;
|
||||||
IdList<SSurface,hSSurface> surface;
|
IdList<SSurface,hSSurface> surface;
|
||||||
|
|
||||||
|
bool booleanFailed;
|
||||||
|
|
||||||
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
void MakeFromExtrusionOf(SBezierLoopSet *sbls, Vector t0, Vector t1,
|
||||||
int color);
|
int color);
|
||||||
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
void MakeFromRevolutionOf(SBezierLoopSet *sbls, Vector pt, Vector axis,
|
||||||
|
@ -475,6 +475,12 @@ void TextWindow::ShowGroupInfo(void) {
|
|||||||
Printf(false,
|
Printf(false,
|
||||||
"%FtSURFACES%E %Fsas mesh%E");
|
"%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/
|
// Leave more space if the group has configuration stuff above the req/
|
||||||
|
Loading…
Reference in New Issue
Block a user