From c0603ae3c540434ea2126fa4bd9eb49782921f1a Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 23 Apr 2008 07:06:43 +0000 Subject: [PATCH] protect from "hphy_flag = hgeo_flag = 0" error --- src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx | 7 ++++++- src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 9eb0c38..8899a5b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -133,7 +133,12 @@ bool BLSURFPlugin_BLSURF::CheckHypothesis { _hypothesis = static_cast (theHyp); ASSERT(_hypothesis); - aStatus = SMESH_Hypothesis::HYP_OK; + if ( _hypothesis->GetPhysicalMesh() == BLSURFPlugin_Hypothesis::DefaultSize && + _hypothesis->GetGeometricMesh() == BLSURFPlugin_Hypothesis::DefaultGeom ) + // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) + aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER; + else + aStatus = SMESH_Hypothesis::HYP_OK; } else aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 46dff32..6f727c5 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -57,13 +57,13 @@ enum Topology { enum PhysicalMesh { - DefaultSize, + DefaultSize = 0, PhysicalUserDefined }; enum GeometricMesh { - DefaultGeom, + DefaultGeom = 0, UserDefined }; @@ -308,6 +308,11 @@ void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { break; } myPhySize->setValue( aPhySize ); + // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) + if ( myGeometricMesh->currentItem() == DefaultGeom ) { + myGeometricMesh->setCurrentItem( UserDefined ); + onGeometricMeshChanged(); + } } } @@ -327,6 +332,11 @@ void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() { } myAngleMeshS->setValue( aAngleMeshS ); myGradation->setValue( aGradation ); + // hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec) + if ( myPhysicalMesh->currentItem() == DefaultSize ) { + myPhysicalMesh->setCurrentItem( PhysicalUserDefined ); + onPhysicalMeshChanged(); + } } } -- 2.39.2