1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
40 //=============================================================================
42 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
46 //=============================================================================
47 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
48 ::SMESH_Gen* theGenImpl) :
49 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
50 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
51 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
54 //=============================================================================
56 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
60 //=============================================================================
61 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
62 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 //=============================================================================
67 //=============================================================================
69 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
74 //=============================================================================
75 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
76 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
78 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
79 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
82 //=============================================================================
84 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
88 //=============================================================================
89 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
90 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
92 return this->GetImpl()->GetPhysicalMesh();
95 //=============================================================================
97 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
102 //=============================================================================
103 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
104 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
106 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
107 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
110 //=============================================================================
112 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
116 //=============================================================================
117 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
118 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
120 return this->GetImpl()->GetGeometricMesh();
123 //=============================================================================
125 * BLSURFPlugin_Hypothesis_i::SetPhySize
129 //=============================================================================
130 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
131 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
133 this->GetImpl()->SetPhySize(theValue, false);
134 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
137 //=============================================================================
139 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
141 * Set Relative PhySize
143 //=============================================================================
144 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
145 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
147 this->GetImpl()->SetPhySize(theValue, true);
148 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << ", isRelative = True )";
151 //=============================================================================
153 * BLSURFPlugin_Hypothesis_i::GetPhySize
157 //=============================================================================
158 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
159 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
161 return this->GetImpl()->GetPhySize();
164 //=============================================================================
166 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
168 * Returns True if PhySize is relative
170 //=============================================================================
171 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
172 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
174 return this->GetImpl()->IsPhySizeRel();
177 //=============================================================================
178 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
180 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
181 this->GetImpl()->SetMinSize(theMinSize, false);
182 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
186 //=============================================================================
187 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
189 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
190 this->GetImpl()->SetMinSize(theMinSize, true);
191 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << ", isRelative = True )";
195 //=============================================================================
196 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
198 return this->GetImpl()->GetMinSize();
201 //=============================================================================
202 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
203 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
205 return this->GetImpl()->IsMinSizeRel();
208 //=============================================================================
209 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
211 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
212 this->GetImpl()->SetMaxSize(theMaxSize, false);
213 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
217 //=============================================================================
218 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
220 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
221 this->GetImpl()->SetMaxSize(theMaxSize, true);
222 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << ", isRelative = True )";
226 //=============================================================================
227 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
229 return this->GetImpl()->GetMaxSize();
232 //=============================================================================
233 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
234 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
236 return this->GetImpl()->IsMaxSizeRel();
239 //=============================================================================
241 * BLSURFPlugin_Hypothesis_i::SetGradation
245 //=============================================================================
246 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
247 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
249 this->GetImpl()->SetGradation(theValue);
250 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
253 //=============================================================================
255 * BLSURFPlugin_Hypothesis_i::GetGradation
259 //=============================================================================
260 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
261 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
263 return this->GetImpl()->GetGradation();
266 //=============================================================================
268 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
272 //=============================================================================
273 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
274 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
276 this->GetImpl()->SetQuadAllowed(theValue);
277 std::string theValueStr = theValue ? "True" : "False";
278 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
281 //=============================================================================
283 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
287 //=============================================================================
288 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
289 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
291 return this->GetImpl()->GetQuadAllowed();
294 //=============================================================================
296 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
300 //=============================================================================
301 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
302 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
304 this->GetImpl()->SetAngleMesh(theValue);
305 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
308 //=============================================================================
310 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
314 //=============================================================================
315 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
316 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
318 return this->GetImpl()->GetAngleMesh();
321 //=============================================================================
323 * BLSURFPlugin_Hypothesis_i::SetChordalError
327 //=============================================================================
328 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
329 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
331 this->GetImpl()->SetChordalError(theValue);
332 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
335 //=============================================================================
337 * BLSURFPlugin_Hypothesis_i::GetChordalError
341 //=============================================================================
342 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
343 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
345 return this->GetImpl()->GetChordalError();
348 //=============================================================================
350 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
354 //=============================================================================
355 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
356 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
358 this->GetImpl()->SetAnisotropic(theValue);
359 std::string theValueStr = theValue ? "True" : "False";
360 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
363 //=============================================================================
365 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
369 //=============================================================================
370 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
371 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
373 return this->GetImpl()->GetAnisotropic();
376 //=============================================================================
378 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
380 * Set Anisotropic Ratio
382 //=============================================================================
383 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
384 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
386 this->GetImpl()->SetAnisotropicRatio(theValue);
387 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
394 * Get Anisotropic Ratio
396 //=============================================================================
397 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
398 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
400 return this->GetImpl()->GetAnisotropicRatio();
404 //=============================================================================
406 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
410 //=============================================================================
411 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
412 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
414 this->GetImpl()->SetRemoveTinyEdges(theValue);
415 std::string theValueStr = theValue ? "True" : "False";
416 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
419 //=============================================================================
421 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
425 //=============================================================================
426 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
427 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
429 return this->GetImpl()->GetRemoveTinyEdges();
432 //=============================================================================
434 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
436 * Set Tiny Edge Length
438 //=============================================================================
439 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
440 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
442 this->GetImpl()->SetTinyEdgeLength(theValue);
443 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
446 //=============================================================================
448 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
450 * Get Tiny Edge Length
452 //=============================================================================
453 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
454 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
456 return this->GetImpl()->GetTinyEdgeLength();
459 //=============================================================================
461 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
465 //=============================================================================
466 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
467 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
469 this->GetImpl()->SetBadElementRemoval(theValue);
470 std::string theValueStr = theValue ? "True" : "False";
471 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
474 //=============================================================================
476 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
480 //=============================================================================
481 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
482 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
484 return this->GetImpl()->GetBadElementRemoval();
487 //=============================================================================
489 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
491 * Set Bad Surface Element Aspect Ratio
493 //=============================================================================
494 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
495 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
497 this->GetImpl()->SetBadElementAspectRatio(theValue);
498 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
501 //=============================================================================
503 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
505 * Get Bad Surface Element Aspect Ratio
507 //=============================================================================
508 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
509 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
511 return this->GetImpl()->GetBadElementAspectRatio();
514 //=============================================================================
516 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
520 //=============================================================================
521 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
522 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
524 this->GetImpl()->SetOptimizeMesh(theValue);
525 std::string theValueStr = theValue ? "True" : "False";
526 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
529 //=============================================================================
531 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
535 //=============================================================================
536 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
537 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
539 return this->GetImpl()->GetOptimizeMesh();
542 //=============================================================================
544 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
548 //=============================================================================
549 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
550 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
552 this->GetImpl()->SetQuadraticMesh(theValue);
553 std::string theValueStr = theValue ? "True" : "False";
554 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
557 //=============================================================================
559 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
563 //=============================================================================
564 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
565 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
567 return this->GetImpl()->GetQuadraticMesh();
575 * BLSURFPlugin_Hypothesis_i::SetTopology
580 //=============================================================================
581 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
582 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
584 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
585 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
588 //=============================================================================
590 * BLSURFPlugin_Hypothesis_i::GetTopology
594 //=============================================================================
595 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
596 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
598 return this->GetImpl()->GetTopology();
601 //=============================================================================
602 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
604 if (theVal < 0 || theVal > 100)
605 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
606 this->GetImpl()->SetVerbosity(theVal);
607 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
610 //=============================================================================
612 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
614 return (CORBA::Short) this->GetImpl()->GetVerbosity();
617 //=============================================================================
619 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
623 //=============================================================================
624 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
625 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
627 this->GetImpl()->SetPreCADMergeEdges(theValue);
628 std::string theValueStr = theValue ? "True" : "False";
629 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
638 //=============================================================================
639 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
640 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
642 return this->GetImpl()->GetPreCADMergeEdges();
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
651 //=============================================================================
652 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
653 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
655 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
656 std::string theValueStr = theValue ? "True" : "False";
657 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
660 //=============================================================================
662 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
666 //=============================================================================
667 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
668 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
670 return this->GetImpl()->GetPreCADProcess3DTopology();
673 //=============================================================================
675 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
679 //=============================================================================
680 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
681 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
683 this->GetImpl()->SetPreCADDiscardInput(theValue);
684 std::string theValueStr = theValue ? "True" : "False";
685 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
688 //=============================================================================
690 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
694 //=============================================================================
695 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
696 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
698 return this->GetImpl()->GetPreCADDiscardInput();
702 //=============================================================================
704 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
705 throw (SALOME::SALOME_Exception) {
707 bool valueChanged = false;
709 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
711 this->GetImpl()->SetOptionValue(optionName, optionValue);
712 } catch (const std::invalid_argument& ex) {
713 SALOME::ExceptionStruct ExDescription;
714 ExDescription.text = ex.what();
715 ExDescription.type = SALOME::BAD_PARAM;
716 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
717 ExDescription.lineNumber = 0;
718 throw SALOME::SALOME_Exception(ExDescription);
719 } catch (SALOME_Exception& ex) {
720 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
723 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
726 //=============================================================================
728 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
729 throw (SALOME::SALOME_Exception) {
731 bool valueChanged = false;
733 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
735 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
736 } catch (const std::invalid_argument& ex) {
737 SALOME::ExceptionStruct ExDescription;
738 ExDescription.text = ex.what();
739 ExDescription.type = SALOME::BAD_PARAM;
740 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
741 ExDescription.lineNumber = 0;
742 throw SALOME::SALOME_Exception(ExDescription);
743 } catch (SALOME_Exception& ex) {
744 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
747 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
750 //=============================================================================
752 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
755 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
756 } catch (const std::invalid_argument& ex) {
757 SALOME::ExceptionStruct ExDescription;
758 ExDescription.text = ex.what();
759 ExDescription.type = SALOME::BAD_PARAM;
760 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
761 ExDescription.lineNumber = 0;
762 throw SALOME::SALOME_Exception(ExDescription);
763 } catch (SALOME_Exception& ex) {
764 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
769 //=============================================================================
771 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
774 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
775 } catch (const std::invalid_argument& ex) {
776 SALOME::ExceptionStruct ExDescription;
777 ExDescription.text = ex.what();
778 ExDescription.type = SALOME::BAD_PARAM;
779 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
780 ExDescription.lineNumber = 0;
781 throw SALOME::SALOME_Exception(ExDescription);
782 } catch (SALOME_Exception& ex) {
783 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
788 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
792 this->GetImpl()->ClearOption(optionName);
793 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
796 //=============================================================================
798 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
800 this->GetImpl()->ClearPreCADOption(optionName);
801 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
804 //=============================================================================
806 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
808 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
810 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
811 result->length(opts.size());
813 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
814 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
815 string name_value = opIt->first;
816 if (!opIt->second.empty()) {
818 name_value += opIt->second;
820 result[i] = CORBA::string_dup(name_value.c_str());
822 return result._retn();
825 //=============================================================================
827 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
829 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
831 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
832 result->length(opts.size());
834 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
835 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
836 string name_value = opIt->first;
837 if (!opIt->second.empty()) {
839 name_value += opIt->second;
841 result[i] = CORBA::string_dup(name_value.c_str());
843 return result._retn();
846 //=============================================================================
848 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
849 throw (SALOME::SALOME_Exception) {
851 for (int i = 0; i < options.length(); ++i) {
852 string name_value = options[i].in();
853 int colonPos = name_value.find(':');
855 if (colonPos == string::npos) // ':' not found
858 name = name_value.substr(0, colonPos);
859 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
860 value = name_value.substr(colonPos + 1);
862 SetOptionValue(name.c_str(), value.c_str());
866 //=============================================================================
868 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
869 throw (SALOME::SALOME_Exception) {
871 for (int i = 0; i < options.length(); ++i) {
872 string name_value = options[i].in();
873 int colonPos = name_value.find(':');
875 if (colonPos == string::npos) // ':' not found
878 name = name_value.substr(0, colonPos);
879 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
880 value = name_value.substr(colonPos + 1);
882 SetPreCADOptionValue(name.c_str(), value.c_str());
886 //=============================================================================
888 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
889 throw (SALOME::SALOME_Exception) {
891 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
892 bool valueChanged = false;
894 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
896 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
897 } catch (const std::invalid_argument& ex) {
898 SALOME::ExceptionStruct ExDescription;
899 ExDescription.text = ex.what();
900 ExDescription.type = SALOME::BAD_PARAM;
901 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
902 ExDescription.lineNumber = 0;
903 throw SALOME::SALOME_Exception(ExDescription);
904 } catch (SALOME_Exception& ex) {
905 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
907 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
909 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
912 //=============================================================================
914 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
915 throw (SALOME::SALOME_Exception) {
917 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
918 bool valueChanged = false;
919 std::ostringstream sizeMapFunction;
921 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
922 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
923 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
926 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
928 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
929 } catch (const std::invalid_argument& ex) {
930 SALOME::ExceptionStruct ExDescription;
931 ExDescription.text = ex.what();
932 ExDescription.type = SALOME::BAD_PARAM;
933 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
934 ExDescription.lineNumber = 0;
935 throw SALOME::SALOME_Exception(ExDescription);
936 } catch (SALOME_Exception& ex) {
937 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
939 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
941 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
944 //=============================================================================
946 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
947 throw (SALOME::SALOME_Exception) {
949 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
950 bool valueChanged = false;
952 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
953 if ( valueChanged ) {
954 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
955 if (!boost::regex_match(string(attractor), re))
956 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
957 this->GetImpl()->SetAttractorEntry(entry, attractor);
959 } catch (const std::invalid_argument& ex) {
960 SALOME::ExceptionStruct ExDescription;
961 ExDescription.text = ex.what();
962 ExDescription.type = SALOME::BAD_PARAM;
963 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
964 ExDescription.lineNumber = 0;
965 throw SALOME::SALOME_Exception(ExDescription);
966 } catch (SALOME_Exception& ex) {
967 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
969 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
971 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
974 //=============================================================================
976 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir
977 throw (SALOME::SALOME_Exception)
980 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
981 bool valueChanged = false;
983 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
985 catch (const std::invalid_argument& ex) {
986 SALOME::ExceptionStruct ExDescription;
987 ExDescription.text = ex.what();
988 ExDescription.type = SALOME::BAD_PARAM;
989 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
990 ExDescription.lineNumber = 0;
991 throw SALOME::SALOME_Exception(ExDescription);
992 } catch (SALOME_Exception& ex) {
993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
996 //if ( valueChanged )
997 SMESH::TPythonDump() << _this() << ".SetAttractorGeom("
998 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1001 //=============================================================================
1003 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1006 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1007 } catch (const std::invalid_argument& ex) {
1008 SALOME::ExceptionStruct ExDescription;
1009 ExDescription.text = ex.what();
1010 ExDescription.type = SALOME::BAD_PARAM;
1011 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1012 ExDescription.lineNumber = 0;
1013 throw SALOME::SALOME_Exception(ExDescription);
1014 } catch (SALOME_Exception& ex) {
1015 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1020 //=============================================================================
1022 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1025 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1026 } catch (const std::invalid_argument& ex) {
1027 SALOME::ExceptionStruct ExDescription;
1028 ExDescription.text = ex.what();
1029 ExDescription.type = SALOME::BAD_PARAM;
1030 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1031 ExDescription.lineNumber = 0;
1032 throw SALOME::SALOME_Exception(ExDescription);
1033 } catch (SALOME_Exception& ex) {
1034 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1039 // //=============================================================================
1041 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1042 // // A finir pour le dump
1043 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1044 // throw (SALOME::SALOME_Exception)
1046 // ASSERT(myBaseImpl);
1048 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1050 // catch (const std::invalid_argument& ex) {
1051 // SALOME::ExceptionStruct ExDescription;
1052 // ExDescription.text = ex.what();
1053 // ExDescription.type = SALOME::BAD_PARAM;
1054 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1055 // ExDescription.lineNumber = 0;
1056 // throw SALOME::SALOME_Exception(ExDescription);
1058 // catch (SALOME_Exception& ex) {
1059 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1064 //=============================================================================
1066 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1068 this->GetImpl()->ClearEntry(entry);
1069 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1072 //=============================================================================
1074 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1076 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1078 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1079 result->length(sizeMaps.size());
1081 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1082 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1083 string entry_sizemap = smIt->first;
1084 if (!smIt->second.empty()) {
1085 entry_sizemap += "|";
1086 entry_sizemap += smIt->second;
1088 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1090 return result._retn();
1093 //=============================================================================
1095 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1097 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1099 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1100 result->length(attractors.size());
1102 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1103 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1104 string entry_attractor = atIt->first;
1105 if (!atIt->second.empty()) {
1106 entry_attractor += "|";
1107 entry_attractor += atIt->second;
1109 result[i] = CORBA::string_dup(entry_attractor.c_str());
1111 return result._retn();
1114 //=============================================================================
1116 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1119 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1121 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1122 result->length( attractors.size() );
1124 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1125 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1126 string faceEntry = atIt->first;
1128 double startSize, endSize, infDist, constDist;
1129 if ( !atIt->second->Empty() ) {
1130 attEntry = atIt->second->GetAttractorEntry();
1131 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1132 std::vector<double> params = atIt->second->GetParameters();
1133 startSize = params[0];
1134 endSize = params[1];
1135 infDist = params[2];
1136 constDist = params[3];
1138 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1139 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1140 result[i].startSize = startSize;
1141 result[i].endSize = endSize;
1142 result[i].infDist = infDist;
1143 result[i].constDist = constDist;
1144 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1145 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1147 return result._retn();
1150 //=============================================================================
1152 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1153 throw (SALOME::SALOME_Exception) {
1155 for (int i = 0; i < sizeMaps.length(); ++i) {
1156 string entry_sizemap = sizeMaps[i].in();
1157 int colonPos = entry_sizemap.find('|');
1158 string entry, sizemap;
1159 if (colonPos == string::npos) // '|' separator not found
1160 entry = entry_sizemap;
1162 entry = entry_sizemap.substr(0, colonPos);
1163 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1164 sizemap = entry_sizemap.substr(colonPos + 1);
1166 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1170 //=============================================================================
1172 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1174 this->GetImpl()->ClearSizeMaps();
1177 //=============================================================================
1179 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {
1182 entry = GeomObj->GetStudyEntry();
1183 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1184 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1185 SetSizeMapEntry(entry.c_str(), sizeMap);
1188 //=============================================================================
1190 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1192 string entry = GeomObj->GetStudyEntry();
1193 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1194 if (shapeType == GEOM::COMPOUND)
1195 shapeType = GeomObj->GetMaxShapeType();
1196 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1197 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1198 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1201 //=============================================================================
1202 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1205 entry = GeomObj->GetStudyEntry();
1206 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1207 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1208 UnsetEntry(entry.c_str());
1209 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1212 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1215 entry = GeomObj->GetStudyEntry();
1216 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1217 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1218 SetAttractorEntry(entry.c_str(), attractor);
1221 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1224 entry = GeomObj->GetStudyEntry();
1225 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1226 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1227 UnsetEntry(entry.c_str());
1228 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1231 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)
1234 string theFaceEntry;
1236 theFaceEntry = theFace->GetStudyEntry();
1237 theAttEntry = theAttractor->GetStudyEntry();
1239 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1240 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1243 if (theFaceEntry.empty()) {
1245 aName += theFace->GetEntry();
1246 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1247 if (!theSFace->_is_nil())
1248 theFaceEntry = theSFace->GetID();
1250 if (theFaceEntry.empty())
1251 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1253 if (theAttEntry.empty()) {
1254 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1256 if (theAttractor->GetShapeType() == GEOM::EDGE)
1258 if (theAttractor->GetShapeType() == GEOM::WIRE)
1260 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1261 aName = "Compound_";
1262 aName += theAttractor->GetEntry();
1263 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1264 if (!theSAtt->_is_nil())
1265 theAttEntry = theSAtt->GetID();
1267 if (theAttEntry.empty())
1268 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1270 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1271 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1272 MESSAGE("IDL : GetName : " << theFace->GetName());
1273 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1274 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1277 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace)
1280 string theFaceEntry;
1281 theFaceEntry = theFace->GetStudyEntry();
1283 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1284 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1287 if (theFaceEntry.empty()) {
1289 aName += theFace->GetEntry();
1290 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1291 if (!theSFace->_is_nil())
1292 theFaceEntry = theSFace->GetID();
1294 if (theFaceEntry.empty())
1295 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1297 MESSAGE("IDL : GetName : " << theFace->GetName());
1298 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1299 UnsetEntry( theFaceEntry.c_str());
1300 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << theFaceEntry.c_str() << " )";
1304 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1307 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1310 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1313 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1316 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1319 this->GetImpl()->UnsetCustomSizeMap(entry);
1320 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1324 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1329 // ///////////////////////
1330 // // ENFORCED VERTICES //
1331 // ///////////////////////
1335 * Returns the list of enforced vertices for a given Face entry
1336 * @return A map of Face entry / List of enforced vertices
1339 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1340 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1343 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1345 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1346 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1347 resultMap->length(faceEntryEnfVertexListMap.size());
1348 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1350 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1351 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1352 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1353 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1354 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1355 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1356 MESSAGE("Face Entry: " << mapElement->faceEntry);
1358 _enfVertexList = it_entry->second;
1359 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1360 enfVertexList->length(_enfVertexList.size());
1361 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1363 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1364 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1365 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1366 currentEnfVertex = (*it_enfVertex);
1368 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1371 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1374 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1377 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1378 coords->length(currentEnfVertex->coords.size());
1379 for (int i=0;i<coords->length();i++)
1380 coords[i] = currentEnfVertex->coords[i];
1381 enfVertex->coords = coords;
1384 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1387 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1388 faceEntryList->length(currentEnfVertex->faceEntries.size());
1389 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1390 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1391 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1392 enfVertex->faceEntries = faceEntryList;
1395 msg << "Enforced vertex: \n"
1396 << "Name: " << enfVertex->name << "\n";
1397 if (coords->length())
1398 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1399 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1400 << "Group Name: " << enfVertex->grpName;
1403 enfVertexList[j] = enfVertex;
1405 mapElement->enfVertexList = enfVertexList;
1407 resultMap[i] = mapElement;
1410 return resultMap._retn();
1414 * Returns the list of all enforced vertices
1415 * @return a list of enforced vertices
1418 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1419 MESSAGE("IDL: GetAllEnforcedVertices()");
1421 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1422 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1423 resultMap->length(enfVertexList.size());
1424 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1426 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1427 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1428 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1429 MESSAGE("Enforced Vertex #" << i);
1430 currentEnfVertex = (*evlIt);
1431 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1433 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1435 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1437 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1438 coords->length(currentEnfVertex->coords.size());
1439 for (int ind = 0; ind < coords->length(); ind++)
1440 coords[ind] = currentEnfVertex->coords[ind];
1441 enfVertex->coords = coords;
1443 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1445 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1446 faceEntryList->length(currentEnfVertex->faceEntries.size());
1447 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1448 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1449 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1450 enfVertex->faceEntries = faceEntryList;
1453 msg << "Enforced vertex: \n"
1454 << "Name: " << enfVertex->name << "\n";
1455 if (coords->length())
1456 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1457 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1458 << "Group Name: " << enfVertex->grpName;
1461 resultMap[i] = enfVertex;
1463 return resultMap._retn();
1468 * Returns the list of enforced vertices coords for a given Face entry.
1469 * They are the coords of the "manual" enforced vertices.
1470 * @return A map of Face entry / List of enforced vertices coords
1473 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1474 MESSAGE("IDL: GetAllCoordsByFace()");
1477 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1479 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1480 resultMap->length(entryCoordsListMap.size());
1481 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1483 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1484 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1485 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1486 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1487 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1488 MESSAGE("Face Entry: " << mapElement->faceEntry);
1490 _coordsList = it_entry->second;
1491 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1492 coordsList->length(_coordsList.size());
1493 MESSAGE("Number of coords: " << coordsList->length());
1495 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1496 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1497 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1498 coords->length((*it_coords).size());
1499 for (int i=0;i<coords->length();i++)
1500 coords[i] = (*it_coords)[i];
1501 coordsList[j] = coords;
1502 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1504 mapElement->coordsList = coordsList;
1506 resultMap[i] = mapElement;
1509 return resultMap._retn();
1513 * Returns a map of enforced vertices coords / enforced vertex.
1514 * They are the coords of the "manual" enforced vertices.
1516 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1517 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1520 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1521 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1522 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1523 resultMap->length(coordsEnfVertexMap.size());
1524 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1526 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1527 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1528 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1529 MESSAGE("Enforced Vertex #" << i);
1530 currentEnfVertex = (it_coords->second);
1531 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1532 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1533 coords->length(it_coords->first.size());
1534 for (int ind=0;ind<coords->length();ind++)
1535 coords[ind] = it_coords->first[ind];
1536 mapElement->coords = coords;
1537 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1539 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1541 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1543 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1545 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1546 coords2->length(currentEnfVertex->coords.size());
1547 for (int ind=0;ind<coords2->length();ind++)
1548 coords2[ind] = currentEnfVertex->coords[ind];
1549 enfVertex->coords = coords2;
1551 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1553 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1554 faceEntryList->length(currentEnfVertex->faceEntries.size());
1555 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1556 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1557 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1558 enfVertex->faceEntries = faceEntryList;
1560 mapElement->enfVertex = enfVertex;
1562 msg << "Enforced vertex: \n"
1563 << "Name: " << enfVertex->name << "\n";
1564 if (coords->length())
1565 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1566 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1567 << "Group Name: " << enfVertex->grpName;
1570 resultMap[i] = mapElement;
1572 return resultMap._retn();
1576 * Returns the list of enforced vertices entries for a given Face entry.
1577 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1578 * @return A map of Face entry / List of enforced vertices geom entries
1581 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1582 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1585 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1587 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1588 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1589 resultMap->length(entryEnfVertexEntryListMap.size());
1590 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1592 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1593 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1594 entryEnfVertexEntryListMap.begin();
1595 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1596 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1597 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1598 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1599 MESSAGE("Face Entry: " << mapElement->faceEntry);
1601 _enfVertexEntryList = it_entry->second;
1602 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1603 enfVertexEntryList->length(_enfVertexEntryList.size());
1604 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1606 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1607 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1608 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1609 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1611 mapElement->enfVertexEntryList = enfVertexEntryList;
1613 resultMap[i] = mapElement;
1616 return resultMap._retn();
1620 * Returns a map of enforced vertices geom entry / enforced vertex.
1621 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1623 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1624 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1627 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1628 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1629 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1630 resultMap->length(enfVertexEntryEnfVertexMap.size());
1631 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1633 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1634 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1635 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1636 MESSAGE("Enforced Vertex #" << i);
1637 currentEnfVertex = it_enfVertexEntry->second;
1638 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1639 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1640 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1642 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1644 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1646 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1648 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1649 coords->length(currentEnfVertex->coords.size());
1650 for (int ind=0;ind<coords->length();ind++)
1651 coords[ind] = currentEnfVertex->coords[ind];
1652 enfVertex->coords = coords;
1654 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1656 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1657 faceEntryList->length(currentEnfVertex->faceEntries.size());
1658 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1659 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1660 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1661 enfVertex->faceEntries = faceEntryList;
1664 msg << "Enforced vertex: \n"
1665 << "Name: " << enfVertex->name << "\n";
1666 if (coords->length())
1667 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1668 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1669 << "Group Name: " << enfVertex->grpName;
1672 mapElement->enfVertex = enfVertex;
1673 resultMap[i] = mapElement;
1675 return resultMap._retn();
1679 * Erase all enforced vertices
1681 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1683 this->GetImpl()->ClearAllEnforcedVertices();
1684 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1688 * Set/get/unset an enforced vertex on face
1690 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1691 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1694 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1695 MESSAGE("theFace shape type is not FACE or COMPOUND");
1696 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1699 string theFaceEntry = theFace->GetStudyEntry();
1701 if (theFaceEntry.empty()) {
1702 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1703 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1705 if (theFace->GetShapeType() == GEOM::FACE)
1707 if (theFace->GetShapeType() == GEOM::COMPOUND)
1708 aName = "Compound_";
1709 aName += theFace->GetEntry();
1710 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1711 if (!theSFace->_is_nil())
1712 theFaceEntry = theSFace->GetID();
1714 if (theFaceEntry.empty())
1715 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1716 MESSAGE("IDL : GetName : " << theFace->GetName());
1717 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1719 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1720 } catch (SALOME_Exception& ex) {
1721 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1726 * Set/get/unset an enforced vertex with name on face
1728 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1729 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1732 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1733 MESSAGE("theFace shape type is not FACE or COMPOUND");
1734 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1737 string theFaceEntry = theFace->GetStudyEntry();
1739 if (theFaceEntry.empty()) {
1740 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1741 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1743 if (theFace->GetShapeType() == GEOM::FACE)
1745 if (theFace->GetShapeType() == GEOM::COMPOUND)
1746 aName = "Compound_";
1747 aName += theFace->GetEntry();
1748 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1749 if (!theSFace->_is_nil())
1750 theFaceEntry = theSFace->GetID();
1752 if (theFaceEntry.empty())
1753 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1755 MESSAGE("IDL : GetName : " << theFace->GetName());
1756 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1758 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1759 } catch (SALOME_Exception& ex) {
1760 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1765 * Set/get/unset an enforced vertex with geom object on face
1767 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1768 throw (SALOME::SALOME_Exception) {
1771 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1772 MESSAGE("theFace shape type is not FACE or COMPOUND");
1773 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1776 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1777 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1778 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1781 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1782 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1783 // if (CORBA::is_nil(measureOp))
1786 // CORBA::Double x, y, z;
1788 // measureOp->PointCoordinates(theVertex, x, y, z);
1790 string theFaceEntry = theFace->GetStudyEntry();
1791 string theVertexEntry = theVertex->GetStudyEntry();
1793 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1794 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1797 if (theFaceEntry.empty()) {
1798 if (theFace->GetShapeType() == GEOM::FACE)
1800 if (theFace->GetShapeType() == GEOM::COMPOUND)
1801 aName = "Compound_";
1802 aName += theFace->GetEntry();
1803 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1804 if (!theSFace->_is_nil())
1805 theFaceEntry = theSFace->GetID();
1807 if (theFaceEntry.empty())
1808 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1810 if (theVertexEntry.empty()) {
1811 if (theVertex->GetShapeType() == GEOM::VERTEX)
1813 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1814 aName = "Compound_";
1815 aName += theVertex->GetEntry();
1816 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1817 if (!theSVertex->_is_nil())
1818 theVertexEntry = theSVertex->GetID();
1820 if (theVertexEntry.empty())
1821 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1823 string theVertexName = theVertex->GetName();
1824 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1825 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1826 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1828 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1829 } catch (SALOME_Exception& ex) {
1830 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1835 * Set an enforced vertex with group name on face
1837 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1838 throw (SALOME::SALOME_Exception)
1842 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1843 MESSAGE("theFace shape type is not FACE or COMPOUND");
1844 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1847 string theFaceEntry = theFace->GetStudyEntry();
1849 if (theFaceEntry.empty()) {
1850 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1851 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1853 if (theFace->GetShapeType() == GEOM::FACE)
1855 if (theFace->GetShapeType() == GEOM::COMPOUND)
1856 aName = "Compound_";
1857 aName += theFace->GetEntry();
1858 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1859 if (!theSFace->_is_nil())
1860 theFaceEntry = theSFace->GetID();
1862 if (theFaceEntry.empty())
1863 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1864 MESSAGE("IDL : GetName : " << theFace->GetName());
1865 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1867 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1868 } catch (SALOME_Exception& ex) {
1869 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1874 * Set an enforced vertex with name and group name on face
1876 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1877 const char* theVertexName, const char* theGroupName)
1878 throw (SALOME::SALOME_Exception)
1882 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1883 MESSAGE("theFace shape type is not FACE or COMPOUND");
1884 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1887 string theFaceEntry = theFace->GetStudyEntry();
1889 if (theFaceEntry.empty()) {
1890 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1891 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1893 if (theFace->GetShapeType() == GEOM::FACE)
1895 if (theFace->GetShapeType() == GEOM::COMPOUND)
1896 aName = "Compound_";
1897 aName += theFace->GetEntry();
1898 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1899 if (!theSFace->_is_nil())
1900 theFaceEntry = theSFace->GetID();
1902 if (theFaceEntry.empty())
1903 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1904 MESSAGE("IDL : GetName : " << theFace->GetName());
1905 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
1907 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
1908 } catch (SALOME_Exception& ex) {
1909 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1914 * Set an enforced vertex with geom entry and group name on face
1916 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
1917 throw (SALOME::SALOME_Exception)
1921 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1922 MESSAGE("theFace shape type is not FACE or COMPOUND");
1923 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1926 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1927 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1928 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1931 string theFaceEntry = theFace->GetStudyEntry();
1932 string theVertexEntry = theVertex->GetStudyEntry();
1934 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1935 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1938 if (theFaceEntry.empty()) {
1939 if (theFace->GetShapeType() == GEOM::FACE)
1941 if (theFace->GetShapeType() == GEOM::COMPOUND)
1942 aName = "Compound_";
1943 aName += theFace->GetEntry();
1944 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1945 if (!theSFace->_is_nil())
1946 theFaceEntry = theSFace->GetID();
1948 if (theFaceEntry.empty())
1949 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1951 if (theVertexEntry.empty()) {
1952 if (theVertex->GetShapeType() == GEOM::VERTEX)
1954 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1955 aName = "Compound_";
1956 aName += theVertex->GetEntry();
1957 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1958 if (!theSVertex->_is_nil())
1959 theVertexEntry = theSVertex->GetID();
1961 if (theVertexEntry.empty())
1962 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1964 string theVertexName = theVertex->GetName();
1965 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1966 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1967 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
1969 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
1970 } catch (SALOME_Exception& ex) {
1971 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1975 //Enable internal enforced vertices on specific face if requested by user
1977 // * Are internal enforced vertices used for a face ?
1979 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
1980 // throw (SALOME::SALOME_Exception) {
1981 // ASSERT(myBaseImpl);
1983 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1984 // MESSAGE("theFace shape type is not FACE or COMPOUND");
1985 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1988 // string theFaceEntry = theFace->GetStudyEntry();
1990 // if (theFaceEntry.empty()) {
1991 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1992 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1994 // if (theFace->GetShapeType() == GEOM::FACE)
1996 // if (theFace->GetShapeType() == GEOM::COMPOUND)
1997 // aName = "Compound_";
1998 // aName += theFace->GetEntry();
1999 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2000 // if (!theSFace->_is_nil())
2001 // theFaceEntry = theSFace->GetID();
2003 // if (theFaceEntry.empty())
2004 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2006 // MESSAGE("IDL : GetName : " << theFace->GetName());
2007 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2009 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2010 // } catch (SALOME_Exception& ex) {
2011 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2016 * Get the list of all enforced vertices
2018 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2019 throw (SALOME::SALOME_Exception) {
2022 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2023 MESSAGE("theFace shape type is not FACE or COMPOUND");
2024 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2027 string theFaceEntry = theFace->GetStudyEntry();
2029 if (theFaceEntry.empty()) {
2030 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2031 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2033 if (theFace->GetShapeType() == GEOM::FACE)
2035 if (theFace->GetShapeType() == GEOM::COMPOUND)
2036 aName = "Compound_";
2037 aName += theFace->GetEntry();
2038 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2039 if (!theSFace->_is_nil())
2040 theFaceEntry = theSFace->GetID();
2042 if (theFaceEntry.empty())
2043 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2045 MESSAGE("IDL : GetName : " << theFace->GetName());
2046 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2048 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2049 } catch (SALOME_Exception& ex) {
2050 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2054 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2055 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2058 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2059 MESSAGE("theFace shape type is not FACE or COMPOUND");
2060 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2063 string theFaceEntry = theFace->GetStudyEntry();
2065 if (theFaceEntry.empty()) {
2066 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2067 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2069 if (theFace->GetShapeType() == GEOM::FACE)
2071 if (theFace->GetShapeType() == GEOM::COMPOUND)
2072 aName = "Compound_";
2073 aName += theFace->GetEntry();
2074 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2075 if (!theSFace->_is_nil())
2076 theFaceEntry = theSFace->GetID();
2078 if (theFaceEntry.empty())
2079 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2080 MESSAGE("IDL : GetName : " << theFace->GetName());
2081 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2084 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2085 } catch (SALOME_Exception& ex) {
2086 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2090 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2091 throw (SALOME::SALOME_Exception) {
2094 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2095 MESSAGE("theFace shape type is not FACE or COMPOUND");
2096 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2098 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2099 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2100 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2103 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2104 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2105 // if (CORBA::is_nil(measureOp))
2108 // CORBA::Double x, y, z;
2110 // measureOp->PointCoordinates(theVertex, x, y, z);
2112 std::string theFaceEntry = theFace->GetStudyEntry();
2113 std::string theVertexEntry = theVertex->GetStudyEntry();
2115 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2116 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2119 if (theFaceEntry.empty()) {
2120 if (theFace->GetShapeType() == GEOM::FACE)
2122 if (theFace->GetShapeType() == GEOM::COMPOUND)
2123 aName = "Compound_";
2124 aName += theFace->GetEntry();
2125 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2126 if (!theSFace->_is_nil())
2127 theFaceEntry = theSFace->GetID();
2129 if (theFaceEntry.empty())
2130 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2132 if (theVertexEntry.empty()) {
2133 if (theVertex->GetShapeType() == GEOM::VERTEX)
2135 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2136 aName = "Compound_";
2137 aName += theVertex->GetEntry();
2138 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2139 if (!theSVertex->_is_nil())
2140 theVertexEntry = theSVertex->GetID();
2142 if (theVertexEntry.empty())
2143 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2145 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2148 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2149 } catch (SALOME_Exception& ex) {
2150 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2154 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2157 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2158 MESSAGE("theFace shape type is not FACE or COMPOUND");
2159 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2162 string theFaceEntry = theFace->GetStudyEntry();
2164 if (theFaceEntry.empty()) {
2165 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2166 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2168 if (theFace->GetShapeType() == GEOM::FACE)
2170 if (theFace->GetShapeType() == GEOM::COMPOUND)
2171 aName = "Compound_";
2172 aName += theFace->GetEntry();
2173 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2174 if (!theSFace->_is_nil())
2175 theFaceEntry = theSFace->GetID();
2177 if (theFaceEntry.empty())
2178 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2180 MESSAGE("IDL : GetName : " << theFace->GetName());
2181 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2184 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2185 } catch (SALOME_Exception& ex) {
2186 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2191 * Set/get/unset an enforced vertex on geom object given by entry
2193 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2194 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2195 throw (SALOME::SALOME_Exception) {
2197 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2198 bool newValue = false;
2199 if (string(theVertexEntry).empty()) {
2201 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2202 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2203 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2204 coords.push_back(x);
2205 coords.push_back(y);
2206 coords.push_back(z);
2207 if (coordsList.find(coords) == coordsList.end()) {
2208 MESSAGE("Coords not found: add it in coordsList");
2211 MESSAGE("Coords already found, compare names");
2212 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2213 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2214 MESSAGE("The names are different: update");
2215 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2219 MESSAGE("The names are identical");
2222 } catch (const std::invalid_argument& ex) {
2223 // no enforced vertex for entry
2224 MESSAGE("Face entry not found : add it to the list");
2228 if (string(theVertexName).empty())
2229 if (string(theGroupName).empty())
2230 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2232 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2234 if (string(theGroupName).empty())
2235 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2237 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2238 << theVertexName << "\", \"" << theGroupName << "\")";
2241 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2242 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2243 if ( it == enfVertexEntryList.end()) {
2244 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2248 MESSAGE("Geom entry already found, compare names");
2249 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2250 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2251 MESSAGE("The names are different: update");
2252 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2256 MESSAGE("The names are identical");
2259 } catch (const std::invalid_argument& ex) {
2260 // no enforced vertex for entry
2261 MESSAGE("Face entry not found : add it to the list");
2265 if (string(theGroupName).empty())
2266 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2268 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2272 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2274 MESSAGE("IDL : SetEnforcedVertexEntry END");
2278 //Enable internal enforced vertices on specific face if requested by user
2279 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2280 // throw (SALOME::SALOME_Exception) {
2281 // ASSERT(myBaseImpl);
2283 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2284 // } catch (const std::exception& ex) {
2285 // std::cout << "Exception: " << ex.what() << std::endl;
2286 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2290 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2291 throw (SALOME::SALOME_Exception) {
2293 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2296 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2297 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2298 vertexList->length(_vList.size());
2299 MESSAGE("Number of enforced vertices: " << vertexList->length());
2300 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2301 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2302 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2304 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2307 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2308 // Geom Vertex Entry
2309 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2311 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2312 coords->length(_enfVertex->coords.size());
2313 for (int ind=0;ind<coords->length();ind++)
2314 coords[ind] = _enfVertex->coords[ind];
2315 enfVertex->coords = coords;
2317 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2319 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2320 faceEntryList->length(_enfVertex->faceEntries.size());
2321 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2322 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2323 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2324 enfVertex->faceEntries = faceEntryList;
2326 vertexList[i] = enfVertex;
2328 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2329 return vertexList._retn();
2330 } catch (const std::invalid_argument& ex) {
2331 SALOME::ExceptionStruct ExDescription;
2332 ExDescription.text = ex.what();
2333 ExDescription.type = SALOME::BAD_PARAM;
2334 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2335 ExDescription.lineNumber = 1385;
2336 throw SALOME::SALOME_Exception(ExDescription);
2337 } catch (const std::exception& ex) {
2338 std::cout << "Exception: " << ex.what() << std::endl;
2339 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2343 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2344 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2346 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2350 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2352 if (string(theVertexEntry).empty())
2353 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2356 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2358 } catch (const std::invalid_argument& ex) {
2360 } catch (const std::exception& ex) {
2361 std::cout << "Exception: " << ex.what() << std::endl;
2362 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2365 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2369 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2370 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2371 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2373 // bool ret = false;
2376 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2377 // } catch (SALOME_Exception& ex) {
2378 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2382 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2385 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2389 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2391 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2394 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2395 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2396 } catch (const std::invalid_argument& ex) {
2398 } catch (const std::exception& ex) {
2399 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2402 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2406 //=============================================================================
2408 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2412 //=============================================================================
2413 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2414 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2416 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2417 std::string theValueStr = theValue ? "True" : "False";
2418 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2421 //=============================================================================
2423 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2427 //=============================================================================
2428 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2429 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2431 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2434 //=============================================================================
2436 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2440 //=============================================================================
2441 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2442 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2444 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2445 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2448 //=============================================================================
2450 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2454 //=============================================================================
2455 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2456 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2458 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2462 * Enable internal enforced vertices on specific face if requested by user
2464 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2465 throw (SALOME::SALOME_Exception)
2467 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2469 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2470 } catch (SALOME_Exception& ex) {
2471 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2475 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2476 throw (SALOME::SALOME_Exception)
2478 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2480 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2481 MESSAGE("theFace shape type is not FACE or COMPOUND");
2482 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2485 string theFaceEntry = theFace->GetStudyEntry();
2487 if (theFaceEntry.empty()) {
2488 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2489 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2491 if (theFace->GetShapeType() == GEOM::FACE)
2493 if (theFace->GetShapeType() == GEOM::COMPOUND)
2494 aName = "Compound_";
2495 aName += theFace->GetEntry();
2496 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2497 if (!theSFace->_is_nil())
2498 theFaceEntry = theSFace->GetID();
2500 if (theFaceEntry.empty())
2501 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2503 MESSAGE("IDL : GetName : " << theFace->GetName());
2504 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2506 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2507 } catch (SALOME_Exception& ex) {
2508 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2512 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2513 throw (SALOME::SALOME_Exception)
2515 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2518 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2519 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2520 if (string(theGroupName).empty())
2521 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2523 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2524 } catch (const std::exception& ex) {
2525 std::cout << "Exception: " << ex.what() << std::endl;
2526 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2533 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2534 throw (SALOME::SALOME_Exception)
2537 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2539 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2541 catch (const std::invalid_argument& ex) {
2542 SALOME::ExceptionStruct ExDescription;
2543 ExDescription.text = ex.what();
2544 ExDescription.type = SALOME::BAD_PARAM;
2545 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2546 ExDescription.lineNumber = 1146;
2547 throw SALOME::SALOME_Exception(ExDescription);
2549 catch (SALOME_Exception& ex) {
2550 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2552 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2557 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2558 throw (SALOME::SALOME_Exception)
2561 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2563 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2565 catch (const std::invalid_argument& ex) {
2566 SALOME::ExceptionStruct ExDescription;
2567 ExDescription.text = ex.what();
2568 ExDescription.type = SALOME::BAD_PARAM;
2569 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2570 ExDescription.lineNumber = 1170;
2571 throw SALOME::SALOME_Exception(ExDescription);
2573 catch (SALOME_Exception& ex) {
2574 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2577 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2578 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2580 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2583 ///////////////////////
2585 ///////////////////////
2587 ///////////////////////
2590 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2592 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2593 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2594 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2595 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2596 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2597 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2598 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2599 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2600 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2601 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2602 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2603 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2604 return txtShapeType;
2607 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2609 // Check shape types
2611 std::stringstream typesTxt;
2612 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2614 GEOM::shape_type theShapeType = theShapeTypes[i];
2615 if (shape->GetShapeType() == theShapeType)
2617 typesTxt << ShapeTypeToString(theShapeType);
2618 if (i < theShapeTypes.size()-1 )
2622 std::stringstream msg;
2623 msg << "shape shape type is not in" << typesTxt;
2625 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2629 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2632 if (shape->GetShapeType() != theShapeType) {
2633 std::stringstream msg;
2634 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2636 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2640 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2642 // Check shape is published in the object browser
2643 string shapeEntry = shape->GetStudyEntry();
2645 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2646 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2649 // Publish shape if needed
2650 if (shapeEntry.empty()) {
2651 if (shape->GetShapeType() == theShapeType)
2653 aName += shape->GetEntry();
2654 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2655 if (!theSFace1->_is_nil())
2656 shapeEntry = theSFace1->GetID();
2658 if (shapeEntry.empty())
2659 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2663 // Format the output of two vectors to use it in MESSAGE and PythonDump
2664 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2666 std::stringstream listEntriesTxt;
2668 if (!theSourceVerticesEntries.empty())
2670 listEntriesTxt << ", [" ;
2672 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2675 listEntriesTxt << ", ";
2676 listEntriesTxt << *it;
2679 listEntriesTxt << "], [" ;
2681 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2684 listEntriesTxt << ", ";
2685 listEntriesTxt << *it;
2687 listEntriesTxt << "]" ;
2689 return listEntriesTxt.str();
2693 * Erase all PreCad periodicity associations
2695 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2697 this->GetImpl()->ClearPreCadPeriodicityVectors();
2698 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2701 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2703 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2704 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2705 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2707 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2709 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2710 return periodicityList._retn();
2713 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2715 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2716 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2717 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2719 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2721 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2722 return periodicityList._retn();
2725 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2726 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2728 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2729 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2731 periodicityList->length(preCadPeriodicityVector.size());
2733 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2735 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2737 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2738 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2739 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2741 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2742 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2744 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2745 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2746 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2749 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2751 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2752 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2754 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2755 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2756 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2759 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2761 periodicityList[i] = myPreCadPeriodicity;
2765 return periodicityList._retn();
2769 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2770 throw (SALOME::SALOME_Exception)
2773 const GEOM::ListOfGO theSourceVertices;
2774 const GEOM::ListOfGO theTargetVertices;
2775 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2779 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2780 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2781 throw (SALOME::SALOME_Exception)
2784 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2786 size_t theLength = theSourceVertices.length();
2787 if (theLength != theTargetVertices.length())
2788 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2790 std::vector<GEOM::shape_type> allowedShapeTypes;
2791 allowedShapeTypes.push_back(GEOM::FACE);
2792 allowedShapeTypes.push_back(GEOM::COMPOUND);
2794 string prefix1 = "Source_face_";
2795 CheckShapeTypes(theFace1, allowedShapeTypes);
2796 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2798 string prefix2 = "Target_face_";
2799 CheckShapeTypes(theFace2, allowedShapeTypes);
2800 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2802 string prefix3 = "Source_vertex_";
2803 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2804 theSourceVerticesEntries->length(theLength);
2805 GEOM::GEOM_Object_ptr theVtx_i;
2807 for (size_t ind = 0; ind < theLength; ind++) {
2808 theVtx_i = theSourceVertices[ind];
2809 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2810 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2813 string prefix4 = "Target_vertex_";
2814 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2815 theTargetVerticesEntries->length(theLength);
2816 for (size_t ind = 0; ind < theLength; ind++) {
2817 theVtx_i = theTargetVertices[ind];
2818 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2819 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2822 string theFace2Name = theFace2->GetName();
2823 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2824 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2825 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2827 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2828 theSourceVerticesEntries, theTargetVerticesEntries);
2829 } catch (SALOME_Exception& ex) {
2830 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2835 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2836 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2837 throw (SALOME::SALOME_Exception)
2842 // Convert BLSURFPlugin::TEntryList to vector<string>
2843 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2844 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2845 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2846 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2849 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2851 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2853 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2854 theSourceVerticesEntries, theTargetVerticesEntries);
2856 SMESH::TPythonDump pd;
2857 if (!theSourceVerticesEntries.empty())
2859 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2860 pd << listEntriesTxt.c_str();
2864 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2865 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2868 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2869 throw (SALOME::SALOME_Exception)
2872 const GEOM::ListOfGO theSourceVertices;
2873 const GEOM::ListOfGO theTargetVertices;
2874 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2877 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2878 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2879 throw (SALOME::SALOME_Exception)
2881 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2884 size_t theLength = theSourceVertices.length();
2885 if (theLength != theTargetVertices.length())
2886 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2888 std::vector<GEOM::shape_type> allowedShapeTypes;
2889 allowedShapeTypes.push_back(GEOM::EDGE);
2890 allowedShapeTypes.push_back(GEOM::COMPOUND);
2892 string prefix1 = "Source_edge_";
2893 CheckShapeTypes(theEdge1, allowedShapeTypes);
2894 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
2896 string prefix2 = "Target_edge_";
2897 CheckShapeTypes(theEdge2, allowedShapeTypes);
2898 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
2900 string prefix3 = "Source_vertex_";
2901 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2902 theSourceVerticesEntries->length(theLength);
2903 GEOM::GEOM_Object_ptr theVtx_i;
2905 for (size_t ind = 0; ind < theLength; ind++) {
2906 theVtx_i = theSourceVertices[ind];
2907 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2908 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2911 string prefix4 = "Target_vertex_";
2912 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2913 theTargetVerticesEntries->length(theLength);
2914 for (size_t ind = 0; ind < theLength; ind++) {
2915 theVtx_i = theTargetVertices[ind];
2916 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2917 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2920 string theEdge2Name = theEdge2->GetName();
2921 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
2922 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
2923 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
2925 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
2926 theSourceVerticesEntries, theTargetVerticesEntries);
2927 } catch (SALOME_Exception& ex) {
2928 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2933 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
2934 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2935 throw (SALOME::SALOME_Exception)
2940 // Convert BLSURFPlugin::TEntryList to vector<string>
2941 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2942 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2943 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2944 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2947 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2949 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
2950 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
2951 theSourceVerticesEntries, theTargetVerticesEntries);
2953 SMESH::TPythonDump pd;
2954 if (!theSourceVerticesEntries.empty())
2956 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
2957 pd << listEntriesTxt.c_str();
2961 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
2963 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
2966 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2967 throw (SALOME::SALOME_Exception)
2971 string prefix1 = "Source_face_";
2972 CheckShapeType(theFace1, GEOM::FACE);
2973 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2974 string prefix2 = "Target_face_";
2975 CheckShapeType(theFace2, GEOM::FACE);
2976 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2978 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2979 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2980 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2982 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
2983 } catch (SALOME_Exception& ex) {
2984 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2990 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
2991 throw (SALOME::SALOME_Exception){
2995 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
2996 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
2997 SMESH::TPythonDump pd;
2998 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2999 MESSAGE("IDL : AddFacePeriodicityEntry END");
3003 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3004 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3005 CORBA::Long edge_orientation)
3006 throw (SALOME::SALOME_Exception){
3009 string prefix_theFace1 = "Source_face_";
3010 CheckShapeType(theFace1, GEOM::FACE);
3011 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3012 string prefix_theFace2 = "Target_face_";
3013 CheckShapeType(theFace2, GEOM::FACE);
3014 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3016 string prefix_theEdge1 = "Source_edge_";
3017 CheckShapeType(theEdge1, GEOM::EDGE);
3018 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3019 string prefix_theEdge2 = "Target_edge_";
3020 CheckShapeType(theEdge2, GEOM::EDGE);
3021 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3023 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3024 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3025 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3026 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3027 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3029 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3030 } catch (SALOME_Exception& ex) {
3031 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3037 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3038 GEOM::GEOM_Object_ptr theEdge2,
3039 CORBA::Long edge_orientation)
3040 throw (SALOME::SALOME_Exception){
3043 string theFace1Entry = "";
3044 string theFace2Entry = "";
3046 string prefix_theEdge1 = "Source_edge_";
3047 CheckShapeType(theEdge1, GEOM::EDGE);
3048 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3049 string prefix_theEdge2 = "Target_edge_";
3050 CheckShapeType(theEdge2, GEOM::EDGE);
3051 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3053 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3054 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3055 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3057 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3058 } catch (SALOME_Exception& ex) {
3059 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3065 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3066 throw (SALOME::SALOME_Exception){
3070 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3071 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3072 SMESH::TPythonDump pd;
3074 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3076 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3077 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3080 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3081 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3082 throw (SALOME::SALOME_Exception){
3085 string prefix_theEdge1 = "Source_edge_";
3086 CheckShapeType(theEdge1, GEOM::EDGE);
3087 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3088 string prefix_theEdge2 = "Target_edge_";
3089 CheckShapeType(theEdge2, GEOM::EDGE);
3090 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3092 string prefix_theVertex1 = "Source_vertex_";
3093 CheckShapeType(theVertex1, GEOM::VERTEX);
3094 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3095 string prefix_theVertex2 = "Target_vertex_";
3096 CheckShapeType(theVertex2, GEOM::VERTEX);
3097 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3099 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3100 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3101 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3102 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3103 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3105 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3106 } catch (SALOME_Exception& ex) {
3107 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3113 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3114 throw (SALOME::SALOME_Exception){
3118 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3119 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3120 SMESH::TPythonDump pd;
3121 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3122 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3126 //================================================================================
3128 * \brief Sets the file for export resulting mesh in GMF format
3129 * \param theFileName - full name of the file (.mesh, .meshb)
3131 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3133 //================================================================================
3134 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3135 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3137 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3138 bool valueChanged/*, modeChanged*/ = false;
3140 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3141 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3142 if (valueChanged)// or (!valueChanged && modeChanged))
3143 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3144 } catch (const std::exception& ex) {
3145 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3147 if (valueChanged)// or (!valueChanged && modeChanged))
3148 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3149 MESSAGE("IDL : SetGMFFile END ");
3152 //================================================================================
3154 * \brief Gets the file name for export resulting mesh in GMF format
3155 * \retval char* - The file name
3157 * Returns the GMF file name
3159 //================================================================================
3160 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3162 // MESSAGE("IDL : GetGMFFile()");
3163 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3166 // //================================================================================
3168 // * \brief Gets the file mode for export resulting mesh in GMF format
3169 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3171 // * Returns the GMF file mode
3173 // //================================================================================
3174 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3175 // ASSERT(myBaseImpl);
3176 // MESSAGE("IDL : GetGMFFileMode()");
3177 // return this->GetImpl()->GetGMFFileMode();
3180 //=============================================================================
3182 * BLSURFPlugin_Hypothesis_i::GetImpl
3184 * Get implementation
3186 //=============================================================================
3187 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3188 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3189 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3192 //================================================================================
3194 * \brief Verify whether hypothesis supports given entity type
3195 * \param type - dimension (see SMESH::Dimension enumeration)
3196 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3198 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3200 //================================================================================
3201 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3202 return type == SMESH::DIM_2D;
3206 // Obsolete methods - To be removed in V7
3209 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3210 this->SetMinSize(theMinSize);
3212 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3213 return this->GetMinSize();
3215 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3216 this->SetMaxSize(theMaxSize);
3218 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3219 return this->GetMaxSize();
3221 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3222 this->SetMinSize(theMinSize);
3224 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3225 return this->GetMinSize();
3227 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3228 this->SetMaxSize(theMaxSize);
3230 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3231 return this->GetMaxSize();
3233 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3234 this->SetAngleMesh(theValue);
3236 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3237 return this->GetAngleMesh();
3239 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3240 this->SetAngleMesh(theValue);
3242 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3243 return this->GetAngleMesh();
3245 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3246 std::string theValueStr = theValue ? "1" : "0";
3247 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3249 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3250 std::string theValueStr = this->GetOptionValue("respect_geometry");
3251 if (theValueStr.empty() || theValueStr == "respect")
3255 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3256 std::string theValueStr = theValue ? "1" : "0";
3257 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3259 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3260 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3261 if (theValueStr == "1")
3265 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3266 std::ostringstream theValueStr;
3267 theValueStr << theValue;
3268 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3270 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3271 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3273 theValueStr >> result;