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();
242 //=============================================================================
244 * BLSURFPlugin_Hypothesis_i::SetUseGradation
248 //=============================================================================
249 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
250 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
252 if ( GetImpl()->GetUseGradation() != bool( theValue ))
254 this->GetImpl()->SetUseGradation(theValue);
255 std::string theValueStr = theValue ? "True" : "False";
256 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
260 //=============================================================================
262 * BLSURFPlugin_Hypothesis_i::GetUseGradation
266 //=============================================================================
267 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
268 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
270 return this->GetImpl()->GetUseGradation();
273 //=============================================================================
275 * BLSURFPlugin_Hypothesis_i::SetGradation
279 //=============================================================================
280 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
281 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
283 this->GetImpl()->SetGradation(theValue);
286 SetUseGradation( false );
288 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
291 //=============================================================================
293 * BLSURFPlugin_Hypothesis_i::GetGradation
297 //=============================================================================
298 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
299 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
301 return this->GetImpl()->GetGradation();
304 //=============================================================================
306 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
310 //=============================================================================
311 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
312 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
314 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
316 this->GetImpl()->SetUseVolumeGradation(theValue);
317 std::string theValueStr = theValue ? "True" : "False";
318 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
322 //=============================================================================
324 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
328 //=============================================================================
329 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
330 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
332 return this->GetImpl()->GetUseVolumeGradation();
335 //=============================================================================
337 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
339 * Set VolumeGradation
341 //=============================================================================
342 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
343 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
345 this->GetImpl()->SetVolumeGradation(theValue);
347 SetUseVolumeGradation( false );
349 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
352 //=============================================================================
354 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
356 * Get VolumeGradation
358 //=============================================================================
359 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
360 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
362 return this->GetImpl()->GetVolumeGradation();
365 //=============================================================================
367 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
371 //=============================================================================
372 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
373 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
375 this->GetImpl()->SetQuadAllowed(theValue);
376 std::string theValueStr = theValue ? "True" : "False";
377 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
380 //=============================================================================
382 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
386 //=============================================================================
387 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
388 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
390 return this->GetImpl()->GetQuadAllowed();
393 //=============================================================================
395 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
399 //=============================================================================
400 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
401 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
403 this->GetImpl()->SetAngleMesh(theValue);
404 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
407 //=============================================================================
409 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
413 //=============================================================================
414 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
415 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
417 return this->GetImpl()->GetAngleMesh();
420 //=============================================================================
422 * BLSURFPlugin_Hypothesis_i::SetChordalError
426 //=============================================================================
427 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
428 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
430 this->GetImpl()->SetChordalError(theValue);
431 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
434 //=============================================================================
436 * BLSURFPlugin_Hypothesis_i::GetChordalError
440 //=============================================================================
441 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
442 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
444 return this->GetImpl()->GetChordalError();
447 //=============================================================================
449 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
453 //=============================================================================
454 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
455 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
457 this->GetImpl()->SetAnisotropic(theValue);
458 std::string theValueStr = theValue ? "True" : "False";
459 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
462 //=============================================================================
464 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
468 //=============================================================================
469 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
470 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
472 return this->GetImpl()->GetAnisotropic();
475 //=============================================================================
477 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
479 * Set Anisotropic Ratio
481 //=============================================================================
482 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
483 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
485 this->GetImpl()->SetAnisotropicRatio(theValue);
486 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
489 //=============================================================================
491 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
493 * Get Anisotropic Ratio
495 //=============================================================================
496 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
497 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
499 return this->GetImpl()->GetAnisotropicRatio();
503 //=============================================================================
505 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
509 //=============================================================================
510 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
511 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
513 this->GetImpl()->SetRemoveTinyEdges(theValue);
514 std::string theValueStr = theValue ? "True" : "False";
515 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
518 //=============================================================================
520 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
524 //=============================================================================
525 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
526 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
528 return this->GetImpl()->GetRemoveTinyEdges();
531 //=============================================================================
533 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
535 * Set Tiny Edge Length
537 //=============================================================================
538 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
539 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
541 this->GetImpl()->SetTinyEdgeLength(theValue);
542 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
545 //=============================================================================
547 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
549 * Get Tiny Edge Length
551 //=============================================================================
552 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
553 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
555 return this->GetImpl()->GetTinyEdgeLength();
558 //=============================================================================
560 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
564 //=============================================================================
565 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
566 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
568 this->GetImpl()->SetOptimiseTinyEdges(theValue);
569 std::string theValueStr = theValue ? "True" : "False";
570 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
573 //=============================================================================
575 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
579 //=============================================================================
580 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
581 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
583 return this->GetImpl()->GetOptimiseTinyEdges();
586 //=============================================================================
588 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
590 * Set Tiny Edge OptimisationLength
592 //=============================================================================
593 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
594 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
596 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
597 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
600 //=============================================================================
602 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
604 * Get Tiny Edge OptimisationLength
606 //=============================================================================
607 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
608 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
610 return this->GetImpl()->GetTinyEdgeOptimisationLength();
613 //=============================================================================
615 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
619 //=============================================================================
620 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
621 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
623 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
624 std::string theValueStr = theValue ? "True" : "False";
625 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
628 //=============================================================================
630 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
634 //=============================================================================
635 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
636 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
638 return this->GetImpl()->GetCorrectSurfaceIntersection();
641 //=============================================================================
643 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
645 * Set Tiny Edge OptimisationLength
647 //=============================================================================
648 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
649 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
651 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
652 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
655 //=============================================================================
657 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
659 * Get Tiny Edge OptimisationLength
661 //=============================================================================
662 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
663 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
665 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
668 //=============================================================================
670 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
674 //=============================================================================
675 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
676 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
678 this->GetImpl()->SetBadElementRemoval(theValue);
679 std::string theValueStr = theValue ? "True" : "False";
680 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
683 //=============================================================================
685 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
689 //=============================================================================
690 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
691 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
693 return this->GetImpl()->GetBadElementRemoval();
696 //=============================================================================
698 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
700 * Set Bad Surface Element Aspect Ratio
702 //=============================================================================
703 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
704 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
706 this->GetImpl()->SetBadElementAspectRatio(theValue);
707 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
710 //=============================================================================
712 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
714 * Get Bad Surface Element Aspect Ratio
716 //=============================================================================
717 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
718 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
720 return this->GetImpl()->GetBadElementAspectRatio();
723 //=============================================================================
725 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
729 //=============================================================================
730 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
731 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
733 this->GetImpl()->SetOptimizeMesh(theValue);
734 std::string theValueStr = theValue ? "True" : "False";
735 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
738 //=============================================================================
740 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
744 //=============================================================================
745 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
746 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
748 return this->GetImpl()->GetOptimizeMesh();
751 //=============================================================================
753 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
757 //=============================================================================
758 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
759 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
761 this->GetImpl()->SetQuadraticMesh(theValue);
762 std::string theValueStr = theValue ? "True" : "False";
763 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
766 //=============================================================================
768 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
772 //=============================================================================
773 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
774 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
776 return this->GetImpl()->GetQuadraticMesh();
784 * BLSURFPlugin_Hypothesis_i::SetTopology
789 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
791 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
793 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
794 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
797 //=============================================================================
799 * BLSURFPlugin_Hypothesis_i::GetTopology
803 //=============================================================================
804 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
805 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
807 return this->GetImpl()->GetTopology();
810 //=============================================================================
811 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
813 if (theVal < 0 || theVal > 100)
814 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
815 this->GetImpl()->SetVerbosity(theVal);
816 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
819 //=============================================================================
821 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
823 return (CORBA::Short) this->GetImpl()->GetVerbosity();
826 //=============================================================================
827 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
829 if ( GetEnforceCadEdgesSize() != toEnforce )
831 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
832 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
835 //=============================================================================
836 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
838 return this->GetImpl()->GetEnforceCadEdgesSize();
840 //=============================================================================
842 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
844 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
846 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
847 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
850 //=============================================================================
851 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
853 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
855 //=============================================================================
857 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
859 if ( GetJacobianRectification() != allowRectification )
861 this->GetImpl()->SetJacobianRectification(allowRectification);
862 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
865 //=============================================================================
866 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
868 return this->GetImpl()->GetJacobianRectification();
870 //=============================================================================
872 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
874 if ( GetMaxNumberOfPointsPerPatch() != nb )
877 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
879 } catch (const std::invalid_argument& ex) {
880 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
881 } catch (SALOME_Exception& ex) {
882 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
884 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
887 //=============================================================================
888 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
890 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
892 //=============================================================================
894 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
896 if ( GetRespectGeometry() != toRespect )
898 this->GetImpl()->SetRespectGeometry(toRespect);
899 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
902 //=============================================================================
903 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
905 return this->GetImpl()->GetRespectGeometry();
907 //=============================================================================
909 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
911 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
913 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
914 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
917 //=============================================================================
918 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
920 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
922 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
926 if ( GetClosedGeometry() != isClosed )
928 this->GetImpl()->SetClosedGeometry(isClosed);
929 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
932 //=============================================================================
933 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
935 return this->GetImpl()->GetClosedGeometry();
937 //=============================================================================
939 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
941 if ( GetDebug() != isDebug )
943 this->GetImpl()->SetDebug(isDebug);
944 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
947 //=============================================================================
948 bool BLSURFPlugin_Hypothesis_i::GetDebug()
950 return this->GetImpl()->GetDebug();
952 //=============================================================================
954 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
957 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
961 this->GetImpl()->SetPeriodicTolerance(tol);
963 } catch (const std::invalid_argument& ex) {
964 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
965 } catch (SALOME_Exception& ex) {
966 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
968 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
971 //=============================================================================
972 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
975 return this->GetImpl()->GetPeriodicTolerance();
977 } catch (const std::invalid_argument& ex) {
978 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
979 } catch (SALOME_Exception& ex) {
980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984 //=============================================================================
986 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
988 if ( GetImpl()->GetRequiredEntities() != howToTreat )
991 this->GetImpl()->SetRequiredEntities(howToTreat);
993 } catch (const std::invalid_argument& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 } catch (SALOME_Exception& ex) {
996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
998 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1001 //=============================================================================
1002 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1004 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1006 //=============================================================================
1008 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1011 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1015 this->GetImpl()->SetSewingTolerance(tol);
1016 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1018 } catch (const std::invalid_argument& ex) {
1019 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1020 } catch (SALOME_Exception& ex) {
1021 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1025 //=============================================================================
1026 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1030 return this->GetImpl()->GetSewingTolerance();
1032 } catch (const std::invalid_argument& ex) {
1033 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1034 } catch (SALOME_Exception& ex) {
1035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1039 //=============================================================================
1041 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1043 if ( GetImpl()->GetTags() != howToTreat )
1046 this->GetImpl()->SetTags(howToTreat);
1048 catch (const std::invalid_argument& ex) {
1049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1050 } catch (SALOME_Exception& ex) {
1051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1054 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1056 //=============================================================================
1057 char* BLSURFPlugin_Hypothesis_i::GetTags()
1059 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1062 //=============================================================================
1063 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1065 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1066 SMESH_Comment hplDump;
1068 for ( size_t i = 0; i < patchList.size(); ++i )
1071 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1072 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1074 patchList[ i ].insert( tags[ j ]);
1075 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1077 hplDump << ( i+1 < patchList.size() ? "," : "]");
1079 if ( GetImpl()->GetHyperPatches() != patchList )
1081 GetImpl()->SetHyperPatches( patchList );
1082 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1086 //=============================================================================
1087 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1089 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1090 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1091 resHpl->length( hpl.size() );
1093 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1094 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1096 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1097 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1098 resHp.length( hp.size() );
1100 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1101 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1107 //=============================================================================
1109 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1113 //=============================================================================
1114 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1115 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
1117 this->GetImpl()->SetPreCADMergeEdges(theValue);
1118 std::string theValueStr = theValue ? "True" : "False";
1119 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1122 //=============================================================================
1124 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1128 //=============================================================================
1129 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1130 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
1132 return this->GetImpl()->GetPreCADMergeEdges();
1135 //=============================================================================
1137 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
1141 //=============================================================================
1142 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1143 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1145 this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1146 std::string theValueStr = theValue ? "True" : "False";
1147 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1150 //=============================================================================
1152 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1156 //=============================================================================
1157 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1158 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1160 return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1163 //=============================================================================
1165 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1169 //=============================================================================
1170 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1171 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1173 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1174 std::string theValueStr = theValue ? "True" : "False";
1175 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1178 //=============================================================================
1180 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1184 //=============================================================================
1185 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1186 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1188 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1191 //=============================================================================
1193 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1197 //=============================================================================
1198 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1199 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1201 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1202 std::string theValueStr = theValue ? "True" : "False";
1203 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1206 //=============================================================================
1208 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1212 //=============================================================================
1213 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1214 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1216 return this->GetImpl()->GetPreCADProcess3DTopology();
1219 //=============================================================================
1221 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1225 //=============================================================================
1226 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1227 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1229 this->GetImpl()->SetPreCADDiscardInput(theValue);
1230 std::string theValueStr = theValue ? "True" : "False";
1231 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1234 //=============================================================================
1236 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1240 //=============================================================================
1241 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1242 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1244 return this->GetImpl()->GetPreCADDiscardInput();
1248 //=============================================================================
1250 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1251 throw (SALOME::SALOME_Exception) {
1254 std::string name( optionName );
1255 if ( !optionValue || !optionValue[0] )
1256 UnsetOption( optionName );
1258 // basic options (visible in Advanced table)
1260 else if ( name == "enforce_cad_edge_sizes" )
1261 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1263 else if ( name == "jacobian_rectification_respect_geometry" )
1264 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1266 else if ( name == "max_number_of_points_per_patch" )
1267 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1269 else if ( name == "rectify_jacobian" )
1270 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1272 else if ( name == "respect_geometry" )
1273 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1275 else if ( name == "tiny_edge_avoid_surface_intersections" )
1276 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1278 else if ( name == "closed_geometry" )
1279 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1281 else if ( name == "debug" )
1282 SetDebug( GetImpl()->ToBool( optionValue ));
1284 else if ( name == "discard_input_topology" )
1285 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1287 else if ( name == "merge_edges" )
1288 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1290 else if ( name == "periodic_tolerance" )
1291 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1293 else if ( name == "remove_duplicate_cad_faces" )
1294 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1296 else if ( name == "required_entities" )
1297 SetRequiredEntities( optionValue );
1299 else if ( name == "sewing_tolerance" )
1300 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1302 else if ( name == "tags" )
1303 SetTags( optionValue );
1305 // other basic options with specific methods
1307 else if ( name == "correct_surface_intersections" )
1308 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1310 else if ( name == "optimise_tiny_edges" )
1311 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1313 else if ( name == "surface_intersections_processing_max_cost" )
1314 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1316 else if ( name == "volume_gradation" )
1317 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1319 else if ( name == "tiny_edge_optimisation_length" )
1320 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1322 // advanced options (for backward compatibility)
1324 else if ( name == "create_tag_on_collision" ||
1325 name == "tiny_edge_respect_geometry" )
1326 AddOption( optionName, optionValue );
1330 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1331 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1334 this->GetImpl()->SetOptionValue(optionName, optionValue);
1335 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1338 } catch (const std::invalid_argument& ex) {
1339 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1340 } catch (SALOME_Exception& ex) {
1341 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1345 //=============================================================================
1347 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1348 throw (SALOME::SALOME_Exception) {
1350 bool valueChanged = false;
1352 std::string name( optionName );
1353 if ( !optionValue || !optionValue[0] )
1354 UnsetOption( optionName );
1356 else if ( name == "closed_geometry" )
1357 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1359 else if ( name == "debug" )
1360 SetDebug( GetImpl()->ToBool( optionValue ));
1362 else if ( name == "discard_input_topology" )
1363 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1365 else if ( name == "merge_edges" )
1366 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1368 else if ( name == "periodic_tolerance" )
1369 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1371 else if ( name == "remove_duplicate_cad_faces" )
1372 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1374 else if ( name == "required_entities" )
1375 SetRequiredEntities( optionValue );
1377 else if ( name == "sewing_tolerance" )
1378 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1380 else if ( name == "tags" )
1381 SetTags( optionValue );
1383 // other basic options with specific methods
1385 else if ( name == "correct_surface_intersections" )
1386 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1388 else if ( name == "optimise_tiny_edges" )
1389 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1391 else if ( name == "surface_intersections_processing_max_cost" )
1392 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1394 else if ( name == "volume_gradation" )
1395 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1397 else if ( name == "tiny_edge_optimisation_length" )
1398 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1400 else if ( name == "remove_tiny_uv_edges" )
1401 SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue ));
1403 else if ( name == "process_3d_topology" )
1404 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1406 // advanced options (for backward compatibility)
1408 else if ( name == "create_tag_on_collision" ||
1409 name == "tiny_edge_respect_geometry" ||
1410 name == "remove_tiny_edges" ||
1411 name == "tiny_edge_length")
1412 AddPreCADOption( optionName, optionValue );
1415 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1417 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1419 } catch (const std::invalid_argument& ex) {
1420 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1421 } catch (SALOME_Exception& ex) {
1422 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1425 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1428 //=============================================================================
1430 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1434 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1435 } catch (const std::invalid_argument& ex) {
1436 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1437 } catch (SALOME_Exception& ex) {
1438 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1443 //=============================================================================
1445 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1449 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1450 } catch (const std::invalid_argument& ex) {
1451 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1452 } catch (SALOME_Exception& ex) {
1453 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1458 //=============================================================================
1460 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1462 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1464 this->GetImpl()->ClearOption(optionName);
1465 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1469 //=============================================================================
1471 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1473 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1475 this->GetImpl()->ClearPreCADOption(optionName);
1476 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1480 //=============================================================================
1482 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1484 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1486 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1487 result->length(opts.size());
1491 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1492 for (; opIt != opts.end(); ++opIt, ++i) {
1493 string name_value_type = opIt->first;
1494 if (!opIt->second.empty()) {
1495 name_value_type += ":";
1496 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1497 name_value_type += isDefault ? ":0" : ":1";
1499 result[i] = CORBA::string_dup(name_value_type.c_str());
1502 return result._retn();
1505 //=============================================================================
1507 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1509 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1511 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1512 result->length(opts.size());
1516 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1517 for (; opIt != opts.end(); ++opIt, ++i) {
1518 string name_value_type = opIt->first;
1519 if (!opIt->second.empty()) {
1520 name_value_type += ":";
1521 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1522 name_value_type += isDefault ? ":0" : ":1";
1524 result[i] = CORBA::string_dup(name_value_type.c_str());
1526 return result._retn();
1529 //=============================================================================
1531 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1533 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1535 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1536 result->length(custom_opts.size());
1539 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1540 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1541 string name_value_type = opIt->first;
1542 if (!opIt->second.empty()) {
1543 name_value_type += ":";
1544 name_value_type += opIt->second;
1545 name_value_type += ":1"; // user defined
1547 result[i] = CORBA::string_dup(name_value_type.c_str());
1549 return result._retn();
1552 //=============================================================================
1554 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1555 throw (SALOME::SALOME_Exception) {
1557 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1558 string name_value_type = options[i].in();
1559 if(name_value_type.empty())
1561 size_t colonPos = name_value_type.find(':');
1563 if (colonPos == string::npos) // ':' not found
1564 name = name_value_type;
1566 name = name_value_type.substr(0, colonPos);
1567 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1568 string value_type = name_value_type.substr(colonPos + 1);
1569 colonPos = value_type.find(':');
1570 value = value_type.substr(0, colonPos);
1571 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1572 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1576 SetOptionValue(name.c_str(), value.c_str());
1580 //=============================================================================
1582 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1583 throw (SALOME::SALOME_Exception) {
1585 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1586 string name_value_type = options[i].in();
1587 if(name_value_type.empty())
1589 size_t colonPos = name_value_type.find(':');
1591 if (colonPos == string::npos) // ':' not found
1592 name = name_value_type;
1594 name = name_value_type.substr(0, colonPos);
1595 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1596 string value_type = name_value_type.substr(colonPos + 1);
1597 colonPos = value_type.find(':');
1598 value = value_type.substr(0, colonPos);
1599 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1600 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1604 SetPreCADOptionValue(name.c_str(), value.c_str());
1608 //=============================================================================
1610 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1612 SMESH::TPythonDump dump;
1614 string optionsAndValues;
1615 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1616 string name_value_type = options[i].in();
1617 if(name_value_type.empty())
1619 size_t colonPos = name_value_type.find(':');
1621 if (colonPos == string::npos) // ':' not found
1622 name = name_value_type;
1624 name = name_value_type.substr(0, colonPos);
1625 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1626 string value_type = name_value_type.substr(colonPos + 1);
1627 colonPos = value_type.find(':');
1628 value = value_type.substr(0, colonPos);
1631 AddOption(name.c_str(), value.c_str());
1633 optionsAndValues += name + " " + value + " ";
1636 if ( !optionsAndValues.empty() )
1637 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1640 //=============================================================================
1642 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1643 throw (SALOME::SALOME_Exception)
1645 if ( !optionsAndValues ) return;
1647 SMESH::TPythonDump dump;
1649 std::istringstream strm( optionsAndValues );
1650 std::istream_iterator<std::string> sIt( strm ), sEnd;
1651 while ( sIt != sEnd )
1653 std::string option = *sIt;
1654 if ( ++sIt != sEnd )
1656 std::string value = *sIt;
1658 AddOption( option.c_str(), value.c_str() );
1662 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1665 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1668 //=============================================================================
1670 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1673 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1675 this->GetImpl()->AddOption(optionName, optionValue);
1676 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1680 //=============================================================================
1682 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1685 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1687 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1688 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1692 //=============================================================================
1694 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1697 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1700 //=============================================================================
1702 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1705 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1708 //=============================================================================
1710 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1711 throw (SALOME::SALOME_Exception) {
1713 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1714 if ( !entry || !entry[0] )
1715 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1716 bool valueChanged = false;
1718 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1720 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1721 } catch (const std::invalid_argument& ex) {
1722 SALOME::ExceptionStruct ExDescription;
1723 ExDescription.text = ex.what();
1724 ExDescription.type = SALOME::BAD_PARAM;
1725 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1726 ExDescription.lineNumber = 0;
1727 throw SALOME::SALOME_Exception(ExDescription);
1728 } catch (SALOME_Exception& ex) {
1729 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1731 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1733 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1736 //=============================================================================
1738 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1739 throw (SALOME::SALOME_Exception) {
1741 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1742 bool valueChanged = false;
1743 std::ostringstream sizeMapFunction;
1744 switch (shapeType) {
1745 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1746 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1747 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1751 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1753 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1754 } catch (const std::invalid_argument& ex) {
1755 SALOME::ExceptionStruct ExDescription;
1756 ExDescription.text = ex.what();
1757 ExDescription.type = SALOME::BAD_PARAM;
1758 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1759 ExDescription.lineNumber = 0;
1760 throw SALOME::SALOME_Exception(ExDescription);
1761 } catch (SALOME_Exception& ex) {
1762 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1764 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1766 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1769 //=============================================================================
1771 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1772 throw (SALOME::SALOME_Exception) {
1774 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1775 bool valueChanged = false;
1777 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1778 if ( valueChanged ) {
1779 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1780 if (!boost::regex_match(string(attractor), re))
1781 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1782 this->GetImpl()->SetAttractorEntry(entry, attractor);
1784 } catch (const std::invalid_argument& ex) {
1785 SALOME::ExceptionStruct ExDescription;
1786 ExDescription.text = ex.what();
1787 ExDescription.type = SALOME::BAD_PARAM;
1788 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1789 ExDescription.lineNumber = 0;
1790 throw SALOME::SALOME_Exception(ExDescription);
1791 } catch (SALOME_Exception& ex) {
1792 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1794 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1796 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1799 //=============================================================================
1801 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
1802 throw (SALOME::SALOME_Exception)
1805 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1806 //bool valueChanged = false;
1808 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1810 catch (const std::invalid_argument& ex) {
1811 SALOME::ExceptionStruct ExDescription;
1812 ExDescription.text = ex.what();
1813 ExDescription.type = SALOME::BAD_PARAM;
1814 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1815 ExDescription.lineNumber = 0;
1816 throw SALOME::SALOME_Exception(ExDescription);
1817 } catch (SALOME_Exception& ex) {
1818 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1820 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1821 //if ( valueChanged )
1822 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1823 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1826 //=============================================================================
1828 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1831 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1832 } catch (const std::invalid_argument& ex) {
1833 SALOME::ExceptionStruct ExDescription;
1834 ExDescription.text = ex.what();
1835 ExDescription.type = SALOME::BAD_PARAM;
1836 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1837 ExDescription.lineNumber = 0;
1838 throw SALOME::SALOME_Exception(ExDescription);
1839 } catch (SALOME_Exception& ex) {
1840 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1845 //=============================================================================
1847 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1850 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1851 } catch (const std::invalid_argument& ex) {
1852 SALOME::ExceptionStruct ExDescription;
1853 ExDescription.text = ex.what();
1854 ExDescription.type = SALOME::BAD_PARAM;
1855 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1856 ExDescription.lineNumber = 0;
1857 throw SALOME::SALOME_Exception(ExDescription);
1858 } catch (SALOME_Exception& ex) {
1859 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1864 // //=============================================================================
1866 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1867 // // A finir pour le dump
1868 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1869 // throw (SALOME::SALOME_Exception)
1871 // ASSERT(myBaseImpl);
1873 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1875 // catch (const std::invalid_argument& ex) {
1876 // SALOME::ExceptionStruct ExDescription;
1877 // ExDescription.text = ex.what();
1878 // ExDescription.type = SALOME::BAD_PARAM;
1879 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1880 // ExDescription.lineNumber = 0;
1881 // throw SALOME::SALOME_Exception(ExDescription);
1883 // catch (SALOME_Exception& ex) {
1884 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1889 //=============================================================================
1891 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1893 this->GetImpl()->ClearEntry(entry);
1894 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1897 //=============================================================================
1899 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1901 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1903 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1904 result->length(sizeMaps.size());
1906 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1907 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1908 string entry_sizemap = smIt->first;
1909 if (!smIt->second.empty()) {
1910 entry_sizemap += "|";
1911 entry_sizemap += smIt->second;
1913 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1915 return result._retn();
1918 //=============================================================================
1920 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1922 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1924 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1925 result->length(attractors.size());
1927 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1928 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1929 string entry_attractor = atIt->first;
1930 if (!atIt->second.empty()) {
1931 entry_attractor += "|";
1932 entry_attractor += atIt->second;
1934 result[i] = CORBA::string_dup(entry_attractor.c_str());
1936 return result._retn();
1939 //=============================================================================
1941 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1944 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1946 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1947 result->length( attractors.size() );
1949 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1950 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1951 string faceEntry = atIt->first;
1953 double startSize, endSize, infDist, constDist;
1954 if ( !atIt->second->Empty() ) {
1955 attEntry = atIt->second->GetAttractorEntry();
1956 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1957 std::vector<double> params = atIt->second->GetParameters();
1958 startSize = params[0];
1959 endSize = params[1];
1960 infDist = params[2];
1961 constDist = params[3];
1963 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1964 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1965 result[i].startSize = startSize;
1966 result[i].endSize = endSize;
1967 result[i].infDist = infDist;
1968 result[i].constDist = constDist;
1969 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1970 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1972 return result._retn();
1975 //=============================================================================
1977 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1978 throw (SALOME::SALOME_Exception) {
1980 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1981 string entry_sizemap = sizeMaps[i].in();
1982 size_t colonPos = entry_sizemap.find('|');
1983 string entry, sizemap;
1984 if (colonPos == string::npos) // '|' separator not found
1985 entry = entry_sizemap;
1987 entry = entry_sizemap.substr(0, colonPos);
1988 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1989 sizemap = entry_sizemap.substr(colonPos + 1);
1991 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1995 //=============================================================================
1997 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1999 this->GetImpl()->ClearSizeMaps();
2002 //=============================================================================
2004 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2005 throw (SALOME::SALOME_Exception)
2009 entry = GeomObj->GetStudyEntry();
2010 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2011 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
2012 SetSizeMapEntry(entry.c_str(), sizeMap);
2015 //=============================================================================
2017 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2019 string entry = GeomObj->GetStudyEntry();
2020 GEOM::shape_type shapeType = GeomObj->GetShapeType();
2021 if (shapeType == GEOM::COMPOUND)
2022 shapeType = GeomObj->GetMaxShapeType();
2023 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2024 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
2025 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2028 //=============================================================================
2029 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2032 entry = GeomObj->GetStudyEntry();
2033 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2034 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
2035 UnsetEntry(entry.c_str());
2036 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2039 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2042 entry = GeomObj->GetStudyEntry();
2043 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2044 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
2045 SetAttractorEntry(entry.c_str(), attractor);
2048 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2051 entry = GeomObj->GetStudyEntry();
2052 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2053 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
2054 UnsetEntry(entry.c_str());
2055 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2058 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)
2061 string theFaceEntry;
2063 theFaceEntry = theFace->GetStudyEntry();
2064 theAttEntry = theAttractor->GetStudyEntry();
2066 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2067 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2070 if (theFaceEntry.empty()) {
2072 aName += theFace->GetEntry();
2073 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2074 if (!theSFace->_is_nil())
2075 theFaceEntry = theSFace->GetID();
2077 if (theFaceEntry.empty())
2078 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2080 if (theAttEntry.empty()) {
2081 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2083 if (theAttractor->GetShapeType() == GEOM::EDGE)
2085 if (theAttractor->GetShapeType() == GEOM::WIRE)
2087 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2088 aName = "Compound_";
2089 aName += theAttractor->GetEntry();
2090 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2091 if (!theSAtt->_is_nil())
2092 theAttEntry = theSAtt->GetID();
2094 if (theAttEntry.empty())
2095 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2097 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2098 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2099 MESSAGE("IDL : GetName : " << theFace->GetName());
2100 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2101 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2104 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2105 GEOM::GEOM_Object_ptr theAttractor)
2108 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2109 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2111 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2112 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2115 // if (theFaceEntry.empty()) {
2117 // aName += theFace->GetEntry();
2118 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2119 // if (!theSFace->_is_nil())
2120 // theFaceEntry = theSFace->GetID();
2122 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2123 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2124 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2126 MESSAGE("IDL : GetName : " << theFace->GetName());
2127 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2128 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2129 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2130 << theFace << ", " << theAttractor << " )";
2133 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2134 const char* attractorEntry)
2136 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2137 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2138 << faceEntry << "', '" << attractorEntry << "' )";
2143 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2146 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2149 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2152 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2155 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2158 this->GetImpl()->UnsetCustomSizeMap(entry);
2159 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2163 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2168 // ///////////////////////
2169 // // ENFORCED VERTICES //
2170 // ///////////////////////
2174 * Returns the list of enforced vertices for a given Face entry
2175 * @return A map of Face entry / List of enforced vertices
2178 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2179 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2182 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2184 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2185 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2186 resultMap->length(faceEntryEnfVertexListMap.size());
2187 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2189 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2190 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2191 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2192 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2193 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2194 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2195 MESSAGE("Face Entry: " << mapElement->faceEntry);
2197 _enfVertexList = it_entry->second;
2198 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2199 enfVertexList->length(_enfVertexList.size());
2200 MESSAGE("Number of enf vertex: " << enfVertexList->length());
2202 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2203 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2204 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2205 currentEnfVertex = (*it_enfVertex);
2207 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2210 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2213 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2216 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2217 coords->length(currentEnfVertex->coords.size());
2218 for (CORBA::ULong i=0;i<coords->length();i++)
2219 coords[i] = currentEnfVertex->coords[i];
2220 enfVertex->coords = coords;
2223 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2226 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2227 faceEntryList->length(currentEnfVertex->faceEntries.size());
2228 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2229 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2230 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2231 enfVertex->faceEntries = faceEntryList;
2234 msg << "Enforced vertex: \n"
2235 << "Name: " << enfVertex->name << "\n";
2236 if (coords->length())
2237 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2238 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2239 << "Group Name: " << enfVertex->grpName;
2242 enfVertexList[j] = enfVertex;
2244 mapElement->enfVertexList = enfVertexList;
2246 resultMap[i] = mapElement;
2249 return resultMap._retn();
2253 * Returns the list of all enforced vertices
2254 * @return a list of enforced vertices
2257 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2258 MESSAGE("IDL: GetAllEnforcedVertices()");
2260 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2261 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2262 resultMap->length(enfVertexList.size());
2263 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2265 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2266 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2267 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2268 MESSAGE("Enforced Vertex #" << i);
2269 currentEnfVertex = (*evlIt);
2270 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2272 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2274 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2276 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2277 coords->length(currentEnfVertex->coords.size());
2278 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2279 coords[ind] = currentEnfVertex->coords[ind];
2280 enfVertex->coords = coords;
2282 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2284 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2285 faceEntryList->length(currentEnfVertex->faceEntries.size());
2286 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2287 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2288 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2289 enfVertex->faceEntries = faceEntryList;
2292 msg << "Enforced vertex: \n"
2293 << "Name: " << enfVertex->name << "\n";
2294 if (coords->length())
2295 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2296 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2297 << "Group Name: " << enfVertex->grpName;
2300 resultMap[i] = enfVertex;
2302 return resultMap._retn();
2307 * Returns the list of enforced vertices coords for a given Face entry.
2308 * They are the coords of the "manual" enforced vertices.
2309 * @return A map of Face entry / List of enforced vertices coords
2312 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2313 MESSAGE("IDL: GetAllCoordsByFace()");
2316 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2318 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2319 resultMap->length(entryCoordsListMap.size());
2320 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2322 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2323 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2324 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2325 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2326 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2327 MESSAGE("Face Entry: " << mapElement->faceEntry);
2329 _coordsList = it_entry->second;
2330 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2331 coordsList->length(_coordsList.size());
2332 MESSAGE("Number of coords: " << coordsList->length());
2334 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2335 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2336 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2337 coords->length((*it_coords).size());
2338 for (CORBA::ULong i=0;i<coords->length();i++)
2339 coords[i] = (*it_coords)[i];
2340 coordsList[j] = coords;
2341 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2343 mapElement->coordsList = coordsList;
2345 resultMap[i] = mapElement;
2348 return resultMap._retn();
2352 * Returns a map of enforced vertices coords / enforced vertex.
2353 * They are the coords of the "manual" enforced vertices.
2355 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2356 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2359 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2360 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2361 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2362 resultMap->length(coordsEnfVertexMap.size());
2363 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2365 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2366 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2367 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2368 MESSAGE("Enforced Vertex #" << i);
2369 currentEnfVertex = (it_coords->second);
2370 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2371 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2372 coords->length(it_coords->first.size());
2373 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2374 coords[ind] = it_coords->first[ind];
2375 mapElement->coords = coords;
2376 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2378 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2380 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2382 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2384 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2385 coords2->length(currentEnfVertex->coords.size());
2386 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2387 coords2[ind] = currentEnfVertex->coords[ind];
2388 enfVertex->coords = coords2;
2390 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2392 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2393 faceEntryList->length(currentEnfVertex->faceEntries.size());
2394 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2395 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2396 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2397 enfVertex->faceEntries = faceEntryList;
2399 mapElement->enfVertex = enfVertex;
2401 msg << "Enforced vertex: \n"
2402 << "Name: " << enfVertex->name << "\n";
2403 if (coords->length())
2404 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2405 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2406 << "Group Name: " << enfVertex->grpName;
2409 resultMap[i] = mapElement;
2411 return resultMap._retn();
2415 * Returns the list of enforced vertices entries for a given Face entry.
2416 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2417 * @return A map of Face entry / List of enforced vertices geom entries
2420 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2421 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2424 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2426 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2427 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2428 resultMap->length(entryEnfVertexEntryListMap.size());
2429 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2431 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2432 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2433 entryEnfVertexEntryListMap.begin();
2434 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2435 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2436 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2437 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2438 MESSAGE("Face Entry: " << mapElement->faceEntry);
2440 _enfVertexEntryList = it_entry->second;
2441 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2442 enfVertexEntryList->length(_enfVertexEntryList.size());
2443 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2445 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2446 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2447 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2448 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2450 mapElement->enfVertexEntryList = enfVertexEntryList;
2452 resultMap[i] = mapElement;
2455 return resultMap._retn();
2459 * Returns a map of enforced vertices geom entry / enforced vertex.
2460 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2462 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2463 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2466 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2467 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2468 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2469 resultMap->length(enfVertexEntryEnfVertexMap.size());
2470 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2472 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2473 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2474 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2475 MESSAGE("Enforced Vertex #" << i);
2476 currentEnfVertex = it_enfVertexEntry->second;
2477 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2478 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2479 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2481 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2483 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2485 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2487 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2488 coords->length(currentEnfVertex->coords.size());
2489 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2490 coords[ind] = currentEnfVertex->coords[ind];
2491 enfVertex->coords = coords;
2493 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2495 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2496 faceEntryList->length(currentEnfVertex->faceEntries.size());
2497 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2498 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2499 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2500 enfVertex->faceEntries = faceEntryList;
2503 msg << "Enforced vertex: \n"
2504 << "Name: " << enfVertex->name << "\n";
2505 if (coords->length())
2506 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2507 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2508 << "Group Name: " << enfVertex->grpName;
2511 mapElement->enfVertex = enfVertex;
2512 resultMap[i] = mapElement;
2514 return resultMap._retn();
2518 * Erase all enforced vertices
2520 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2522 this->GetImpl()->ClearAllEnforcedVertices();
2523 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2527 * Set/get/unset an enforced vertex on face - OBSOLETE
2529 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2530 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2533 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2534 MESSAGE("theFace shape type is not FACE or COMPOUND");
2535 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2538 string theFaceEntry = theFace->GetStudyEntry();
2540 if (theFaceEntry.empty()) {
2541 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2542 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2544 if (theFace->GetShapeType() == GEOM::FACE)
2546 if (theFace->GetShapeType() == GEOM::COMPOUND)
2547 aName = "Compound_";
2548 aName += theFace->GetEntry();
2549 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2550 if (!theSFace->_is_nil())
2551 theFaceEntry = theSFace->GetID();
2553 if (theFaceEntry.empty())
2554 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2555 MESSAGE("IDL : GetName : " << theFace->GetName());
2556 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2558 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2559 } catch (SALOME_Exception& ex) {
2560 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2565 * Set/get/unset an enforced vertex with name on face
2567 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2568 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2571 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2572 MESSAGE("theFace shape type is not FACE or COMPOUND");
2573 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2576 string theFaceEntry = theFace->GetStudyEntry();
2578 if (theFaceEntry.empty()) {
2579 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2580 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2582 if (theFace->GetShapeType() == GEOM::FACE)
2584 if (theFace->GetShapeType() == GEOM::COMPOUND)
2585 aName = "Compound_";
2586 aName += theFace->GetEntry();
2587 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2588 if (!theSFace->_is_nil())
2589 theFaceEntry = theSFace->GetID();
2591 if (theFaceEntry.empty())
2592 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2594 MESSAGE("IDL : GetName : " << theFace->GetName());
2595 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2597 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2598 } catch (SALOME_Exception& ex) {
2599 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2604 * Set/get/unset an enforced vertex with geom object on face
2606 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2607 throw (SALOME::SALOME_Exception) {
2610 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2611 MESSAGE("theFace shape type is not FACE or COMPOUND");
2612 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2615 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2616 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2617 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2620 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2621 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2622 // if (CORBA::is_nil(measureOp))
2625 // CORBA::Double x, y, z;
2627 // measureOp->PointCoordinates(theVertex, x, y, z);
2629 string theFaceEntry = theFace->GetStudyEntry();
2630 string theVertexEntry = theVertex->GetStudyEntry();
2632 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2633 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2636 if (theFaceEntry.empty()) {
2637 if (theFace->GetShapeType() == GEOM::FACE)
2639 if (theFace->GetShapeType() == GEOM::COMPOUND)
2640 aName = "Compound_";
2641 aName += theFace->GetEntry();
2642 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2643 if (!theSFace->_is_nil())
2644 theFaceEntry = theSFace->GetID();
2646 if (theFaceEntry.empty())
2647 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2649 if (theVertexEntry.empty()) {
2650 if (theVertex->GetShapeType() == GEOM::VERTEX)
2652 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2653 aName = "Compound_";
2654 aName += theVertex->GetEntry();
2655 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2656 if (!theSVertex->_is_nil())
2657 theVertexEntry = theSVertex->GetID();
2659 if (theVertexEntry.empty())
2660 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2662 string theVertexName = theVertex->GetName();
2663 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2664 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2665 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2667 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2668 } catch (SALOME_Exception& ex) {
2669 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2674 * Set an enforced vertex with group name on face
2676 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2677 throw (SALOME::SALOME_Exception)
2681 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2682 MESSAGE("theFace shape type is not FACE or COMPOUND");
2683 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2686 string theFaceEntry = theFace->GetStudyEntry();
2688 if (theFaceEntry.empty()) {
2689 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2690 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2692 if (theFace->GetShapeType() == GEOM::FACE)
2694 if (theFace->GetShapeType() == GEOM::COMPOUND)
2695 aName = "Compound_";
2696 aName += theFace->GetEntry();
2697 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2698 if (!theSFace->_is_nil())
2699 theFaceEntry = theSFace->GetID();
2701 if (theFaceEntry.empty())
2702 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2703 MESSAGE("IDL : GetName : " << theFace->GetName());
2704 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2706 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2707 } catch (SALOME_Exception& ex) {
2708 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2713 * Set an enforced vertex with name and group name on face
2715 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2716 const char* theVertexName, const char* theGroupName)
2717 throw (SALOME::SALOME_Exception)
2721 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2722 MESSAGE("theFace shape type is not FACE or COMPOUND");
2723 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2726 string theFaceEntry = theFace->GetStudyEntry();
2728 if (theFaceEntry.empty()) {
2729 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2730 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2732 if (theFace->GetShapeType() == GEOM::FACE)
2734 if (theFace->GetShapeType() == GEOM::COMPOUND)
2735 aName = "Compound_";
2736 aName += theFace->GetEntry();
2737 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2738 if (!theSFace->_is_nil())
2739 theFaceEntry = theSFace->GetID();
2741 if (theFaceEntry.empty())
2742 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2743 MESSAGE("IDL : GetName : " << theFace->GetName());
2744 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2746 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2747 } catch (SALOME_Exception& ex) {
2748 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2753 * Set an enforced vertex with geom entry and group name on face
2755 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2756 throw (SALOME::SALOME_Exception)
2760 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2761 MESSAGE("theFace shape type is not FACE or COMPOUND");
2762 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2765 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2766 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2767 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2770 string theFaceEntry = theFace->GetStudyEntry();
2771 string theVertexEntry = theVertex->GetStudyEntry();
2773 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2774 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2777 if (theFaceEntry.empty()) {
2778 if (theFace->GetShapeType() == GEOM::FACE)
2780 if (theFace->GetShapeType() == GEOM::COMPOUND)
2781 aName = "Compound_";
2782 aName += theFace->GetEntry();
2783 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2784 if (!theSFace->_is_nil())
2785 theFaceEntry = theSFace->GetID();
2787 if (theFaceEntry.empty())
2788 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2790 if (theVertexEntry.empty()) {
2791 if (theVertex->GetShapeType() == GEOM::VERTEX)
2793 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2794 aName = "Compound_";
2795 aName += theVertex->GetEntry();
2796 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2797 if (!theSVertex->_is_nil())
2798 theVertexEntry = theSVertex->GetID();
2800 if (theVertexEntry.empty())
2801 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2803 string theVertexName = theVertex->GetName();
2804 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2805 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2806 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2808 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2809 } catch (SALOME_Exception& ex) {
2810 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2814 //Enable internal enforced vertices on specific face if requested by user
2816 // * Are internal enforced vertices used for a face ?
2818 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2819 // throw (SALOME::SALOME_Exception) {
2820 // ASSERT(myBaseImpl);
2822 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2823 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2824 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2827 // string theFaceEntry = theFace->GetStudyEntry();
2829 // if (theFaceEntry.empty()) {
2830 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2831 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2833 // if (theFace->GetShapeType() == GEOM::FACE)
2835 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2836 // aName = "Compound_";
2837 // aName += theFace->GetEntry();
2838 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2839 // if (!theSFace->_is_nil())
2840 // theFaceEntry = theSFace->GetID();
2842 // if (theFaceEntry.empty())
2843 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2845 // MESSAGE("IDL : GetName : " << theFace->GetName());
2846 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2848 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2849 // } catch (SALOME_Exception& ex) {
2850 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2855 * Get the list of all enforced vertices
2857 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2858 throw (SALOME::SALOME_Exception) {
2861 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2862 MESSAGE("theFace shape type is not FACE or COMPOUND");
2863 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2866 string theFaceEntry = theFace->GetStudyEntry();
2868 if (theFaceEntry.empty()) {
2869 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2870 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2872 if (theFace->GetShapeType() == GEOM::FACE)
2874 if (theFace->GetShapeType() == GEOM::COMPOUND)
2875 aName = "Compound_";
2876 aName += theFace->GetEntry();
2877 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2878 if (!theSFace->_is_nil())
2879 theFaceEntry = theSFace->GetID();
2881 if (theFaceEntry.empty())
2882 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2884 MESSAGE("IDL : GetName : " << theFace->GetName());
2885 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2887 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2888 } catch (SALOME_Exception& ex) {
2889 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2893 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2894 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2897 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2898 MESSAGE("theFace shape type is not FACE or COMPOUND");
2899 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2902 string theFaceEntry = theFace->GetStudyEntry();
2904 if (theFaceEntry.empty()) {
2905 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2906 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2908 if (theFace->GetShapeType() == GEOM::FACE)
2910 if (theFace->GetShapeType() == GEOM::COMPOUND)
2911 aName = "Compound_";
2912 aName += theFace->GetEntry();
2913 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2914 if (!theSFace->_is_nil())
2915 theFaceEntry = theSFace->GetID();
2917 if (theFaceEntry.empty())
2918 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2919 MESSAGE("IDL : GetName : " << theFace->GetName());
2920 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2923 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2924 } catch (SALOME_Exception& ex) {
2925 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2929 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2930 throw (SALOME::SALOME_Exception) {
2933 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2934 MESSAGE("theFace shape type is not FACE or COMPOUND");
2935 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2937 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2938 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2939 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2942 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2943 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2944 // if (CORBA::is_nil(measureOp))
2947 // CORBA::Double x, y, z;
2949 // measureOp->PointCoordinates(theVertex, x, y, z);
2951 std::string theFaceEntry = theFace->GetStudyEntry();
2952 std::string theVertexEntry = theVertex->GetStudyEntry();
2954 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2955 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2958 if (theFaceEntry.empty()) {
2959 if (theFace->GetShapeType() == GEOM::FACE)
2961 if (theFace->GetShapeType() == GEOM::COMPOUND)
2962 aName = "Compound_";
2963 aName += theFace->GetEntry();
2964 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2965 if (!theSFace->_is_nil())
2966 theFaceEntry = theSFace->GetID();
2968 if (theFaceEntry.empty())
2969 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2971 if (theVertexEntry.empty()) {
2972 if (theVertex->GetShapeType() == GEOM::VERTEX)
2974 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2975 aName = "Compound_";
2976 aName += theVertex->GetEntry();
2977 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2978 if (!theSVertex->_is_nil())
2979 theVertexEntry = theSVertex->GetID();
2981 if (theVertexEntry.empty())
2982 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2984 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2987 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2988 } catch (SALOME_Exception& ex) {
2989 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2993 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2996 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2997 MESSAGE("theFace shape type is not FACE or COMPOUND");
2998 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3001 string theFaceEntry = theFace->GetStudyEntry();
3003 if (theFaceEntry.empty()) {
3004 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3005 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3007 if (theFace->GetShapeType() == GEOM::FACE)
3009 if (theFace->GetShapeType() == GEOM::COMPOUND)
3010 aName = "Compound_";
3011 aName += theFace->GetEntry();
3012 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3013 if (!theSFace->_is_nil())
3014 theFaceEntry = theSFace->GetID();
3016 if (theFaceEntry.empty())
3017 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3019 MESSAGE("IDL : GetName : " << theFace->GetName());
3020 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
3023 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3024 } catch (SALOME_Exception& ex) {
3025 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3030 * Set/get/unset an enforced vertex on face - NEW (no face)
3032 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3037 return SetEnforcedVertexEntry("", x, y, z);
3038 } catch (SALOME_Exception& ex) {
3039 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3044 * Set/get/unset an enforced vertex with name on face
3046 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3049 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3050 } catch (SALOME_Exception& ex) {
3051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3056 * Set/get/unset an enforced vertex with geom object on face
3058 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3059 throw (SALOME::SALOME_Exception)
3061 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3062 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3063 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3065 string theVertexEntry = theVertex->GetStudyEntry();
3067 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3068 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3071 if (theVertexEntry.empty()) {
3072 if (theVertex->GetShapeType() == GEOM::VERTEX)
3074 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3075 aName = "Compound_";
3076 aName += theVertex->GetEntry();
3077 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3078 if (!theSVertex->_is_nil())
3079 theVertexEntry = theSVertex->GetID();
3081 if (theVertexEntry.empty())
3082 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3084 string theVertexName = theVertex->GetName();
3086 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3087 } catch (SALOME_Exception& ex) {
3088 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3093 * Set an enforced vertex with group name on face
3095 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3096 throw (SALOME::SALOME_Exception)
3101 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3102 } catch (SALOME_Exception& ex) {
3103 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3108 * Set an enforced vertex with name and group name on face
3110 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3111 const char* theVertexName, const char* theGroupName)
3112 throw (SALOME::SALOME_Exception)
3117 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3118 } catch (SALOME_Exception& ex) {
3119 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3124 * Set an enforced vertex with geom entry and group name on face
3126 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3127 throw (SALOME::SALOME_Exception)
3129 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3130 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3131 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3134 string theVertexEntry = theVertex->GetStudyEntry();
3136 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3137 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3140 if (theVertexEntry.empty()) {
3141 if (theVertex->GetShapeType() == GEOM::VERTEX)
3143 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3144 aName = "Compound_";
3145 aName += theVertex->GetEntry();
3146 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3147 if (!theSVertex->_is_nil())
3148 theVertexEntry = theSVertex->GetID();
3150 if (theVertexEntry.empty())
3151 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3153 string theVertexName = theVertex->GetName();
3155 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3156 } catch (SALOME_Exception& ex) {
3157 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3161 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3164 return UnsetEnforcedVertexEntry("", x, y, z);
3165 } catch (SALOME_Exception& ex) {
3166 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3170 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3171 throw (SALOME::SALOME_Exception)
3173 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3174 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3175 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3177 std::string theVertexEntry = theVertex->GetStudyEntry();
3179 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3180 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3183 if (theVertexEntry.empty()) {
3184 if (theVertex->GetShapeType() == GEOM::VERTEX)
3186 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3187 aName = "Compound_";
3188 aName += theVertex->GetEntry();
3189 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3190 if (!theSVertex->_is_nil())
3191 theVertexEntry = theSVertex->GetID();
3193 if (theVertexEntry.empty())
3194 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3197 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3198 } catch (SALOME_Exception& ex) {
3199 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3203 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3206 return UnsetEnforcedVerticesEntry("");
3207 } catch (SALOME_Exception& ex) {
3208 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3213 * Set/get/unset an enforced vertex on geom object given by entry
3215 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3219 const char* theVertexName,
3220 const char* theVertexEntry,
3221 const char* theGroupName)
3222 throw (SALOME::SALOME_Exception)
3224 bool newValue = false;
3225 if (string(theVertexEntry).empty()) {
3227 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3228 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3229 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3230 coords.push_back(x);
3231 coords.push_back(y);
3232 coords.push_back(z);
3233 if (coordsList.find(coords) == coordsList.end()) {
3236 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3237 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3241 } catch (const std::invalid_argument& ex) {
3242 // no enforced vertex for entry
3246 if (string(theVertexName).empty()) {
3247 if (string(theGroupName).empty())
3248 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3250 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3253 if (string(theGroupName).empty())
3254 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3256 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3257 << theVertexName << "\", \"" << theGroupName << "\")";
3262 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3263 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3264 if ( it == enfVertexEntryList.end()) {
3268 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3269 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3273 } catch (const std::invalid_argument& ex) {
3274 // no enforced vertex for entry
3278 if (string(theGroupName).empty())
3279 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3281 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3286 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3291 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3292 throw (SALOME::SALOME_Exception)
3295 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3296 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3297 vertexList->length(_vList.size());
3298 MESSAGE("Number of enforced vertices: " << vertexList->length());
3299 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3300 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3301 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3303 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3306 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3307 // Geom Vertex Entry
3308 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3310 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3311 coords->length(_enfVertex->coords.size());
3312 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3313 coords[ind] = _enfVertex->coords[ind];
3314 enfVertex->coords = coords;
3316 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3318 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3319 faceEntryList->length(_enfVertex->faceEntries.size());
3320 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3321 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3322 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3323 enfVertex->faceEntries = faceEntryList;
3325 vertexList[i] = enfVertex;
3327 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3328 return vertexList._retn();
3329 } catch (const std::invalid_argument& ex) {
3330 SALOME::ExceptionStruct ExDescription;
3331 ExDescription.text = ex.what();
3332 ExDescription.type = SALOME::BAD_PARAM;
3333 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3334 ExDescription.lineNumber = 1385;
3335 throw SALOME::SALOME_Exception(ExDescription);
3336 } catch (const std::exception& ex) {
3337 std::cout << "Exception: " << ex.what() << std::endl;
3338 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3342 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3348 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3350 if (string(theVertexEntry).empty())
3351 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3354 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3356 } catch (const std::invalid_argument& ex) {
3358 } catch (const std::exception& ex) {
3359 std::cout << "Exception: " << ex.what() << std::endl;
3360 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3363 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3366 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3371 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3372 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3373 } catch (const std::invalid_argument& ex) {
3375 } catch (const std::exception& ex) {
3376 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3382 //=============================================================================
3384 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3388 //=============================================================================
3389 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3392 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3393 std::string theValueStr = theValue ? "True" : "False";
3394 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3397 //=============================================================================
3399 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3403 //=============================================================================
3404 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3407 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3410 //=============================================================================
3412 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3416 //=============================================================================
3417 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3420 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3421 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3424 //=============================================================================
3426 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3430 //=============================================================================
3431 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3434 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3438 * Enable internal enforced vertices on specific face if requested by user
3440 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3441 throw (SALOME::SALOME_Exception)
3443 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3445 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3446 } catch (SALOME_Exception& ex) {
3447 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3451 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3452 throw (SALOME::SALOME_Exception)
3454 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3456 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3457 MESSAGE("theFace shape type is not FACE or COMPOUND");
3458 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3461 string theFaceEntry = theFace->GetStudyEntry();
3463 if (theFaceEntry.empty()) {
3464 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3465 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3467 if (theFace->GetShapeType() == GEOM::FACE)
3469 if (theFace->GetShapeType() == GEOM::COMPOUND)
3470 aName = "Compound_";
3471 aName += theFace->GetEntry();
3472 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3473 if (!theSFace->_is_nil())
3474 theFaceEntry = theSFace->GetID();
3476 if (theFaceEntry.empty())
3477 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3479 MESSAGE("IDL : GetName : " << theFace->GetName());
3480 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3482 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3483 } catch (SALOME_Exception& ex) {
3484 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3488 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3489 throw (SALOME::SALOME_Exception)
3491 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3494 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3495 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3496 if (string(theGroupName).empty())
3497 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3499 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3500 } catch (const std::exception& ex) {
3501 std::cout << "Exception: " << ex.what() << std::endl;
3502 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3509 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3510 throw (SALOME::SALOME_Exception)
3513 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3515 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3517 catch (const std::invalid_argument& ex) {
3518 SALOME::ExceptionStruct ExDescription;
3519 ExDescription.text = ex.what();
3520 ExDescription.type = SALOME::BAD_PARAM;
3521 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3522 ExDescription.lineNumber = 1146;
3523 throw SALOME::SALOME_Exception(ExDescription);
3525 catch (SALOME_Exception& ex) {
3526 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3528 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3533 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3534 throw (SALOME::SALOME_Exception)
3537 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3539 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3541 catch (const std::invalid_argument& ex) {
3542 SALOME::ExceptionStruct ExDescription;
3543 ExDescription.text = ex.what();
3544 ExDescription.type = SALOME::BAD_PARAM;
3545 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3546 ExDescription.lineNumber = 1170;
3547 throw SALOME::SALOME_Exception(ExDescription);
3549 catch (SALOME_Exception& ex) {
3550 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3553 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3554 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3556 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3559 ///////////////////////
3561 ///////////////////////
3563 ///////////////////////
3566 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3568 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3569 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3570 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3571 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3572 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3573 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3574 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3575 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3576 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3577 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3578 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3579 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3580 return txtShapeType;
3583 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3585 // Check shape types
3587 std::stringstream typesTxt;
3588 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3590 GEOM::shape_type theShapeType = theShapeTypes[i];
3591 if (shape->GetShapeType() == theShapeType)
3593 typesTxt << ShapeTypeToString(theShapeType);
3594 if (i < theShapeTypes.size()-1 )
3598 std::stringstream msg;
3599 msg << "shape shape type is not in" << typesTxt.str();
3601 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3605 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3608 if (shape->GetShapeType() != theShapeType) {
3609 std::stringstream msg;
3610 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3612 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3616 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3618 // Check shape is published in the object browser
3619 string shapeEntry = shape->GetStudyEntry();
3621 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3622 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3625 // Publish shape if needed
3626 if (shapeEntry.empty()) {
3627 if (shape->GetShapeType() == theShapeType)
3629 aName += shape->GetEntry();
3630 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3631 if (!theSFace1->_is_nil())
3632 shapeEntry = theSFace1->GetID();
3634 if (shapeEntry.empty())
3635 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3639 // Format the output of two vectors to use it in MESSAGE and PythonDump
3640 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3642 std::stringstream listEntriesTxt;
3644 if (!theSourceVerticesEntries.empty())
3646 listEntriesTxt << ", [" ;
3648 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3651 listEntriesTxt << ", ";
3652 listEntriesTxt << *it;
3655 listEntriesTxt << "], [" ;
3657 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3660 listEntriesTxt << ", ";
3661 listEntriesTxt << *it;
3663 listEntriesTxt << "]" ;
3665 return listEntriesTxt.str();
3669 * Erase all PreCad periodicity associations
3671 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3673 this->GetImpl()->ClearPreCadPeriodicityVectors();
3674 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3677 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3679 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3680 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3681 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3683 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3685 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3686 return periodicityList._retn();
3689 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3691 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3692 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3693 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3695 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3697 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3698 return periodicityList._retn();
3701 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3702 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3704 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3705 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3707 periodicityList->length(preCadPeriodicityVector.size());
3709 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3711 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3713 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3714 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3715 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3717 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3718 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3720 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3721 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3722 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3725 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3727 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3728 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3730 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3731 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3732 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3735 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3737 periodicityList[i] = myPreCadPeriodicity;
3741 return periodicityList._retn();
3745 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3746 throw (SALOME::SALOME_Exception)
3749 const GEOM::ListOfGO theSourceVertices;
3750 const GEOM::ListOfGO theTargetVertices;
3751 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3755 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3756 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3757 throw (SALOME::SALOME_Exception)
3760 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3762 size_t theLength = theSourceVertices.length();
3763 if (theLength != theTargetVertices.length())
3764 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3766 std::vector<GEOM::shape_type> allowedShapeTypes;
3767 allowedShapeTypes.push_back(GEOM::FACE);
3768 allowedShapeTypes.push_back(GEOM::COMPOUND);
3770 string prefix1 = "Source_face_";
3771 CheckShapeTypes(theFace1, allowedShapeTypes);
3772 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3774 string prefix2 = "Target_face_";
3775 CheckShapeTypes(theFace2, allowedShapeTypes);
3776 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3778 string prefix3 = "Source_vertex_";
3779 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3780 theSourceVerticesEntries->length(theLength);
3781 GEOM::GEOM_Object_ptr theVtx_i;
3783 for (size_t ind = 0; ind < theLength; ind++) {
3784 theVtx_i = theSourceVertices[ind];
3785 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3786 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3789 string prefix4 = "Target_vertex_";
3790 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3791 theTargetVerticesEntries->length(theLength);
3792 for (size_t ind = 0; ind < theLength; ind++) {
3793 theVtx_i = theTargetVertices[ind];
3794 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3795 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3798 string theFace2Name = theFace2->GetName();
3799 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3800 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3801 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3803 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3804 theSourceVerticesEntries, theTargetVerticesEntries);
3805 } catch (SALOME_Exception& ex) {
3806 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3811 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3812 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3813 throw (SALOME::SALOME_Exception)
3818 // Convert BLSURFPlugin::TEntryList to vector<string>
3819 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3820 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3821 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3822 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3825 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3827 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3829 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3830 theSourceVerticesEntries, theTargetVerticesEntries);
3832 SMESH::TPythonDump pd;
3833 if (!theSourceVerticesEntries.empty())
3835 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3836 pd << listEntriesTxt.c_str();
3840 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3841 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3844 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3845 throw (SALOME::SALOME_Exception)
3848 const GEOM::ListOfGO theSourceVertices;
3849 const GEOM::ListOfGO theTargetVertices;
3850 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3853 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3854 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3855 throw (SALOME::SALOME_Exception)
3857 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3860 size_t theLength = theSourceVertices.length();
3861 if (theLength != theTargetVertices.length())
3862 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3864 std::vector<GEOM::shape_type> allowedShapeTypes;
3865 allowedShapeTypes.push_back(GEOM::EDGE);
3866 allowedShapeTypes.push_back(GEOM::COMPOUND);
3868 string prefix1 = "Source_edge_";
3869 CheckShapeTypes(theEdge1, allowedShapeTypes);
3870 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3872 string prefix2 = "Target_edge_";
3873 CheckShapeTypes(theEdge2, allowedShapeTypes);
3874 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3876 string prefix3 = "Source_vertex_";
3877 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3878 theSourceVerticesEntries->length(theLength);
3879 GEOM::GEOM_Object_ptr theVtx_i;
3881 for (size_t ind = 0; ind < theLength; ind++) {
3882 theVtx_i = theSourceVertices[ind];
3883 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3884 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3887 string prefix4 = "Target_vertex_";
3888 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3889 theTargetVerticesEntries->length(theLength);
3890 for (size_t ind = 0; ind < theLength; ind++) {
3891 theVtx_i = theTargetVertices[ind];
3892 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3893 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3896 string theEdge2Name = theEdge2->GetName();
3897 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3898 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3899 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3901 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3902 theSourceVerticesEntries, theTargetVerticesEntries);
3903 } catch (SALOME_Exception& ex) {
3904 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3909 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3910 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3911 throw (SALOME::SALOME_Exception)
3916 // Convert BLSURFPlugin::TEntryList to vector<string>
3917 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3918 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3919 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3920 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3923 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3925 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3926 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3927 theSourceVerticesEntries, theTargetVerticesEntries);
3929 SMESH::TPythonDump pd;
3930 if (!theSourceVerticesEntries.empty())
3932 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3933 pd << listEntriesTxt.c_str();
3937 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3939 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3943 //================================================================================
3945 * \brief Sets the file for export resulting mesh in GMF format
3946 * \param theFileName - full name of the file (.mesh, .meshb)
3948 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3950 //================================================================================
3951 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3952 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3954 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3955 bool valueChanged/*, modeChanged*/ = false;
3957 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3958 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3959 if (valueChanged)// or (!valueChanged && modeChanged))
3960 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3961 } catch (const std::exception& ex) {
3962 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3964 if (valueChanged)// or (!valueChanged && modeChanged))
3965 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3966 MESSAGE("IDL : SetGMFFile END ");
3969 //================================================================================
3971 * \brief Gets the file name for export resulting mesh in GMF format
3972 * \retval char* - The file name
3974 * Returns the GMF file name
3976 //================================================================================
3977 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3979 // MESSAGE("IDL : GetGMFFile()");
3980 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3983 // //================================================================================
3985 // * \brief Gets the file mode for export resulting mesh in GMF format
3986 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3988 // * Returns the GMF file mode
3990 // //================================================================================
3991 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3992 // ASSERT(myBaseImpl);
3993 // MESSAGE("IDL : GetGMFFileMode()");
3994 // return this->GetImpl()->GetGMFFileMode();
3997 //=============================================================================
3999 * BLSURFPlugin_Hypothesis_i::GetImpl
4001 * Get implementation
4003 //=============================================================================
4004 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
4005 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
4006 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
4009 //================================================================================
4011 * \brief Verify whether hypothesis supports given entity type
4012 * \param type - dimension (see SMESH::Dimension enumeration)
4013 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
4015 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
4017 //================================================================================
4018 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
4019 return type == SMESH::DIM_2D;
4023 // Obsolete methods - To be removed in V7
4026 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
4027 this->SetMinSize(theMinSize);
4029 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
4030 return this->GetMinSize();
4032 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
4033 this->SetMaxSize(theMaxSize);
4035 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
4036 return this->GetMaxSize();
4038 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
4039 this->SetMinSize(theMinSize);
4041 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
4042 return this->GetMinSize();
4044 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
4045 this->SetMaxSize(theMaxSize);
4047 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
4048 return this->GetMaxSize();
4050 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
4051 this->SetAngleMesh(theValue);
4053 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
4054 return this->GetAngleMesh();
4056 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
4057 this->SetAngleMesh(theValue);
4059 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
4060 return this->GetAngleMesh();
4062 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
4063 std::string theValueStr = theValue ? "1" : "0";
4064 this->SetOptionValue("respect_geometry",theValueStr.c_str());
4066 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
4067 std::string theValueStr = this->GetOptionValue("respect_geometry");
4068 if (theValueStr.empty() || theValueStr == "respect")
4072 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
4073 std::string theValueStr = theValue ? "1" : "0";
4074 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
4076 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
4077 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
4078 if (theValueStr == "1")
4082 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
4083 std::ostringstream theValueStr;
4084 theValueStr << theValue;
4085 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
4087 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
4088 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
4090 theValueStr >> result;