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::SetPreCADRemoveDuplicateCADFaces
1141 //=============================================================================
1142 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1143 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1145 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1146 std::string theValueStr = theValue ? "True" : "False";
1147 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1150 //=============================================================================
1152 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1156 //=============================================================================
1157 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1158 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1160 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1163 //=============================================================================
1165 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1169 //=============================================================================
1170 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1171 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1173 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1174 std::string theValueStr = theValue ? "True" : "False";
1175 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1178 //=============================================================================
1180 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1184 //=============================================================================
1185 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1186 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1188 return this->GetImpl()->GetPreCADProcess3DTopology();
1191 //=============================================================================
1193 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1197 //=============================================================================
1198 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1199 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1201 this->GetImpl()->SetPreCADDiscardInput(theValue);
1202 std::string theValueStr = theValue ? "True" : "False";
1203 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1206 //=============================================================================
1208 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1212 //=============================================================================
1213 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1214 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1216 return this->GetImpl()->GetPreCADDiscardInput();
1220 //=============================================================================
1222 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1223 throw (SALOME::SALOME_Exception) {
1226 std::string name( optionName );
1227 if ( !optionValue || !optionValue[0] )
1228 UnsetOption( optionName );
1230 // basic options (visible in Advanced table)
1232 else if ( name == "enforce_cad_edge_sizes" )
1233 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1235 else if ( name == "jacobian_rectification_respect_geometry" )
1236 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1238 else if ( name == "max_number_of_points_per_patch" )
1239 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1241 else if ( name == "rectify_jacobian" )
1242 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1244 else if ( name == "respect_geometry" )
1245 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1247 else if ( name == "tiny_edge_avoid_surface_intersections" )
1248 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1250 else if ( name == "closed_geometry" )
1251 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1253 else if ( name == "debug" )
1254 SetDebug( GetImpl()->ToBool( optionValue ));
1256 else if ( name == "discard_input_topology" )
1257 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1259 else if ( name == "merge_edges" )
1260 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1262 else if ( name == "periodic_tolerance" )
1263 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1265 else if ( name == "remove_duplicate_cad_faces" )
1266 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1268 else if ( name == "required_entities" )
1269 SetRequiredEntities( optionValue );
1271 else if ( name == "sewing_tolerance" )
1272 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1274 else if ( name == "tags" )
1275 SetTags( optionValue );
1277 // other basic options with specific methods
1279 else if ( name == "correct_surface_intersections" )
1280 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1282 else if ( name == "optimise_tiny_edges" )
1283 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1285 else if ( name == "surface_intersections_processing_max_cost" )
1286 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1288 else if ( name == "volume_gradation" )
1289 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1291 else if ( name == "tiny_edge_optimisation_length" )
1292 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1294 // advanced options (for backward compatibility)
1296 else if ( name == "create_tag_on_collision" ||
1297 name == "tiny_edge_respect_geometry" )
1298 AddOption( optionName, optionValue );
1302 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1303 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1306 this->GetImpl()->SetOptionValue(optionName, optionValue);
1307 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1310 } catch (const std::invalid_argument& ex) {
1311 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1312 } catch (SALOME_Exception& ex) {
1313 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1317 //=============================================================================
1319 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1320 throw (SALOME::SALOME_Exception) {
1322 bool valueChanged = false;
1324 std::string name( optionName );
1325 if ( !optionValue || !optionValue[0] )
1326 UnsetOption( optionName );
1328 else if ( name == "closed_geometry" )
1329 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1331 else if ( name == "debug" )
1332 SetDebug( GetImpl()->ToBool( optionValue ));
1334 else if ( name == "discard_input_topology" )
1335 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1337 else if ( name == "merge_edges" )
1338 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1340 else if ( name == "periodic_tolerance" )
1341 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1343 else if ( name == "remove_duplicate_cad_faces" )
1344 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1346 else if ( name == "required_entities" )
1347 SetRequiredEntities( optionValue );
1349 else if ( name == "sewing_tolerance" )
1350 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1352 else if ( name == "tags" )
1353 SetTags( optionValue );
1355 // other basic options with specific methods
1357 else if ( name == "correct_surface_intersections" )
1358 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1360 else if ( name == "optimise_tiny_edges" )
1361 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1363 else if ( name == "surface_intersections_processing_max_cost" )
1364 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1366 else if ( name == "volume_gradation" )
1367 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1369 else if ( name == "tiny_edge_optimisation_length" )
1370 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1372 else if ( name == "process_3d_topology" )
1373 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1375 // advanced options (for backward compatibility)
1377 else if ( name == "create_tag_on_collision" ||
1378 name == "tiny_edge_respect_geometry" ||
1379 name == "remove_tiny_edges" ||
1380 name == "tiny_edge_length")
1381 AddPreCADOption( optionName, optionValue );
1384 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1386 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1388 } catch (const std::invalid_argument& ex) {
1389 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1390 } catch (SALOME_Exception& ex) {
1391 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1394 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1397 //=============================================================================
1399 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1403 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1404 } catch (const std::invalid_argument& ex) {
1405 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1406 } catch (SALOME_Exception& ex) {
1407 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1412 //=============================================================================
1414 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1418 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
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 );
1427 //=============================================================================
1429 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1431 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1433 this->GetImpl()->ClearOption(optionName);
1434 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1438 //=============================================================================
1440 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1442 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1444 this->GetImpl()->ClearPreCADOption(optionName);
1445 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1449 //=============================================================================
1451 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1453 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1455 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1456 result->length(opts.size());
1460 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1461 for (; opIt != opts.end(); ++opIt, ++i) {
1462 string name_value_type = opIt->first;
1463 if (!opIt->second.empty()) {
1464 name_value_type += ":";
1465 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1466 name_value_type += isDefault ? ":0" : ":1";
1468 result[i] = CORBA::string_dup(name_value_type.c_str());
1471 return result._retn();
1474 //=============================================================================
1476 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1478 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1480 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1481 result->length(opts.size());
1485 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1486 for (; opIt != opts.end(); ++opIt, ++i) {
1487 string name_value_type = opIt->first;
1488 if (!opIt->second.empty()) {
1489 name_value_type += ":";
1490 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1491 name_value_type += isDefault ? ":0" : ":1";
1493 result[i] = CORBA::string_dup(name_value_type.c_str());
1495 return result._retn();
1498 //=============================================================================
1500 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1502 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1504 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1505 result->length(custom_opts.size());
1508 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1509 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1510 string name_value_type = opIt->first;
1511 if (!opIt->second.empty()) {
1512 name_value_type += ":";
1513 name_value_type += opIt->second;
1514 name_value_type += ":1"; // user defined
1516 result[i] = CORBA::string_dup(name_value_type.c_str());
1518 return result._retn();
1521 //=============================================================================
1523 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1524 throw (SALOME::SALOME_Exception) {
1526 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1527 string name_value_type = options[i].in();
1528 if(name_value_type.empty())
1530 size_t colonPos = name_value_type.find(':');
1532 if (colonPos == string::npos) // ':' not found
1533 name = name_value_type;
1535 name = name_value_type.substr(0, colonPos);
1536 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1537 string value_type = name_value_type.substr(colonPos + 1);
1538 colonPos = value_type.find(':');
1539 value = value_type.substr(0, colonPos);
1540 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1541 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1545 SetOptionValue(name.c_str(), value.c_str());
1549 //=============================================================================
1551 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1552 throw (SALOME::SALOME_Exception) {
1554 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1555 string name_value_type = options[i].in();
1556 if(name_value_type.empty())
1558 size_t colonPos = name_value_type.find(':');
1560 if (colonPos == string::npos) // ':' not found
1561 name = name_value_type;
1563 name = name_value_type.substr(0, colonPos);
1564 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1565 string value_type = name_value_type.substr(colonPos + 1);
1566 colonPos = value_type.find(':');
1567 value = value_type.substr(0, colonPos);
1568 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1569 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1573 SetPreCADOptionValue(name.c_str(), value.c_str());
1577 //=============================================================================
1579 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1581 SMESH::TPythonDump dump;
1583 string optionsAndValues;
1584 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1585 string name_value_type = options[i].in();
1586 if(name_value_type.empty())
1588 size_t colonPos = name_value_type.find(':');
1590 if (colonPos == string::npos) // ':' not found
1591 name = name_value_type;
1593 name = name_value_type.substr(0, colonPos);
1594 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1595 string value_type = name_value_type.substr(colonPos + 1);
1596 colonPos = value_type.find(':');
1597 value = value_type.substr(0, colonPos);
1600 AddOption(name.c_str(), value.c_str());
1602 optionsAndValues += name + " " + value + " ";
1605 if ( !optionsAndValues.empty() )
1606 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1609 //=============================================================================
1611 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1612 throw (SALOME::SALOME_Exception)
1614 if ( !optionsAndValues ) return;
1616 SMESH::TPythonDump dump;
1618 std::istringstream strm( optionsAndValues );
1619 std::istream_iterator<std::string> sIt( strm ), sEnd;
1620 while ( sIt != sEnd )
1622 std::string option = *sIt;
1623 if ( ++sIt != sEnd )
1625 std::string value = *sIt;
1627 AddOption( option.c_str(), value.c_str() );
1631 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1634 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1637 //=============================================================================
1639 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1642 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1644 this->GetImpl()->AddOption(optionName, optionValue);
1645 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1649 //=============================================================================
1651 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1654 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1656 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1657 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1661 //=============================================================================
1663 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1666 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1669 //=============================================================================
1671 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1674 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1677 //=============================================================================
1679 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1680 throw (SALOME::SALOME_Exception) {
1682 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1683 if ( !entry || !entry[0] )
1684 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1685 bool valueChanged = false;
1687 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1689 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1690 } catch (const std::invalid_argument& ex) {
1691 SALOME::ExceptionStruct ExDescription;
1692 ExDescription.text = ex.what();
1693 ExDescription.type = SALOME::BAD_PARAM;
1694 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1695 ExDescription.lineNumber = 0;
1696 throw SALOME::SALOME_Exception(ExDescription);
1697 } catch (SALOME_Exception& ex) {
1698 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1700 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1702 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1705 //=============================================================================
1707 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1708 throw (SALOME::SALOME_Exception) {
1710 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1711 bool valueChanged = false;
1712 std::ostringstream sizeMapFunction;
1713 switch (shapeType) {
1714 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1715 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1716 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1720 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1722 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1723 } catch (const std::invalid_argument& ex) {
1724 SALOME::ExceptionStruct ExDescription;
1725 ExDescription.text = ex.what();
1726 ExDescription.type = SALOME::BAD_PARAM;
1727 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1728 ExDescription.lineNumber = 0;
1729 throw SALOME::SALOME_Exception(ExDescription);
1730 } catch (SALOME_Exception& ex) {
1731 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1733 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1735 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1738 //=============================================================================
1740 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1741 throw (SALOME::SALOME_Exception) {
1743 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1744 bool valueChanged = false;
1746 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1747 if ( valueChanged ) {
1748 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1749 if (!boost::regex_match(string(attractor), re))
1750 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1751 this->GetImpl()->SetAttractorEntry(entry, attractor);
1753 } catch (const std::invalid_argument& ex) {
1754 SALOME::ExceptionStruct ExDescription;
1755 ExDescription.text = ex.what();
1756 ExDescription.type = SALOME::BAD_PARAM;
1757 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1758 ExDescription.lineNumber = 0;
1759 throw SALOME::SALOME_Exception(ExDescription);
1760 } catch (SALOME_Exception& ex) {
1761 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1763 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1765 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1768 //=============================================================================
1770 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
1771 throw (SALOME::SALOME_Exception)
1774 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1775 //bool valueChanged = false;
1777 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1779 catch (const std::invalid_argument& ex) {
1780 SALOME::ExceptionStruct ExDescription;
1781 ExDescription.text = ex.what();
1782 ExDescription.type = SALOME::BAD_PARAM;
1783 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1784 ExDescription.lineNumber = 0;
1785 throw SALOME::SALOME_Exception(ExDescription);
1786 } catch (SALOME_Exception& ex) {
1787 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1789 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1790 //if ( valueChanged )
1791 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1792 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1795 //=============================================================================
1797 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1800 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1801 } catch (const std::invalid_argument& ex) {
1802 SALOME::ExceptionStruct ExDescription;
1803 ExDescription.text = ex.what();
1804 ExDescription.type = SALOME::BAD_PARAM;
1805 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1806 ExDescription.lineNumber = 0;
1807 throw SALOME::SALOME_Exception(ExDescription);
1808 } catch (SALOME_Exception& ex) {
1809 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1814 //=============================================================================
1816 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1819 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1820 } catch (const std::invalid_argument& ex) {
1821 SALOME::ExceptionStruct ExDescription;
1822 ExDescription.text = ex.what();
1823 ExDescription.type = SALOME::BAD_PARAM;
1824 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1825 ExDescription.lineNumber = 0;
1826 throw SALOME::SALOME_Exception(ExDescription);
1827 } catch (SALOME_Exception& ex) {
1828 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1833 // //=============================================================================
1835 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1836 // // A finir pour le dump
1837 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1838 // throw (SALOME::SALOME_Exception)
1840 // ASSERT(myBaseImpl);
1842 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1844 // catch (const std::invalid_argument& ex) {
1845 // SALOME::ExceptionStruct ExDescription;
1846 // ExDescription.text = ex.what();
1847 // ExDescription.type = SALOME::BAD_PARAM;
1848 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1849 // ExDescription.lineNumber = 0;
1850 // throw SALOME::SALOME_Exception(ExDescription);
1852 // catch (SALOME_Exception& ex) {
1853 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1858 //=============================================================================
1860 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1862 this->GetImpl()->ClearEntry(entry);
1863 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1866 //=============================================================================
1868 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1870 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1872 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1873 result->length(sizeMaps.size());
1875 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1876 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1877 string entry_sizemap = smIt->first;
1878 if (!smIt->second.empty()) {
1879 entry_sizemap += "|";
1880 entry_sizemap += smIt->second;
1882 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1884 return result._retn();
1887 //=============================================================================
1889 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1891 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1893 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1894 result->length(attractors.size());
1896 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1897 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1898 string entry_attractor = atIt->first;
1899 if (!atIt->second.empty()) {
1900 entry_attractor += "|";
1901 entry_attractor += atIt->second;
1903 result[i] = CORBA::string_dup(entry_attractor.c_str());
1905 return result._retn();
1908 //=============================================================================
1910 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1913 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1915 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1916 result->length( attractors.size() );
1918 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1919 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1920 string faceEntry = atIt->first;
1922 double startSize, endSize, infDist, constDist;
1923 if ( !atIt->second->Empty() ) {
1924 attEntry = atIt->second->GetAttractorEntry();
1925 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1926 std::vector<double> params = atIt->second->GetParameters();
1927 startSize = params[0];
1928 endSize = params[1];
1929 infDist = params[2];
1930 constDist = params[3];
1932 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1933 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1934 result[i].startSize = startSize;
1935 result[i].endSize = endSize;
1936 result[i].infDist = infDist;
1937 result[i].constDist = constDist;
1938 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1939 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1941 return result._retn();
1944 //=============================================================================
1946 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1947 throw (SALOME::SALOME_Exception) {
1949 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1950 string entry_sizemap = sizeMaps[i].in();
1951 size_t colonPos = entry_sizemap.find('|');
1952 string entry, sizemap;
1953 if (colonPos == string::npos) // '|' separator not found
1954 entry = entry_sizemap;
1956 entry = entry_sizemap.substr(0, colonPos);
1957 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1958 sizemap = entry_sizemap.substr(colonPos + 1);
1960 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1964 //=============================================================================
1966 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1968 this->GetImpl()->ClearSizeMaps();
1971 //=============================================================================
1973 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1974 throw (SALOME::SALOME_Exception)
1978 entry = GeomObj->GetStudyEntry();
1979 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1980 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1981 SetSizeMapEntry(entry.c_str(), sizeMap);
1984 //=============================================================================
1986 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1988 string entry = GeomObj->GetStudyEntry();
1989 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1990 if (shapeType == GEOM::COMPOUND)
1991 shapeType = GeomObj->GetMaxShapeType();
1992 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1993 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1994 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1997 //=============================================================================
1998 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2001 entry = GeomObj->GetStudyEntry();
2002 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2003 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
2004 UnsetEntry(entry.c_str());
2005 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2008 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2011 entry = GeomObj->GetStudyEntry();
2012 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2013 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
2014 SetAttractorEntry(entry.c_str(), attractor);
2017 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2020 entry = GeomObj->GetStudyEntry();
2021 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2022 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
2023 UnsetEntry(entry.c_str());
2024 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2027 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)
2030 string theFaceEntry;
2032 theFaceEntry = theFace->GetStudyEntry();
2033 theAttEntry = theAttractor->GetStudyEntry();
2035 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2036 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2039 if (theFaceEntry.empty()) {
2041 aName += theFace->GetEntry();
2042 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2043 if (!theSFace->_is_nil())
2044 theFaceEntry = theSFace->GetID();
2046 if (theFaceEntry.empty())
2047 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2049 if (theAttEntry.empty()) {
2050 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2052 if (theAttractor->GetShapeType() == GEOM::EDGE)
2054 if (theAttractor->GetShapeType() == GEOM::WIRE)
2056 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2057 aName = "Compound_";
2058 aName += theAttractor->GetEntry();
2059 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2060 if (!theSAtt->_is_nil())
2061 theAttEntry = theSAtt->GetID();
2063 if (theAttEntry.empty())
2064 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2066 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2067 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2068 MESSAGE("IDL : GetName : " << theFace->GetName());
2069 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2070 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2073 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2074 GEOM::GEOM_Object_ptr theAttractor)
2077 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2078 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2080 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2081 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2084 // if (theFaceEntry.empty()) {
2086 // aName += theFace->GetEntry();
2087 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2088 // if (!theSFace->_is_nil())
2089 // theFaceEntry = theSFace->GetID();
2091 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2092 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2093 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2095 MESSAGE("IDL : GetName : " << theFace->GetName());
2096 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2097 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2098 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2099 << theFace << ", " << theAttractor << " )";
2102 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2103 const char* attractorEntry)
2105 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2106 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2107 << faceEntry << "', '" << attractorEntry << "' )";
2112 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2115 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2118 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2121 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2124 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2127 this->GetImpl()->UnsetCustomSizeMap(entry);
2128 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2132 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2137 // ///////////////////////
2138 // // ENFORCED VERTICES //
2139 // ///////////////////////
2143 * Returns the list of enforced vertices for a given Face entry
2144 * @return A map of Face entry / List of enforced vertices
2147 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2148 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2151 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2153 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2154 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2155 resultMap->length(faceEntryEnfVertexListMap.size());
2156 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2158 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2159 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2160 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2161 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2162 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2163 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2164 MESSAGE("Face Entry: " << mapElement->faceEntry);
2166 _enfVertexList = it_entry->second;
2167 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2168 enfVertexList->length(_enfVertexList.size());
2169 MESSAGE("Number of enf vertex: " << enfVertexList->length());
2171 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2172 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2173 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2174 currentEnfVertex = (*it_enfVertex);
2176 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2179 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2182 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2185 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2186 coords->length(currentEnfVertex->coords.size());
2187 for (CORBA::ULong i=0;i<coords->length();i++)
2188 coords[i] = currentEnfVertex->coords[i];
2189 enfVertex->coords = coords;
2192 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2195 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2196 faceEntryList->length(currentEnfVertex->faceEntries.size());
2197 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2198 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2199 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2200 enfVertex->faceEntries = faceEntryList;
2203 msg << "Enforced vertex: \n"
2204 << "Name: " << enfVertex->name << "\n";
2205 if (coords->length())
2206 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2207 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2208 << "Group Name: " << enfVertex->grpName;
2211 enfVertexList[j] = enfVertex;
2213 mapElement->enfVertexList = enfVertexList;
2215 resultMap[i] = mapElement;
2218 return resultMap._retn();
2222 * Returns the list of all enforced vertices
2223 * @return a list of enforced vertices
2226 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2227 MESSAGE("IDL: GetAllEnforcedVertices()");
2229 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2230 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2231 resultMap->length(enfVertexList.size());
2232 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2234 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2235 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2236 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2237 MESSAGE("Enforced Vertex #" << i);
2238 currentEnfVertex = (*evlIt);
2239 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2241 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2243 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2245 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2246 coords->length(currentEnfVertex->coords.size());
2247 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2248 coords[ind] = currentEnfVertex->coords[ind];
2249 enfVertex->coords = coords;
2251 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2253 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2254 faceEntryList->length(currentEnfVertex->faceEntries.size());
2255 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2256 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2257 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2258 enfVertex->faceEntries = faceEntryList;
2261 msg << "Enforced vertex: \n"
2262 << "Name: " << enfVertex->name << "\n";
2263 if (coords->length())
2264 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2265 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2266 << "Group Name: " << enfVertex->grpName;
2269 resultMap[i] = enfVertex;
2271 return resultMap._retn();
2276 * Returns the list of enforced vertices coords for a given Face entry.
2277 * They are the coords of the "manual" enforced vertices.
2278 * @return A map of Face entry / List of enforced vertices coords
2281 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2282 MESSAGE("IDL: GetAllCoordsByFace()");
2285 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2287 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2288 resultMap->length(entryCoordsListMap.size());
2289 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2291 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2292 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2293 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2294 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2295 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2296 MESSAGE("Face Entry: " << mapElement->faceEntry);
2298 _coordsList = it_entry->second;
2299 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2300 coordsList->length(_coordsList.size());
2301 MESSAGE("Number of coords: " << coordsList->length());
2303 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2304 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2305 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2306 coords->length((*it_coords).size());
2307 for (CORBA::ULong i=0;i<coords->length();i++)
2308 coords[i] = (*it_coords)[i];
2309 coordsList[j] = coords;
2310 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2312 mapElement->coordsList = coordsList;
2314 resultMap[i] = mapElement;
2317 return resultMap._retn();
2321 * Returns a map of enforced vertices coords / enforced vertex.
2322 * They are the coords of the "manual" enforced vertices.
2324 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2325 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2328 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2329 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2330 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2331 resultMap->length(coordsEnfVertexMap.size());
2332 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2334 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2335 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2336 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2337 MESSAGE("Enforced Vertex #" << i);
2338 currentEnfVertex = (it_coords->second);
2339 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2340 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2341 coords->length(it_coords->first.size());
2342 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2343 coords[ind] = it_coords->first[ind];
2344 mapElement->coords = coords;
2345 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2347 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2349 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2351 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2353 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2354 coords2->length(currentEnfVertex->coords.size());
2355 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2356 coords2[ind] = currentEnfVertex->coords[ind];
2357 enfVertex->coords = coords2;
2359 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2361 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2362 faceEntryList->length(currentEnfVertex->faceEntries.size());
2363 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2364 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2365 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2366 enfVertex->faceEntries = faceEntryList;
2368 mapElement->enfVertex = enfVertex;
2370 msg << "Enforced vertex: \n"
2371 << "Name: " << enfVertex->name << "\n";
2372 if (coords->length())
2373 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2374 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2375 << "Group Name: " << enfVertex->grpName;
2378 resultMap[i] = mapElement;
2380 return resultMap._retn();
2384 * Returns the list of enforced vertices entries for a given Face entry.
2385 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2386 * @return A map of Face entry / List of enforced vertices geom entries
2389 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2390 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2393 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2395 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2396 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2397 resultMap->length(entryEnfVertexEntryListMap.size());
2398 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2400 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2401 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2402 entryEnfVertexEntryListMap.begin();
2403 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2404 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2405 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2406 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2407 MESSAGE("Face Entry: " << mapElement->faceEntry);
2409 _enfVertexEntryList = it_entry->second;
2410 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2411 enfVertexEntryList->length(_enfVertexEntryList.size());
2412 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2414 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2415 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2416 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2417 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2419 mapElement->enfVertexEntryList = enfVertexEntryList;
2421 resultMap[i] = mapElement;
2424 return resultMap._retn();
2428 * Returns a map of enforced vertices geom entry / enforced vertex.
2429 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2431 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2432 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2435 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2436 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2437 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2438 resultMap->length(enfVertexEntryEnfVertexMap.size());
2439 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2441 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2442 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2443 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2444 MESSAGE("Enforced Vertex #" << i);
2445 currentEnfVertex = it_enfVertexEntry->second;
2446 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2447 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2448 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2450 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2452 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2454 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2456 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2457 coords->length(currentEnfVertex->coords.size());
2458 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2459 coords[ind] = currentEnfVertex->coords[ind];
2460 enfVertex->coords = coords;
2462 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2464 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2465 faceEntryList->length(currentEnfVertex->faceEntries.size());
2466 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2467 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2468 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2469 enfVertex->faceEntries = faceEntryList;
2472 msg << "Enforced vertex: \n"
2473 << "Name: " << enfVertex->name << "\n";
2474 if (coords->length())
2475 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2476 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2477 << "Group Name: " << enfVertex->grpName;
2480 mapElement->enfVertex = enfVertex;
2481 resultMap[i] = mapElement;
2483 return resultMap._retn();
2487 * Erase all enforced vertices
2489 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2491 this->GetImpl()->ClearAllEnforcedVertices();
2492 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2496 * Set/get/unset an enforced vertex on face - OBSOLETE
2498 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2499 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2502 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2503 MESSAGE("theFace shape type is not FACE or COMPOUND");
2504 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2507 string theFaceEntry = theFace->GetStudyEntry();
2509 if (theFaceEntry.empty()) {
2510 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2511 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2513 if (theFace->GetShapeType() == GEOM::FACE)
2515 if (theFace->GetShapeType() == GEOM::COMPOUND)
2516 aName = "Compound_";
2517 aName += theFace->GetEntry();
2518 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2519 if (!theSFace->_is_nil())
2520 theFaceEntry = theSFace->GetID();
2522 if (theFaceEntry.empty())
2523 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2524 MESSAGE("IDL : GetName : " << theFace->GetName());
2525 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2527 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2528 } catch (SALOME_Exception& ex) {
2529 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2534 * Set/get/unset an enforced vertex with name on face
2536 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2537 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2540 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2541 MESSAGE("theFace shape type is not FACE or COMPOUND");
2542 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2545 string theFaceEntry = theFace->GetStudyEntry();
2547 if (theFaceEntry.empty()) {
2548 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2549 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2551 if (theFace->GetShapeType() == GEOM::FACE)
2553 if (theFace->GetShapeType() == GEOM::COMPOUND)
2554 aName = "Compound_";
2555 aName += theFace->GetEntry();
2556 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2557 if (!theSFace->_is_nil())
2558 theFaceEntry = theSFace->GetID();
2560 if (theFaceEntry.empty())
2561 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2563 MESSAGE("IDL : GetName : " << theFace->GetName());
2564 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2566 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2567 } catch (SALOME_Exception& ex) {
2568 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2573 * Set/get/unset an enforced vertex with geom object on face
2575 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2576 throw (SALOME::SALOME_Exception) {
2579 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2580 MESSAGE("theFace shape type is not FACE or COMPOUND");
2581 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2584 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2585 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2586 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2589 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2590 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2591 // if (CORBA::is_nil(measureOp))
2594 // CORBA::Double x, y, z;
2596 // measureOp->PointCoordinates(theVertex, x, y, z);
2598 string theFaceEntry = theFace->GetStudyEntry();
2599 string theVertexEntry = theVertex->GetStudyEntry();
2601 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2602 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2605 if (theFaceEntry.empty()) {
2606 if (theFace->GetShapeType() == GEOM::FACE)
2608 if (theFace->GetShapeType() == GEOM::COMPOUND)
2609 aName = "Compound_";
2610 aName += theFace->GetEntry();
2611 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2612 if (!theSFace->_is_nil())
2613 theFaceEntry = theSFace->GetID();
2615 if (theFaceEntry.empty())
2616 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2618 if (theVertexEntry.empty()) {
2619 if (theVertex->GetShapeType() == GEOM::VERTEX)
2621 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2622 aName = "Compound_";
2623 aName += theVertex->GetEntry();
2624 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2625 if (!theSVertex->_is_nil())
2626 theVertexEntry = theSVertex->GetID();
2628 if (theVertexEntry.empty())
2629 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2631 string theVertexName = theVertex->GetName();
2632 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2633 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2634 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2636 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2637 } catch (SALOME_Exception& ex) {
2638 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2643 * Set an enforced vertex with group name on face
2645 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2646 throw (SALOME::SALOME_Exception)
2650 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2651 MESSAGE("theFace shape type is not FACE or COMPOUND");
2652 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2655 string theFaceEntry = theFace->GetStudyEntry();
2657 if (theFaceEntry.empty()) {
2658 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2659 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2661 if (theFace->GetShapeType() == GEOM::FACE)
2663 if (theFace->GetShapeType() == GEOM::COMPOUND)
2664 aName = "Compound_";
2665 aName += theFace->GetEntry();
2666 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2667 if (!theSFace->_is_nil())
2668 theFaceEntry = theSFace->GetID();
2670 if (theFaceEntry.empty())
2671 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2672 MESSAGE("IDL : GetName : " << theFace->GetName());
2673 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2675 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2676 } catch (SALOME_Exception& ex) {
2677 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2682 * Set an enforced vertex with name and group name on face
2684 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2685 const char* theVertexName, const char* theGroupName)
2686 throw (SALOME::SALOME_Exception)
2690 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2691 MESSAGE("theFace shape type is not FACE or COMPOUND");
2692 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2695 string theFaceEntry = theFace->GetStudyEntry();
2697 if (theFaceEntry.empty()) {
2698 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2699 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2701 if (theFace->GetShapeType() == GEOM::FACE)
2703 if (theFace->GetShapeType() == GEOM::COMPOUND)
2704 aName = "Compound_";
2705 aName += theFace->GetEntry();
2706 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2707 if (!theSFace->_is_nil())
2708 theFaceEntry = theSFace->GetID();
2710 if (theFaceEntry.empty())
2711 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2712 MESSAGE("IDL : GetName : " << theFace->GetName());
2713 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2715 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2716 } catch (SALOME_Exception& ex) {
2717 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2722 * Set an enforced vertex with geom entry and group name on face
2724 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2725 throw (SALOME::SALOME_Exception)
2729 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2730 MESSAGE("theFace shape type is not FACE or COMPOUND");
2731 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2734 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2735 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2736 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2739 string theFaceEntry = theFace->GetStudyEntry();
2740 string theVertexEntry = theVertex->GetStudyEntry();
2742 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2743 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2746 if (theFaceEntry.empty()) {
2747 if (theFace->GetShapeType() == GEOM::FACE)
2749 if (theFace->GetShapeType() == GEOM::COMPOUND)
2750 aName = "Compound_";
2751 aName += theFace->GetEntry();
2752 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2753 if (!theSFace->_is_nil())
2754 theFaceEntry = theSFace->GetID();
2756 if (theFaceEntry.empty())
2757 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2759 if (theVertexEntry.empty()) {
2760 if (theVertex->GetShapeType() == GEOM::VERTEX)
2762 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2763 aName = "Compound_";
2764 aName += theVertex->GetEntry();
2765 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2766 if (!theSVertex->_is_nil())
2767 theVertexEntry = theSVertex->GetID();
2769 if (theVertexEntry.empty())
2770 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2772 string theVertexName = theVertex->GetName();
2773 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2774 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2775 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2777 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2778 } catch (SALOME_Exception& ex) {
2779 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2783 //Enable internal enforced vertices on specific face if requested by user
2785 // * Are internal enforced vertices used for a face ?
2787 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2788 // throw (SALOME::SALOME_Exception) {
2789 // ASSERT(myBaseImpl);
2791 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2792 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2793 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2796 // string theFaceEntry = theFace->GetStudyEntry();
2798 // if (theFaceEntry.empty()) {
2799 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2800 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2802 // if (theFace->GetShapeType() == GEOM::FACE)
2804 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2805 // aName = "Compound_";
2806 // aName += theFace->GetEntry();
2807 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2808 // if (!theSFace->_is_nil())
2809 // theFaceEntry = theSFace->GetID();
2811 // if (theFaceEntry.empty())
2812 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2814 // MESSAGE("IDL : GetName : " << theFace->GetName());
2815 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2817 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2818 // } catch (SALOME_Exception& ex) {
2819 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2824 * Get the list of all enforced vertices
2826 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2827 throw (SALOME::SALOME_Exception) {
2830 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2831 MESSAGE("theFace shape type is not FACE or COMPOUND");
2832 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2835 string theFaceEntry = theFace->GetStudyEntry();
2837 if (theFaceEntry.empty()) {
2838 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2839 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2841 if (theFace->GetShapeType() == GEOM::FACE)
2843 if (theFace->GetShapeType() == GEOM::COMPOUND)
2844 aName = "Compound_";
2845 aName += theFace->GetEntry();
2846 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2847 if (!theSFace->_is_nil())
2848 theFaceEntry = theSFace->GetID();
2850 if (theFaceEntry.empty())
2851 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2853 MESSAGE("IDL : GetName : " << theFace->GetName());
2854 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2856 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2857 } catch (SALOME_Exception& ex) {
2858 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2862 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2863 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2866 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2867 MESSAGE("theFace shape type is not FACE or COMPOUND");
2868 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2871 string theFaceEntry = theFace->GetStudyEntry();
2873 if (theFaceEntry.empty()) {
2874 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2875 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2877 if (theFace->GetShapeType() == GEOM::FACE)
2879 if (theFace->GetShapeType() == GEOM::COMPOUND)
2880 aName = "Compound_";
2881 aName += theFace->GetEntry();
2882 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2883 if (!theSFace->_is_nil())
2884 theFaceEntry = theSFace->GetID();
2886 if (theFaceEntry.empty())
2887 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2888 MESSAGE("IDL : GetName : " << theFace->GetName());
2889 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2892 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2893 } catch (SALOME_Exception& ex) {
2894 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2898 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2899 throw (SALOME::SALOME_Exception) {
2902 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2903 MESSAGE("theFace shape type is not FACE or COMPOUND");
2904 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2906 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2907 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2908 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2911 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2912 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2913 // if (CORBA::is_nil(measureOp))
2916 // CORBA::Double x, y, z;
2918 // measureOp->PointCoordinates(theVertex, x, y, z);
2920 std::string theFaceEntry = theFace->GetStudyEntry();
2921 std::string theVertexEntry = theVertex->GetStudyEntry();
2923 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2924 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2927 if (theFaceEntry.empty()) {
2928 if (theFace->GetShapeType() == GEOM::FACE)
2930 if (theFace->GetShapeType() == GEOM::COMPOUND)
2931 aName = "Compound_";
2932 aName += theFace->GetEntry();
2933 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2934 if (!theSFace->_is_nil())
2935 theFaceEntry = theSFace->GetID();
2937 if (theFaceEntry.empty())
2938 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2940 if (theVertexEntry.empty()) {
2941 if (theVertex->GetShapeType() == GEOM::VERTEX)
2943 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2944 aName = "Compound_";
2945 aName += theVertex->GetEntry();
2946 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2947 if (!theSVertex->_is_nil())
2948 theVertexEntry = theSVertex->GetID();
2950 if (theVertexEntry.empty())
2951 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2953 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2956 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2957 } catch (SALOME_Exception& ex) {
2958 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2962 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2965 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2966 MESSAGE("theFace shape type is not FACE or COMPOUND");
2967 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2970 string theFaceEntry = theFace->GetStudyEntry();
2972 if (theFaceEntry.empty()) {
2973 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2974 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2976 if (theFace->GetShapeType() == GEOM::FACE)
2978 if (theFace->GetShapeType() == GEOM::COMPOUND)
2979 aName = "Compound_";
2980 aName += theFace->GetEntry();
2981 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2982 if (!theSFace->_is_nil())
2983 theFaceEntry = theSFace->GetID();
2985 if (theFaceEntry.empty())
2986 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2988 MESSAGE("IDL : GetName : " << theFace->GetName());
2989 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2992 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2993 } catch (SALOME_Exception& ex) {
2994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2999 * Set/get/unset an enforced vertex on face - NEW (no face)
3001 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3006 return SetEnforcedVertexEntry("", x, y, z);
3007 } catch (SALOME_Exception& ex) {
3008 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3013 * Set/get/unset an enforced vertex with name on face
3015 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3018 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3019 } catch (SALOME_Exception& ex) {
3020 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3025 * Set/get/unset an enforced vertex with geom object on face
3027 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3028 throw (SALOME::SALOME_Exception)
3030 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3031 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3032 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3034 string theVertexEntry = theVertex->GetStudyEntry();
3036 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3037 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3040 if (theVertexEntry.empty()) {
3041 if (theVertex->GetShapeType() == GEOM::VERTEX)
3043 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3044 aName = "Compound_";
3045 aName += theVertex->GetEntry();
3046 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3047 if (!theSVertex->_is_nil())
3048 theVertexEntry = theSVertex->GetID();
3050 if (theVertexEntry.empty())
3051 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3053 string theVertexName = theVertex->GetName();
3055 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3056 } catch (SALOME_Exception& ex) {
3057 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3062 * Set an enforced vertex with group name on face
3064 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3065 throw (SALOME::SALOME_Exception)
3070 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3071 } catch (SALOME_Exception& ex) {
3072 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3077 * Set an enforced vertex with name and group name on face
3079 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3080 const char* theVertexName, const char* theGroupName)
3081 throw (SALOME::SALOME_Exception)
3086 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3087 } catch (SALOME_Exception& ex) {
3088 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3093 * Set an enforced vertex with geom entry and group name on face
3095 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3096 throw (SALOME::SALOME_Exception)
3098 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3099 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3100 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3103 string theVertexEntry = theVertex->GetStudyEntry();
3105 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3106 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3109 if (theVertexEntry.empty()) {
3110 if (theVertex->GetShapeType() == GEOM::VERTEX)
3112 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3113 aName = "Compound_";
3114 aName += theVertex->GetEntry();
3115 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3116 if (!theSVertex->_is_nil())
3117 theVertexEntry = theSVertex->GetID();
3119 if (theVertexEntry.empty())
3120 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3122 string theVertexName = theVertex->GetName();
3124 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3125 } catch (SALOME_Exception& ex) {
3126 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3130 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3133 return UnsetEnforcedVertexEntry("", x, y, z);
3134 } catch (SALOME_Exception& ex) {
3135 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3139 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3140 throw (SALOME::SALOME_Exception)
3142 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3143 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3144 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3146 std::string theVertexEntry = theVertex->GetStudyEntry();
3148 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3149 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3152 if (theVertexEntry.empty()) {
3153 if (theVertex->GetShapeType() == GEOM::VERTEX)
3155 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3156 aName = "Compound_";
3157 aName += theVertex->GetEntry();
3158 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3159 if (!theSVertex->_is_nil())
3160 theVertexEntry = theSVertex->GetID();
3162 if (theVertexEntry.empty())
3163 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3166 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3167 } catch (SALOME_Exception& ex) {
3168 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3172 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3175 return UnsetEnforcedVerticesEntry("");
3176 } catch (SALOME_Exception& ex) {
3177 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3182 * Set/get/unset an enforced vertex on geom object given by entry
3184 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3188 const char* theVertexName,
3189 const char* theVertexEntry,
3190 const char* theGroupName)
3191 throw (SALOME::SALOME_Exception)
3193 bool newValue = false;
3194 if (string(theVertexEntry).empty()) {
3196 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3197 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3198 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3199 coords.push_back(x);
3200 coords.push_back(y);
3201 coords.push_back(z);
3202 if (coordsList.find(coords) == coordsList.end()) {
3205 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3206 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3210 } catch (const std::invalid_argument& ex) {
3211 // no enforced vertex for entry
3215 if (string(theVertexName).empty()) {
3216 if (string(theGroupName).empty())
3217 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3219 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3222 if (string(theGroupName).empty())
3223 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3225 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3226 << theVertexName << "\", \"" << theGroupName << "\")";
3231 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3232 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3233 if ( it == enfVertexEntryList.end()) {
3237 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3238 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3242 } catch (const std::invalid_argument& ex) {
3243 // no enforced vertex for entry
3247 if (string(theGroupName).empty())
3248 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3250 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3255 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3260 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3261 throw (SALOME::SALOME_Exception)
3264 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3265 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3266 vertexList->length(_vList.size());
3267 MESSAGE("Number of enforced vertices: " << vertexList->length());
3268 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3269 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3270 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3272 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3275 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3276 // Geom Vertex Entry
3277 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3279 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3280 coords->length(_enfVertex->coords.size());
3281 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3282 coords[ind] = _enfVertex->coords[ind];
3283 enfVertex->coords = coords;
3285 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3287 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3288 faceEntryList->length(_enfVertex->faceEntries.size());
3289 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3290 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3291 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3292 enfVertex->faceEntries = faceEntryList;
3294 vertexList[i] = enfVertex;
3296 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3297 return vertexList._retn();
3298 } catch (const std::invalid_argument& ex) {
3299 SALOME::ExceptionStruct ExDescription;
3300 ExDescription.text = ex.what();
3301 ExDescription.type = SALOME::BAD_PARAM;
3302 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3303 ExDescription.lineNumber = 1385;
3304 throw SALOME::SALOME_Exception(ExDescription);
3305 } catch (const std::exception& ex) {
3306 std::cout << "Exception: " << ex.what() << std::endl;
3307 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3311 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3317 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3319 if (string(theVertexEntry).empty())
3320 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3323 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3325 } catch (const std::invalid_argument& ex) {
3327 } catch (const std::exception& ex) {
3328 std::cout << "Exception: " << ex.what() << std::endl;
3329 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3332 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3335 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3340 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3341 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3342 } catch (const std::invalid_argument& ex) {
3344 } catch (const std::exception& ex) {
3345 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3351 //=============================================================================
3353 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3357 //=============================================================================
3358 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3361 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3362 std::string theValueStr = theValue ? "True" : "False";
3363 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3366 //=============================================================================
3368 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3372 //=============================================================================
3373 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3376 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3379 //=============================================================================
3381 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3385 //=============================================================================
3386 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3389 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3390 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3393 //=============================================================================
3395 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3399 //=============================================================================
3400 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3403 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3407 * Enable internal enforced vertices on specific face if requested by user
3409 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3410 throw (SALOME::SALOME_Exception)
3412 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3414 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3415 } catch (SALOME_Exception& ex) {
3416 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3420 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3421 throw (SALOME::SALOME_Exception)
3423 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3425 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3426 MESSAGE("theFace shape type is not FACE or COMPOUND");
3427 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3430 string theFaceEntry = theFace->GetStudyEntry();
3432 if (theFaceEntry.empty()) {
3433 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3434 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3436 if (theFace->GetShapeType() == GEOM::FACE)
3438 if (theFace->GetShapeType() == GEOM::COMPOUND)
3439 aName = "Compound_";
3440 aName += theFace->GetEntry();
3441 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3442 if (!theSFace->_is_nil())
3443 theFaceEntry = theSFace->GetID();
3445 if (theFaceEntry.empty())
3446 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3448 MESSAGE("IDL : GetName : " << theFace->GetName());
3449 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3451 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3452 } catch (SALOME_Exception& ex) {
3453 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3457 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3458 throw (SALOME::SALOME_Exception)
3460 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3463 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3464 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3465 if (string(theGroupName).empty())
3466 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3468 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3469 } catch (const std::exception& ex) {
3470 std::cout << "Exception: " << ex.what() << std::endl;
3471 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3478 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3479 throw (SALOME::SALOME_Exception)
3482 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3484 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3486 catch (const std::invalid_argument& ex) {
3487 SALOME::ExceptionStruct ExDescription;
3488 ExDescription.text = ex.what();
3489 ExDescription.type = SALOME::BAD_PARAM;
3490 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3491 ExDescription.lineNumber = 1146;
3492 throw SALOME::SALOME_Exception(ExDescription);
3494 catch (SALOME_Exception& ex) {
3495 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3497 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3502 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3503 throw (SALOME::SALOME_Exception)
3506 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3508 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3510 catch (const std::invalid_argument& ex) {
3511 SALOME::ExceptionStruct ExDescription;
3512 ExDescription.text = ex.what();
3513 ExDescription.type = SALOME::BAD_PARAM;
3514 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3515 ExDescription.lineNumber = 1170;
3516 throw SALOME::SALOME_Exception(ExDescription);
3518 catch (SALOME_Exception& ex) {
3519 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3522 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3523 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3525 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3528 ///////////////////////
3530 ///////////////////////
3532 ///////////////////////
3535 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3537 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3538 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3539 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3540 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3541 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3542 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3543 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3544 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3545 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3546 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3547 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3548 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3549 return txtShapeType;
3552 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3554 // Check shape types
3556 std::stringstream typesTxt;
3557 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3559 GEOM::shape_type theShapeType = theShapeTypes[i];
3560 if (shape->GetShapeType() == theShapeType)
3562 typesTxt << ShapeTypeToString(theShapeType);
3563 if (i < theShapeTypes.size()-1 )
3567 std::stringstream msg;
3568 msg << "shape shape type is not in" << typesTxt.str();
3570 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3574 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3577 if (shape->GetShapeType() != theShapeType) {
3578 std::stringstream msg;
3579 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3581 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3585 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3587 // Check shape is published in the object browser
3588 string shapeEntry = shape->GetStudyEntry();
3590 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3591 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3594 // Publish shape if needed
3595 if (shapeEntry.empty()) {
3596 if (shape->GetShapeType() == theShapeType)
3598 aName += shape->GetEntry();
3599 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3600 if (!theSFace1->_is_nil())
3601 shapeEntry = theSFace1->GetID();
3603 if (shapeEntry.empty())
3604 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3608 // Format the output of two vectors to use it in MESSAGE and PythonDump
3609 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3611 std::stringstream listEntriesTxt;
3613 if (!theSourceVerticesEntries.empty())
3615 listEntriesTxt << ", [" ;
3617 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3620 listEntriesTxt << ", ";
3621 listEntriesTxt << *it;
3624 listEntriesTxt << "], [" ;
3626 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3629 listEntriesTxt << ", ";
3630 listEntriesTxt << *it;
3632 listEntriesTxt << "]" ;
3634 return listEntriesTxt.str();
3638 * Erase all PreCad periodicity associations
3640 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3642 this->GetImpl()->ClearPreCadPeriodicityVectors();
3643 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3646 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3648 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3649 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3650 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3652 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3654 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3655 return periodicityList._retn();
3658 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3660 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3661 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3662 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3664 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3666 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3667 return periodicityList._retn();
3670 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3671 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3673 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3674 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3676 periodicityList->length(preCadPeriodicityVector.size());
3678 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3680 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3682 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3683 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3684 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3686 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3687 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3689 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3690 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3691 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3694 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3696 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3697 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3699 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3700 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3701 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3704 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3706 periodicityList[i] = myPreCadPeriodicity;
3710 return periodicityList._retn();
3714 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3715 throw (SALOME::SALOME_Exception)
3718 const GEOM::ListOfGO theSourceVertices;
3719 const GEOM::ListOfGO theTargetVertices;
3720 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3724 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3725 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3726 throw (SALOME::SALOME_Exception)
3729 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3731 size_t theLength = theSourceVertices.length();
3732 if (theLength != theTargetVertices.length())
3733 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3735 std::vector<GEOM::shape_type> allowedShapeTypes;
3736 allowedShapeTypes.push_back(GEOM::FACE);
3737 allowedShapeTypes.push_back(GEOM::COMPOUND);
3739 string prefix1 = "Source_face_";
3740 CheckShapeTypes(theFace1, allowedShapeTypes);
3741 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3743 string prefix2 = "Target_face_";
3744 CheckShapeTypes(theFace2, allowedShapeTypes);
3745 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3747 string prefix3 = "Source_vertex_";
3748 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3749 theSourceVerticesEntries->length(theLength);
3750 GEOM::GEOM_Object_ptr theVtx_i;
3752 for (size_t ind = 0; ind < theLength; ind++) {
3753 theVtx_i = theSourceVertices[ind];
3754 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3755 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3758 string prefix4 = "Target_vertex_";
3759 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3760 theTargetVerticesEntries->length(theLength);
3761 for (size_t ind = 0; ind < theLength; ind++) {
3762 theVtx_i = theTargetVertices[ind];
3763 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3764 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3767 string theFace2Name = theFace2->GetName();
3768 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3769 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3770 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3772 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3773 theSourceVerticesEntries, theTargetVerticesEntries);
3774 } catch (SALOME_Exception& ex) {
3775 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3780 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3781 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3782 throw (SALOME::SALOME_Exception)
3787 // Convert BLSURFPlugin::TEntryList to vector<string>
3788 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3789 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3790 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3791 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3794 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3796 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3798 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3799 theSourceVerticesEntries, theTargetVerticesEntries);
3801 SMESH::TPythonDump pd;
3802 if (!theSourceVerticesEntries.empty())
3804 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3805 pd << listEntriesTxt.c_str();
3809 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3810 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3813 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3814 throw (SALOME::SALOME_Exception)
3817 const GEOM::ListOfGO theSourceVertices;
3818 const GEOM::ListOfGO theTargetVertices;
3819 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3822 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3823 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3824 throw (SALOME::SALOME_Exception)
3826 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3829 size_t theLength = theSourceVertices.length();
3830 if (theLength != theTargetVertices.length())
3831 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3833 std::vector<GEOM::shape_type> allowedShapeTypes;
3834 allowedShapeTypes.push_back(GEOM::EDGE);
3835 allowedShapeTypes.push_back(GEOM::COMPOUND);
3837 string prefix1 = "Source_edge_";
3838 CheckShapeTypes(theEdge1, allowedShapeTypes);
3839 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3841 string prefix2 = "Target_edge_";
3842 CheckShapeTypes(theEdge2, allowedShapeTypes);
3843 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3845 string prefix3 = "Source_vertex_";
3846 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3847 theSourceVerticesEntries->length(theLength);
3848 GEOM::GEOM_Object_ptr theVtx_i;
3850 for (size_t ind = 0; ind < theLength; ind++) {
3851 theVtx_i = theSourceVertices[ind];
3852 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3853 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3856 string prefix4 = "Target_vertex_";
3857 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3858 theTargetVerticesEntries->length(theLength);
3859 for (size_t ind = 0; ind < theLength; ind++) {
3860 theVtx_i = theTargetVertices[ind];
3861 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3862 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3865 string theEdge2Name = theEdge2->GetName();
3866 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3867 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3868 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3870 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3871 theSourceVerticesEntries, theTargetVerticesEntries);
3872 } catch (SALOME_Exception& ex) {
3873 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3878 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3879 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3880 throw (SALOME::SALOME_Exception)
3885 // Convert BLSURFPlugin::TEntryList to vector<string>
3886 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3887 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3888 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3889 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3892 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3894 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3895 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3896 theSourceVerticesEntries, theTargetVerticesEntries);
3898 SMESH::TPythonDump pd;
3899 if (!theSourceVerticesEntries.empty())
3901 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3902 pd << listEntriesTxt.c_str();
3906 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3908 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3912 //================================================================================
3914 * \brief Sets the file for export resulting mesh in GMF format
3915 * \param theFileName - full name of the file (.mesh, .meshb)
3917 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3919 //================================================================================
3920 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3921 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3923 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3924 bool valueChanged/*, modeChanged*/ = false;
3926 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3927 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3928 if (valueChanged)// or (!valueChanged && modeChanged))
3929 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3930 } catch (const std::exception& ex) {
3931 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3933 if (valueChanged)// or (!valueChanged && modeChanged))
3934 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3935 MESSAGE("IDL : SetGMFFile END ");
3938 //================================================================================
3940 * \brief Gets the file name for export resulting mesh in GMF format
3941 * \retval char* - The file name
3943 * Returns the GMF file name
3945 //================================================================================
3946 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3948 // MESSAGE("IDL : GetGMFFile()");
3949 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3952 // //================================================================================
3954 // * \brief Gets the file mode for export resulting mesh in GMF format
3955 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3957 // * Returns the GMF file mode
3959 // //================================================================================
3960 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3961 // ASSERT(myBaseImpl);
3962 // MESSAGE("IDL : GetGMFFileMode()");
3963 // return this->GetImpl()->GetGMFFileMode();
3966 //=============================================================================
3968 * BLSURFPlugin_Hypothesis_i::GetImpl
3970 * Get implementation
3972 //=============================================================================
3973 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3974 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3975 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3978 //================================================================================
3980 * \brief Verify whether hypothesis supports given entity type
3981 * \param type - dimension (see SMESH::Dimension enumeration)
3982 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3984 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3986 //================================================================================
3987 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3988 return type == SMESH::DIM_2D;
3992 // Obsolete methods - To be removed in V7
3995 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3996 this->SetMinSize(theMinSize);
3998 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3999 return this->GetMinSize();
4001 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
4002 this->SetMaxSize(theMaxSize);
4004 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
4005 return this->GetMaxSize();
4007 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
4008 this->SetMinSize(theMinSize);
4010 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
4011 return this->GetMinSize();
4013 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
4014 this->SetMaxSize(theMaxSize);
4016 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
4017 return this->GetMaxSize();
4019 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
4020 this->SetAngleMesh(theValue);
4022 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
4023 return this->GetAngleMesh();
4025 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
4026 this->SetAngleMesh(theValue);
4028 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
4029 return this->GetAngleMesh();
4031 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
4032 std::string theValueStr = theValue ? "1" : "0";
4033 this->SetOptionValue("respect_geometry",theValueStr.c_str());
4035 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
4036 std::string theValueStr = this->GetOptionValue("respect_geometry");
4037 if (theValueStr.empty() || theValueStr == "respect")
4041 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
4042 std::string theValueStr = theValue ? "1" : "0";
4043 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
4045 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
4046 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
4047 if (theValueStr == "1")
4051 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
4052 std::ostringstream theValueStr;
4053 theValueStr << theValue;
4054 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
4056 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
4057 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
4059 theValueStr >> result;