1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_Gen_i.hxx"
29 #include "SMESH_PythonDump.hxx"
30 #include "GEOM_Object.hxx"
32 #include "Utils_CorbaException.hxx"
33 #include "utilities.h"
37 #include "boost/regex.hpp"
39 //=============================================================================
41 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
45 //=============================================================================
46 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
47 ::SMESH_Gen* theGenImpl) :
48 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
49 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
50 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
53 //=============================================================================
55 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
59 //=============================================================================
60 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
61 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 * BLSURFPlugin_Hypothesis_i::SetTopology
70 //=============================================================================
71 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
72 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
74 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
75 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
78 //=============================================================================
80 * BLSURFPlugin_Hypothesis_i::GetTopology
84 //=============================================================================
85 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
86 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
88 return this->GetImpl()->GetTopology();
91 //=============================================================================
93 //=============================================================================
95 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
100 //=============================================================================
101 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
102 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
104 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
105 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
108 //=============================================================================
110 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
114 //=============================================================================
115 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
116 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
118 return this->GetImpl()->GetPhysicalMesh();
121 //=============================================================================
123 * BLSURFPlugin_Hypothesis_i::SetPhySize
127 //=============================================================================
128 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
129 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
131 this->GetImpl()->SetPhySize(theValue);
132 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
135 //=============================================================================
137 * BLSURFPlugin_Hypothesis_i::GetPhySize
141 //=============================================================================
142 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
143 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
145 return this->GetImpl()->GetPhySize();
148 //=============================================================================
149 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
151 if (GetPhyMin() != theMinSize) {
152 this->GetImpl()->SetPhyMin(theMinSize);
153 SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )";
157 //=============================================================================
158 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
160 return this->GetImpl()->GetPhyMin();
163 //=============================================================================
164 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
166 if (GetPhyMax() != theMaxSize) {
167 this->GetImpl()->SetPhyMax(theMaxSize);
168 SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )";
172 //=============================================================================
173 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
175 return this->GetImpl()->GetPhyMax();
178 //=============================================================================
180 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
185 //=============================================================================
186 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
187 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
189 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
190 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
193 //=============================================================================
195 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
199 //=============================================================================
200 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
201 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
203 return this->GetImpl()->GetGeometricMesh();
206 //=============================================================================
208 * BLSURFPlugin_Hypothesis_i::SetAngleMeshS
212 //=============================================================================
213 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
214 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS");
216 this->GetImpl()->SetAngleMeshS(theValue);
217 SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )";
220 //=============================================================================
222 * BLSURFPlugin_Hypothesis_i::GetAngleMeshS
226 //=============================================================================
227 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
228 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS");
230 return this->GetImpl()->GetAngleMeshS();
233 //=============================================================================
234 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double angle) {
236 this->GetImpl()->SetAngleMeshC(angle);
237 SMESH::TPythonDump() << _this() << ".SetAngleMeshC( " << angle << " )";
240 //=============================================================================
241 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
243 return this->GetImpl()->GetAngleMeshC();
246 //=============================================================================
247 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
249 if (GetGeoMin() != theMinSize) {
250 this->GetImpl()->SetGeoMin(theMinSize);
251 SMESH::TPythonDump() << _this() << ".SetGeoMin( " << theMinSize << " )";
255 //=============================================================================
256 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
258 return this->GetImpl()->GetGeoMin();
261 //=============================================================================
262 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
264 if (GetGeoMax() != theMaxSize) {
265 this->GetImpl()->SetGeoMax(theMaxSize);
266 SMESH::TPythonDump() << _this() << ".SetGeoMax( " << theMaxSize << " )";
270 //=============================================================================
271 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
273 return this->GetImpl()->GetGeoMax();
276 //=============================================================================
278 * BLSURFPlugin_Hypothesis_i::SetGradation
282 //=============================================================================
283 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
284 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
286 this->GetImpl()->SetGradation(theValue);
287 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
290 //=============================================================================
292 * BLSURFPlugin_Hypothesis_i::GetGradation
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
298 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
300 return this->GetImpl()->GetGradation();
303 //=============================================================================
305 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
309 //=============================================================================
310 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
311 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
313 this->GetImpl()->SetQuadAllowed(theValue);
314 std::string theValueStr = theValue ? "True" : "False";
315 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
318 //=============================================================================
320 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
324 //=============================================================================
325 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
326 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
328 return this->GetImpl()->GetQuadAllowed();
331 //=============================================================================
333 * BLSURFPlugin_Hypothesis_i::SetDecimesh
337 //=============================================================================
338 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
339 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh");
341 this->GetImpl()->SetDecimesh(theValue);
342 std::string theValueStr = theValue ? "True" : "False";
343 SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValueStr.c_str() << " )";
346 //=============================================================================
348 * BLSURFPlugin_Hypothesis_i::GetDecimesh
352 //=============================================================================
353 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
354 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh");
356 return this->GetImpl()->GetDecimesh();
359 //=============================================================================
360 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
362 if (theVal < 0 || theVal > 100)
363 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
364 this->GetImpl()->SetVerbosity(theVal);
365 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
368 //=============================================================================
370 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
372 return (CORBA::Short) this->GetImpl()->GetVerbosity();
375 //=============================================================================
377 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
381 //=============================================================================
382 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
383 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
385 this->GetImpl()->SetPreCADMergeEdges(theValue);
386 std::string theValueStr = theValue ? "True" : "False";
387 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
396 //=============================================================================
397 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
398 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
400 return this->GetImpl()->GetPreCADMergeEdges();
403 //=============================================================================
405 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges
409 //=============================================================================
410 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
411 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges");
413 this->GetImpl()->SetPreCADRemoveNanoEdges(theValue);
414 std::string theValueStr = theValue ? "True" : "False";
415 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveNanoEdges( " << theValueStr.c_str() << " )";
418 //=============================================================================
420 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges
424 //=============================================================================
425 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
426 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges");
428 return this->GetImpl()->GetPreCADRemoveNanoEdges();
431 //=============================================================================
433 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
437 //=============================================================================
438 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
439 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
441 this->GetImpl()->SetPreCADDiscardInput(theValue);
442 std::string theValueStr = theValue ? "True" : "False";
443 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
446 //=============================================================================
448 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
452 //=============================================================================
453 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
454 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
456 return this->GetImpl()->GetPreCADDiscardInput();
459 //=============================================================================
461 * BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano
463 * Set length for nano edges
465 //=============================================================================
466 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
467 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano");
469 this->GetImpl()->SetPreCADEpsNano(theValue);
470 SMESH::TPythonDump() << _this() << ".SetPreCADEpsNano( " << theValue << " )";
473 //=============================================================================
475 * BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano
477 * Get length of nano edges
479 //=============================================================================
480 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
481 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano");
483 return this->GetImpl()->GetPreCADEpsNano();
486 //=============================================================================
488 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
489 throw (SALOME::SALOME_Exception) {
491 bool valueChanged = false;
493 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
495 this->GetImpl()->SetOptionValue(optionName, optionValue);
496 } catch (const std::invalid_argument& ex) {
497 SALOME::ExceptionStruct ExDescription;
498 ExDescription.text = ex.what();
499 ExDescription.type = SALOME::BAD_PARAM;
500 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
501 ExDescription.lineNumber = 0;
502 throw SALOME::SALOME_Exception(ExDescription);
503 } catch (SALOME_Exception& ex) {
504 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
507 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
510 //=============================================================================
512 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
513 throw (SALOME::SALOME_Exception) {
515 bool valueChanged = false;
517 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
519 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
520 } catch (const std::invalid_argument& ex) {
521 SALOME::ExceptionStruct ExDescription;
522 ExDescription.text = ex.what();
523 ExDescription.type = SALOME::BAD_PARAM;
524 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
525 ExDescription.lineNumber = 0;
526 throw SALOME::SALOME_Exception(ExDescription);
527 } catch (SALOME_Exception& ex) {
528 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
531 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
534 //=============================================================================
536 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
539 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
540 } catch (const std::invalid_argument& ex) {
541 SALOME::ExceptionStruct ExDescription;
542 ExDescription.text = ex.what();
543 ExDescription.type = SALOME::BAD_PARAM;
544 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
545 ExDescription.lineNumber = 0;
546 throw SALOME::SALOME_Exception(ExDescription);
547 } catch (SALOME_Exception& ex) {
548 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
553 //=============================================================================
555 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
558 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
559 } catch (const std::invalid_argument& ex) {
560 SALOME::ExceptionStruct ExDescription;
561 ExDescription.text = ex.what();
562 ExDescription.type = SALOME::BAD_PARAM;
563 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
564 ExDescription.lineNumber = 0;
565 throw SALOME::SALOME_Exception(ExDescription);
566 } catch (SALOME_Exception& ex) {
567 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
572 //=============================================================================
574 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
576 this->GetImpl()->ClearOption(optionName);
577 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
580 //=============================================================================
582 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
584 this->GetImpl()->ClearPreCADOption(optionName);
585 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
588 //=============================================================================
590 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
592 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
594 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
595 result->length(opts.size());
597 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
598 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
599 string name_value = opIt->first;
600 if (!opIt->second.empty()) {
602 name_value += opIt->second;
604 result[i] = CORBA::string_dup(name_value.c_str());
606 return result._retn();
609 //=============================================================================
611 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
613 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
615 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
616 result->length(opts.size());
618 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
619 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
620 string name_value = opIt->first;
621 if (!opIt->second.empty()) {
623 name_value += opIt->second;
625 result[i] = CORBA::string_dup(name_value.c_str());
627 return result._retn();
630 //=============================================================================
632 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
633 throw (SALOME::SALOME_Exception) {
635 for (int i = 0; i < options.length(); ++i) {
636 string name_value = options[i].in();
637 int colonPos = name_value.find(':');
639 if (colonPos == string::npos) // ':' not found
642 name = name_value.substr(0, colonPos);
643 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
644 value = name_value.substr(colonPos + 1);
646 SetOptionValue(name.c_str(), value.c_str());
650 //=============================================================================
652 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
653 throw (SALOME::SALOME_Exception) {
655 for (int i = 0; i < options.length(); ++i) {
656 string name_value = options[i].in();
657 int colonPos = name_value.find(':');
659 if (colonPos == string::npos) // ':' not found
662 name = name_value.substr(0, colonPos);
663 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
664 value = name_value.substr(colonPos + 1);
666 SetPreCADOptionValue(name.c_str(), value.c_str());
670 //=============================================================================
672 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
673 throw (SALOME::SALOME_Exception) {
675 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
676 bool valueChanged = false;
678 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
680 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
681 } catch (const std::invalid_argument& ex) {
682 SALOME::ExceptionStruct ExDescription;
683 ExDescription.text = ex.what();
684 ExDescription.type = SALOME::BAD_PARAM;
685 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
686 ExDescription.lineNumber = 0;
687 throw SALOME::SALOME_Exception(ExDescription);
688 } catch (SALOME_Exception& ex) {
689 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
691 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
693 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
696 //=============================================================================
698 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
699 throw (SALOME::SALOME_Exception) {
701 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
702 bool valueChanged = false;
704 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
705 if ( valueChanged ) {
706 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
707 if (!boost::regex_match(string(attractor), re))
708 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
709 this->GetImpl()->SetAttractorEntry(entry, attractor);
711 } catch (const std::invalid_argument& ex) {
712 SALOME::ExceptionStruct ExDescription;
713 ExDescription.text = ex.what();
714 ExDescription.type = SALOME::BAD_PARAM;
715 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
716 ExDescription.lineNumber = 0;
717 throw SALOME::SALOME_Exception(ExDescription);
718 } catch (SALOME_Exception& ex) {
719 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
721 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
723 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
726 //=============================================================================
728 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius) //TODO à finir
729 throw (SALOME::SALOME_Exception)
732 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
733 bool valueChanged = false;
735 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
737 catch (const std::invalid_argument& ex) {
738 SALOME::ExceptionStruct ExDescription;
739 ExDescription.text = ex.what();
740 ExDescription.type = SALOME::BAD_PARAM;
741 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
742 ExDescription.lineNumber = 0;
743 throw SALOME::SALOME_Exception(ExDescription);
744 } catch (SALOME_Exception& ex) {
745 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
747 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
748 //if ( valueChanged )
749 SMESH::TPythonDump() << _this() << ".SetAttractorGeom("
750 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
753 //=============================================================================
755 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
758 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
759 } catch (const std::invalid_argument& ex) {
760 SALOME::ExceptionStruct ExDescription;
761 ExDescription.text = ex.what();
762 ExDescription.type = SALOME::BAD_PARAM;
763 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
764 ExDescription.lineNumber = 0;
765 throw SALOME::SALOME_Exception(ExDescription);
766 } catch (SALOME_Exception& ex) {
767 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
772 //=============================================================================
774 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
777 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
778 } catch (const std::invalid_argument& ex) {
779 SALOME::ExceptionStruct ExDescription;
780 ExDescription.text = ex.what();
781 ExDescription.type = SALOME::BAD_PARAM;
782 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
783 ExDescription.lineNumber = 0;
784 throw SALOME::SALOME_Exception(ExDescription);
785 } catch (SALOME_Exception& ex) {
786 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
791 // //=============================================================================
793 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
794 // // A finir pour le dump
795 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
796 // throw (SALOME::SALOME_Exception)
798 // ASSERT(myBaseImpl);
800 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
802 // catch (const std::invalid_argument& ex) {
803 // SALOME::ExceptionStruct ExDescription;
804 // ExDescription.text = ex.what();
805 // ExDescription.type = SALOME::BAD_PARAM;
806 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
807 // ExDescription.lineNumber = 0;
808 // throw SALOME::SALOME_Exception(ExDescription);
810 // catch (SALOME_Exception& ex) {
811 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
816 //=============================================================================
818 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
820 this->GetImpl()->ClearEntry(entry);
821 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
824 //=============================================================================
826 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
828 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
830 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
831 result->length(sizeMaps.size());
833 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
834 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
835 string entry_sizemap = smIt->first;
836 if (!smIt->second.empty()) {
837 entry_sizemap += "|";
838 entry_sizemap += smIt->second;
840 result[i] = CORBA::string_dup(entry_sizemap.c_str());
842 return result._retn();
845 //=============================================================================
847 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
849 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
851 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
852 result->length(attractors.size());
854 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
855 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
856 string entry_attractor = atIt->first;
857 if (!atIt->second.empty()) {
858 entry_attractor += "|";
859 entry_attractor += atIt->second;
861 result[i] = CORBA::string_dup(entry_attractor.c_str());
863 return result._retn();
866 //=============================================================================
868 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
871 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
873 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
874 result->length( attractors.size() );
876 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
877 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
878 string faceEntry = atIt->first;
880 double startSize, endSize, infDist, constDist;
881 if ( !atIt->second->Empty() ) {
882 attEntry = atIt->second->GetAttractorEntry();
883 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
884 std::vector<double> params = atIt->second->GetParameters();
885 startSize = params[0];
888 constDist = params[3];
890 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
891 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
892 result[i].startSize = startSize;
893 result[i].endSize = endSize;
894 result[i].infDist = infDist;
895 result[i].constDist = constDist;
896 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
897 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
899 return result._retn();
902 //=============================================================================
904 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
905 throw (SALOME::SALOME_Exception) {
907 for (int i = 0; i < sizeMaps.length(); ++i) {
908 string entry_sizemap = sizeMaps[i].in();
909 int colonPos = entry_sizemap.find('|');
910 string entry, sizemap;
911 if (colonPos == string::npos) // '|' separator not found
912 entry = entry_sizemap;
914 entry = entry_sizemap.substr(0, colonPos);
915 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
916 sizemap = entry_sizemap.substr(colonPos + 1);
918 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
922 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
926 this->GetImpl()->ClearSizeMaps();
929 //=============================================================================
931 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {
934 entry = GeomObj->GetStudyEntry();
935 MESSAGE("IDL : GetName : " << GeomObj->GetName());
936 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
937 SetSizeMapEntry(entry.c_str(), sizeMap);
940 //=============================================================================
941 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
944 entry = GeomObj->GetStudyEntry();
945 MESSAGE("IDL : GetName : " << GeomObj->GetName());
946 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
947 UnsetEntry(entry.c_str());
948 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
951 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
954 entry = GeomObj->GetStudyEntry();
955 MESSAGE("IDL : GetName : " << GeomObj->GetName());
956 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
957 SetAttractorEntry(entry.c_str(), attractor);
960 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
963 entry = GeomObj->GetStudyEntry();
964 MESSAGE("IDL : GetName : " << GeomObj->GetName());
965 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
966 UnsetEntry(entry.c_str());
967 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
970 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, double StartSize, double EndSize, double ActionRadius, double ConstantRadius)
975 theFaceEntry = theFace->GetStudyEntry();
976 theAttEntry = theAttractor->GetStudyEntry();
978 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
979 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
982 if (theFaceEntry.empty()) {
984 aName += theFace->GetEntry();
985 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
986 if (!theSFace->_is_nil())
987 theFaceEntry = theSFace->GetID();
989 if (theFaceEntry.empty())
990 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
992 if (theAttEntry.empty()) {
993 if (theAttractor->GetShapeType() == GEOM::VERTEX)
995 if (theAttractor->GetShapeType() == GEOM::EDGE)
997 if (theAttractor->GetShapeType() == GEOM::WIRE)
999 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1000 aName = "Compound_";
1001 aName += theAttractor->GetEntry();
1002 SALOMEDS::SObject_ptr theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1003 if (!theSAtt->_is_nil())
1004 theAttEntry = theSAtt->GetID();
1006 if (theAttEntry.empty())
1007 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1009 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1010 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1011 MESSAGE("IDL : GetName : " << theFace->GetName());
1012 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1013 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1016 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace)
1019 string theFaceEntry;
1020 theFaceEntry = theFace->GetStudyEntry();
1022 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1023 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1026 if (theFaceEntry.empty()) {
1028 aName += theFace->GetEntry();
1029 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1030 if (!theSFace->_is_nil())
1031 theFaceEntry = theSFace->GetID();
1033 if (theFaceEntry.empty())
1034 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1036 MESSAGE("IDL : GetName : " << theFace->GetName());
1037 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1038 UnsetEntry( theFaceEntry.c_str());
1039 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << theFaceEntry.c_str() << " )";
1043 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1046 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1049 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1052 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1055 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1058 this->GetImpl()->UnsetCustomSizeMap(entry);
1059 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1063 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1068 // ///////////////////////
1069 // // ENFORCED VERTICES //
1070 // ///////////////////////
1074 * Returns the list of enforced vertices for a given Face entry
1075 * @return A map of Face entry / List of enforced vertices
1078 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1079 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1082 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1084 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1085 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1086 resultMap->length(faceEntryEnfVertexListMap.size());
1087 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1089 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1090 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1091 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1092 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1093 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1094 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1095 MESSAGE("Face Entry: " << mapElement->faceEntry);
1097 _enfVertexList = it_entry->second;
1098 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1099 enfVertexList->length(_enfVertexList.size());
1100 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1102 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1103 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1104 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1105 currentEnfVertex = (*it_enfVertex);
1107 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1110 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1113 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1116 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1117 coords->length(currentEnfVertex->coords.size());
1118 for (int i=0;i<coords->length();i++)
1119 coords[i] = currentEnfVertex->coords[i];
1120 enfVertex->coords = coords;
1123 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1126 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1127 faceEntryList->length(currentEnfVertex->faceEntries.size());
1128 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1129 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1130 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1131 enfVertex->faceEntries = faceEntryList;
1134 msg << "Enforced vertex: \n"
1135 << "Name: " << enfVertex->name << "\n";
1136 if (coords->length())
1137 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1138 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1139 << "Group Name: " << enfVertex->grpName;
1142 enfVertexList[j] = enfVertex;
1144 mapElement->enfVertexList = enfVertexList;
1146 resultMap[i] = mapElement;
1149 return resultMap._retn();
1153 * Returns the list of all enforced vertices
1154 * @return a list of enforced vertices
1157 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1158 MESSAGE("IDL: GetAllEnforcedVertices()");
1160 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1161 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1162 resultMap->length(enfVertexList.size());
1163 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1165 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1166 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1167 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1168 MESSAGE("Enforced Vertex #" << i);
1169 currentEnfVertex = (*evlIt);
1170 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1172 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1174 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1176 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1177 coords->length(currentEnfVertex->coords.size());
1178 for (int ind = 0; ind < coords->length(); ind++)
1179 coords[ind] = currentEnfVertex->coords[ind];
1180 enfVertex->coords = coords;
1182 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1184 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1185 faceEntryList->length(currentEnfVertex->faceEntries.size());
1186 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1187 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1188 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1189 enfVertex->faceEntries = faceEntryList;
1192 msg << "Enforced vertex: \n"
1193 << "Name: " << enfVertex->name << "\n";
1194 if (coords->length())
1195 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1196 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1197 << "Group Name: " << enfVertex->grpName;
1200 resultMap[i] = enfVertex;
1202 return resultMap._retn();
1207 * Returns the list of enforced vertices coords for a given Face entry.
1208 * They are the coords of the "manual" enforced vertices.
1209 * @return A map of Face entry / List of enforced vertices coords
1212 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1213 MESSAGE("IDL: GetAllCoordsByFace()");
1216 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1218 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1219 resultMap->length(entryCoordsListMap.size());
1220 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1222 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1223 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1224 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1225 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1226 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1227 MESSAGE("Face Entry: " << mapElement->faceEntry);
1229 _coordsList = it_entry->second;
1230 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1231 coordsList->length(_coordsList.size());
1232 MESSAGE("Number of coords: " << coordsList->length());
1234 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1235 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1236 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1237 coords->length((*it_coords).size());
1238 for (int i=0;i<coords->length();i++)
1239 coords[i] = (*it_coords)[i];
1240 coordsList[j] = coords;
1241 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1243 mapElement->coordsList = coordsList;
1245 resultMap[i] = mapElement;
1248 return resultMap._retn();
1252 * Returns a map of enforced vertices coords / enforced vertex.
1253 * They are the coords of the "manual" enforced vertices.
1255 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1256 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1259 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1260 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1261 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1262 resultMap->length(coordsEnfVertexMap.size());
1263 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1265 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1266 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1267 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1268 MESSAGE("Enforced Vertex #" << i);
1269 currentEnfVertex = (it_coords->second);
1270 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1271 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1272 coords->length(it_coords->first.size());
1273 for (int ind=0;ind<coords->length();ind++)
1274 coords[ind] = it_coords->first[ind];
1275 mapElement->coords = coords;
1276 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1278 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1280 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1282 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1284 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1285 coords2->length(currentEnfVertex->coords.size());
1286 for (int ind=0;ind<coords2->length();ind++)
1287 coords2[ind] = currentEnfVertex->coords[ind];
1288 enfVertex->coords = coords2;
1290 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1292 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1293 faceEntryList->length(currentEnfVertex->faceEntries.size());
1294 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1295 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1296 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1297 enfVertex->faceEntries = faceEntryList;
1299 mapElement->enfVertex = enfVertex;
1301 msg << "Enforced vertex: \n"
1302 << "Name: " << enfVertex->name << "\n";
1303 if (coords->length())
1304 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1305 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1306 << "Group Name: " << enfVertex->grpName;
1309 resultMap[i] = mapElement;
1311 return resultMap._retn();
1315 * Returns the list of enforced vertices entries for a given Face entry.
1316 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1317 * @return A map of Face entry / List of enforced vertices geom entries
1320 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1321 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1324 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1326 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1327 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1328 resultMap->length(entryEnfVertexEntryListMap.size());
1329 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1331 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1332 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1333 entryEnfVertexEntryListMap.begin();
1334 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1335 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1336 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1337 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1338 MESSAGE("Face Entry: " << mapElement->faceEntry);
1340 _enfVertexEntryList = it_entry->second;
1341 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1342 enfVertexEntryList->length(_enfVertexEntryList.size());
1343 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1345 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1346 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1347 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1348 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1350 mapElement->enfVertexEntryList = enfVertexEntryList;
1352 resultMap[i] = mapElement;
1355 return resultMap._retn();
1359 * Returns a map of enforced vertices geom entry / enforced vertex.
1360 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1362 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1363 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1366 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1367 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1368 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1369 resultMap->length(enfVertexEntryEnfVertexMap.size());
1370 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1372 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1373 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1374 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1375 MESSAGE("Enforced Vertex #" << i);
1376 currentEnfVertex = it_enfVertexEntry->second;
1377 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1378 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1379 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1381 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1383 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1385 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1387 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1388 coords->length(currentEnfVertex->coords.size());
1389 for (int ind=0;ind<coords->length();ind++)
1390 coords[ind] = currentEnfVertex->coords[ind];
1391 enfVertex->coords = coords;
1393 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1395 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1396 faceEntryList->length(currentEnfVertex->faceEntries.size());
1397 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1398 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1399 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1400 enfVertex->faceEntries = faceEntryList;
1403 msg << "Enforced vertex: \n"
1404 << "Name: " << enfVertex->name << "\n";
1405 if (coords->length())
1406 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1407 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1408 << "Group Name: " << enfVertex->grpName;
1411 mapElement->enfVertex = enfVertex;
1412 resultMap[i] = mapElement;
1414 return resultMap._retn();
1418 * Erase all enforced vertices
1420 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1422 this->GetImpl()->ClearAllEnforcedVertices();
1423 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1427 * Set/get/unset an enforced vertex on face
1429 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1430 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1433 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1434 MESSAGE("theFace shape type is not FACE or COMPOUND");
1435 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1438 string theFaceEntry = theFace->GetStudyEntry();
1440 if (theFaceEntry.empty()) {
1441 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1442 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1444 if (theFace->GetShapeType() == GEOM::FACE)
1446 if (theFace->GetShapeType() == GEOM::COMPOUND)
1447 aName = "Compound_";
1448 aName += theFace->GetEntry();
1449 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1450 if (!theSFace->_is_nil())
1451 theFaceEntry = theSFace->GetID();
1453 if (theFaceEntry.empty())
1454 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1455 MESSAGE("IDL : GetName : " << theFace->GetName());
1456 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1458 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1459 } catch (SALOME_Exception& ex) {
1460 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1465 * Set/get/unset an enforced vertex with name on face
1467 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1468 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1471 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1472 MESSAGE("theFace shape type is not FACE or COMPOUND");
1473 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1476 string theFaceEntry = theFace->GetStudyEntry();
1478 if (theFaceEntry.empty()) {
1479 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1480 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1482 if (theFace->GetShapeType() == GEOM::FACE)
1484 if (theFace->GetShapeType() == GEOM::COMPOUND)
1485 aName = "Compound_";
1486 aName += theFace->GetEntry();
1487 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1488 if (!theSFace->_is_nil())
1489 theFaceEntry = theSFace->GetID();
1491 if (theFaceEntry.empty())
1492 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1494 MESSAGE("IDL : GetName : " << theFace->GetName());
1495 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1497 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1498 } catch (SALOME_Exception& ex) {
1499 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1504 * Set/get/unset an enforced vertex with geom object on face
1506 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1507 throw (SALOME::SALOME_Exception) {
1510 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1511 MESSAGE("theFace shape type is not FACE or COMPOUND");
1512 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1515 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1516 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1517 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1520 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1521 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1522 // if (CORBA::is_nil(measureOp))
1525 // CORBA::Double x, y, z;
1527 // measureOp->PointCoordinates(theVertex, x, y, z);
1529 string theFaceEntry = theFace->GetStudyEntry();
1530 string theVertexEntry = theVertex->GetStudyEntry();
1532 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1533 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1536 if (theFaceEntry.empty()) {
1537 if (theFace->GetShapeType() == GEOM::FACE)
1539 if (theFace->GetShapeType() == GEOM::COMPOUND)
1540 aName = "Compound_";
1541 aName += theFace->GetEntry();
1542 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1543 if (!theSFace->_is_nil())
1544 theFaceEntry = theSFace->GetID();
1546 if (theFaceEntry.empty())
1547 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1549 if (theVertexEntry.empty()) {
1550 if (theVertex->GetShapeType() == GEOM::VERTEX)
1552 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1553 aName = "Compound_";
1554 aName += theVertex->GetEntry();
1555 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1556 if (!theSVertex->_is_nil())
1557 theVertexEntry = theSVertex->GetID();
1559 if (theVertexEntry.empty())
1560 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1562 string theVertexName = theVertex->GetName();
1563 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1564 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1565 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1567 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1568 } catch (SALOME_Exception& ex) {
1569 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1574 * Set an enforced vertex with group name on face
1576 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1577 throw (SALOME::SALOME_Exception)
1581 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1582 MESSAGE("theFace shape type is not FACE or COMPOUND");
1583 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1586 string theFaceEntry = theFace->GetStudyEntry();
1588 if (theFaceEntry.empty()) {
1589 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1590 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1592 if (theFace->GetShapeType() == GEOM::FACE)
1594 if (theFace->GetShapeType() == GEOM::COMPOUND)
1595 aName = "Compound_";
1596 aName += theFace->GetEntry();
1597 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1598 if (!theSFace->_is_nil())
1599 theFaceEntry = theSFace->GetID();
1601 if (theFaceEntry.empty())
1602 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1603 MESSAGE("IDL : GetName : " << theFace->GetName());
1604 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1606 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1607 } catch (SALOME_Exception& ex) {
1608 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1613 * Set an enforced vertex with name and group name on face
1615 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1616 const char* theVertexName, const char* theGroupName)
1617 throw (SALOME::SALOME_Exception)
1621 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1622 MESSAGE("theFace shape type is not FACE or COMPOUND");
1623 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1626 string theFaceEntry = theFace->GetStudyEntry();
1628 if (theFaceEntry.empty()) {
1629 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1630 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1632 if (theFace->GetShapeType() == GEOM::FACE)
1634 if (theFace->GetShapeType() == GEOM::COMPOUND)
1635 aName = "Compound_";
1636 aName += theFace->GetEntry();
1637 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1638 if (!theSFace->_is_nil())
1639 theFaceEntry = theSFace->GetID();
1641 if (theFaceEntry.empty())
1642 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1643 MESSAGE("IDL : GetName : " << theFace->GetName());
1644 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
1646 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
1647 } catch (SALOME_Exception& ex) {
1648 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1653 * Set an enforced vertex with geom entry and group name on face
1655 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
1656 throw (SALOME::SALOME_Exception)
1660 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1661 MESSAGE("theFace shape type is not FACE or COMPOUND");
1662 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1665 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1666 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1667 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1670 string theFaceEntry = theFace->GetStudyEntry();
1671 string theVertexEntry = theVertex->GetStudyEntry();
1673 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1674 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1677 if (theFaceEntry.empty()) {
1678 if (theFace->GetShapeType() == GEOM::FACE)
1680 if (theFace->GetShapeType() == GEOM::COMPOUND)
1681 aName = "Compound_";
1682 aName += theFace->GetEntry();
1683 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1684 if (!theSFace->_is_nil())
1685 theFaceEntry = theSFace->GetID();
1687 if (theFaceEntry.empty())
1688 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1690 if (theVertexEntry.empty()) {
1691 if (theVertex->GetShapeType() == GEOM::VERTEX)
1693 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1694 aName = "Compound_";
1695 aName += theVertex->GetEntry();
1696 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1697 if (!theSVertex->_is_nil())
1698 theVertexEntry = theSVertex->GetID();
1700 if (theVertexEntry.empty())
1701 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1703 string theVertexName = theVertex->GetName();
1704 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1705 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1706 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
1708 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
1709 } catch (SALOME_Exception& ex) {
1710 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1714 //Enable internal enforced vertices on specific face if requested by user
1716 // * Are internal enforced vertices used for a face ?
1718 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
1719 // throw (SALOME::SALOME_Exception) {
1720 // ASSERT(myBaseImpl);
1722 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1723 // MESSAGE("theFace shape type is not FACE or COMPOUND");
1724 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1727 // string theFaceEntry = theFace->GetStudyEntry();
1729 // if (theFaceEntry.empty()) {
1730 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1731 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1733 // if (theFace->GetShapeType() == GEOM::FACE)
1735 // if (theFace->GetShapeType() == GEOM::COMPOUND)
1736 // aName = "Compound_";
1737 // aName += theFace->GetEntry();
1738 // SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1739 // if (!theSFace->_is_nil())
1740 // theFaceEntry = theSFace->GetID();
1742 // if (theFaceEntry.empty())
1743 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1745 // MESSAGE("IDL : GetName : " << theFace->GetName());
1746 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
1748 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
1749 // } catch (SALOME_Exception& ex) {
1750 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1755 * Get the list of all enforced vertices
1757 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
1758 throw (SALOME::SALOME_Exception) {
1761 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1762 MESSAGE("theFace shape type is not FACE or COMPOUND");
1763 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1766 string theFaceEntry = theFace->GetStudyEntry();
1768 if (theFaceEntry.empty()) {
1769 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1770 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1772 if (theFace->GetShapeType() == GEOM::FACE)
1774 if (theFace->GetShapeType() == GEOM::COMPOUND)
1775 aName = "Compound_";
1776 aName += theFace->GetEntry();
1777 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1778 if (!theSFace->_is_nil())
1779 theFaceEntry = theSFace->GetID();
1781 if (theFaceEntry.empty())
1782 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1784 MESSAGE("IDL : GetName : " << theFace->GetName());
1785 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
1787 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
1788 } catch (SALOME_Exception& ex) {
1789 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1793 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1794 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1797 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1798 MESSAGE("theFace shape type is not FACE or COMPOUND");
1799 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1802 string theFaceEntry = theFace->GetStudyEntry();
1804 if (theFaceEntry.empty()) {
1805 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1806 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1808 if (theFace->GetShapeType() == GEOM::FACE)
1810 if (theFace->GetShapeType() == GEOM::COMPOUND)
1811 aName = "Compound_";
1812 aName += theFace->GetEntry();
1813 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1814 if (!theSFace->_is_nil())
1815 theFaceEntry = theSFace->GetID();
1817 if (theFaceEntry.empty())
1818 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1819 MESSAGE("IDL : GetName : " << theFace->GetName());
1820 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1823 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1824 } catch (SALOME_Exception& ex) {
1825 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1829 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1830 throw (SALOME::SALOME_Exception) {
1833 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1834 MESSAGE("theFace shape type is not FACE or COMPOUND");
1835 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1837 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1838 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1839 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1842 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1843 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1844 // if (CORBA::is_nil(measureOp))
1847 // CORBA::Double x, y, z;
1849 // measureOp->PointCoordinates(theVertex, x, y, z);
1851 std::string theFaceEntry = theFace->GetStudyEntry();
1852 std::string theVertexEntry = theVertex->GetStudyEntry();
1854 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1855 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1858 if (theFaceEntry.empty()) {
1859 if (theFace->GetShapeType() == GEOM::FACE)
1861 if (theFace->GetShapeType() == GEOM::COMPOUND)
1862 aName = "Compound_";
1863 aName += theFace->GetEntry();
1864 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1865 if (!theSFace->_is_nil())
1866 theFaceEntry = theSFace->GetID();
1868 if (theFaceEntry.empty())
1869 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1871 if (theVertexEntry.empty()) {
1872 if (theVertex->GetShapeType() == GEOM::VERTEX)
1874 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1875 aName = "Compound_";
1876 aName += theVertex->GetEntry();
1877 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1878 if (!theSVertex->_is_nil())
1879 theVertexEntry = theSVertex->GetID();
1881 if (theVertexEntry.empty())
1882 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1884 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
1887 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
1888 } catch (SALOME_Exception& ex) {
1889 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1893 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
1896 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1897 MESSAGE("theFace shape type is not FACE or COMPOUND");
1898 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1901 string theFaceEntry = theFace->GetStudyEntry();
1903 if (theFaceEntry.empty()) {
1904 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1905 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1907 if (theFace->GetShapeType() == GEOM::FACE)
1909 if (theFace->GetShapeType() == GEOM::COMPOUND)
1910 aName = "Compound_";
1911 aName += theFace->GetEntry();
1912 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1913 if (!theSFace->_is_nil())
1914 theFaceEntry = theSFace->GetID();
1916 if (theFaceEntry.empty())
1917 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1919 MESSAGE("IDL : GetName : " << theFace->GetName());
1920 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
1923 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
1924 } catch (SALOME_Exception& ex) {
1925 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1930 * Set/get/unset an enforced vertex on geom object given by entry
1932 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
1933 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
1934 throw (SALOME::SALOME_Exception) {
1936 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
1937 bool newValue = false;
1938 if (string(theVertexEntry).empty()) {
1940 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
1941 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
1942 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
1943 coords.push_back(x);
1944 coords.push_back(y);
1945 coords.push_back(z);
1946 if (coordsList.find(coords) == coordsList.end()) {
1947 MESSAGE("Coords not found: add it in coordsList");
1950 MESSAGE("Coords already found, compare names");
1951 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
1952 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
1953 MESSAGE("The names are different: update");
1954 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
1958 MESSAGE("The names are identical");
1961 } catch (const std::invalid_argument& ex) {
1962 // no enforced vertex for entry
1963 MESSAGE("Face entry not found : add it to the list");
1967 if (string(theVertexName).empty())
1968 if (string(theGroupName).empty())
1969 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
1971 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
1973 if (string(theGroupName).empty())
1974 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
1976 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
1977 << theVertexName << "\", \"" << theGroupName << "\")";
1980 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
1981 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
1982 if ( it == enfVertexEntryList.end()) {
1983 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
1987 MESSAGE("Geom entry already found, compare names");
1988 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
1989 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
1990 MESSAGE("The names are different: update");
1991 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
1995 MESSAGE("The names are identical");
1998 } catch (const std::invalid_argument& ex) {
1999 // no enforced vertex for entry
2000 MESSAGE("Face entry not found : add it to the list");
2004 if (string(theGroupName).empty())
2005 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2007 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2011 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2013 MESSAGE("IDL : SetEnforcedVertexEntry END");
2017 //Enable internal enforced vertices on specific face if requested by user
2018 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2019 // throw (SALOME::SALOME_Exception) {
2020 // ASSERT(myBaseImpl);
2022 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2023 // } catch (const std::exception& ex) {
2024 // std::cout << "Exception: " << ex.what() << std::endl;
2025 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2029 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2030 throw (SALOME::SALOME_Exception) {
2032 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2035 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2036 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2037 vertexList->length(_vList.size());
2038 MESSAGE("Number of enforced vertices: " << vertexList->length());
2039 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2040 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2041 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2043 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2046 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2047 // Geom Vertex Entry
2048 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2050 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2051 coords->length(_enfVertex->coords.size());
2052 for (int ind=0;ind<coords->length();ind++)
2053 coords[ind] = _enfVertex->coords[ind];
2054 enfVertex->coords = coords;
2056 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2058 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2059 faceEntryList->length(_enfVertex->faceEntries.size());
2060 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2061 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2062 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2063 enfVertex->faceEntries = faceEntryList;
2065 vertexList[i] = enfVertex;
2067 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2068 return vertexList._retn();
2069 } catch (const std::invalid_argument& ex) {
2070 SALOME::ExceptionStruct ExDescription;
2071 ExDescription.text = ex.what();
2072 ExDescription.type = SALOME::BAD_PARAM;
2073 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2074 ExDescription.lineNumber = 1385;
2075 throw SALOME::SALOME_Exception(ExDescription);
2076 } catch (const std::exception& ex) {
2077 std::cout << "Exception: " << ex.what() << std::endl;
2078 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2082 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2083 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2085 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2089 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2091 if (string(theVertexEntry).empty())
2092 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2095 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2097 } catch (const std::invalid_argument& ex) {
2099 } catch (const std::exception& ex) {
2100 std::cout << "Exception: " << ex.what() << std::endl;
2101 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2104 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2108 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2109 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2110 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2112 // bool ret = false;
2115 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2116 // } catch (SALOME_Exception& ex) {
2117 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2121 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2124 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2128 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2130 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2133 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2134 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2135 } catch (const std::invalid_argument& ex) {
2137 } catch (const std::exception& ex) {
2138 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2141 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2145 //=============================================================================
2147 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2151 //=============================================================================
2152 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2153 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2155 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2156 std::string theValueStr = theValue ? "True" : "False";
2157 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2160 //=============================================================================
2162 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2166 //=============================================================================
2167 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2168 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2170 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2173 //=============================================================================
2175 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2179 //=============================================================================
2180 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2181 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2183 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2184 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2187 //=============================================================================
2189 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2193 //=============================================================================
2194 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2195 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2197 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2201 * Enable internal enforced vertices on specific face if requested by user
2203 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2204 throw (SALOME::SALOME_Exception)
2206 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2208 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2209 } catch (SALOME_Exception& ex) {
2210 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2214 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2215 throw (SALOME::SALOME_Exception)
2217 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2219 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2220 MESSAGE("theFace shape type is not FACE or COMPOUND");
2221 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2224 string theFaceEntry = theFace->GetStudyEntry();
2226 if (theFaceEntry.empty()) {
2227 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2228 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2230 if (theFace->GetShapeType() == GEOM::FACE)
2232 if (theFace->GetShapeType() == GEOM::COMPOUND)
2233 aName = "Compound_";
2234 aName += theFace->GetEntry();
2235 SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2236 if (!theSFace->_is_nil())
2237 theFaceEntry = theSFace->GetID();
2239 if (theFaceEntry.empty())
2240 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2242 MESSAGE("IDL : GetName : " << theFace->GetName());
2243 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2245 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2246 } catch (SALOME_Exception& ex) {
2247 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2251 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2252 throw (SALOME::SALOME_Exception)
2254 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2257 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2258 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2259 if (string(theGroupName).empty())
2260 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2262 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2263 } catch (const std::exception& ex) {
2264 std::cout << "Exception: " << ex.what() << std::endl;
2265 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2272 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2273 throw (SALOME::SALOME_Exception)
2276 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2278 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2280 catch (const std::invalid_argument& ex) {
2281 SALOME::ExceptionStruct ExDescription;
2282 ExDescription.text = ex.what();
2283 ExDescription.type = SALOME::BAD_PARAM;
2284 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2285 ExDescription.lineNumber = 1146;
2286 throw SALOME::SALOME_Exception(ExDescription);
2288 catch (SALOME_Exception& ex) {
2289 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2291 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2296 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2297 throw (SALOME::SALOME_Exception)
2300 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2302 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2304 catch (const std::invalid_argument& ex) {
2305 SALOME::ExceptionStruct ExDescription;
2306 ExDescription.text = ex.what();
2307 ExDescription.type = SALOME::BAD_PARAM;
2308 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2309 ExDescription.lineNumber = 1170;
2310 throw SALOME::SALOME_Exception(ExDescription);
2312 catch (SALOME_Exception& ex) {
2313 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2316 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2317 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2319 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2322 ///////////////////////
2325 //================================================================================
2327 * \brief Sets the file for export resulting mesh in GMF format
2328 * \param theFileName - full name of the file (.mesh, .meshb)
2330 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
2332 //================================================================================
2333 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
2334 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
2336 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
2337 bool valueChanged/*, modeChanged*/ = false;
2339 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
2340 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
2341 if (valueChanged)// or (!valueChanged && modeChanged))
2342 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
2343 } catch (const std::exception& ex) {
2344 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2346 if (valueChanged)// or (!valueChanged && modeChanged))
2347 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
2348 MESSAGE("IDL : SetGMFFile END ");
2351 //================================================================================
2353 * \brief Gets the file name for export resulting mesh in GMF format
2354 * \retval char* - The file name
2356 * Returns the GMF file name
2358 //================================================================================
2359 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
2361 // MESSAGE("IDL : GetGMFFile()");
2362 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
2365 // //================================================================================
2367 // * \brief Gets the file mode for export resulting mesh in GMF format
2368 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
2370 // * Returns the GMF file mode
2372 // //================================================================================
2373 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
2374 // ASSERT(myBaseImpl);
2375 // MESSAGE("IDL : GetGMFFileMode()");
2376 // return this->GetImpl()->GetGMFFileMode();
2379 //=============================================================================
2381 * BLSURFPlugin_Hypothesis_i::GetImpl
2383 * Get implementation
2385 //=============================================================================
2386 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
2387 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
2388 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
2391 //================================================================================
2393 * \brief Verify whether hypothesis supports given entity type
2394 * \param type - dimension (see SMESH::Dimension enumeration)
2395 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
2397 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
2399 //================================================================================
2400 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
2401 return type == SMESH::DIM_2D;