From bd0e97bad009e1267214653b1bf01a47baf9cfbb Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Fri, 15 Feb 2008 03:35:15 -0800 Subject: [PATCH] Now I can suppress an imported part; so the entities still show up, but the mesh doesn't get combined. That effectively hides it, good for looking inside and such. [git-p4: depot-paths = "//depot/solvespace/": change = 1860] --- file.cpp | 1 + groupmesh.cpp | 5 +++-- sketch.h | 2 ++ textscreens.cpp | 21 +++++++++++++++++++-- ui.h | 1 + 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/file.cpp b/file.cpp index c61c44f6..12de674d 100644 --- a/file.cpp +++ b/file.cpp @@ -85,6 +85,7 @@ const SolveSpace::SaveTable SolveSpace::SAVED[] = { { 'g', "Group.predef.negateU", 'b', &(SS.sv.g.predef.negateU) }, { 'g', "Group.predef.negateV", 'b', &(SS.sv.g.predef.negateV) }, { 'g', "Group.visible", 'b', &(SS.sv.g.visible) }, + { 'g', "Group.suppress", 'b', &(SS.sv.g.suppress) }, { 'g', "Group.remap", 'M', &(SS.sv.g.remap) }, { 'g', "Group.impFile", 'P', &(SS.sv.g.impFile) }, { 'g', "Group.impFileRel", 'P', &(SS.sv.g.impFileRel) }, diff --git a/groupmesh.cpp b/groupmesh.cpp index be4d910e..1116560d 100644 --- a/groupmesh.cpp +++ b/groupmesh.cpp @@ -511,8 +511,9 @@ void Group::GenerateMesh(void) { runningMesh.Clear(); // If this group contributes no new mesh, then our running mesh is the - // same as last time, no combining required. - if(thisMesh.l.n == 0) { + // same as last time, no combining required. Likewise if we have a mesh + // but it's suppressed. + if(thisMesh.l.n == 0 || suppress) { runningMesh.MakeFromCopy(PreviousGroupMesh()); goto done; } diff --git a/sketch.h b/sketch.h index f9ade1ee..fc5d66f9 100644 --- a/sketch.h +++ b/sketch.h @@ -94,6 +94,8 @@ public: hGroup opA; hGroup opB; bool visible; + bool suppress; + bool clean; bool vvMeshClean; hEntity activeWorkplane; diff --git a/textscreens.cpp b/textscreens.cpp index 62c0986b..a10f5d70 100644 --- a/textscreens.cpp +++ b/textscreens.cpp @@ -225,6 +225,15 @@ void TextWindow::ScreenChangeMeshCombine(int link, DWORD v) { SS.GenerateAll(); SS.GW.ClearSuper(); } +void TextWindow::ScreenChangeSuppress(int link, DWORD v) { + SS.UndoRemember(); + + Group *g = SS.GetGroup(SS.TW.shown.group); + g->suppress = !(g->suppress); + SS.MarkGroupDirty(g->h); + SS.GenerateAll(); + SS.GW.ClearSuper(); +} void TextWindow::ScreenChangeRightLeftHanded(int link, DWORD v) { SS.UndoRemember(); @@ -412,8 +421,16 @@ void TextWindow::ShowGroupInfo(void) { Group::COMBINE_AS_ASSEMBLE, (asy || !asa ? "" : "assemble"), (asy && asa ? "assemble" : "")); } - if(g->type == Group::IMPORTED && g->meshError.yes) { - Printf(false, "%Fx the parts interfere!"); + if(g->type == Group::IMPORTED) { + if(g->meshError.yes) { + Printf(false, "%Fx the parts interfere!"); + } + bool sup = g->suppress; + Printf(false, "%FtSUPPRESS%E %Fh%f%Ll%s%E%Fs%s%E / %Fh%f%Ll%s%E%Fs%s%E", + &TextWindow::ScreenChangeSuppress, + (sup ? "" : "yes"), (sup ? "yes" : ""), + &TextWindow::ScreenChangeSuppress, + (!sup ? "" : "no"), (!sup ? "no" : "")); } if(g->type == Group::EXTRUDE || diff --git a/ui.h b/ui.h index 7d5c7123..32596074 100644 --- a/ui.h +++ b/ui.h @@ -131,6 +131,7 @@ public: static void ScreenChangeOneOrTwoSides(int link, DWORD v); static void ScreenChangeSkipFirst(int link, DWORD v); static void ScreenChangeMeshCombine(int link, DWORD v); + static void ScreenChangeSuppress(int link, DWORD v); static void ScreenChangeRightLeftHanded(int link, DWORD v); static void ScreenChangeHelixParameter(int link, DWORD v); static void ScreenColor(int link, DWORD v);