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 //=============================================================================
1064 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1068 //=============================================================================
1069 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1070 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
1072 this->GetImpl()->SetPreCADMergeEdges(theValue);
1073 std::string theValueStr = theValue ? "True" : "False";
1074 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1077 //=============================================================================
1079 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1083 //=============================================================================
1084 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1085 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
1087 return this->GetImpl()->GetPreCADMergeEdges();
1090 //=============================================================================
1092 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
1096 //=============================================================================
1097 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1098 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1100 this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1101 std::string theValueStr = theValue ? "True" : "False";
1102 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1105 //=============================================================================
1107 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1111 //=============================================================================
1112 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1113 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1115 return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1118 //=============================================================================
1120 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1124 //=============================================================================
1125 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1126 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1128 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1129 std::string theValueStr = theValue ? "True" : "False";
1130 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1133 //=============================================================================
1135 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1139 //=============================================================================
1140 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1141 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1143 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1146 //=============================================================================
1148 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1152 //=============================================================================
1153 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1154 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1156 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1157 std::string theValueStr = theValue ? "True" : "False";
1158 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1161 //=============================================================================
1163 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1167 //=============================================================================
1168 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1169 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1171 return this->GetImpl()->GetPreCADProcess3DTopology();
1174 //=============================================================================
1176 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1180 //=============================================================================
1181 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1182 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1184 this->GetImpl()->SetPreCADDiscardInput(theValue);
1185 std::string theValueStr = theValue ? "True" : "False";
1186 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1189 //=============================================================================
1191 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1195 //=============================================================================
1196 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1197 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1199 return this->GetImpl()->GetPreCADDiscardInput();
1203 //=============================================================================
1205 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1206 throw (SALOME::SALOME_Exception) {
1209 std::string name( optionName );
1210 if ( !optionValue || !optionValue[0] )
1211 UnsetOption( optionName );
1213 // basic options (visible in Advanced table)
1215 else if ( name == "enforce_cad_edge_sizes" )
1216 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1218 else if ( name == "jacobian_rectification_respect_geometry" )
1219 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1221 else if ( name == "max_number_of_points_per_patch" )
1222 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1224 else if ( name == "rectify_jacobian" )
1225 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1227 else if ( name == "respect_geometry" )
1228 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1230 else if ( name == "tiny_edge_avoid_surface_intersections" )
1231 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1233 else if ( name == "closed_geometry" )
1234 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1236 else if ( name == "debug" )
1237 SetDebug( GetImpl()->ToBool( optionValue ));
1239 else if ( name == "discard_input_topology" )
1240 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1242 else if ( name == "merge_edges" )
1243 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1245 else if ( name == "periodic_tolerance" )
1246 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1248 else if ( name == "remove_duplicate_cad_faces" )
1249 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1251 else if ( name == "required_entities" )
1252 SetRequiredEntities( optionValue );
1254 else if ( name == "sewing_tolerance" )
1255 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1257 else if ( name == "tags" )
1258 SetTags( optionValue );
1260 // other basic options with specific methods
1262 else if ( name == "correct_surface_intersections" )
1263 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1265 else if ( name == "optimise_tiny_edges" )
1266 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1268 else if ( name == "surface_intersections_processing_max_cost" )
1269 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1271 else if ( name == "volume_gradation" )
1272 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1274 else if ( name == "tiny_edge_optimisation_length" )
1275 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1277 // advanced options (for backward compatibility)
1279 else if ( name == "create_tag_on_collision" ||
1280 name == "tiny_edge_respect_geometry" )
1281 AddOption( optionName, optionValue );
1285 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1286 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1289 this->GetImpl()->SetOptionValue(optionName, optionValue);
1290 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1293 } catch (const std::invalid_argument& ex) {
1294 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1295 } catch (SALOME_Exception& ex) {
1296 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1300 //=============================================================================
1302 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1303 throw (SALOME::SALOME_Exception) {
1305 bool valueChanged = false;
1307 std::string name( optionName );
1308 if ( !optionValue || !optionValue[0] )
1309 UnsetOption( optionName );
1311 else if ( name == "closed_geometry" )
1312 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1314 else if ( name == "debug" )
1315 SetDebug( GetImpl()->ToBool( optionValue ));
1317 else if ( name == "discard_input_topology" )
1318 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1320 else if ( name == "merge_edges" )
1321 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1323 else if ( name == "periodic_tolerance" )
1324 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1326 else if ( name == "remove_duplicate_cad_faces" )
1327 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1329 else if ( name == "required_entities" )
1330 SetRequiredEntities( optionValue );
1332 else if ( name == "sewing_tolerance" )
1333 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1335 else if ( name == "tags" )
1336 SetTags( optionValue );
1338 // other basic options with specific methods
1340 else if ( name == "correct_surface_intersections" )
1341 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1343 else if ( name == "optimise_tiny_edges" )
1344 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1346 else if ( name == "surface_intersections_processing_max_cost" )
1347 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1349 else if ( name == "volume_gradation" )
1350 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1352 else if ( name == "tiny_edge_optimisation_length" )
1353 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1355 else if ( name == "remove_tiny_uv_edges" )
1356 SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue ));
1358 else if ( name == "process_3d_topology" )
1359 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1361 // advanced options (for backward compatibility)
1363 else if ( name == "create_tag_on_collision" ||
1364 name == "tiny_edge_respect_geometry" ||
1365 name == "remove_tiny_edges" ||
1366 name == "tiny_edge_length")
1367 AddPreCADOption( optionName, optionValue );
1370 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1372 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1374 } catch (const std::invalid_argument& ex) {
1375 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1376 } catch (SALOME_Exception& ex) {
1377 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1380 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1383 //=============================================================================
1385 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1389 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1390 } catch (const std::invalid_argument& ex) {
1391 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1392 } catch (SALOME_Exception& ex) {
1393 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1398 //=============================================================================
1400 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1404 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1405 } catch (const std::invalid_argument& ex) {
1406 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1407 } catch (SALOME_Exception& ex) {
1408 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1413 //=============================================================================
1415 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1417 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1419 this->GetImpl()->ClearOption(optionName);
1420 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1424 //=============================================================================
1426 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1428 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1430 this->GetImpl()->ClearPreCADOption(optionName);
1431 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1435 //=============================================================================
1437 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1439 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1441 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1442 result->length(opts.size());
1446 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1447 for (; opIt != opts.end(); ++opIt, ++i) {
1448 string name_value_type = opIt->first;
1449 if (!opIt->second.empty()) {
1450 name_value_type += ":";
1451 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1452 name_value_type += isDefault ? ":0" : ":1";
1454 result[i] = CORBA::string_dup(name_value_type.c_str());
1457 return result._retn();
1460 //=============================================================================
1462 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1464 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1466 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1467 result->length(opts.size());
1471 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1472 for (; opIt != opts.end(); ++opIt, ++i) {
1473 string name_value_type = opIt->first;
1474 if (!opIt->second.empty()) {
1475 name_value_type += ":";
1476 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1477 name_value_type += isDefault ? ":0" : ":1";
1479 result[i] = CORBA::string_dup(name_value_type.c_str());
1481 return result._retn();
1484 //=============================================================================
1486 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1488 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1490 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1491 result->length(custom_opts.size());
1494 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1495 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1496 string name_value_type = opIt->first;
1497 if (!opIt->second.empty()) {
1498 name_value_type += ":";
1499 name_value_type += opIt->second;
1500 name_value_type += ":1"; // user defined
1502 result[i] = CORBA::string_dup(name_value_type.c_str());
1504 return result._retn();
1507 //=============================================================================
1509 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1510 throw (SALOME::SALOME_Exception) {
1512 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1513 string name_value_type = options[i].in();
1514 if(name_value_type.empty())
1516 size_t colonPos = name_value_type.find(':');
1518 if (colonPos == string::npos) // ':' not found
1519 name = name_value_type;
1521 name = name_value_type.substr(0, colonPos);
1522 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1523 string value_type = name_value_type.substr(colonPos + 1);
1524 colonPos = value_type.find(':');
1525 value = value_type.substr(0, colonPos);
1526 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1527 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1531 SetOptionValue(name.c_str(), value.c_str());
1535 //=============================================================================
1537 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1538 throw (SALOME::SALOME_Exception) {
1540 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1541 string name_value_type = options[i].in();
1542 if(name_value_type.empty())
1544 size_t colonPos = name_value_type.find(':');
1546 if (colonPos == string::npos) // ':' not found
1547 name = name_value_type;
1549 name = name_value_type.substr(0, colonPos);
1550 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1551 string value_type = name_value_type.substr(colonPos + 1);
1552 colonPos = value_type.find(':');
1553 value = value_type.substr(0, colonPos);
1554 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1555 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1559 SetPreCADOptionValue(name.c_str(), value.c_str());
1563 //=============================================================================
1565 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1567 SMESH::TPythonDump dump;
1569 string optionsAndValues;
1570 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1571 string name_value_type = options[i].in();
1572 if(name_value_type.empty())
1574 size_t colonPos = name_value_type.find(':');
1576 if (colonPos == string::npos) // ':' not found
1577 name = name_value_type;
1579 name = name_value_type.substr(0, colonPos);
1580 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1581 string value_type = name_value_type.substr(colonPos + 1);
1582 colonPos = value_type.find(':');
1583 value = value_type.substr(0, colonPos);
1586 AddOption(name.c_str(), value.c_str());
1588 optionsAndValues += name + " " + value + " ";
1591 if ( !optionsAndValues.empty() )
1592 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1595 //=============================================================================
1597 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1598 throw (SALOME::SALOME_Exception)
1600 if ( !optionsAndValues ) return;
1602 SMESH::TPythonDump dump;
1604 std::istringstream strm( optionsAndValues );
1605 std::istream_iterator<std::string> sIt( strm ), sEnd;
1606 while ( sIt != sEnd )
1608 std::string option = *sIt;
1609 if ( ++sIt != sEnd )
1611 std::string value = *sIt;
1613 AddOption( option.c_str(), value.c_str() );
1617 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1620 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1623 //=============================================================================
1625 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1628 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1630 this->GetImpl()->AddOption(optionName, optionValue);
1631 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1635 //=============================================================================
1637 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1640 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1642 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1643 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1647 //=============================================================================
1649 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1652 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1655 //=============================================================================
1657 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1660 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1663 //=============================================================================
1665 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1666 throw (SALOME::SALOME_Exception) {
1668 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1669 if ( !entry || !entry[0] )
1670 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1671 bool valueChanged = false;
1673 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1675 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1676 } catch (const std::invalid_argument& ex) {
1677 SALOME::ExceptionStruct ExDescription;
1678 ExDescription.text = ex.what();
1679 ExDescription.type = SALOME::BAD_PARAM;
1680 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1681 ExDescription.lineNumber = 0;
1682 throw SALOME::SALOME_Exception(ExDescription);
1683 } catch (SALOME_Exception& ex) {
1684 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1686 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1688 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1691 //=============================================================================
1693 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1694 throw (SALOME::SALOME_Exception) {
1696 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1697 bool valueChanged = false;
1698 std::ostringstream sizeMapFunction;
1699 switch (shapeType) {
1700 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1701 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1702 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1706 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1708 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1709 } catch (const std::invalid_argument& ex) {
1710 SALOME::ExceptionStruct ExDescription;
1711 ExDescription.text = ex.what();
1712 ExDescription.type = SALOME::BAD_PARAM;
1713 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1714 ExDescription.lineNumber = 0;
1715 throw SALOME::SALOME_Exception(ExDescription);
1716 } catch (SALOME_Exception& ex) {
1717 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1719 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1721 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1724 //=============================================================================
1726 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1727 throw (SALOME::SALOME_Exception) {
1729 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1730 bool valueChanged = false;
1732 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1733 if ( valueChanged ) {
1734 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1735 if (!boost::regex_match(string(attractor), re))
1736 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1737 this->GetImpl()->SetAttractorEntry(entry, attractor);
1739 } catch (const std::invalid_argument& ex) {
1740 SALOME::ExceptionStruct ExDescription;
1741 ExDescription.text = ex.what();
1742 ExDescription.type = SALOME::BAD_PARAM;
1743 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1744 ExDescription.lineNumber = 0;
1745 throw SALOME::SALOME_Exception(ExDescription);
1746 } catch (SALOME_Exception& ex) {
1747 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1749 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1751 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1754 //=============================================================================
1756 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
1757 throw (SALOME::SALOME_Exception)
1760 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1761 //bool valueChanged = false;
1763 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1765 catch (const std::invalid_argument& ex) {
1766 SALOME::ExceptionStruct ExDescription;
1767 ExDescription.text = ex.what();
1768 ExDescription.type = SALOME::BAD_PARAM;
1769 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1770 ExDescription.lineNumber = 0;
1771 throw SALOME::SALOME_Exception(ExDescription);
1772 } catch (SALOME_Exception& ex) {
1773 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1775 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1776 //if ( valueChanged )
1777 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1778 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1781 //=============================================================================
1783 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1786 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1787 } catch (const std::invalid_argument& ex) {
1788 SALOME::ExceptionStruct ExDescription;
1789 ExDescription.text = ex.what();
1790 ExDescription.type = SALOME::BAD_PARAM;
1791 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1792 ExDescription.lineNumber = 0;
1793 throw SALOME::SALOME_Exception(ExDescription);
1794 } catch (SALOME_Exception& ex) {
1795 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1800 //=============================================================================
1802 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1805 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1806 } catch (const std::invalid_argument& ex) {
1807 SALOME::ExceptionStruct ExDescription;
1808 ExDescription.text = ex.what();
1809 ExDescription.type = SALOME::BAD_PARAM;
1810 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1811 ExDescription.lineNumber = 0;
1812 throw SALOME::SALOME_Exception(ExDescription);
1813 } catch (SALOME_Exception& ex) {
1814 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1819 // //=============================================================================
1821 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1822 // // A finir pour le dump
1823 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1824 // throw (SALOME::SALOME_Exception)
1826 // ASSERT(myBaseImpl);
1828 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1830 // catch (const std::invalid_argument& ex) {
1831 // SALOME::ExceptionStruct ExDescription;
1832 // ExDescription.text = ex.what();
1833 // ExDescription.type = SALOME::BAD_PARAM;
1834 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1835 // ExDescription.lineNumber = 0;
1836 // throw SALOME::SALOME_Exception(ExDescription);
1838 // catch (SALOME_Exception& ex) {
1839 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1844 //=============================================================================
1846 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1848 this->GetImpl()->ClearEntry(entry);
1849 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1852 //=============================================================================
1854 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1856 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1858 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1859 result->length(sizeMaps.size());
1861 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1862 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1863 string entry_sizemap = smIt->first;
1864 if (!smIt->second.empty()) {
1865 entry_sizemap += "|";
1866 entry_sizemap += smIt->second;
1868 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1870 return result._retn();
1873 //=============================================================================
1875 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1877 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1879 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1880 result->length(attractors.size());
1882 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1883 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1884 string entry_attractor = atIt->first;
1885 if (!atIt->second.empty()) {
1886 entry_attractor += "|";
1887 entry_attractor += atIt->second;
1889 result[i] = CORBA::string_dup(entry_attractor.c_str());
1891 return result._retn();
1894 //=============================================================================
1896 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1899 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1901 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1902 result->length( attractors.size() );
1904 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1905 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1906 string faceEntry = atIt->first;
1908 double startSize, endSize, infDist, constDist;
1909 if ( !atIt->second->Empty() ) {
1910 attEntry = atIt->second->GetAttractorEntry();
1911 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1912 std::vector<double> params = atIt->second->GetParameters();
1913 startSize = params[0];
1914 endSize = params[1];
1915 infDist = params[2];
1916 constDist = params[3];
1918 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1919 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1920 result[i].startSize = startSize;
1921 result[i].endSize = endSize;
1922 result[i].infDist = infDist;
1923 result[i].constDist = constDist;
1924 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1925 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1927 return result._retn();
1930 //=============================================================================
1932 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1933 throw (SALOME::SALOME_Exception) {
1935 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1936 string entry_sizemap = sizeMaps[i].in();
1937 size_t colonPos = entry_sizemap.find('|');
1938 string entry, sizemap;
1939 if (colonPos == string::npos) // '|' separator not found
1940 entry = entry_sizemap;
1942 entry = entry_sizemap.substr(0, colonPos);
1943 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1944 sizemap = entry_sizemap.substr(colonPos + 1);
1946 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1950 //=============================================================================
1952 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1954 this->GetImpl()->ClearSizeMaps();
1957 //=============================================================================
1959 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1960 throw (SALOME::SALOME_Exception)
1964 entry = GeomObj->GetStudyEntry();
1965 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1966 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1967 SetSizeMapEntry(entry.c_str(), sizeMap);
1970 //=============================================================================
1972 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1974 string entry = GeomObj->GetStudyEntry();
1975 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1976 if (shapeType == GEOM::COMPOUND)
1977 shapeType = GeomObj->GetMaxShapeType();
1978 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1979 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1980 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1983 //=============================================================================
1984 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1987 entry = GeomObj->GetStudyEntry();
1988 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1989 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1990 UnsetEntry(entry.c_str());
1991 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1994 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1997 entry = GeomObj->GetStudyEntry();
1998 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1999 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
2000 SetAttractorEntry(entry.c_str(), attractor);
2003 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2006 entry = GeomObj->GetStudyEntry();
2007 MESSAGE("IDL : GetName : " << GeomObj->GetName());
2008 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
2009 UnsetEntry(entry.c_str());
2010 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2013 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)
2016 string theFaceEntry;
2018 theFaceEntry = theFace->GetStudyEntry();
2019 theAttEntry = theAttractor->GetStudyEntry();
2021 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2022 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2025 if (theFaceEntry.empty()) {
2027 aName += theFace->GetEntry();
2028 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2029 if (!theSFace->_is_nil())
2030 theFaceEntry = theSFace->GetID();
2032 if (theFaceEntry.empty())
2033 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2035 if (theAttEntry.empty()) {
2036 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2038 if (theAttractor->GetShapeType() == GEOM::EDGE)
2040 if (theAttractor->GetShapeType() == GEOM::WIRE)
2042 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2043 aName = "Compound_";
2044 aName += theAttractor->GetEntry();
2045 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2046 if (!theSAtt->_is_nil())
2047 theAttEntry = theSAtt->GetID();
2049 if (theAttEntry.empty())
2050 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2052 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2053 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2054 MESSAGE("IDL : GetName : " << theFace->GetName());
2055 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2056 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2059 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2060 GEOM::GEOM_Object_ptr theAttractor)
2063 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2064 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2066 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2067 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2070 // if (theFaceEntry.empty()) {
2072 // aName += theFace->GetEntry();
2073 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2074 // if (!theSFace->_is_nil())
2075 // theFaceEntry = theSFace->GetID();
2077 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2078 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2079 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2081 MESSAGE("IDL : GetName : " << theFace->GetName());
2082 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2083 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2084 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2085 << theFace << ", " << theAttractor << " )";
2088 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2089 const char* attractorEntry)
2091 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2092 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2093 << faceEntry << "', '" << attractorEntry << "' )";
2098 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2101 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2104 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2107 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2110 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2113 this->GetImpl()->UnsetCustomSizeMap(entry);
2114 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2118 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2123 // ///////////////////////
2124 // // ENFORCED VERTICES //
2125 // ///////////////////////
2129 * Returns the list of enforced vertices for a given Face entry
2130 * @return A map of Face entry / List of enforced vertices
2133 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2134 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2137 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2139 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2140 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2141 resultMap->length(faceEntryEnfVertexListMap.size());
2142 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2144 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2145 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2146 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2147 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2148 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2149 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2150 MESSAGE("Face Entry: " << mapElement->faceEntry);
2152 _enfVertexList = it_entry->second;
2153 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2154 enfVertexList->length(_enfVertexList.size());
2155 MESSAGE("Number of enf vertex: " << enfVertexList->length());
2157 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2158 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2159 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2160 currentEnfVertex = (*it_enfVertex);
2162 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2165 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2168 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2171 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2172 coords->length(currentEnfVertex->coords.size());
2173 for (CORBA::ULong i=0;i<coords->length();i++)
2174 coords[i] = currentEnfVertex->coords[i];
2175 enfVertex->coords = coords;
2178 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2181 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2182 faceEntryList->length(currentEnfVertex->faceEntries.size());
2183 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2184 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2185 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2186 enfVertex->faceEntries = faceEntryList;
2189 msg << "Enforced vertex: \n"
2190 << "Name: " << enfVertex->name << "\n";
2191 if (coords->length())
2192 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2193 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2194 << "Group Name: " << enfVertex->grpName;
2197 enfVertexList[j] = enfVertex;
2199 mapElement->enfVertexList = enfVertexList;
2201 resultMap[i] = mapElement;
2204 return resultMap._retn();
2208 * Returns the list of all enforced vertices
2209 * @return a list of enforced vertices
2212 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2213 MESSAGE("IDL: GetAllEnforcedVertices()");
2215 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2216 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2217 resultMap->length(enfVertexList.size());
2218 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2220 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2221 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2222 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2223 MESSAGE("Enforced Vertex #" << i);
2224 currentEnfVertex = (*evlIt);
2225 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2227 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2229 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2231 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2232 coords->length(currentEnfVertex->coords.size());
2233 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2234 coords[ind] = currentEnfVertex->coords[ind];
2235 enfVertex->coords = coords;
2237 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2239 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2240 faceEntryList->length(currentEnfVertex->faceEntries.size());
2241 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2242 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2243 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2244 enfVertex->faceEntries = faceEntryList;
2247 msg << "Enforced vertex: \n"
2248 << "Name: " << enfVertex->name << "\n";
2249 if (coords->length())
2250 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2251 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2252 << "Group Name: " << enfVertex->grpName;
2255 resultMap[i] = enfVertex;
2257 return resultMap._retn();
2262 * Returns the list of enforced vertices coords for a given Face entry.
2263 * They are the coords of the "manual" enforced vertices.
2264 * @return A map of Face entry / List of enforced vertices coords
2267 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2268 MESSAGE("IDL: GetAllCoordsByFace()");
2271 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2273 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2274 resultMap->length(entryCoordsListMap.size());
2275 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2277 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2278 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2279 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2280 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2281 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2282 MESSAGE("Face Entry: " << mapElement->faceEntry);
2284 _coordsList = it_entry->second;
2285 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2286 coordsList->length(_coordsList.size());
2287 MESSAGE("Number of coords: " << coordsList->length());
2289 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2290 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2291 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2292 coords->length((*it_coords).size());
2293 for (CORBA::ULong i=0;i<coords->length();i++)
2294 coords[i] = (*it_coords)[i];
2295 coordsList[j] = coords;
2296 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2298 mapElement->coordsList = coordsList;
2300 resultMap[i] = mapElement;
2303 return resultMap._retn();
2307 * Returns a map of enforced vertices coords / enforced vertex.
2308 * They are the coords of the "manual" enforced vertices.
2310 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2311 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2314 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2315 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2316 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2317 resultMap->length(coordsEnfVertexMap.size());
2318 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2320 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2321 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2322 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2323 MESSAGE("Enforced Vertex #" << i);
2324 currentEnfVertex = (it_coords->second);
2325 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2326 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2327 coords->length(it_coords->first.size());
2328 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2329 coords[ind] = it_coords->first[ind];
2330 mapElement->coords = coords;
2331 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2333 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2335 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2337 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2339 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2340 coords2->length(currentEnfVertex->coords.size());
2341 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2342 coords2[ind] = currentEnfVertex->coords[ind];
2343 enfVertex->coords = coords2;
2345 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2347 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2348 faceEntryList->length(currentEnfVertex->faceEntries.size());
2349 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2350 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2351 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2352 enfVertex->faceEntries = faceEntryList;
2354 mapElement->enfVertex = enfVertex;
2356 msg << "Enforced vertex: \n"
2357 << "Name: " << enfVertex->name << "\n";
2358 if (coords->length())
2359 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2360 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2361 << "Group Name: " << enfVertex->grpName;
2364 resultMap[i] = mapElement;
2366 return resultMap._retn();
2370 * Returns the list of enforced vertices entries for a given Face entry.
2371 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2372 * @return A map of Face entry / List of enforced vertices geom entries
2375 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2376 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2379 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2381 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2382 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2383 resultMap->length(entryEnfVertexEntryListMap.size());
2384 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2386 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2387 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2388 entryEnfVertexEntryListMap.begin();
2389 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2390 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2391 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2392 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2393 MESSAGE("Face Entry: " << mapElement->faceEntry);
2395 _enfVertexEntryList = it_entry->second;
2396 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2397 enfVertexEntryList->length(_enfVertexEntryList.size());
2398 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2400 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2401 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2402 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2403 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2405 mapElement->enfVertexEntryList = enfVertexEntryList;
2407 resultMap[i] = mapElement;
2410 return resultMap._retn();
2414 * Returns a map of enforced vertices geom entry / enforced vertex.
2415 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2417 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2418 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2421 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2422 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2423 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2424 resultMap->length(enfVertexEntryEnfVertexMap.size());
2425 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2427 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2428 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2429 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2430 MESSAGE("Enforced Vertex #" << i);
2431 currentEnfVertex = it_enfVertexEntry->second;
2432 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2433 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2434 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2436 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2438 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2440 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2442 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2443 coords->length(currentEnfVertex->coords.size());
2444 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2445 coords[ind] = currentEnfVertex->coords[ind];
2446 enfVertex->coords = coords;
2448 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2450 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2451 faceEntryList->length(currentEnfVertex->faceEntries.size());
2452 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2453 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2454 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2455 enfVertex->faceEntries = faceEntryList;
2458 msg << "Enforced vertex: \n"
2459 << "Name: " << enfVertex->name << "\n";
2460 if (coords->length())
2461 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2462 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2463 << "Group Name: " << enfVertex->grpName;
2466 mapElement->enfVertex = enfVertex;
2467 resultMap[i] = mapElement;
2469 return resultMap._retn();
2473 * Erase all enforced vertices
2475 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2477 this->GetImpl()->ClearAllEnforcedVertices();
2478 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2482 * Set/get/unset an enforced vertex on face
2484 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2485 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2488 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2489 MESSAGE("theFace shape type is not FACE or COMPOUND");
2490 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2493 string theFaceEntry = theFace->GetStudyEntry();
2495 if (theFaceEntry.empty()) {
2496 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2497 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2499 if (theFace->GetShapeType() == GEOM::FACE)
2501 if (theFace->GetShapeType() == GEOM::COMPOUND)
2502 aName = "Compound_";
2503 aName += theFace->GetEntry();
2504 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2505 if (!theSFace->_is_nil())
2506 theFaceEntry = theSFace->GetID();
2508 if (theFaceEntry.empty())
2509 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2510 MESSAGE("IDL : GetName : " << theFace->GetName());
2511 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2513 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2514 } catch (SALOME_Exception& ex) {
2515 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2520 * Set/get/unset an enforced vertex with name on face
2522 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2523 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2526 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2527 MESSAGE("theFace shape type is not FACE or COMPOUND");
2528 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2531 string theFaceEntry = theFace->GetStudyEntry();
2533 if (theFaceEntry.empty()) {
2534 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2535 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2537 if (theFace->GetShapeType() == GEOM::FACE)
2539 if (theFace->GetShapeType() == GEOM::COMPOUND)
2540 aName = "Compound_";
2541 aName += theFace->GetEntry();
2542 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2543 if (!theSFace->_is_nil())
2544 theFaceEntry = theSFace->GetID();
2546 if (theFaceEntry.empty())
2547 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2549 MESSAGE("IDL : GetName : " << theFace->GetName());
2550 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2552 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2553 } catch (SALOME_Exception& ex) {
2554 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2559 * Set/get/unset an enforced vertex with geom object on face
2561 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2562 throw (SALOME::SALOME_Exception) {
2565 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2566 MESSAGE("theFace shape type is not FACE or COMPOUND");
2567 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2570 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2571 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2572 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2575 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2576 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2577 // if (CORBA::is_nil(measureOp))
2580 // CORBA::Double x, y, z;
2582 // measureOp->PointCoordinates(theVertex, x, y, z);
2584 string theFaceEntry = theFace->GetStudyEntry();
2585 string theVertexEntry = theVertex->GetStudyEntry();
2587 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2588 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2591 if (theFaceEntry.empty()) {
2592 if (theFace->GetShapeType() == GEOM::FACE)
2594 if (theFace->GetShapeType() == GEOM::COMPOUND)
2595 aName = "Compound_";
2596 aName += theFace->GetEntry();
2597 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2598 if (!theSFace->_is_nil())
2599 theFaceEntry = theSFace->GetID();
2601 if (theFaceEntry.empty())
2602 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2604 if (theVertexEntry.empty()) {
2605 if (theVertex->GetShapeType() == GEOM::VERTEX)
2607 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2608 aName = "Compound_";
2609 aName += theVertex->GetEntry();
2610 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2611 if (!theSVertex->_is_nil())
2612 theVertexEntry = theSVertex->GetID();
2614 if (theVertexEntry.empty())
2615 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2617 string theVertexName = theVertex->GetName();
2618 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2619 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2620 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2622 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2623 } catch (SALOME_Exception& ex) {
2624 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2629 * Set an enforced vertex with group name on face
2631 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2632 throw (SALOME::SALOME_Exception)
2636 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2637 MESSAGE("theFace shape type is not FACE or COMPOUND");
2638 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2641 string theFaceEntry = theFace->GetStudyEntry();
2643 if (theFaceEntry.empty()) {
2644 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2645 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2647 if (theFace->GetShapeType() == GEOM::FACE)
2649 if (theFace->GetShapeType() == GEOM::COMPOUND)
2650 aName = "Compound_";
2651 aName += theFace->GetEntry();
2652 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2653 if (!theSFace->_is_nil())
2654 theFaceEntry = theSFace->GetID();
2656 if (theFaceEntry.empty())
2657 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2658 MESSAGE("IDL : GetName : " << theFace->GetName());
2659 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2661 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2662 } catch (SALOME_Exception& ex) {
2663 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2668 * Set an enforced vertex with name and group name on face
2670 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2671 const char* theVertexName, const char* theGroupName)
2672 throw (SALOME::SALOME_Exception)
2676 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2677 MESSAGE("theFace shape type is not FACE or COMPOUND");
2678 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2681 string theFaceEntry = theFace->GetStudyEntry();
2683 if (theFaceEntry.empty()) {
2684 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2685 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2687 if (theFace->GetShapeType() == GEOM::FACE)
2689 if (theFace->GetShapeType() == GEOM::COMPOUND)
2690 aName = "Compound_";
2691 aName += theFace->GetEntry();
2692 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2693 if (!theSFace->_is_nil())
2694 theFaceEntry = theSFace->GetID();
2696 if (theFaceEntry.empty())
2697 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2698 MESSAGE("IDL : GetName : " << theFace->GetName());
2699 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2701 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2702 } catch (SALOME_Exception& ex) {
2703 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2708 * Set an enforced vertex with geom entry and group name on face
2710 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2711 throw (SALOME::SALOME_Exception)
2715 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2716 MESSAGE("theFace shape type is not FACE or COMPOUND");
2717 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2720 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2721 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2722 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2725 string theFaceEntry = theFace->GetStudyEntry();
2726 string theVertexEntry = theVertex->GetStudyEntry();
2728 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2729 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2732 if (theFaceEntry.empty()) {
2733 if (theFace->GetShapeType() == GEOM::FACE)
2735 if (theFace->GetShapeType() == GEOM::COMPOUND)
2736 aName = "Compound_";
2737 aName += theFace->GetEntry();
2738 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2739 if (!theSFace->_is_nil())
2740 theFaceEntry = theSFace->GetID();
2742 if (theFaceEntry.empty())
2743 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2745 if (theVertexEntry.empty()) {
2746 if (theVertex->GetShapeType() == GEOM::VERTEX)
2748 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2749 aName = "Compound_";
2750 aName += theVertex->GetEntry();
2751 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2752 if (!theSVertex->_is_nil())
2753 theVertexEntry = theSVertex->GetID();
2755 if (theVertexEntry.empty())
2756 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2758 string theVertexName = theVertex->GetName();
2759 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2760 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2761 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2763 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2764 } catch (SALOME_Exception& ex) {
2765 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2769 //Enable internal enforced vertices on specific face if requested by user
2771 // * Are internal enforced vertices used for a face ?
2773 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2774 // throw (SALOME::SALOME_Exception) {
2775 // ASSERT(myBaseImpl);
2777 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2778 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2779 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2782 // string theFaceEntry = theFace->GetStudyEntry();
2784 // if (theFaceEntry.empty()) {
2785 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2786 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2788 // if (theFace->GetShapeType() == GEOM::FACE)
2790 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2791 // aName = "Compound_";
2792 // aName += theFace->GetEntry();
2793 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2794 // if (!theSFace->_is_nil())
2795 // theFaceEntry = theSFace->GetID();
2797 // if (theFaceEntry.empty())
2798 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2800 // MESSAGE("IDL : GetName : " << theFace->GetName());
2801 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2803 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2804 // } catch (SALOME_Exception& ex) {
2805 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2810 * Get the list of all enforced vertices
2812 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2813 throw (SALOME::SALOME_Exception) {
2816 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2817 MESSAGE("theFace shape type is not FACE or COMPOUND");
2818 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2821 string theFaceEntry = theFace->GetStudyEntry();
2823 if (theFaceEntry.empty()) {
2824 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2825 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2827 if (theFace->GetShapeType() == GEOM::FACE)
2829 if (theFace->GetShapeType() == GEOM::COMPOUND)
2830 aName = "Compound_";
2831 aName += theFace->GetEntry();
2832 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2833 if (!theSFace->_is_nil())
2834 theFaceEntry = theSFace->GetID();
2836 if (theFaceEntry.empty())
2837 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2839 MESSAGE("IDL : GetName : " << theFace->GetName());
2840 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2842 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2843 } catch (SALOME_Exception& ex) {
2844 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2848 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2849 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2852 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2853 MESSAGE("theFace shape type is not FACE or COMPOUND");
2854 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2857 string theFaceEntry = theFace->GetStudyEntry();
2859 if (theFaceEntry.empty()) {
2860 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2861 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2863 if (theFace->GetShapeType() == GEOM::FACE)
2865 if (theFace->GetShapeType() == GEOM::COMPOUND)
2866 aName = "Compound_";
2867 aName += theFace->GetEntry();
2868 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2869 if (!theSFace->_is_nil())
2870 theFaceEntry = theSFace->GetID();
2872 if (theFaceEntry.empty())
2873 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2874 MESSAGE("IDL : GetName : " << theFace->GetName());
2875 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2878 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2879 } catch (SALOME_Exception& ex) {
2880 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2884 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2885 throw (SALOME::SALOME_Exception) {
2888 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2889 MESSAGE("theFace shape type is not FACE or COMPOUND");
2890 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2892 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2893 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2894 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2897 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2898 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2899 // if (CORBA::is_nil(measureOp))
2902 // CORBA::Double x, y, z;
2904 // measureOp->PointCoordinates(theVertex, x, y, z);
2906 std::string theFaceEntry = theFace->GetStudyEntry();
2907 std::string theVertexEntry = theVertex->GetStudyEntry();
2909 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2910 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2913 if (theFaceEntry.empty()) {
2914 if (theFace->GetShapeType() == GEOM::FACE)
2916 if (theFace->GetShapeType() == GEOM::COMPOUND)
2917 aName = "Compound_";
2918 aName += theFace->GetEntry();
2919 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2920 if (!theSFace->_is_nil())
2921 theFaceEntry = theSFace->GetID();
2923 if (theFaceEntry.empty())
2924 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2926 if (theVertexEntry.empty()) {
2927 if (theVertex->GetShapeType() == GEOM::VERTEX)
2929 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2930 aName = "Compound_";
2931 aName += theVertex->GetEntry();
2932 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2933 if (!theSVertex->_is_nil())
2934 theVertexEntry = theSVertex->GetID();
2936 if (theVertexEntry.empty())
2937 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2939 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2942 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2943 } catch (SALOME_Exception& ex) {
2944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2948 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2951 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2952 MESSAGE("theFace shape type is not FACE or COMPOUND");
2953 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2956 string theFaceEntry = theFace->GetStudyEntry();
2958 if (theFaceEntry.empty()) {
2959 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2960 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2962 if (theFace->GetShapeType() == GEOM::FACE)
2964 if (theFace->GetShapeType() == GEOM::COMPOUND)
2965 aName = "Compound_";
2966 aName += theFace->GetEntry();
2967 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2968 if (!theSFace->_is_nil())
2969 theFaceEntry = theSFace->GetID();
2971 if (theFaceEntry.empty())
2972 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2974 MESSAGE("IDL : GetName : " << theFace->GetName());
2975 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2978 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2979 } catch (SALOME_Exception& ex) {
2980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2985 * Set/get/unset an enforced vertex on geom object given by entry
2987 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2988 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2989 throw (SALOME::SALOME_Exception) {
2991 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2992 bool newValue = false;
2993 if (string(theVertexEntry).empty()) {
2995 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2996 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2997 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2998 coords.push_back(x);
2999 coords.push_back(y);
3000 coords.push_back(z);
3001 if (coordsList.find(coords) == coordsList.end()) {
3002 MESSAGE("Coords not found: add it in coordsList");
3005 MESSAGE("Coords already found, compare names");
3006 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3007 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3008 MESSAGE("The names are different: update");
3009 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
3013 MESSAGE("The names are identical");
3016 } catch (const std::invalid_argument& ex) {
3017 // no enforced vertex for entry
3018 MESSAGE("Face entry not found : add it to the list");
3022 if (string(theVertexName).empty()) {
3023 if (string(theGroupName).empty())
3024 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
3026 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3029 if (string(theGroupName).empty())
3030 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3032 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
3033 << theVertexName << "\", \"" << theGroupName << "\")";
3038 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3039 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3040 if ( it == enfVertexEntryList.end()) {
3041 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
3045 MESSAGE("Geom entry already found, compare names");
3046 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3047 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3048 MESSAGE("The names are different: update");
3049 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
3053 MESSAGE("The names are identical");
3056 } catch (const std::invalid_argument& ex) {
3057 // no enforced vertex for entry
3058 MESSAGE("Face entry not found : add it to the list");
3062 if (string(theGroupName).empty())
3063 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3065 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
3070 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3072 MESSAGE("IDL : SetEnforcedVertexEntry END");
3076 //Enable internal enforced vertices on specific face if requested by user
3077 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
3078 // throw (SALOME::SALOME_Exception) {
3079 // ASSERT(myBaseImpl);
3081 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
3082 // } catch (const std::exception& ex) {
3083 // std::cout << "Exception: " << ex.what() << std::endl;
3084 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3088 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3089 throw (SALOME::SALOME_Exception) {
3091 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
3094 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3095 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3096 vertexList->length(_vList.size());
3097 MESSAGE("Number of enforced vertices: " << vertexList->length());
3098 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3099 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3100 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3102 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3105 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3106 // Geom Vertex Entry
3107 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3109 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3110 coords->length(_enfVertex->coords.size());
3111 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3112 coords[ind] = _enfVertex->coords[ind];
3113 enfVertex->coords = coords;
3115 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3117 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3118 faceEntryList->length(_enfVertex->faceEntries.size());
3119 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3120 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3121 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3122 enfVertex->faceEntries = faceEntryList;
3124 vertexList[i] = enfVertex;
3126 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3127 return vertexList._retn();
3128 } catch (const std::invalid_argument& ex) {
3129 SALOME::ExceptionStruct ExDescription;
3130 ExDescription.text = ex.what();
3131 ExDescription.type = SALOME::BAD_PARAM;
3132 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3133 ExDescription.lineNumber = 1385;
3134 throw SALOME::SALOME_Exception(ExDescription);
3135 } catch (const std::exception& ex) {
3136 std::cout << "Exception: " << ex.what() << std::endl;
3137 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3141 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
3142 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
3144 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
3148 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3150 if (string(theVertexEntry).empty())
3151 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
3154 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3156 } catch (const std::invalid_argument& ex) {
3158 } catch (const std::exception& ex) {
3159 std::cout << "Exception: " << ex.what() << std::endl;
3160 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3163 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3167 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
3168 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
3169 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
3171 // bool ret = false;
3174 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
3175 // } catch (SALOME_Exception& ex) {
3176 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3180 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
3183 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
3187 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
3189 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
3192 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3193 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
3194 } catch (const std::invalid_argument& ex) {
3196 } catch (const std::exception& ex) {
3197 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3200 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
3204 //=============================================================================
3206 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3210 //=============================================================================
3211 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
3212 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
3214 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3215 std::string theValueStr = theValue ? "True" : "False";
3216 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3219 //=============================================================================
3221 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3225 //=============================================================================
3226 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
3227 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
3229 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3232 //=============================================================================
3234 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3238 //=============================================================================
3239 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
3240 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
3242 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3243 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3246 //=============================================================================
3248 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3252 //=============================================================================
3253 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
3254 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
3256 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3260 * Enable internal enforced vertices on specific face if requested by user
3262 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3263 throw (SALOME::SALOME_Exception)
3265 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3267 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3268 } catch (SALOME_Exception& ex) {
3269 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3273 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3274 throw (SALOME::SALOME_Exception)
3276 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3278 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3279 MESSAGE("theFace shape type is not FACE or COMPOUND");
3280 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3283 string theFaceEntry = theFace->GetStudyEntry();
3285 if (theFaceEntry.empty()) {
3286 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3287 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3289 if (theFace->GetShapeType() == GEOM::FACE)
3291 if (theFace->GetShapeType() == GEOM::COMPOUND)
3292 aName = "Compound_";
3293 aName += theFace->GetEntry();
3294 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3295 if (!theSFace->_is_nil())
3296 theFaceEntry = theSFace->GetID();
3298 if (theFaceEntry.empty())
3299 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3301 MESSAGE("IDL : GetName : " << theFace->GetName());
3302 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3304 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3305 } catch (SALOME_Exception& ex) {
3306 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3310 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3311 throw (SALOME::SALOME_Exception)
3313 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3316 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3317 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3318 if (string(theGroupName).empty())
3319 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3321 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3322 } catch (const std::exception& ex) {
3323 std::cout << "Exception: " << ex.what() << std::endl;
3324 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3331 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3332 throw (SALOME::SALOME_Exception)
3335 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3337 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3339 catch (const std::invalid_argument& ex) {
3340 SALOME::ExceptionStruct ExDescription;
3341 ExDescription.text = ex.what();
3342 ExDescription.type = SALOME::BAD_PARAM;
3343 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3344 ExDescription.lineNumber = 1146;
3345 throw SALOME::SALOME_Exception(ExDescription);
3347 catch (SALOME_Exception& ex) {
3348 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3350 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3355 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3356 throw (SALOME::SALOME_Exception)
3359 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3361 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3363 catch (const std::invalid_argument& ex) {
3364 SALOME::ExceptionStruct ExDescription;
3365 ExDescription.text = ex.what();
3366 ExDescription.type = SALOME::BAD_PARAM;
3367 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3368 ExDescription.lineNumber = 1170;
3369 throw SALOME::SALOME_Exception(ExDescription);
3371 catch (SALOME_Exception& ex) {
3372 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3375 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3376 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3378 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3381 ///////////////////////
3383 ///////////////////////
3385 ///////////////////////
3388 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3390 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3391 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3392 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3393 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3394 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3395 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3396 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3397 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3398 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3399 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3400 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3401 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3402 return txtShapeType;
3405 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3407 // Check shape types
3409 std::stringstream typesTxt;
3410 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3412 GEOM::shape_type theShapeType = theShapeTypes[i];
3413 if (shape->GetShapeType() == theShapeType)
3415 typesTxt << ShapeTypeToString(theShapeType);
3416 if (i < theShapeTypes.size()-1 )
3420 std::stringstream msg;
3421 msg << "shape shape type is not in" << typesTxt.str();
3423 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3427 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3430 if (shape->GetShapeType() != theShapeType) {
3431 std::stringstream msg;
3432 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3434 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3438 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3440 // Check shape is published in the object browser
3441 string shapeEntry = shape->GetStudyEntry();
3443 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3444 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3447 // Publish shape if needed
3448 if (shapeEntry.empty()) {
3449 if (shape->GetShapeType() == theShapeType)
3451 aName += shape->GetEntry();
3452 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3453 if (!theSFace1->_is_nil())
3454 shapeEntry = theSFace1->GetID();
3456 if (shapeEntry.empty())
3457 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3461 // Format the output of two vectors to use it in MESSAGE and PythonDump
3462 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3464 std::stringstream listEntriesTxt;
3466 if (!theSourceVerticesEntries.empty())
3468 listEntriesTxt << ", [" ;
3470 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3473 listEntriesTxt << ", ";
3474 listEntriesTxt << *it;
3477 listEntriesTxt << "], [" ;
3479 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3482 listEntriesTxt << ", ";
3483 listEntriesTxt << *it;
3485 listEntriesTxt << "]" ;
3487 return listEntriesTxt.str();
3491 * Erase all PreCad periodicity associations
3493 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3495 this->GetImpl()->ClearPreCadPeriodicityVectors();
3496 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3499 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3501 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3502 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3503 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3505 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3507 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3508 return periodicityList._retn();
3511 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3513 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3514 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3515 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3517 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3519 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3520 return periodicityList._retn();
3523 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3524 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3526 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3527 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3529 periodicityList->length(preCadPeriodicityVector.size());
3531 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3533 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3535 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3536 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3537 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3539 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3540 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3542 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3543 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3544 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3547 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3549 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3550 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3552 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3553 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3554 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3557 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3559 periodicityList[i] = myPreCadPeriodicity;
3563 return periodicityList._retn();
3567 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3568 throw (SALOME::SALOME_Exception)
3571 const GEOM::ListOfGO theSourceVertices;
3572 const GEOM::ListOfGO theTargetVertices;
3573 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3577 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3578 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3579 throw (SALOME::SALOME_Exception)
3582 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3584 size_t theLength = theSourceVertices.length();
3585 if (theLength != theTargetVertices.length())
3586 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3588 std::vector<GEOM::shape_type> allowedShapeTypes;
3589 allowedShapeTypes.push_back(GEOM::FACE);
3590 allowedShapeTypes.push_back(GEOM::COMPOUND);
3592 string prefix1 = "Source_face_";
3593 CheckShapeTypes(theFace1, allowedShapeTypes);
3594 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3596 string prefix2 = "Target_face_";
3597 CheckShapeTypes(theFace2, allowedShapeTypes);
3598 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3600 string prefix3 = "Source_vertex_";
3601 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3602 theSourceVerticesEntries->length(theLength);
3603 GEOM::GEOM_Object_ptr theVtx_i;
3605 for (size_t ind = 0; ind < theLength; ind++) {
3606 theVtx_i = theSourceVertices[ind];
3607 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3608 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3611 string prefix4 = "Target_vertex_";
3612 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3613 theTargetVerticesEntries->length(theLength);
3614 for (size_t ind = 0; ind < theLength; ind++) {
3615 theVtx_i = theTargetVertices[ind];
3616 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3617 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3620 string theFace2Name = theFace2->GetName();
3621 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3622 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3623 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3625 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3626 theSourceVerticesEntries, theTargetVerticesEntries);
3627 } catch (SALOME_Exception& ex) {
3628 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3633 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3634 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3635 throw (SALOME::SALOME_Exception)
3640 // Convert BLSURFPlugin::TEntryList to vector<string>
3641 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3642 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3643 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3644 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3647 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3649 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3651 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3652 theSourceVerticesEntries, theTargetVerticesEntries);
3654 SMESH::TPythonDump pd;
3655 if (!theSourceVerticesEntries.empty())
3657 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3658 pd << listEntriesTxt.c_str();
3662 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3663 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3666 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3667 throw (SALOME::SALOME_Exception)
3670 const GEOM::ListOfGO theSourceVertices;
3671 const GEOM::ListOfGO theTargetVertices;
3672 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3675 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3676 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3677 throw (SALOME::SALOME_Exception)
3679 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3682 size_t theLength = theSourceVertices.length();
3683 if (theLength != theTargetVertices.length())
3684 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3686 std::vector<GEOM::shape_type> allowedShapeTypes;
3687 allowedShapeTypes.push_back(GEOM::EDGE);
3688 allowedShapeTypes.push_back(GEOM::COMPOUND);
3690 string prefix1 = "Source_edge_";
3691 CheckShapeTypes(theEdge1, allowedShapeTypes);
3692 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3694 string prefix2 = "Target_edge_";
3695 CheckShapeTypes(theEdge2, allowedShapeTypes);
3696 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3698 string prefix3 = "Source_vertex_";
3699 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3700 theSourceVerticesEntries->length(theLength);
3701 GEOM::GEOM_Object_ptr theVtx_i;
3703 for (size_t ind = 0; ind < theLength; ind++) {
3704 theVtx_i = theSourceVertices[ind];
3705 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3706 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3709 string prefix4 = "Target_vertex_";
3710 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3711 theTargetVerticesEntries->length(theLength);
3712 for (size_t ind = 0; ind < theLength; ind++) {
3713 theVtx_i = theTargetVertices[ind];
3714 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3715 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3718 string theEdge2Name = theEdge2->GetName();
3719 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3720 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3721 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3723 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3724 theSourceVerticesEntries, theTargetVerticesEntries);
3725 } catch (SALOME_Exception& ex) {
3726 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3731 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3732 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3733 throw (SALOME::SALOME_Exception)
3738 // Convert BLSURFPlugin::TEntryList to vector<string>
3739 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3740 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3741 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3742 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3745 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3747 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3748 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3749 theSourceVerticesEntries, theTargetVerticesEntries);
3751 SMESH::TPythonDump pd;
3752 if (!theSourceVerticesEntries.empty())
3754 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3755 pd << listEntriesTxt.c_str();
3759 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3761 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3765 //================================================================================
3767 * \brief Sets the file for export resulting mesh in GMF format
3768 * \param theFileName - full name of the file (.mesh, .meshb)
3770 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3772 //================================================================================
3773 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3774 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3776 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3777 bool valueChanged/*, modeChanged*/ = false;
3779 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3780 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3781 if (valueChanged)// or (!valueChanged && modeChanged))
3782 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3783 } catch (const std::exception& ex) {
3784 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3786 if (valueChanged)// or (!valueChanged && modeChanged))
3787 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3788 MESSAGE("IDL : SetGMFFile END ");
3791 //================================================================================
3793 * \brief Gets the file name for export resulting mesh in GMF format
3794 * \retval char* - The file name
3796 * Returns the GMF file name
3798 //================================================================================
3799 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3801 // MESSAGE("IDL : GetGMFFile()");
3802 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3805 // //================================================================================
3807 // * \brief Gets the file mode for export resulting mesh in GMF format
3808 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3810 // * Returns the GMF file mode
3812 // //================================================================================
3813 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3814 // ASSERT(myBaseImpl);
3815 // MESSAGE("IDL : GetGMFFileMode()");
3816 // return this->GetImpl()->GetGMFFileMode();
3819 //=============================================================================
3821 * BLSURFPlugin_Hypothesis_i::GetImpl
3823 * Get implementation
3825 //=============================================================================
3826 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3827 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3828 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3831 //================================================================================
3833 * \brief Verify whether hypothesis supports given entity type
3834 * \param type - dimension (see SMESH::Dimension enumeration)
3835 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3837 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3839 //================================================================================
3840 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3841 return type == SMESH::DIM_2D;
3845 // Obsolete methods - To be removed in V7
3848 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3849 this->SetMinSize(theMinSize);
3851 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3852 return this->GetMinSize();
3854 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3855 this->SetMaxSize(theMaxSize);
3857 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3858 return this->GetMaxSize();
3860 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3861 this->SetMinSize(theMinSize);
3863 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3864 return this->GetMinSize();
3866 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3867 this->SetMaxSize(theMaxSize);
3869 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3870 return this->GetMaxSize();
3872 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3873 this->SetAngleMesh(theValue);
3875 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3876 return this->GetAngleMesh();
3878 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3879 this->SetAngleMesh(theValue);
3881 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3882 return this->GetAngleMesh();
3884 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3885 std::string theValueStr = theValue ? "1" : "0";
3886 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3888 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3889 std::string theValueStr = this->GetOptionValue("respect_geometry");
3890 if (theValueStr.empty() || theValueStr == "respect")
3894 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3895 std::string theValueStr = theValue ? "1" : "0";
3896 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3898 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3899 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3900 if (theValueStr == "1")
3904 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3905 std::ostringstream theValueStr;
3906 theValueStr << theValue;
3907 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3909 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3910 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3912 theValueStr >> result;