1 // Copyright (C) 2007-2016 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>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
50 ::SMESH_Gen* theGenImpl) :
51 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
52 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
53 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
56 //=============================================================================
58 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
62 //=============================================================================
63 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
64 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
67 //=============================================================================
69 //=============================================================================
71 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
76 //=============================================================================
77 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
78 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
80 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
81 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
84 //=============================================================================
86 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
90 //=============================================================================
91 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
92 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
94 return this->GetImpl()->GetPhysicalMesh();
97 //=============================================================================
99 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
104 //=============================================================================
105 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
106 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
108 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
109 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
112 //=============================================================================
114 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
118 //=============================================================================
119 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
120 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
122 return this->GetImpl()->GetGeometricMesh();
125 //=============================================================================
127 * BLSURFPlugin_Hypothesis_i::SetPhySize
131 //=============================================================================
132 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
133 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
135 this->GetImpl()->SetPhySize(theValue, false);
136 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
139 //=============================================================================
141 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
143 * Set Relative PhySize
145 //=============================================================================
146 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
147 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
149 this->GetImpl()->SetPhySize(theValue, true);
150 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
153 //=============================================================================
155 * BLSURFPlugin_Hypothesis_i::GetPhySize
159 //=============================================================================
160 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
161 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
163 return this->GetImpl()->GetPhySize();
166 //=============================================================================
168 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
170 * Returns True if PhySize is relative
172 //=============================================================================
173 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
174 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
176 return this->GetImpl()->IsPhySizeRel();
179 //=============================================================================
180 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
182 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
183 this->GetImpl()->SetMinSize(theMinSize, false);
184 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
188 //=============================================================================
189 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
191 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
192 this->GetImpl()->SetMinSize(theMinSize, true);
193 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
197 //=============================================================================
198 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
200 return this->GetImpl()->GetMinSize();
203 //=============================================================================
204 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
205 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
207 return this->GetImpl()->IsMinSizeRel();
210 //=============================================================================
211 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
213 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
214 this->GetImpl()->SetMaxSize(theMaxSize, false);
215 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
219 //=============================================================================
220 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
222 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
223 this->GetImpl()->SetMaxSize(theMaxSize, true);
224 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
228 //=============================================================================
229 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
231 return this->GetImpl()->GetMaxSize();
234 //=============================================================================
235 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
236 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
238 return this->GetImpl()->IsMaxSizeRel();
241 //=============================================================================
243 * BLSURFPlugin_Hypothesis_i::SetGradation
247 //=============================================================================
248 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
249 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
251 this->GetImpl()->SetGradation(theValue);
252 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
255 //=============================================================================
257 * BLSURFPlugin_Hypothesis_i::GetGradation
261 //=============================================================================
262 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
263 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
265 return this->GetImpl()->GetGradation();
268 //=============================================================================
270 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
274 //=============================================================================
275 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
276 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
278 this->GetImpl()->SetQuadAllowed(theValue);
279 std::string theValueStr = theValue ? "True" : "False";
280 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
283 //=============================================================================
285 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
289 //=============================================================================
290 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
291 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
293 return this->GetImpl()->GetQuadAllowed();
296 //=============================================================================
298 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
302 //=============================================================================
303 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
304 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
306 this->GetImpl()->SetAngleMesh(theValue);
307 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
310 //=============================================================================
312 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
316 //=============================================================================
317 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
318 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
320 return this->GetImpl()->GetAngleMesh();
323 //=============================================================================
325 * BLSURFPlugin_Hypothesis_i::SetChordalError
329 //=============================================================================
330 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
331 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
333 this->GetImpl()->SetChordalError(theValue);
334 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
337 //=============================================================================
339 * BLSURFPlugin_Hypothesis_i::GetChordalError
343 //=============================================================================
344 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
345 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
347 return this->GetImpl()->GetChordalError();
350 //=============================================================================
352 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
356 //=============================================================================
357 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
358 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
360 this->GetImpl()->SetAnisotropic(theValue);
361 std::string theValueStr = theValue ? "True" : "False";
362 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
365 //=============================================================================
367 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
371 //=============================================================================
372 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
373 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
375 return this->GetImpl()->GetAnisotropic();
378 //=============================================================================
380 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
382 * Set Anisotropic Ratio
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
386 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
388 this->GetImpl()->SetAnisotropicRatio(theValue);
389 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
392 //=============================================================================
394 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
396 * Get Anisotropic Ratio
398 //=============================================================================
399 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
400 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
402 return this->GetImpl()->GetAnisotropicRatio();
406 //=============================================================================
408 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
412 //=============================================================================
413 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
414 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
416 this->GetImpl()->SetRemoveTinyEdges(theValue);
417 std::string theValueStr = theValue ? "True" : "False";
418 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
421 //=============================================================================
423 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
427 //=============================================================================
428 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
429 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
431 return this->GetImpl()->GetRemoveTinyEdges();
434 //=============================================================================
436 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
438 * Set Tiny Edge Length
440 //=============================================================================
441 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
442 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
444 this->GetImpl()->SetTinyEdgeLength(theValue);
445 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
448 //=============================================================================
450 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
452 * Get Tiny Edge Length
454 //=============================================================================
455 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
456 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
458 return this->GetImpl()->GetTinyEdgeLength();
461 //=============================================================================
463 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
467 //=============================================================================
468 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
469 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
471 this->GetImpl()->SetBadElementRemoval(theValue);
472 std::string theValueStr = theValue ? "True" : "False";
473 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
476 //=============================================================================
478 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
482 //=============================================================================
483 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
484 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
486 return this->GetImpl()->GetBadElementRemoval();
489 //=============================================================================
491 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
493 * Set Bad Surface Element Aspect Ratio
495 //=============================================================================
496 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
497 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
499 this->GetImpl()->SetBadElementAspectRatio(theValue);
500 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
503 //=============================================================================
505 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
507 * Get Bad Surface Element Aspect Ratio
509 //=============================================================================
510 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
511 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
513 return this->GetImpl()->GetBadElementAspectRatio();
516 //=============================================================================
518 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
522 //=============================================================================
523 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
524 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
526 this->GetImpl()->SetOptimizeMesh(theValue);
527 std::string theValueStr = theValue ? "True" : "False";
528 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
531 //=============================================================================
533 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
537 //=============================================================================
538 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
539 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
541 return this->GetImpl()->GetOptimizeMesh();
544 //=============================================================================
546 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
550 //=============================================================================
551 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
552 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
554 this->GetImpl()->SetQuadraticMesh(theValue);
555 std::string theValueStr = theValue ? "True" : "False";
556 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
559 //=============================================================================
561 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
565 //=============================================================================
566 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
567 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
569 return this->GetImpl()->GetQuadraticMesh();
577 * BLSURFPlugin_Hypothesis_i::SetTopology
582 //=============================================================================
583 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
584 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
586 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
587 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
590 //=============================================================================
592 * BLSURFPlugin_Hypothesis_i::GetTopology
596 //=============================================================================
597 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
598 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
600 return this->GetImpl()->GetTopology();
603 //=============================================================================
604 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
606 if (theVal < 0 || theVal > 100)
607 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
608 this->GetImpl()->SetVerbosity(theVal);
609 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
612 //=============================================================================
614 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
616 return (CORBA::Short) this->GetImpl()->GetVerbosity();
619 //=============================================================================
621 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
625 //=============================================================================
626 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
627 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
629 this->GetImpl()->SetPreCADMergeEdges(theValue);
630 std::string theValueStr = theValue ? "True" : "False";
631 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
634 //=============================================================================
636 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
640 //=============================================================================
641 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
642 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
644 return this->GetImpl()->GetPreCADMergeEdges();
647 //=============================================================================
649 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
653 //=============================================================================
654 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
655 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
657 this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
658 std::string theValueStr = theValue ? "True" : "False";
659 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
662 //=============================================================================
664 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
668 //=============================================================================
669 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
670 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
672 return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
675 //=============================================================================
677 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
681 //=============================================================================
682 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
683 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
685 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
686 std::string theValueStr = theValue ? "True" : "False";
687 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
690 //=============================================================================
692 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
696 //=============================================================================
697 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
698 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
700 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
703 //=============================================================================
705 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
709 //=============================================================================
710 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
711 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
713 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
714 std::string theValueStr = theValue ? "True" : "False";
715 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
718 //=============================================================================
720 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
724 //=============================================================================
725 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
726 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
728 return this->GetImpl()->GetPreCADProcess3DTopology();
731 //=============================================================================
733 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
737 //=============================================================================
738 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
739 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
741 this->GetImpl()->SetPreCADDiscardInput(theValue);
742 std::string theValueStr = theValue ? "True" : "False";
743 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
746 //=============================================================================
748 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
752 //=============================================================================
753 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
754 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
756 return this->GetImpl()->GetPreCADDiscardInput();
760 //=============================================================================
762 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
763 throw (SALOME::SALOME_Exception) {
765 bool valueChanged = false;
767 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
769 this->GetImpl()->SetOptionValue(optionName, optionValue);
770 } catch (const std::invalid_argument& ex) {
771 SALOME::ExceptionStruct ExDescription;
772 ExDescription.text = ex.what();
773 ExDescription.type = SALOME::BAD_PARAM;
774 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
775 ExDescription.lineNumber = 0;
776 throw SALOME::SALOME_Exception(ExDescription);
777 } catch (SALOME_Exception& ex) {
778 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
781 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
784 //=============================================================================
786 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
787 throw (SALOME::SALOME_Exception) {
789 bool valueChanged = false;
791 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
793 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
794 } catch (const std::invalid_argument& ex) {
795 SALOME::ExceptionStruct ExDescription;
796 ExDescription.text = ex.what();
797 ExDescription.type = SALOME::BAD_PARAM;
798 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
799 ExDescription.lineNumber = 0;
800 throw SALOME::SALOME_Exception(ExDescription);
801 } catch (SALOME_Exception& ex) {
802 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
805 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
808 //=============================================================================
810 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
813 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
814 } catch (const std::invalid_argument& ex) {
815 SALOME::ExceptionStruct ExDescription;
816 ExDescription.text = ex.what();
817 ExDescription.type = SALOME::BAD_PARAM;
818 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
819 ExDescription.lineNumber = 0;
820 throw SALOME::SALOME_Exception(ExDescription);
821 } catch (SALOME_Exception& ex) {
822 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
827 //=============================================================================
829 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
832 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
833 } catch (const std::invalid_argument& ex) {
834 SALOME::ExceptionStruct ExDescription;
835 ExDescription.text = ex.what();
836 ExDescription.type = SALOME::BAD_PARAM;
837 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
838 ExDescription.lineNumber = 0;
839 throw SALOME::SALOME_Exception(ExDescription);
840 } catch (SALOME_Exception& ex) {
841 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
846 //=============================================================================
848 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
850 this->GetImpl()->ClearOption(optionName);
851 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
854 //=============================================================================
856 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
858 this->GetImpl()->ClearPreCADOption(optionName);
859 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
862 //=============================================================================
864 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
866 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
868 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
869 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
870 result->length(opts.size()+custom_opts.size());
873 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
874 for (; opIt != opts.end(); ++opIt, ++i) {
875 string name_value_type = opIt->first;
876 if (!opIt->second.empty()) {
877 name_value_type += ":";
878 name_value_type += opIt->second;
879 name_value_type += ":0";
881 result[i] = CORBA::string_dup(name_value_type.c_str());
884 opIt = custom_opts.begin();
885 for (; opIt != custom_opts.end(); ++opIt,++i) {
886 string name_value_type = opIt->first;
887 if (!opIt->second.empty()) {
888 name_value_type += ":";
889 name_value_type += opIt->second;
890 name_value_type += ":1";
892 result[i] = CORBA::string_dup(name_value_type.c_str());
894 return result._retn();
897 //=============================================================================
899 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
901 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
903 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
904 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
905 result->length(opts.size()+custom_opts.size());
908 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
909 for (; opIt != opts.end(); ++opIt, ++i) {
910 string name_value_type = opIt->first;
911 if (!opIt->second.empty()) {
912 name_value_type += ":";
913 name_value_type += opIt->second;
914 name_value_type += ":0";
916 result[i] = CORBA::string_dup(name_value_type.c_str());
919 opIt = custom_opts.begin();
920 for (; opIt != custom_opts.end(); ++opIt,++i) {
921 string name_value_type = opIt->first;
922 if (!opIt->second.empty()) {
923 name_value_type += ":";
924 name_value_type += opIt->second;
925 name_value_type += ":1";
927 result[i] = CORBA::string_dup(name_value_type.c_str());
929 return result._retn();
932 //=============================================================================
934 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
935 throw (SALOME::SALOME_Exception) {
937 for (CORBA::ULong i = 0; i < options.length(); ++i) {
938 string name_value_type = options[i].in();
939 if(name_value_type.empty())
941 size_t colonPos = name_value_type.find(':');
944 if (colonPos == string::npos) // ':' not found
945 name = name_value_type;
947 name = name_value_type.substr(0, colonPos);
948 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
949 string value_type = name_value_type.substr(colonPos + 1);
950 colonPos = value_type.find(':');
951 value = value_type.substr(0, colonPos);
952 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
953 custom = atoi((value_type.substr(colonPos + 1)).c_str());
956 custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
960 //=============================================================================
962 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
963 throw (SALOME::SALOME_Exception) {
965 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
966 string name_value_type = options[i].in();
967 if(name_value_type.empty())
969 size_t colonPos = name_value_type.find(':');
972 if (colonPos == string::npos) // ':' not found
973 name = name_value_type;
975 name = name_value_type.substr(0, colonPos);
976 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
977 string value_type = name_value_type.substr(colonPos + 1);
978 colonPos = value_type.find(':');
979 value = value_type.substr(0, colonPos);
980 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
981 custom = atoi((value_type.substr(colonPos + 1)).c_str());
984 custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
988 //=============================================================================
990 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
993 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
995 this->GetImpl()->AddOption(optionName, optionValue);
996 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1000 //=============================================================================
1002 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1005 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1007 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1008 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1012 //=============================================================================
1014 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1017 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1020 //=============================================================================
1022 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1025 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1028 //=============================================================================
1030 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1031 throw (SALOME::SALOME_Exception) {
1033 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1034 if ( !entry || !entry[0] )
1035 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1036 bool valueChanged = false;
1038 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1040 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1041 } catch (const std::invalid_argument& ex) {
1042 SALOME::ExceptionStruct ExDescription;
1043 ExDescription.text = ex.what();
1044 ExDescription.type = SALOME::BAD_PARAM;
1045 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1046 ExDescription.lineNumber = 0;
1047 throw SALOME::SALOME_Exception(ExDescription);
1048 } catch (SALOME_Exception& ex) {
1049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1051 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1053 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1056 //=============================================================================
1058 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1059 throw (SALOME::SALOME_Exception) {
1061 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1062 bool valueChanged = false;
1063 std::ostringstream sizeMapFunction;
1064 switch (shapeType) {
1065 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1066 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1067 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1071 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1073 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1074 } catch (const std::invalid_argument& ex) {
1075 SALOME::ExceptionStruct ExDescription;
1076 ExDescription.text = ex.what();
1077 ExDescription.type = SALOME::BAD_PARAM;
1078 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1079 ExDescription.lineNumber = 0;
1080 throw SALOME::SALOME_Exception(ExDescription);
1081 } catch (SALOME_Exception& ex) {
1082 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1084 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1086 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1089 //=============================================================================
1091 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1092 throw (SALOME::SALOME_Exception) {
1094 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1095 bool valueChanged = false;
1097 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1098 if ( valueChanged ) {
1099 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1100 if (!boost::regex_match(string(attractor), re))
1101 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1102 this->GetImpl()->SetAttractorEntry(entry, attractor);
1104 } catch (const std::invalid_argument& ex) {
1105 SALOME::ExceptionStruct ExDescription;
1106 ExDescription.text = ex.what();
1107 ExDescription.type = SALOME::BAD_PARAM;
1108 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1109 ExDescription.lineNumber = 0;
1110 throw SALOME::SALOME_Exception(ExDescription);
1111 } catch (SALOME_Exception& ex) {
1112 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1114 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1116 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1119 //=============================================================================
1121 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
1122 throw (SALOME::SALOME_Exception)
1125 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1126 //bool valueChanged = false;
1128 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1130 catch (const std::invalid_argument& ex) {
1131 SALOME::ExceptionStruct ExDescription;
1132 ExDescription.text = ex.what();
1133 ExDescription.type = SALOME::BAD_PARAM;
1134 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1135 ExDescription.lineNumber = 0;
1136 throw SALOME::SALOME_Exception(ExDescription);
1137 } catch (SALOME_Exception& ex) {
1138 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1140 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1141 //if ( valueChanged )
1142 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1143 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1146 //=============================================================================
1148 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1151 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1152 } catch (const std::invalid_argument& ex) {
1153 SALOME::ExceptionStruct ExDescription;
1154 ExDescription.text = ex.what();
1155 ExDescription.type = SALOME::BAD_PARAM;
1156 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1157 ExDescription.lineNumber = 0;
1158 throw SALOME::SALOME_Exception(ExDescription);
1159 } catch (SALOME_Exception& ex) {
1160 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1165 //=============================================================================
1167 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1170 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1171 } catch (const std::invalid_argument& ex) {
1172 SALOME::ExceptionStruct ExDescription;
1173 ExDescription.text = ex.what();
1174 ExDescription.type = SALOME::BAD_PARAM;
1175 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1176 ExDescription.lineNumber = 0;
1177 throw SALOME::SALOME_Exception(ExDescription);
1178 } catch (SALOME_Exception& ex) {
1179 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1184 // //=============================================================================
1186 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1187 // // A finir pour le dump
1188 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1189 // throw (SALOME::SALOME_Exception)
1191 // ASSERT(myBaseImpl);
1193 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1195 // catch (const std::invalid_argument& ex) {
1196 // SALOME::ExceptionStruct ExDescription;
1197 // ExDescription.text = ex.what();
1198 // ExDescription.type = SALOME::BAD_PARAM;
1199 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1200 // ExDescription.lineNumber = 0;
1201 // throw SALOME::SALOME_Exception(ExDescription);
1203 // catch (SALOME_Exception& ex) {
1204 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1209 //=============================================================================
1211 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1213 this->GetImpl()->ClearEntry(entry);
1214 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1217 //=============================================================================
1219 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1221 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1223 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1224 result->length(sizeMaps.size());
1226 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1227 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1228 string entry_sizemap = smIt->first;
1229 if (!smIt->second.empty()) {
1230 entry_sizemap += "|";
1231 entry_sizemap += smIt->second;
1233 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1235 return result._retn();
1238 //=============================================================================
1240 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1242 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1244 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1245 result->length(attractors.size());
1247 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1248 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1249 string entry_attractor = atIt->first;
1250 if (!atIt->second.empty()) {
1251 entry_attractor += "|";
1252 entry_attractor += atIt->second;
1254 result[i] = CORBA::string_dup(entry_attractor.c_str());
1256 return result._retn();
1259 //=============================================================================
1261 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1264 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1266 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1267 result->length( attractors.size() );
1269 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1270 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1271 string faceEntry = atIt->first;
1273 double startSize, endSize, infDist, constDist;
1274 if ( !atIt->second->Empty() ) {
1275 attEntry = atIt->second->GetAttractorEntry();
1276 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1277 std::vector<double> params = atIt->second->GetParameters();
1278 startSize = params[0];
1279 endSize = params[1];
1280 infDist = params[2];
1281 constDist = params[3];
1283 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1284 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1285 result[i].startSize = startSize;
1286 result[i].endSize = endSize;
1287 result[i].infDist = infDist;
1288 result[i].constDist = constDist;
1289 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1290 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1292 return result._retn();
1295 //=============================================================================
1297 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1298 throw (SALOME::SALOME_Exception) {
1300 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1301 string entry_sizemap = sizeMaps[i].in();
1302 size_t colonPos = entry_sizemap.find('|');
1303 string entry, sizemap;
1304 if (colonPos == string::npos) // '|' separator not found
1305 entry = entry_sizemap;
1307 entry = entry_sizemap.substr(0, colonPos);
1308 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1309 sizemap = entry_sizemap.substr(colonPos + 1);
1311 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1315 //=============================================================================
1317 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1319 this->GetImpl()->ClearSizeMaps();
1322 //=============================================================================
1324 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1325 throw (SALOME::SALOME_Exception)
1329 entry = GeomObj->GetStudyEntry();
1330 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1331 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1332 SetSizeMapEntry(entry.c_str(), sizeMap);
1335 //=============================================================================
1337 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1339 string entry = GeomObj->GetStudyEntry();
1340 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1341 if (shapeType == GEOM::COMPOUND)
1342 shapeType = GeomObj->GetMaxShapeType();
1343 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1344 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1345 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1348 //=============================================================================
1349 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1352 entry = GeomObj->GetStudyEntry();
1353 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1354 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1355 UnsetEntry(entry.c_str());
1356 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1359 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1362 entry = GeomObj->GetStudyEntry();
1363 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1364 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1365 SetAttractorEntry(entry.c_str(), attractor);
1368 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1371 entry = GeomObj->GetStudyEntry();
1372 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1373 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1374 UnsetEntry(entry.c_str());
1375 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1378 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)
1381 string theFaceEntry;
1383 theFaceEntry = theFace->GetStudyEntry();
1384 theAttEntry = theAttractor->GetStudyEntry();
1386 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1387 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1390 if (theFaceEntry.empty()) {
1392 aName += theFace->GetEntry();
1393 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1394 if (!theSFace->_is_nil())
1395 theFaceEntry = theSFace->GetID();
1397 if (theFaceEntry.empty())
1398 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1400 if (theAttEntry.empty()) {
1401 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1403 if (theAttractor->GetShapeType() == GEOM::EDGE)
1405 if (theAttractor->GetShapeType() == GEOM::WIRE)
1407 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1408 aName = "Compound_";
1409 aName += theAttractor->GetEntry();
1410 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1411 if (!theSAtt->_is_nil())
1412 theAttEntry = theSAtt->GetID();
1414 if (theAttEntry.empty())
1415 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1417 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1418 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1419 MESSAGE("IDL : GetName : " << theFace->GetName());
1420 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1421 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1424 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1425 GEOM::GEOM_Object_ptr theAttractor)
1428 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1429 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1431 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1432 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1435 // if (theFaceEntry.empty()) {
1437 // aName += theFace->GetEntry();
1438 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1439 // if (!theSFace->_is_nil())
1440 // theFaceEntry = theSFace->GetID();
1442 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1443 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1444 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1446 MESSAGE("IDL : GetName : " << theFace->GetName());
1447 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1448 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1449 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1450 << theFace << ", " << theAttractor << " )";
1453 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1454 const char* attractorEntry)
1456 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1457 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1458 << faceEntry << "', '" << attractorEntry << "' )";
1463 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1466 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1469 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1472 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1475 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1478 this->GetImpl()->UnsetCustomSizeMap(entry);
1479 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1483 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1488 // ///////////////////////
1489 // // ENFORCED VERTICES //
1490 // ///////////////////////
1494 * Returns the list of enforced vertices for a given Face entry
1495 * @return A map of Face entry / List of enforced vertices
1498 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1499 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1502 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1504 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1505 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1506 resultMap->length(faceEntryEnfVertexListMap.size());
1507 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1509 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1510 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1511 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1512 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1513 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1514 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1515 MESSAGE("Face Entry: " << mapElement->faceEntry);
1517 _enfVertexList = it_entry->second;
1518 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1519 enfVertexList->length(_enfVertexList.size());
1520 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1522 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1523 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1524 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1525 currentEnfVertex = (*it_enfVertex);
1527 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1530 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1533 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1536 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1537 coords->length(currentEnfVertex->coords.size());
1538 for (CORBA::ULong i=0;i<coords->length();i++)
1539 coords[i] = currentEnfVertex->coords[i];
1540 enfVertex->coords = coords;
1543 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1546 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1547 faceEntryList->length(currentEnfVertex->faceEntries.size());
1548 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1549 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1550 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1551 enfVertex->faceEntries = faceEntryList;
1554 msg << "Enforced vertex: \n"
1555 << "Name: " << enfVertex->name << "\n";
1556 if (coords->length())
1557 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1558 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1559 << "Group Name: " << enfVertex->grpName;
1562 enfVertexList[j] = enfVertex;
1564 mapElement->enfVertexList = enfVertexList;
1566 resultMap[i] = mapElement;
1569 return resultMap._retn();
1573 * Returns the list of all enforced vertices
1574 * @return a list of enforced vertices
1577 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1578 MESSAGE("IDL: GetAllEnforcedVertices()");
1580 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1581 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1582 resultMap->length(enfVertexList.size());
1583 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1585 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1586 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1587 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1588 MESSAGE("Enforced Vertex #" << i);
1589 currentEnfVertex = (*evlIt);
1590 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1592 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1594 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1596 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1597 coords->length(currentEnfVertex->coords.size());
1598 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
1599 coords[ind] = currentEnfVertex->coords[ind];
1600 enfVertex->coords = coords;
1602 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1604 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1605 faceEntryList->length(currentEnfVertex->faceEntries.size());
1606 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1607 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1608 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1609 enfVertex->faceEntries = faceEntryList;
1612 msg << "Enforced vertex: \n"
1613 << "Name: " << enfVertex->name << "\n";
1614 if (coords->length())
1615 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1616 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1617 << "Group Name: " << enfVertex->grpName;
1620 resultMap[i] = enfVertex;
1622 return resultMap._retn();
1627 * Returns the list of enforced vertices coords for a given Face entry.
1628 * They are the coords of the "manual" enforced vertices.
1629 * @return A map of Face entry / List of enforced vertices coords
1632 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1633 MESSAGE("IDL: GetAllCoordsByFace()");
1636 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1638 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1639 resultMap->length(entryCoordsListMap.size());
1640 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1642 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1643 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1644 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1645 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1646 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1647 MESSAGE("Face Entry: " << mapElement->faceEntry);
1649 _coordsList = it_entry->second;
1650 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1651 coordsList->length(_coordsList.size());
1652 MESSAGE("Number of coords: " << coordsList->length());
1654 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1655 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1656 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1657 coords->length((*it_coords).size());
1658 for (CORBA::ULong i=0;i<coords->length();i++)
1659 coords[i] = (*it_coords)[i];
1660 coordsList[j] = coords;
1661 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1663 mapElement->coordsList = coordsList;
1665 resultMap[i] = mapElement;
1668 return resultMap._retn();
1672 * Returns a map of enforced vertices coords / enforced vertex.
1673 * They are the coords of the "manual" enforced vertices.
1675 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1676 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1679 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1680 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1681 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1682 resultMap->length(coordsEnfVertexMap.size());
1683 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1685 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1686 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1687 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1688 MESSAGE("Enforced Vertex #" << i);
1689 currentEnfVertex = (it_coords->second);
1690 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1691 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1692 coords->length(it_coords->first.size());
1693 for (CORBA::ULong ind=0;ind<coords->length();ind++)
1694 coords[ind] = it_coords->first[ind];
1695 mapElement->coords = coords;
1696 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1698 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1700 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1702 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1704 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1705 coords2->length(currentEnfVertex->coords.size());
1706 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
1707 coords2[ind] = currentEnfVertex->coords[ind];
1708 enfVertex->coords = coords2;
1710 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1712 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1713 faceEntryList->length(currentEnfVertex->faceEntries.size());
1714 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1715 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1716 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1717 enfVertex->faceEntries = faceEntryList;
1719 mapElement->enfVertex = enfVertex;
1721 msg << "Enforced vertex: \n"
1722 << "Name: " << enfVertex->name << "\n";
1723 if (coords->length())
1724 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1725 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1726 << "Group Name: " << enfVertex->grpName;
1729 resultMap[i] = mapElement;
1731 return resultMap._retn();
1735 * Returns the list of enforced vertices entries for a given Face entry.
1736 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1737 * @return A map of Face entry / List of enforced vertices geom entries
1740 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1741 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1744 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1746 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1747 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1748 resultMap->length(entryEnfVertexEntryListMap.size());
1749 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1751 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1752 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1753 entryEnfVertexEntryListMap.begin();
1754 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1755 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1756 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1757 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1758 MESSAGE("Face Entry: " << mapElement->faceEntry);
1760 _enfVertexEntryList = it_entry->second;
1761 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1762 enfVertexEntryList->length(_enfVertexEntryList.size());
1763 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1765 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1766 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1767 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1768 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1770 mapElement->enfVertexEntryList = enfVertexEntryList;
1772 resultMap[i] = mapElement;
1775 return resultMap._retn();
1779 * Returns a map of enforced vertices geom entry / enforced vertex.
1780 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1782 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1783 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1786 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1787 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1788 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1789 resultMap->length(enfVertexEntryEnfVertexMap.size());
1790 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1792 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1793 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1794 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1795 MESSAGE("Enforced Vertex #" << i);
1796 currentEnfVertex = it_enfVertexEntry->second;
1797 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1798 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1799 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1801 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1803 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1805 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1807 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1808 coords->length(currentEnfVertex->coords.size());
1809 for (CORBA::ULong ind=0;ind<coords->length();ind++)
1810 coords[ind] = currentEnfVertex->coords[ind];
1811 enfVertex->coords = coords;
1813 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1815 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1816 faceEntryList->length(currentEnfVertex->faceEntries.size());
1817 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1818 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1819 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1820 enfVertex->faceEntries = faceEntryList;
1823 msg << "Enforced vertex: \n"
1824 << "Name: " << enfVertex->name << "\n";
1825 if (coords->length())
1826 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1827 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1828 << "Group Name: " << enfVertex->grpName;
1831 mapElement->enfVertex = enfVertex;
1832 resultMap[i] = mapElement;
1834 return resultMap._retn();
1838 * Erase all enforced vertices
1840 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1842 this->GetImpl()->ClearAllEnforcedVertices();
1843 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1847 * Set/get/unset an enforced vertex on face
1849 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1850 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1853 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1854 MESSAGE("theFace shape type is not FACE or COMPOUND");
1855 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1858 string theFaceEntry = theFace->GetStudyEntry();
1860 if (theFaceEntry.empty()) {
1861 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1862 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1864 if (theFace->GetShapeType() == GEOM::FACE)
1866 if (theFace->GetShapeType() == GEOM::COMPOUND)
1867 aName = "Compound_";
1868 aName += theFace->GetEntry();
1869 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1870 if (!theSFace->_is_nil())
1871 theFaceEntry = theSFace->GetID();
1873 if (theFaceEntry.empty())
1874 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1875 MESSAGE("IDL : GetName : " << theFace->GetName());
1876 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1878 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1879 } catch (SALOME_Exception& ex) {
1880 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1885 * Set/get/unset an enforced vertex with name on face
1887 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1888 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1891 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1892 MESSAGE("theFace shape type is not FACE or COMPOUND");
1893 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1896 string theFaceEntry = theFace->GetStudyEntry();
1898 if (theFaceEntry.empty()) {
1899 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1900 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1902 if (theFace->GetShapeType() == GEOM::FACE)
1904 if (theFace->GetShapeType() == GEOM::COMPOUND)
1905 aName = "Compound_";
1906 aName += theFace->GetEntry();
1907 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1908 if (!theSFace->_is_nil())
1909 theFaceEntry = theSFace->GetID();
1911 if (theFaceEntry.empty())
1912 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1914 MESSAGE("IDL : GetName : " << theFace->GetName());
1915 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1917 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1918 } catch (SALOME_Exception& ex) {
1919 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1924 * Set/get/unset an enforced vertex with geom object on face
1926 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1927 throw (SALOME::SALOME_Exception) {
1930 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1931 MESSAGE("theFace shape type is not FACE or COMPOUND");
1932 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1935 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1936 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1937 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1940 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1941 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1942 // if (CORBA::is_nil(measureOp))
1945 // CORBA::Double x, y, z;
1947 // measureOp->PointCoordinates(theVertex, x, y, z);
1949 string theFaceEntry = theFace->GetStudyEntry();
1950 string theVertexEntry = theVertex->GetStudyEntry();
1952 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1953 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1956 if (theFaceEntry.empty()) {
1957 if (theFace->GetShapeType() == GEOM::FACE)
1959 if (theFace->GetShapeType() == GEOM::COMPOUND)
1960 aName = "Compound_";
1961 aName += theFace->GetEntry();
1962 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1963 if (!theSFace->_is_nil())
1964 theFaceEntry = theSFace->GetID();
1966 if (theFaceEntry.empty())
1967 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1969 if (theVertexEntry.empty()) {
1970 if (theVertex->GetShapeType() == GEOM::VERTEX)
1972 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1973 aName = "Compound_";
1974 aName += theVertex->GetEntry();
1975 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1976 if (!theSVertex->_is_nil())
1977 theVertexEntry = theSVertex->GetID();
1979 if (theVertexEntry.empty())
1980 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1982 string theVertexName = theVertex->GetName();
1983 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1984 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1985 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1987 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1988 } catch (SALOME_Exception& ex) {
1989 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1994 * Set an enforced vertex with group name on face
1996 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1997 throw (SALOME::SALOME_Exception)
2001 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2002 MESSAGE("theFace shape type is not FACE or COMPOUND");
2003 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2006 string theFaceEntry = theFace->GetStudyEntry();
2008 if (theFaceEntry.empty()) {
2009 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2010 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2012 if (theFace->GetShapeType() == GEOM::FACE)
2014 if (theFace->GetShapeType() == GEOM::COMPOUND)
2015 aName = "Compound_";
2016 aName += theFace->GetEntry();
2017 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2018 if (!theSFace->_is_nil())
2019 theFaceEntry = theSFace->GetID();
2021 if (theFaceEntry.empty())
2022 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2023 MESSAGE("IDL : GetName : " << theFace->GetName());
2024 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2026 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2027 } catch (SALOME_Exception& ex) {
2028 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2033 * Set an enforced vertex with name and group name on face
2035 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2036 const char* theVertexName, const char* theGroupName)
2037 throw (SALOME::SALOME_Exception)
2041 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2042 MESSAGE("theFace shape type is not FACE or COMPOUND");
2043 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2046 string theFaceEntry = theFace->GetStudyEntry();
2048 if (theFaceEntry.empty()) {
2049 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2050 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2052 if (theFace->GetShapeType() == GEOM::FACE)
2054 if (theFace->GetShapeType() == GEOM::COMPOUND)
2055 aName = "Compound_";
2056 aName += theFace->GetEntry();
2057 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2058 if (!theSFace->_is_nil())
2059 theFaceEntry = theSFace->GetID();
2061 if (theFaceEntry.empty())
2062 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2063 MESSAGE("IDL : GetName : " << theFace->GetName());
2064 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2066 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2067 } catch (SALOME_Exception& ex) {
2068 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2073 * Set an enforced vertex with geom entry and group name on face
2075 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2076 throw (SALOME::SALOME_Exception)
2080 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2081 MESSAGE("theFace shape type is not FACE or COMPOUND");
2082 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2085 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2086 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2087 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2090 string theFaceEntry = theFace->GetStudyEntry();
2091 string theVertexEntry = theVertex->GetStudyEntry();
2093 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2094 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2097 if (theFaceEntry.empty()) {
2098 if (theFace->GetShapeType() == GEOM::FACE)
2100 if (theFace->GetShapeType() == GEOM::COMPOUND)
2101 aName = "Compound_";
2102 aName += theFace->GetEntry();
2103 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2104 if (!theSFace->_is_nil())
2105 theFaceEntry = theSFace->GetID();
2107 if (theFaceEntry.empty())
2108 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2110 if (theVertexEntry.empty()) {
2111 if (theVertex->GetShapeType() == GEOM::VERTEX)
2113 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2114 aName = "Compound_";
2115 aName += theVertex->GetEntry();
2116 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2117 if (!theSVertex->_is_nil())
2118 theVertexEntry = theSVertex->GetID();
2120 if (theVertexEntry.empty())
2121 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2123 string theVertexName = theVertex->GetName();
2124 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2125 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2126 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2128 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2129 } catch (SALOME_Exception& ex) {
2130 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2134 //Enable internal enforced vertices on specific face if requested by user
2136 // * Are internal enforced vertices used for a face ?
2138 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2139 // throw (SALOME::SALOME_Exception) {
2140 // ASSERT(myBaseImpl);
2142 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2143 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2144 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2147 // string theFaceEntry = theFace->GetStudyEntry();
2149 // if (theFaceEntry.empty()) {
2150 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2151 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2153 // if (theFace->GetShapeType() == GEOM::FACE)
2155 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2156 // aName = "Compound_";
2157 // aName += theFace->GetEntry();
2158 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2159 // if (!theSFace->_is_nil())
2160 // theFaceEntry = theSFace->GetID();
2162 // if (theFaceEntry.empty())
2163 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2165 // MESSAGE("IDL : GetName : " << theFace->GetName());
2166 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2168 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2169 // } catch (SALOME_Exception& ex) {
2170 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2175 * Get the list of all enforced vertices
2177 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2178 throw (SALOME::SALOME_Exception) {
2181 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2182 MESSAGE("theFace shape type is not FACE or COMPOUND");
2183 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2186 string theFaceEntry = theFace->GetStudyEntry();
2188 if (theFaceEntry.empty()) {
2189 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2190 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2192 if (theFace->GetShapeType() == GEOM::FACE)
2194 if (theFace->GetShapeType() == GEOM::COMPOUND)
2195 aName = "Compound_";
2196 aName += theFace->GetEntry();
2197 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2198 if (!theSFace->_is_nil())
2199 theFaceEntry = theSFace->GetID();
2201 if (theFaceEntry.empty())
2202 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2204 MESSAGE("IDL : GetName : " << theFace->GetName());
2205 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2207 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2208 } catch (SALOME_Exception& ex) {
2209 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2213 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2214 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2217 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2218 MESSAGE("theFace shape type is not FACE or COMPOUND");
2219 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2222 string theFaceEntry = theFace->GetStudyEntry();
2224 if (theFaceEntry.empty()) {
2225 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2226 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2228 if (theFace->GetShapeType() == GEOM::FACE)
2230 if (theFace->GetShapeType() == GEOM::COMPOUND)
2231 aName = "Compound_";
2232 aName += theFace->GetEntry();
2233 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2234 if (!theSFace->_is_nil())
2235 theFaceEntry = theSFace->GetID();
2237 if (theFaceEntry.empty())
2238 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2239 MESSAGE("IDL : GetName : " << theFace->GetName());
2240 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2243 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2244 } catch (SALOME_Exception& ex) {
2245 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2249 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2250 throw (SALOME::SALOME_Exception) {
2253 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2254 MESSAGE("theFace shape type is not FACE or COMPOUND");
2255 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2257 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2258 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2259 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2262 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2263 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2264 // if (CORBA::is_nil(measureOp))
2267 // CORBA::Double x, y, z;
2269 // measureOp->PointCoordinates(theVertex, x, y, z);
2271 std::string theFaceEntry = theFace->GetStudyEntry();
2272 std::string theVertexEntry = theVertex->GetStudyEntry();
2274 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2275 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2278 if (theFaceEntry.empty()) {
2279 if (theFace->GetShapeType() == GEOM::FACE)
2281 if (theFace->GetShapeType() == GEOM::COMPOUND)
2282 aName = "Compound_";
2283 aName += theFace->GetEntry();
2284 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2285 if (!theSFace->_is_nil())
2286 theFaceEntry = theSFace->GetID();
2288 if (theFaceEntry.empty())
2289 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2291 if (theVertexEntry.empty()) {
2292 if (theVertex->GetShapeType() == GEOM::VERTEX)
2294 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2295 aName = "Compound_";
2296 aName += theVertex->GetEntry();
2297 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2298 if (!theSVertex->_is_nil())
2299 theVertexEntry = theSVertex->GetID();
2301 if (theVertexEntry.empty())
2302 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2304 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2307 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2308 } catch (SALOME_Exception& ex) {
2309 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2313 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2316 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2317 MESSAGE("theFace shape type is not FACE or COMPOUND");
2318 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2321 string theFaceEntry = theFace->GetStudyEntry();
2323 if (theFaceEntry.empty()) {
2324 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2325 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2327 if (theFace->GetShapeType() == GEOM::FACE)
2329 if (theFace->GetShapeType() == GEOM::COMPOUND)
2330 aName = "Compound_";
2331 aName += theFace->GetEntry();
2332 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2333 if (!theSFace->_is_nil())
2334 theFaceEntry = theSFace->GetID();
2336 if (theFaceEntry.empty())
2337 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2339 MESSAGE("IDL : GetName : " << theFace->GetName());
2340 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2343 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2344 } catch (SALOME_Exception& ex) {
2345 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2350 * Set/get/unset an enforced vertex on geom object given by entry
2352 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2353 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2354 throw (SALOME::SALOME_Exception) {
2356 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2357 bool newValue = false;
2358 if (string(theVertexEntry).empty()) {
2360 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2361 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2362 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2363 coords.push_back(x);
2364 coords.push_back(y);
2365 coords.push_back(z);
2366 if (coordsList.find(coords) == coordsList.end()) {
2367 MESSAGE("Coords not found: add it in coordsList");
2370 MESSAGE("Coords already found, compare names");
2371 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2372 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2373 MESSAGE("The names are different: update");
2374 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2378 MESSAGE("The names are identical");
2381 } catch (const std::invalid_argument& ex) {
2382 // no enforced vertex for entry
2383 MESSAGE("Face entry not found : add it to the list");
2387 if (string(theVertexName).empty()) {
2388 if (string(theGroupName).empty())
2389 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2391 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2394 if (string(theGroupName).empty())
2395 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2397 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2398 << theVertexName << "\", \"" << theGroupName << "\")";
2403 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2404 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2405 if ( it == enfVertexEntryList.end()) {
2406 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2410 MESSAGE("Geom entry already found, compare names");
2411 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2412 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2413 MESSAGE("The names are different: update");
2414 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2418 MESSAGE("The names are identical");
2421 } catch (const std::invalid_argument& ex) {
2422 // no enforced vertex for entry
2423 MESSAGE("Face entry not found : add it to the list");
2427 if (string(theGroupName).empty())
2428 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2430 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2435 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2437 MESSAGE("IDL : SetEnforcedVertexEntry END");
2441 //Enable internal enforced vertices on specific face if requested by user
2442 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2443 // throw (SALOME::SALOME_Exception) {
2444 // ASSERT(myBaseImpl);
2446 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2447 // } catch (const std::exception& ex) {
2448 // std::cout << "Exception: " << ex.what() << std::endl;
2449 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2453 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2454 throw (SALOME::SALOME_Exception) {
2456 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2459 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2460 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2461 vertexList->length(_vList.size());
2462 MESSAGE("Number of enforced vertices: " << vertexList->length());
2463 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2464 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2465 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2467 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2470 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2471 // Geom Vertex Entry
2472 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2474 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2475 coords->length(_enfVertex->coords.size());
2476 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
2477 coords[ind] = _enfVertex->coords[ind];
2478 enfVertex->coords = coords;
2480 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2482 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2483 faceEntryList->length(_enfVertex->faceEntries.size());
2484 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2485 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2486 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2487 enfVertex->faceEntries = faceEntryList;
2489 vertexList[i] = enfVertex;
2491 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2492 return vertexList._retn();
2493 } catch (const std::invalid_argument& ex) {
2494 SALOME::ExceptionStruct ExDescription;
2495 ExDescription.text = ex.what();
2496 ExDescription.type = SALOME::BAD_PARAM;
2497 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2498 ExDescription.lineNumber = 1385;
2499 throw SALOME::SALOME_Exception(ExDescription);
2500 } catch (const std::exception& ex) {
2501 std::cout << "Exception: " << ex.what() << std::endl;
2502 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2506 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2507 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2509 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2513 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2515 if (string(theVertexEntry).empty())
2516 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2519 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2521 } catch (const std::invalid_argument& ex) {
2523 } catch (const std::exception& ex) {
2524 std::cout << "Exception: " << ex.what() << std::endl;
2525 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2528 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2532 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2533 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2534 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2536 // bool ret = false;
2539 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2540 // } catch (SALOME_Exception& ex) {
2541 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2545 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2548 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2552 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2554 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2557 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2558 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2559 } catch (const std::invalid_argument& ex) {
2561 } catch (const std::exception& ex) {
2562 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2565 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2569 //=============================================================================
2571 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2575 //=============================================================================
2576 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2577 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2579 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2580 std::string theValueStr = theValue ? "True" : "False";
2581 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2584 //=============================================================================
2586 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2590 //=============================================================================
2591 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2592 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2594 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2597 //=============================================================================
2599 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2603 //=============================================================================
2604 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2605 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2607 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2608 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2611 //=============================================================================
2613 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2617 //=============================================================================
2618 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2619 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2621 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2625 * Enable internal enforced vertices on specific face if requested by user
2627 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2628 throw (SALOME::SALOME_Exception)
2630 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2632 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2633 } catch (SALOME_Exception& ex) {
2634 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2638 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2639 throw (SALOME::SALOME_Exception)
2641 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2643 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2644 MESSAGE("theFace shape type is not FACE or COMPOUND");
2645 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2648 string theFaceEntry = theFace->GetStudyEntry();
2650 if (theFaceEntry.empty()) {
2651 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2652 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2654 if (theFace->GetShapeType() == GEOM::FACE)
2656 if (theFace->GetShapeType() == GEOM::COMPOUND)
2657 aName = "Compound_";
2658 aName += theFace->GetEntry();
2659 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2660 if (!theSFace->_is_nil())
2661 theFaceEntry = theSFace->GetID();
2663 if (theFaceEntry.empty())
2664 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2666 MESSAGE("IDL : GetName : " << theFace->GetName());
2667 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2669 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2670 } catch (SALOME_Exception& ex) {
2671 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2675 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2676 throw (SALOME::SALOME_Exception)
2678 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2681 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2682 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2683 if (string(theGroupName).empty())
2684 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2686 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2687 } catch (const std::exception& ex) {
2688 std::cout << "Exception: " << ex.what() << std::endl;
2689 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2696 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2697 throw (SALOME::SALOME_Exception)
2700 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2702 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2704 catch (const std::invalid_argument& ex) {
2705 SALOME::ExceptionStruct ExDescription;
2706 ExDescription.text = ex.what();
2707 ExDescription.type = SALOME::BAD_PARAM;
2708 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2709 ExDescription.lineNumber = 1146;
2710 throw SALOME::SALOME_Exception(ExDescription);
2712 catch (SALOME_Exception& ex) {
2713 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2715 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2720 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2721 throw (SALOME::SALOME_Exception)
2724 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2726 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2728 catch (const std::invalid_argument& ex) {
2729 SALOME::ExceptionStruct ExDescription;
2730 ExDescription.text = ex.what();
2731 ExDescription.type = SALOME::BAD_PARAM;
2732 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2733 ExDescription.lineNumber = 1170;
2734 throw SALOME::SALOME_Exception(ExDescription);
2736 catch (SALOME_Exception& ex) {
2737 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2740 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2741 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2743 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2746 ///////////////////////
2748 ///////////////////////
2750 ///////////////////////
2753 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2755 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2756 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2757 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2758 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2759 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2760 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2761 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2762 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2763 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2764 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2765 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2766 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2767 return txtShapeType;
2770 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2772 // Check shape types
2774 std::stringstream typesTxt;
2775 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2777 GEOM::shape_type theShapeType = theShapeTypes[i];
2778 if (shape->GetShapeType() == theShapeType)
2780 typesTxt << ShapeTypeToString(theShapeType);
2781 if (i < theShapeTypes.size()-1 )
2785 std::stringstream msg;
2786 msg << "shape shape type is not in" << typesTxt.str();
2788 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2792 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2795 if (shape->GetShapeType() != theShapeType) {
2796 std::stringstream msg;
2797 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2799 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2803 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2805 // Check shape is published in the object browser
2806 string shapeEntry = shape->GetStudyEntry();
2808 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2809 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2812 // Publish shape if needed
2813 if (shapeEntry.empty()) {
2814 if (shape->GetShapeType() == theShapeType)
2816 aName += shape->GetEntry();
2817 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2818 if (!theSFace1->_is_nil())
2819 shapeEntry = theSFace1->GetID();
2821 if (shapeEntry.empty())
2822 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2826 // Format the output of two vectors to use it in MESSAGE and PythonDump
2827 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2829 std::stringstream listEntriesTxt;
2831 if (!theSourceVerticesEntries.empty())
2833 listEntriesTxt << ", [" ;
2835 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2838 listEntriesTxt << ", ";
2839 listEntriesTxt << *it;
2842 listEntriesTxt << "], [" ;
2844 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2847 listEntriesTxt << ", ";
2848 listEntriesTxt << *it;
2850 listEntriesTxt << "]" ;
2852 return listEntriesTxt.str();
2856 * Erase all PreCad periodicity associations
2858 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2860 this->GetImpl()->ClearPreCadPeriodicityVectors();
2861 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2864 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2866 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2867 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2868 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2870 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2872 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2873 return periodicityList._retn();
2876 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2878 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2879 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2880 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2882 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2884 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2885 return periodicityList._retn();
2888 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2889 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2891 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2892 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2894 periodicityList->length(preCadPeriodicityVector.size());
2896 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2898 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2900 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2901 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2902 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2904 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2905 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2907 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2908 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2909 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2912 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2914 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2915 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2917 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2918 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2919 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2922 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2924 periodicityList[i] = myPreCadPeriodicity;
2928 return periodicityList._retn();
2932 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2933 throw (SALOME::SALOME_Exception)
2936 const GEOM::ListOfGO theSourceVertices;
2937 const GEOM::ListOfGO theTargetVertices;
2938 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2942 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2943 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2944 throw (SALOME::SALOME_Exception)
2947 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2949 size_t theLength = theSourceVertices.length();
2950 if (theLength != theTargetVertices.length())
2951 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2953 std::vector<GEOM::shape_type> allowedShapeTypes;
2954 allowedShapeTypes.push_back(GEOM::FACE);
2955 allowedShapeTypes.push_back(GEOM::COMPOUND);
2957 string prefix1 = "Source_face_";
2958 CheckShapeTypes(theFace1, allowedShapeTypes);
2959 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2961 string prefix2 = "Target_face_";
2962 CheckShapeTypes(theFace2, allowedShapeTypes);
2963 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2965 string prefix3 = "Source_vertex_";
2966 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2967 theSourceVerticesEntries->length(theLength);
2968 GEOM::GEOM_Object_ptr theVtx_i;
2970 for (size_t ind = 0; ind < theLength; ind++) {
2971 theVtx_i = theSourceVertices[ind];
2972 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2973 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2976 string prefix4 = "Target_vertex_";
2977 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2978 theTargetVerticesEntries->length(theLength);
2979 for (size_t ind = 0; ind < theLength; ind++) {
2980 theVtx_i = theTargetVertices[ind];
2981 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2982 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2985 string theFace2Name = theFace2->GetName();
2986 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2987 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2988 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2990 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2991 theSourceVerticesEntries, theTargetVerticesEntries);
2992 } catch (SALOME_Exception& ex) {
2993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2998 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2999 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3000 throw (SALOME::SALOME_Exception)
3005 // Convert BLSURFPlugin::TEntryList to vector<string>
3006 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3007 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3008 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3009 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3012 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3014 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3016 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3017 theSourceVerticesEntries, theTargetVerticesEntries);
3019 SMESH::TPythonDump pd;
3020 if (!theSourceVerticesEntries.empty())
3022 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3023 pd << listEntriesTxt.c_str();
3027 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3028 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3031 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3032 throw (SALOME::SALOME_Exception)
3035 const GEOM::ListOfGO theSourceVertices;
3036 const GEOM::ListOfGO theTargetVertices;
3037 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3040 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3041 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3042 throw (SALOME::SALOME_Exception)
3044 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3047 size_t theLength = theSourceVertices.length();
3048 if (theLength != theTargetVertices.length())
3049 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3051 std::vector<GEOM::shape_type> allowedShapeTypes;
3052 allowedShapeTypes.push_back(GEOM::EDGE);
3053 allowedShapeTypes.push_back(GEOM::COMPOUND);
3055 string prefix1 = "Source_edge_";
3056 CheckShapeTypes(theEdge1, allowedShapeTypes);
3057 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3059 string prefix2 = "Target_edge_";
3060 CheckShapeTypes(theEdge2, allowedShapeTypes);
3061 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3063 string prefix3 = "Source_vertex_";
3064 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3065 theSourceVerticesEntries->length(theLength);
3066 GEOM::GEOM_Object_ptr theVtx_i;
3068 for (size_t ind = 0; ind < theLength; ind++) {
3069 theVtx_i = theSourceVertices[ind];
3070 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3071 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3074 string prefix4 = "Target_vertex_";
3075 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3076 theTargetVerticesEntries->length(theLength);
3077 for (size_t ind = 0; ind < theLength; ind++) {
3078 theVtx_i = theTargetVertices[ind];
3079 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3080 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3083 string theEdge2Name = theEdge2->GetName();
3084 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3085 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3086 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3088 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3089 theSourceVerticesEntries, theTargetVerticesEntries);
3090 } catch (SALOME_Exception& ex) {
3091 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3096 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3097 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3098 throw (SALOME::SALOME_Exception)
3103 // Convert BLSURFPlugin::TEntryList to vector<string>
3104 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3105 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3106 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3107 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3110 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3112 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3113 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3114 theSourceVerticesEntries, theTargetVerticesEntries);
3116 SMESH::TPythonDump pd;
3117 if (!theSourceVerticesEntries.empty())
3119 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3120 pd << listEntriesTxt.c_str();
3124 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3126 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3130 //================================================================================
3132 * \brief Sets the file for export resulting mesh in GMF format
3133 * \param theFileName - full name of the file (.mesh, .meshb)
3135 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3137 //================================================================================
3138 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3139 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3141 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3142 bool valueChanged/*, modeChanged*/ = false;
3144 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3145 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3146 if (valueChanged)// or (!valueChanged && modeChanged))
3147 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3148 } catch (const std::exception& ex) {
3149 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3151 if (valueChanged)// or (!valueChanged && modeChanged))
3152 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3153 MESSAGE("IDL : SetGMFFile END ");
3156 //================================================================================
3158 * \brief Gets the file name for export resulting mesh in GMF format
3159 * \retval char* - The file name
3161 * Returns the GMF file name
3163 //================================================================================
3164 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3166 // MESSAGE("IDL : GetGMFFile()");
3167 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3170 // //================================================================================
3172 // * \brief Gets the file mode for export resulting mesh in GMF format
3173 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3175 // * Returns the GMF file mode
3177 // //================================================================================
3178 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3179 // ASSERT(myBaseImpl);
3180 // MESSAGE("IDL : GetGMFFileMode()");
3181 // return this->GetImpl()->GetGMFFileMode();
3184 //=============================================================================
3186 * BLSURFPlugin_Hypothesis_i::GetImpl
3188 * Get implementation
3190 //=============================================================================
3191 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3192 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3193 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3196 //================================================================================
3198 * \brief Verify whether hypothesis supports given entity type
3199 * \param type - dimension (see SMESH::Dimension enumeration)
3200 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3202 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3204 //================================================================================
3205 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3206 return type == SMESH::DIM_2D;
3210 // Obsolete methods - To be removed in V7
3213 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3214 this->SetMinSize(theMinSize);
3216 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3217 return this->GetMinSize();
3219 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3220 this->SetMaxSize(theMaxSize);
3222 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3223 return this->GetMaxSize();
3225 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3226 this->SetMinSize(theMinSize);
3228 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3229 return this->GetMinSize();
3231 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3232 this->SetMaxSize(theMaxSize);
3234 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3235 return this->GetMaxSize();
3237 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3238 this->SetAngleMesh(theValue);
3240 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3241 return this->GetAngleMesh();
3243 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3244 this->SetAngleMesh(theValue);
3246 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3247 return this->GetAngleMesh();
3249 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3250 std::string theValueStr = theValue ? "1" : "0";
3251 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3253 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3254 std::string theValueStr = this->GetOptionValue("respect_geometry");
3255 if (theValueStr.empty() || theValueStr == "respect")
3259 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3260 std::string theValueStr = theValue ? "1" : "0";
3261 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3263 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3264 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3265 if (theValueStr == "1")
3269 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3270 std::ostringstream theValueStr;
3271 theValueStr << theValue;
3272 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3274 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3275 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3277 theValueStr >> result;