From 41711a232eef045e34929d286f445e48961a7673 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 25 Aug 2016 15:26:35 +0300 Subject: [PATCH] 53541: squish: MG-CADSurf Hypothesis Construction does not work correctly --- src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx | 2 + .../BLSURFPlugin_Hypothesis_i.cxx | 49 +++++++++++++------ src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 8 +-- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index b3bc714..be2f6c7 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -325,6 +325,7 @@ void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetGradation(double theVal) { if (theVal != _gradation) { + _useGradation = ( theVal > 0 ); _gradation = theVal; NotifySubMeshesHypothesisModification(); } @@ -341,6 +342,7 @@ void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal) { //============================================================================= void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal) { if (theVal != _volumeGradation) { + _useVolumeGradation = ( theVal > 0 ); _volumeGradation = theVal; NotifySubMeshesHypothesisModification(); } diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx index fb13d35..e5c3c0d 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -249,9 +249,12 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() { void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) { MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation"); ASSERT(myBaseImpl); - this->GetImpl()->SetUseGradation(theValue); - std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )"; + if ( GetImpl()->GetUseGradation() != bool( theValue )) + { + this->GetImpl()->SetUseGradation(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )"; + } } //============================================================================= @@ -278,7 +281,11 @@ void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) { // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); ASSERT(myBaseImpl); this->GetImpl()->SetGradation(theValue); - SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; + + if ( theValue < 0 ) + SetUseGradation( false ); + else + SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; } //============================================================================= @@ -304,9 +311,12 @@ CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() { void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) { MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation"); ASSERT(myBaseImpl); - this->GetImpl()->SetUseVolumeGradation(theValue); - std::string theValueStr = theValue ? "True" : "False"; - SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )"; + if ( GetImpl()->GetUseVolumeGradation() != bool( theValue )) + { + this->GetImpl()->SetUseVolumeGradation(theValue); + std::string theValueStr = theValue ? "True" : "False"; + SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )"; + } } //============================================================================= @@ -333,7 +343,10 @@ void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) { // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation"); ASSERT(myBaseImpl); this->GetImpl()->SetVolumeGradation(theValue); - SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )"; + if ( theValue < 0 ) + SetUseVolumeGradation( false ); + else + SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )"; } //============================================================================= @@ -1339,11 +1352,19 @@ void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, con else if ( name == "tiny_edge_optimisation_length" ) SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue )); + else if ( name == "remove_tiny_uv_edges" ) + SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue )); + + else if ( name == "process_3d_topology" ) + SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue )); + // advanced options (for backward compatibility) else if ( name == "create_tag_on_collision" || - name == "tiny_edge_respect_geometry" ) - AddOption( optionName, optionValue ); + name == "tiny_edge_respect_geometry" || + name == "remove_tiny_edges" || + name == "tiny_edge_length") + AddPreCADOption( optionName, optionValue ); else { valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue); @@ -3872,10 +3893,10 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() { } void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) { std::string theValueStr = theValue ? "1" : "0"; - this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str()); + this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str()); } CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { - std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges"); + std::string theValueStr = this->GetPreCADOption("remove_tiny_edges"); if (theValueStr == "1") return true; return false; @@ -3883,10 +3904,10 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() { void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) { std::ostringstream theValueStr; theValueStr << theValue; - this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str()); + this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str()); } CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() { - std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length")); + std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length")); double result; theValueStr >> result; return result; diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index aecdbe5..fb0f672 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -2525,10 +2525,10 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes h_data.myMinSizeRel = myStdWidget->myMinSizeRel->isChecked(); h_data.myMaxSize = myStdWidget->myMaxSize->text().isEmpty() ? -1.0 : myStdWidget->myMaxSize->GetValue(); h_data.myMaxSizeRel = myStdWidget->myMaxSizeRel->isChecked(); - h_data.myUseGradation = myStdWidget->myUseGradation->isChecked(); - h_data.myGradation = myStdWidget->myGradation->text().isEmpty() ? -1.0 : myStdWidget->myGradation->GetValue(); - h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked(); - h_data.myVolumeGradation = myStdWidget->myVolumeGradation->text().isEmpty() ? -1.0 : myStdWidget->myVolumeGradation->GetValue(); + h_data.myUseGradation = myStdWidget->myUseGradation->isChecked() && !myStdWidget->myGradation->text().isEmpty(); + h_data.myGradation = h_data.myUseGradation ? myStdWidget->myGradation->GetValue() : -1.0; + h_data.myUseVolumeGradation = myStdWidget->myUseVolumeGradation->isChecked() && !myStdWidget->myVolumeGradation->text().isEmpty(); + h_data.myVolumeGradation = h_data.myUseVolumeGradation ? myStdWidget->myVolumeGradation->GetValue() : -1. ; h_data.myAllowQuadrangles = myStdWidget->myAllowQuadrangles->isChecked(); h_data.myAngleMesh = myStdWidget->myAngleMesh->text().isEmpty() ? -1.0 : myStdWidget->myAngleMesh->GetValue(); h_data.myChordalError = myStdWidget->myChordalError->text().isEmpty() ? -1.0 : myStdWidget->myChordalError->GetValue(); -- 2.39.2