diff --git a/Common/Options.cpp b/Common/Options.cpp index df4c02dfad54955efcdae2d465c08b1f710b073c..0e910764ea60cf2b27ce832d54e0d734ccd12583 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -4232,8 +4232,15 @@ double opt_geometry_auto_coherence(OPT_ARGS_NUM) double opt_geometry_hide_compounds(OPT_ARGS_NUM) { - if(action & GMSH_SET) + if(action & GMSH_SET){ + int old = CTX::instance()->geom.hideCompounds; CTX::instance()->geom.hideCompounds = (int)val; + if(old != (int)val){ + GModel::current()->setCompoundVisibility(); + CTX::instance()->mesh.changed = ENT_ALL; + if(FlGui::available()) FlGui::instance()->resetVisibility(); + } + } #if defined(HAVE_FLTK) if(FlGui::available() && (action & GMSH_GUI)){ FlGui::instance()->options->geo.butt[17]->value diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 256112a60ac7352543dbdb8ddf66e67a81ab0a6c..6e9a2293d3070a5cd2e18ff9d367f34cc02744e0 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -432,7 +432,6 @@ static void geometry_options_ok_cb(Fl_Widget *w, void *data) opt_geometry_occ_connect_faces(0, GMSH_SET, o->geo.butt[15]->value()); opt_geometry_light_two_side(0, GMSH_SET, o->geo.butt[14]->value()); - int old_hide_compound = (int)opt_geometry_hide_compounds(0, GMSH_GET, 0); opt_geometry_hide_compounds(0, GMSH_SET, o->geo.butt[17]->value()); opt_geometry_normals(0, GMSH_SET, o->geo.value[0]->value()); @@ -462,12 +461,6 @@ static void geometry_options_ok_cb(Fl_Widget *w, void *data) opt_geometry_transform(0, GMSH_SET, o->geo.choice[3]->value()); opt_geometry_label_type(0, GMSH_SET, o->geo.choice[4]->value() + 1); - if(old_hide_compound != (int)opt_geometry_hide_compounds(0, GMSH_GET, 0)){ - GModel::current()->setCompoundVisibility(); - FlGui::instance()->resetVisibility(); - CTX::instance()->mesh.changed = ENT_ALL; - } - if(CTX::instance()->fastRedraw) CTX::instance()->post.draw = CTX::instance()->mesh.draw = 0; drawContext::global()->draw(); diff --git a/tutorial/t12.geo b/tutorial/t12.geo index 74d8a98c8fe1df6dc7c837692d51404c45f5d2cf..e698d2b193e7c385fdd009e7151c01be827fb83c 100644 --- a/tutorial/t12.geo +++ b/tutorial/t12.geo @@ -11,7 +11,7 @@ // parametrization can then be used for remeshing the compound as if // it were a single CAD entity. -lc = 0.2; +lc = 0.1; Point(1) = {0, 0, 0, lc}; Point(2) = {1, 0, 0, lc}; Point(3) = {1, 1, 0.5, lc}; Point(4) = {0, 1, 0.4, lc}; @@ -36,9 +36,10 @@ Compound Line(101) = {6, 7, 8}; // Treat surfaces 12, 14 and 16 as a single surface Compound Surface(200) = {12, 14, 16}; -// Hide the original surfaces so we only see the compound -// (cross-patch) mesh -//Hide {Surface{12, 14, 16}; } +// Add option to toggle visibility of sub-entities +DefineConstant[ hide = {Geometry.HideCompounds, Choices{0,1}, + Name "Hide compound sub-entities", GmshOption "Geometry.HideCompounds", + AutoCheck 0} ]; // More details about the reparametrization technique can be found in // the following papers: diff --git a/tutorial/t13.geo b/tutorial/t13.geo index 4e2ca14a4f1072afcd873547ad4803ba3d92a3fa..b76be2a8be2046cd257d7dae6247cd592cd31436 100644 --- a/tutorial/t13.geo +++ b/tutorial/t13.geo @@ -46,12 +46,18 @@ Field[1] = MathEval; Field[1].F = "2.5"; Background Field = 1; -DefineConstant[ funny = {0, Choices{0,1}, Name "Apply funny mesh size field?"} ]; +DefineConstant[ + funny = {0, Choices{0,1}, Name "Apply funny mesh size field?"}, + hide = {0, Choices{0,1}, Name "Hide compound sub-entities"} +]; + If(funny) Field[1].F = "2*Sin((x+y)/5) + 3"; EndIf +DefineConstant[ ]; + Mesh.RemeshAlgorithm = 1; // automatic Mesh.RemeshParametrization = 7; // conformal finite element -Geometry.HideCompounds = 0; // don't hide the compound entities +Geometry.HideCompounds = hide; // hide the compound sub-entities? Mesh.Algorithm = 6; // Frontal