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>
31 #include <SMESHGUI_Utils.h>
33 #include <SALOMEDS_wrap.hxx>
34 #include <Utils_CorbaException.hxx>
35 #include <utilities.h>
39 #include <boost/regex.hpp>
43 //=============================================================================
45 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
49 //=============================================================================
50 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
51 ::SMESH_Gen* theGenImpl) :
52 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
53 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
54 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
57 //=============================================================================
59 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
63 //=============================================================================
64 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
65 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
68 //=============================================================================
70 //=============================================================================
72 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
77 //=============================================================================
78 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
79 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
81 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
82 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
85 //=============================================================================
87 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
91 //=============================================================================
92 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
93 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
95 return this->GetImpl()->GetPhysicalMesh();
98 //=============================================================================
100 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
105 //=============================================================================
106 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
107 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
109 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
110 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
113 //=============================================================================
115 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
119 //=============================================================================
120 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
121 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
123 return this->GetImpl()->GetGeometricMesh();
126 //=============================================================================
128 * BLSURFPlugin_Hypothesis_i::SetPhySize
132 //=============================================================================
133 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
134 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
136 this->GetImpl()->SetPhySize(theValue, false);
137 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
140 //=============================================================================
142 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
144 * Set Relative PhySize
146 //=============================================================================
147 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
148 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
150 this->GetImpl()->SetPhySize(theValue, true);
151 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
154 //=============================================================================
156 * BLSURFPlugin_Hypothesis_i::GetPhySize
160 //=============================================================================
161 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
162 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
164 return this->GetImpl()->GetPhySize();
167 //=============================================================================
169 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
171 * Returns True if PhySize is relative
173 //=============================================================================
174 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
175 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
177 return this->GetImpl()->IsPhySizeRel();
180 //=============================================================================
181 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
183 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
184 this->GetImpl()->SetMinSize(theMinSize, false);
185 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
189 //=============================================================================
190 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
192 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
193 this->GetImpl()->SetMinSize(theMinSize, true);
194 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
198 //=============================================================================
199 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
201 return this->GetImpl()->GetMinSize();
204 //=============================================================================
205 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
206 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
208 return this->GetImpl()->IsMinSizeRel();
211 //=============================================================================
212 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
214 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
215 this->GetImpl()->SetMaxSize(theMaxSize, false);
216 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
220 //=============================================================================
221 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
223 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
224 this->GetImpl()->SetMaxSize(theMaxSize, true);
225 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
229 //=============================================================================
230 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
232 return this->GetImpl()->GetMaxSize();
235 //=============================================================================
236 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
237 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
239 return this->GetImpl()->IsMaxSizeRel();
243 //=============================================================================
245 * BLSURFPlugin_Hypothesis_i::SetUseGradation
249 //=============================================================================
250 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
251 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
253 this->GetImpl()->SetUseGradation(theValue);
254 std::string theValueStr = theValue ? "True" : "False";
255 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
258 //=============================================================================
260 * BLSURFPlugin_Hypothesis_i::GetUseGradation
264 //=============================================================================
265 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
266 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
268 return this->GetImpl()->GetUseGradation();
271 //=============================================================================
273 * BLSURFPlugin_Hypothesis_i::SetGradation
277 //=============================================================================
278 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
279 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
281 this->GetImpl()->SetGradation(theValue);
282 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
285 //=============================================================================
287 * BLSURFPlugin_Hypothesis_i::GetGradation
291 //=============================================================================
292 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
293 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
295 return this->GetImpl()->GetGradation();
298 //=============================================================================
300 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
304 //=============================================================================
305 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
306 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
308 this->GetImpl()->SetUseVolumeGradation(theValue);
309 std::string theValueStr = theValue ? "True" : "False";
310 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
313 //=============================================================================
315 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
319 //=============================================================================
320 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
321 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
323 return this->GetImpl()->GetUseVolumeGradation();
326 //=============================================================================
328 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
330 * Set VolumeGradation
332 //=============================================================================
333 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
334 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
336 this->GetImpl()->SetVolumeGradation(theValue);
337 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
340 //=============================================================================
342 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
344 * Get VolumeGradation
346 //=============================================================================
347 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
348 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
350 return this->GetImpl()->GetVolumeGradation();
353 //=============================================================================
355 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
359 //=============================================================================
360 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
361 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
363 this->GetImpl()->SetQuadAllowed(theValue);
364 std::string theValueStr = theValue ? "True" : "False";
365 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
368 //=============================================================================
370 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
374 //=============================================================================
375 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
376 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
378 return this->GetImpl()->GetQuadAllowed();
381 //=============================================================================
383 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
387 //=============================================================================
388 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
389 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
391 this->GetImpl()->SetAngleMesh(theValue);
392 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
395 //=============================================================================
397 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
401 //=============================================================================
402 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
403 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
405 return this->GetImpl()->GetAngleMesh();
408 //=============================================================================
410 * BLSURFPlugin_Hypothesis_i::SetChordalError
414 //=============================================================================
415 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
416 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
418 this->GetImpl()->SetChordalError(theValue);
419 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
422 //=============================================================================
424 * BLSURFPlugin_Hypothesis_i::GetChordalError
428 //=============================================================================
429 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
430 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
432 return this->GetImpl()->GetChordalError();
435 //=============================================================================
437 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
441 //=============================================================================
442 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
443 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
445 this->GetImpl()->SetAnisotropic(theValue);
446 std::string theValueStr = theValue ? "True" : "False";
447 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
450 //=============================================================================
452 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
456 //=============================================================================
457 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
458 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
460 return this->GetImpl()->GetAnisotropic();
463 //=============================================================================
465 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
467 * Set Anisotropic Ratio
469 //=============================================================================
470 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
471 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
473 this->GetImpl()->SetAnisotropicRatio(theValue);
474 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
477 //=============================================================================
479 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
481 * Get Anisotropic Ratio
483 //=============================================================================
484 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
485 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
487 return this->GetImpl()->GetAnisotropicRatio();
491 //=============================================================================
493 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
497 //=============================================================================
498 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
499 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
501 this->GetImpl()->SetRemoveTinyEdges(theValue);
502 std::string theValueStr = theValue ? "True" : "False";
503 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
506 //=============================================================================
508 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
512 //=============================================================================
513 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
514 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
516 return this->GetImpl()->GetRemoveTinyEdges();
519 //=============================================================================
521 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
523 * Set Tiny Edge Length
525 //=============================================================================
526 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
527 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
529 this->GetImpl()->SetTinyEdgeLength(theValue);
530 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
533 //=============================================================================
535 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
537 * Get Tiny Edge Length
539 //=============================================================================
540 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
541 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
543 return this->GetImpl()->GetTinyEdgeLength();
546 //=============================================================================
548 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
552 //=============================================================================
553 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
554 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
556 this->GetImpl()->SetOptimiseTinyEdges(theValue);
557 std::string theValueStr = theValue ? "True" : "False";
558 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
561 //=============================================================================
563 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
567 //=============================================================================
568 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
569 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
571 return this->GetImpl()->GetOptimiseTinyEdges();
574 //=============================================================================
576 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
578 * Set Tiny Edge OptimisationLength
580 //=============================================================================
581 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
582 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
584 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
585 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
588 //=============================================================================
590 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
592 * Get Tiny Edge OptimisationLength
594 //=============================================================================
595 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
596 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
598 return this->GetImpl()->GetTinyEdgeOptimisationLength();
601 //=============================================================================
603 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
607 //=============================================================================
608 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
609 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
611 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
612 std::string theValueStr = theValue ? "True" : "False";
613 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
616 //=============================================================================
618 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
622 //=============================================================================
623 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
624 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
626 return this->GetImpl()->GetCorrectSurfaceIntersection();
629 //=============================================================================
631 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
633 * Set Tiny Edge OptimisationLength
635 //=============================================================================
636 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
637 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
639 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
640 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
643 //=============================================================================
645 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
647 * Get Tiny Edge OptimisationLength
649 //=============================================================================
650 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
651 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
653 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
656 //=============================================================================
658 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
662 //=============================================================================
663 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
664 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
666 this->GetImpl()->SetBadElementRemoval(theValue);
667 std::string theValueStr = theValue ? "True" : "False";
668 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
671 //=============================================================================
673 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
679 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
681 return this->GetImpl()->GetBadElementRemoval();
684 //=============================================================================
686 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
688 * Set Bad Surface Element Aspect Ratio
690 //=============================================================================
691 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
692 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
694 this->GetImpl()->SetBadElementAspectRatio(theValue);
695 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
698 //=============================================================================
700 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
702 * Get Bad Surface Element Aspect Ratio
704 //=============================================================================
705 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
706 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
708 return this->GetImpl()->GetBadElementAspectRatio();
711 //=============================================================================
713 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
717 //=============================================================================
718 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
719 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
721 this->GetImpl()->SetOptimizeMesh(theValue);
722 std::string theValueStr = theValue ? "True" : "False";
723 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
726 //=============================================================================
728 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
732 //=============================================================================
733 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
734 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
736 return this->GetImpl()->GetOptimizeMesh();
739 //=============================================================================
741 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
745 //=============================================================================
746 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
747 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
749 this->GetImpl()->SetQuadraticMesh(theValue);
750 std::string theValueStr = theValue ? "True" : "False";
751 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
754 //=============================================================================
756 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
760 //=============================================================================
761 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
762 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
764 return this->GetImpl()->GetQuadraticMesh();
772 * BLSURFPlugin_Hypothesis_i::SetTopology
777 //=============================================================================
778 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
779 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
781 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
782 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
785 //=============================================================================
787 * BLSURFPlugin_Hypothesis_i::GetTopology
791 //=============================================================================
792 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
793 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
795 return this->GetImpl()->GetTopology();
798 //=============================================================================
799 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
801 if (theVal < 0 || theVal > 100)
802 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
803 this->GetImpl()->SetVerbosity(theVal);
804 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
807 //=============================================================================
809 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
811 return (CORBA::Short) this->GetImpl()->GetVerbosity();
814 //=============================================================================
815 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
817 if ( GetEnforceCadEdgesSize() != toEnforce )
819 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
820 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
823 //=============================================================================
824 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
826 return this->GetImpl()->GetEnforceCadEdgesSize();
828 //=============================================================================
830 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
832 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
834 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
835 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
838 //=============================================================================
839 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
841 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
843 //=============================================================================
845 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
847 if ( GetJacobianRectification() != allowRectification )
849 this->GetImpl()->SetJacobianRectification(allowRectification);
850 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
853 //=============================================================================
854 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
856 return this->GetImpl()->GetJacobianRectification();
858 //=============================================================================
860 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
862 if ( GetMaxNumberOfPointsPerPatch() != nb )
865 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
867 } catch (const std::invalid_argument& ex) {
868 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
869 } catch (SALOME_Exception& ex) {
870 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
872 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
875 //=============================================================================
876 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
878 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
880 //=============================================================================
882 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
884 if ( GetRespectGeometry() != toRespect )
886 this->GetImpl()->SetRespectGeometry(toRespect);
887 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
890 //=============================================================================
891 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
893 return this->GetImpl()->GetRespectGeometry();
895 //=============================================================================
897 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
899 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
901 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
902 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
905 //=============================================================================
906 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
908 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
910 //=============================================================================
912 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
914 if ( GetClosedGeometry() != isClosed )
916 this->GetImpl()->SetClosedGeometry(isClosed);
917 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
920 //=============================================================================
921 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
923 return this->GetImpl()->GetClosedGeometry();
925 //=============================================================================
927 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
929 if ( GetDebug() != isDebug )
931 this->GetImpl()->SetDebug(isDebug);
932 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
935 //=============================================================================
936 bool BLSURFPlugin_Hypothesis_i::GetDebug()
938 return this->GetImpl()->GetDebug();
940 //=============================================================================
942 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
944 if ( SMESH::toStdStr( GetPreCADOptionValue("periodic_tolerance")) != SMESH_Comment( tol ))
948 this->GetImpl()->SetPeriodicTolerance(tol);
950 } catch (const std::invalid_argument& ex) {
951 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
952 } catch (SALOME_Exception& ex) {
953 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
955 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
958 //=============================================================================
959 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
962 return this->GetImpl()->GetPeriodicTolerance();
964 } catch (const std::invalid_argument& ex) {
965 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
966 } catch (SALOME_Exception& ex) {
967 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
971 //=============================================================================
973 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
975 if ( GetImpl()->GetRequiredEntities() != howToTreat )
978 this->GetImpl()->SetRequiredEntities(howToTreat);
980 } catch (const std::invalid_argument& ex) {
981 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
982 } catch (SALOME_Exception& ex) {
983 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
985 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
988 //=============================================================================
989 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
991 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
993 //=============================================================================
995 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
997 if ( SMESH::toStdStr( GetPreCADOptionValue("sewing_tolerance")) != SMESH_Comment( tol ))
1001 this->GetImpl()->SetSewingTolerance(tol);
1002 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1004 } catch (const std::invalid_argument& ex) {
1005 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1006 } catch (SALOME_Exception& ex) {
1007 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1011 //=============================================================================
1012 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1016 return this->GetImpl()->GetSewingTolerance();
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 //=============================================================================
1027 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1029 if ( GetImpl()->GetTags() != howToTreat )
1032 this->GetImpl()->SetTags(howToTreat);
1034 catch (const std::invalid_argument& ex) {
1035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1036 } catch (SALOME_Exception& ex) {
1037 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1040 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1042 //=============================================================================
1043 char* BLSURFPlugin_Hypothesis_i::GetTags()
1045 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1048 //=============================================================================
1050 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1054 //=============================================================================
1055 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1056 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
1058 this->GetImpl()->SetPreCADMergeEdges(theValue);
1059 std::string theValueStr = theValue ? "True" : "False";
1060 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1063 //=============================================================================
1065 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1069 //=============================================================================
1070 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1071 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
1073 return this->GetImpl()->GetPreCADMergeEdges();
1076 //=============================================================================
1078 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
1082 //=============================================================================
1083 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1084 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1086 this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1087 std::string theValueStr = theValue ? "True" : "False";
1088 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1091 //=============================================================================
1093 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1097 //=============================================================================
1098 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1099 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1101 return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1104 //=============================================================================
1106 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1110 //=============================================================================
1111 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1112 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1114 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1115 std::string theValueStr = theValue ? "True" : "False";
1116 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1119 //=============================================================================
1121 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1125 //=============================================================================
1126 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1127 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1129 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1132 //=============================================================================
1134 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1138 //=============================================================================
1139 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1140 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1142 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1143 std::string theValueStr = theValue ? "True" : "False";
1144 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1147 //=============================================================================
1149 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1153 //=============================================================================
1154 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1155 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1157 return this->GetImpl()->GetPreCADProcess3DTopology();
1160 //=============================================================================
1162 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1166 //=============================================================================
1167 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1168 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1170 this->GetImpl()->SetPreCADDiscardInput(theValue);
1171 std::string theValueStr = theValue ? "True" : "False";
1172 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1175 //=============================================================================
1177 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1181 //=============================================================================
1182 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1183 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1185 return this->GetImpl()->GetPreCADDiscardInput();
1189 //=============================================================================
1191 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1192 throw (SALOME::SALOME_Exception) {
1195 std::string name( optionName );
1196 if ( !optionValue || !optionValue[0] )
1197 UnsetOption( optionName );
1199 // basic options (visible in Advanced table)
1201 else if ( name == "enforce_cad_edge_sizes" )
1202 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1204 else if ( name == "jacobian_rectification_respect_geometry" )
1205 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1207 else if ( name == "max_number_of_points_per_patch" )
1208 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1210 else if ( name == "rectify_jacobian" )
1211 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1213 else if ( name == "respect_geometry" )
1214 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1216 else if ( name == "tiny_edge_avoid_surface_intersections" )
1217 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1219 else if ( name == "closed_geometry" )
1220 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1222 else if ( name == "debug" )
1223 SetDebug( GetImpl()->ToBool( optionValue ));
1225 else if ( name == "discard_input_topology" )
1226 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1228 else if ( name == "merge_edges" )
1229 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1231 else if ( name == "periodic_tolerance" )
1232 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1234 else if ( name == "remove_duplicate_cad_faces" )
1235 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1237 else if ( name == "required_entities" )
1238 SetRequiredEntities( optionValue );
1240 else if ( name == "sewing_tolerance" )
1241 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1243 else if ( name == "tags" )
1244 SetTags( optionValue );
1246 // other basic options with specific methods
1248 else if ( name == "correct_surface_intersections" )
1249 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1251 else if ( name == "optimise_tiny_edges" )
1252 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1254 else if ( name == "surface_intersections_processing_max_cost" )
1255 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1257 else if ( name == "volume_gradation" )
1258 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1260 else if ( name == "tiny_edge_optimisation_length" )
1261 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1263 // advanced options (for backward compatibility)
1265 else if ( name == "create_tag_on_collision" ||
1266 name == "tiny_edge_respect_geometry" )
1267 AddOption( optionName, optionValue );
1271 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1272 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1275 this->GetImpl()->SetOptionValue(optionName, optionValue);
1276 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1279 } catch (const std::invalid_argument& ex) {
1280 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1281 } catch (SALOME_Exception& ex) {
1282 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1286 //=============================================================================
1288 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1289 throw (SALOME::SALOME_Exception) {
1291 bool valueChanged = false;
1293 std::string name( optionName );
1294 if ( !optionValue || !optionValue[0] )
1295 UnsetOption( optionName );
1297 else if ( name == "closed_geometry" )
1298 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1300 else if ( name == "debug" )
1301 SetDebug( GetImpl()->ToBool( optionValue ));
1303 else if ( name == "discard_input_topology" )
1304 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1306 else if ( name == "merge_edges" )
1307 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1309 else if ( name == "periodic_tolerance" )
1310 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1312 else if ( name == "remove_duplicate_cad_faces" )
1313 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1315 else if ( name == "required_entities" )
1316 SetRequiredEntities( optionValue );
1318 else if ( name == "sewing_tolerance" )
1319 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1321 else if ( name == "tags" )
1322 SetTags( optionValue );
1324 // other basic options with specific methods
1326 else if ( name == "correct_surface_intersections" )
1327 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1329 else if ( name == "optimise_tiny_edges" )
1330 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1332 else if ( name == "surface_intersections_processing_max_cost" )
1333 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1335 else if ( name == "volume_gradation" )
1336 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1338 else if ( name == "tiny_edge_optimisation_length" )
1339 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1341 // advanced options (for backward compatibility)
1343 else if ( name == "create_tag_on_collision" ||
1344 name == "tiny_edge_respect_geometry" )
1345 AddOption( optionName, optionValue );
1348 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1350 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1352 } catch (const std::invalid_argument& ex) {
1353 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1354 } catch (SALOME_Exception& ex) {
1355 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1358 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1361 //=============================================================================
1363 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1367 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1368 } catch (const std::invalid_argument& ex) {
1369 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1370 } catch (SALOME_Exception& ex) {
1371 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1376 //=============================================================================
1378 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1382 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1383 } catch (const std::invalid_argument& ex) {
1384 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1385 } catch (SALOME_Exception& ex) {
1386 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1391 //=============================================================================
1393 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1395 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1397 this->GetImpl()->ClearOption(optionName);
1398 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1402 //=============================================================================
1404 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1406 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1408 this->GetImpl()->ClearPreCADOption(optionName);
1409 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1413 //=============================================================================
1415 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1417 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1419 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1420 result->length(opts.size());
1424 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1425 for (; opIt != opts.end(); ++opIt, ++i) {
1426 string name_value_type = opIt->first;
1427 if (!opIt->second.empty()) {
1428 name_value_type += ":";
1429 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1430 name_value_type += isDefault ? ":0" : ":1";
1432 result[i] = CORBA::string_dup(name_value_type.c_str());
1435 return result._retn();
1438 //=============================================================================
1440 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1442 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1444 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1445 result->length(opts.size());
1449 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1450 for (; opIt != opts.end(); ++opIt, ++i) {
1451 string name_value_type = opIt->first;
1452 if (!opIt->second.empty()) {
1453 name_value_type += ":";
1454 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1455 name_value_type += isDefault ? ":0" : ":1";
1457 result[i] = CORBA::string_dup(name_value_type.c_str());
1459 return result._retn();
1462 //=============================================================================
1464 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1466 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1468 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1469 result->length(custom_opts.size());
1472 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1473 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1474 string name_value_type = opIt->first;
1475 if (!opIt->second.empty()) {
1476 name_value_type += ":";
1477 name_value_type += opIt->second;
1478 name_value_type += ":1"; // user defined
1480 result[i] = CORBA::string_dup(name_value_type.c_str());
1482 return result._retn();
1485 //=============================================================================
1487 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1488 throw (SALOME::SALOME_Exception) {
1490 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1491 string name_value_type = options[i].in();
1492 if(name_value_type.empty())
1494 size_t colonPos = name_value_type.find(':');
1496 if (colonPos == string::npos) // ':' not found
1497 name = name_value_type;
1499 name = name_value_type.substr(0, colonPos);
1500 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1501 string value_type = name_value_type.substr(colonPos + 1);
1502 colonPos = value_type.find(':');
1503 value = value_type.substr(0, colonPos);
1504 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1505 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1509 SetOptionValue(name.c_str(), value.c_str());
1513 //=============================================================================
1515 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1516 throw (SALOME::SALOME_Exception) {
1518 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1519 string name_value_type = options[i].in();
1520 if(name_value_type.empty())
1522 size_t colonPos = name_value_type.find(':');
1524 if (colonPos == string::npos) // ':' not found
1525 name = name_value_type;
1527 name = name_value_type.substr(0, colonPos);
1528 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1529 string value_type = name_value_type.substr(colonPos + 1);
1530 colonPos = value_type.find(':');
1531 value = value_type.substr(0, colonPos);
1532 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1533 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1537 SetPreCADOptionValue(name.c_str(), value.c_str());
1541 //=============================================================================
1543 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1545 SMESH::TPythonDump dump;
1547 string optionsAndValues;
1548 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1549 string name_value_type = options[i].in();
1550 if(name_value_type.empty())
1552 size_t colonPos = name_value_type.find(':');
1554 if (colonPos == string::npos) // ':' not found
1555 name = name_value_type;
1557 name = name_value_type.substr(0, colonPos);
1558 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1559 string value_type = name_value_type.substr(colonPos + 1);
1560 colonPos = value_type.find(':');
1561 value = value_type.substr(0, colonPos);
1564 AddOption(name.c_str(), value.c_str());
1566 optionsAndValues += name + " " + value + " ";
1569 if ( !optionsAndValues.empty() )
1570 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1573 //=============================================================================
1575 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1576 throw (SALOME::SALOME_Exception)
1578 if ( !optionsAndValues ) return;
1580 SMESH::TPythonDump dump;
1582 std::istringstream strm( optionsAndValues );
1583 std::istream_iterator<std::string> sIt( strm ), sEnd;
1584 while ( sIt != sEnd )
1586 std::string option = *sIt;
1587 if ( ++sIt != sEnd )
1589 std::string value = *sIt;
1591 AddOption( option.c_str(), value.c_str() );
1595 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1598 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1601 //=============================================================================
1603 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1606 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1608 this->GetImpl()->AddOption(optionName, optionValue);
1609 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1613 //=============================================================================
1615 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1618 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1620 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1621 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1625 //=============================================================================
1627 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1630 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1633 //=============================================================================
1635 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1638 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1641 //=============================================================================
1643 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1644 throw (SALOME::SALOME_Exception) {
1646 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1647 if ( !entry || !entry[0] )
1648 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1649 bool valueChanged = false;
1651 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1653 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1654 } catch (const std::invalid_argument& ex) {
1655 SALOME::ExceptionStruct ExDescription;
1656 ExDescription.text = ex.what();
1657 ExDescription.type = SALOME::BAD_PARAM;
1658 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1659 ExDescription.lineNumber = 0;
1660 throw SALOME::SALOME_Exception(ExDescription);
1661 } catch (SALOME_Exception& ex) {
1662 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1664 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1666 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1669 //=============================================================================
1671 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1672 throw (SALOME::SALOME_Exception) {
1674 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1675 bool valueChanged = false;
1676 std::ostringstream sizeMapFunction;
1677 switch (shapeType) {
1678 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1679 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1680 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1684 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1686 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1687 } catch (const std::invalid_argument& ex) {
1688 SALOME::ExceptionStruct ExDescription;
1689 ExDescription.text = ex.what();
1690 ExDescription.type = SALOME::BAD_PARAM;
1691 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1692 ExDescription.lineNumber = 0;
1693 throw SALOME::SALOME_Exception(ExDescription);
1694 } catch (SALOME_Exception& ex) {
1695 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1697 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1699 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1702 //=============================================================================
1704 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1705 throw (SALOME::SALOME_Exception) {
1707 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1708 bool valueChanged = false;
1710 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1711 if ( valueChanged ) {
1712 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1713 if (!boost::regex_match(string(attractor), re))
1714 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1715 this->GetImpl()->SetAttractorEntry(entry, attractor);
1717 } catch (const std::invalid_argument& ex) {
1718 SALOME::ExceptionStruct ExDescription;
1719 ExDescription.text = ex.what();
1720 ExDescription.type = SALOME::BAD_PARAM;
1721 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1722 ExDescription.lineNumber = 0;
1723 throw SALOME::SALOME_Exception(ExDescription);
1724 } catch (SALOME_Exception& ex) {
1725 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1727 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1729 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1732 //=============================================================================
1734 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
1735 throw (SALOME::SALOME_Exception)
1738 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1739 //bool valueChanged = false;
1741 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1743 catch (const std::invalid_argument& ex) {
1744 SALOME::ExceptionStruct ExDescription;
1745 ExDescription.text = ex.what();
1746 ExDescription.type = SALOME::BAD_PARAM;
1747 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1748 ExDescription.lineNumber = 0;
1749 throw SALOME::SALOME_Exception(ExDescription);
1750 } catch (SALOME_Exception& ex) {
1751 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1753 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1754 //if ( valueChanged )
1755 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1756 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1759 //=============================================================================
1761 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1764 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
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::GetSizeMapEntry(name)";
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 );
1778 //=============================================================================
1780 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1783 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1784 } catch (const std::invalid_argument& ex) {
1785 SALOME::ExceptionStruct ExDescription;
1786 ExDescription.text = ex.what();
1787 ExDescription.type = SALOME::BAD_PARAM;
1788 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1789 ExDescription.lineNumber = 0;
1790 throw SALOME::SALOME_Exception(ExDescription);
1791 } catch (SALOME_Exception& ex) {
1792 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1797 // //=============================================================================
1799 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1800 // // A finir pour le dump
1801 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1802 // throw (SALOME::SALOME_Exception)
1804 // ASSERT(myBaseImpl);
1806 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1808 // catch (const std::invalid_argument& ex) {
1809 // SALOME::ExceptionStruct ExDescription;
1810 // ExDescription.text = ex.what();
1811 // ExDescription.type = SALOME::BAD_PARAM;
1812 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1813 // ExDescription.lineNumber = 0;
1814 // throw SALOME::SALOME_Exception(ExDescription);
1816 // catch (SALOME_Exception& ex) {
1817 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1822 //=============================================================================
1824 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1826 this->GetImpl()->ClearEntry(entry);
1827 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1830 //=============================================================================
1832 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1834 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1836 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1837 result->length(sizeMaps.size());
1839 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1840 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1841 string entry_sizemap = smIt->first;
1842 if (!smIt->second.empty()) {
1843 entry_sizemap += "|";
1844 entry_sizemap += smIt->second;
1846 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1848 return result._retn();
1851 //=============================================================================
1853 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1855 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1857 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1858 result->length(attractors.size());
1860 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1861 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1862 string entry_attractor = atIt->first;
1863 if (!atIt->second.empty()) {
1864 entry_attractor += "|";
1865 entry_attractor += atIt->second;
1867 result[i] = CORBA::string_dup(entry_attractor.c_str());
1869 return result._retn();
1872 //=============================================================================
1874 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1877 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1879 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1880 result->length( attractors.size() );
1882 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1883 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1884 string faceEntry = atIt->first;
1886 double startSize, endSize, infDist, constDist;
1887 if ( !atIt->second->Empty() ) {
1888 attEntry = atIt->second->GetAttractorEntry();
1889 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1890 std::vector<double> params = atIt->second->GetParameters();
1891 startSize = params[0];
1892 endSize = params[1];
1893 infDist = params[2];
1894 constDist = params[3];
1896 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1897 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1898 result[i].startSize = startSize;
1899 result[i].endSize = endSize;
1900 result[i].infDist = infDist;
1901 result[i].constDist = constDist;
1902 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1903 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1905 return result._retn();
1908 //=============================================================================
1910 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1911 throw (SALOME::SALOME_Exception) {
1913 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1914 string entry_sizemap = sizeMaps[i].in();
1915 size_t colonPos = entry_sizemap.find('|');
1916 string entry, sizemap;
1917 if (colonPos == string::npos) // '|' separator not found
1918 entry = entry_sizemap;
1920 entry = entry_sizemap.substr(0, colonPos);
1921 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1922 sizemap = entry_sizemap.substr(colonPos + 1);
1924 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1928 //=============================================================================
1930 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1932 this->GetImpl()->ClearSizeMaps();
1935 //=============================================================================
1937 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1938 throw (SALOME::SALOME_Exception)
1942 entry = GeomObj->GetStudyEntry();
1943 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1944 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1945 SetSizeMapEntry(entry.c_str(), sizeMap);
1948 //=============================================================================
1950 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1952 string entry = GeomObj->GetStudyEntry();
1953 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1954 if (shapeType == GEOM::COMPOUND)
1955 shapeType = GeomObj->GetMaxShapeType();
1956 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1957 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1958 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1961 //=============================================================================
1962 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1965 entry = GeomObj->GetStudyEntry();
1966 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1967 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1968 UnsetEntry(entry.c_str());
1969 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1972 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1975 entry = GeomObj->GetStudyEntry();
1976 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1977 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1978 SetAttractorEntry(entry.c_str(), attractor);
1981 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1984 entry = GeomObj->GetStudyEntry();
1985 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1986 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1987 UnsetEntry(entry.c_str());
1988 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1991 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)
1994 string theFaceEntry;
1996 theFaceEntry = theFace->GetStudyEntry();
1997 theAttEntry = theAttractor->GetStudyEntry();
1999 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2000 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2003 if (theFaceEntry.empty()) {
2005 aName += theFace->GetEntry();
2006 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2007 if (!theSFace->_is_nil())
2008 theFaceEntry = theSFace->GetID();
2010 if (theFaceEntry.empty())
2011 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2013 if (theAttEntry.empty()) {
2014 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2016 if (theAttractor->GetShapeType() == GEOM::EDGE)
2018 if (theAttractor->GetShapeType() == GEOM::WIRE)
2020 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2021 aName = "Compound_";
2022 aName += theAttractor->GetEntry();
2023 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2024 if (!theSAtt->_is_nil())
2025 theAttEntry = theSAtt->GetID();
2027 if (theAttEntry.empty())
2028 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2030 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2031 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2032 MESSAGE("IDL : GetName : " << theFace->GetName());
2033 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2034 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2037 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2038 GEOM::GEOM_Object_ptr theAttractor)
2041 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2042 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2044 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2045 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2048 // if (theFaceEntry.empty()) {
2050 // aName += theFace->GetEntry();
2051 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2052 // if (!theSFace->_is_nil())
2053 // theFaceEntry = theSFace->GetID();
2055 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2056 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2057 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2059 MESSAGE("IDL : GetName : " << theFace->GetName());
2060 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2061 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2062 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2063 << theFace << ", " << theAttractor << " )";
2066 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2067 const char* attractorEntry)
2069 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2070 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2071 << faceEntry << "', '" << attractorEntry << "' )";
2076 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2079 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2082 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2085 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2088 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2091 this->GetImpl()->UnsetCustomSizeMap(entry);
2092 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2096 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2101 // ///////////////////////
2102 // // ENFORCED VERTICES //
2103 // ///////////////////////
2107 * Returns the list of enforced vertices for a given Face entry
2108 * @return A map of Face entry / List of enforced vertices
2111 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2112 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2115 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2117 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2118 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2119 resultMap->length(faceEntryEnfVertexListMap.size());
2120 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2122 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2123 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2124 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2125 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2126 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2127 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2128 MESSAGE("Face Entry: " << mapElement->faceEntry);
2130 _enfVertexList = it_entry->second;
2131 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2132 enfVertexList->length(_enfVertexList.size());
2133 MESSAGE("Number of enf vertex: " << enfVertexList->length());
2135 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2136 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2137 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2138 currentEnfVertex = (*it_enfVertex);
2140 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2143 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2146 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2149 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2150 coords->length(currentEnfVertex->coords.size());
2151 for (CORBA::ULong i=0;i<coords->length();i++)
2152 coords[i] = currentEnfVertex->coords[i];
2153 enfVertex->coords = coords;
2156 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2159 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2160 faceEntryList->length(currentEnfVertex->faceEntries.size());
2161 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2162 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2163 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2164 enfVertex->faceEntries = faceEntryList;
2167 msg << "Enforced vertex: \n"
2168 << "Name: " << enfVertex->name << "\n";
2169 if (coords->length())
2170 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2171 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2172 << "Group Name: " << enfVertex->grpName;
2175 enfVertexList[j] = enfVertex;
2177 mapElement->enfVertexList = enfVertexList;
2179 resultMap[i] = mapElement;
2182 return resultMap._retn();
2186 * Returns the list of all enforced vertices
2187 * @return a list of enforced vertices
2190 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2191 MESSAGE("IDL: GetAllEnforcedVertices()");
2193 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2194 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2195 resultMap->length(enfVertexList.size());
2196 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2198 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2199 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2200 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2201 MESSAGE("Enforced Vertex #" << i);
2202 currentEnfVertex = (*evlIt);
2203 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2205 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2207 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2209 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2210 coords->length(currentEnfVertex->coords.size());
2211 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2212 coords[ind] = currentEnfVertex->coords[ind];
2213 enfVertex->coords = coords;
2215 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2217 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2218 faceEntryList->length(currentEnfVertex->faceEntries.size());
2219 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2220 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2221 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2222 enfVertex->faceEntries = faceEntryList;
2225 msg << "Enforced vertex: \n"
2226 << "Name: " << enfVertex->name << "\n";
2227 if (coords->length())
2228 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2229 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2230 << "Group Name: " << enfVertex->grpName;
2233 resultMap[i] = enfVertex;
2235 return resultMap._retn();
2240 * Returns the list of enforced vertices coords for a given Face entry.
2241 * They are the coords of the "manual" enforced vertices.
2242 * @return A map of Face entry / List of enforced vertices coords
2245 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2246 MESSAGE("IDL: GetAllCoordsByFace()");
2249 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2251 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2252 resultMap->length(entryCoordsListMap.size());
2253 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2255 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2256 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2257 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2258 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2259 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2260 MESSAGE("Face Entry: " << mapElement->faceEntry);
2262 _coordsList = it_entry->second;
2263 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2264 coordsList->length(_coordsList.size());
2265 MESSAGE("Number of coords: " << coordsList->length());
2267 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2268 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2269 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2270 coords->length((*it_coords).size());
2271 for (CORBA::ULong i=0;i<coords->length();i++)
2272 coords[i] = (*it_coords)[i];
2273 coordsList[j] = coords;
2274 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2276 mapElement->coordsList = coordsList;
2278 resultMap[i] = mapElement;
2281 return resultMap._retn();
2285 * Returns a map of enforced vertices coords / enforced vertex.
2286 * They are the coords of the "manual" enforced vertices.
2288 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2289 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2292 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2293 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2294 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2295 resultMap->length(coordsEnfVertexMap.size());
2296 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2298 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2299 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2300 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2301 MESSAGE("Enforced Vertex #" << i);
2302 currentEnfVertex = (it_coords->second);
2303 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2304 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2305 coords->length(it_coords->first.size());
2306 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2307 coords[ind] = it_coords->first[ind];
2308 mapElement->coords = coords;
2309 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2311 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2313 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2315 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2317 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2318 coords2->length(currentEnfVertex->coords.size());
2319 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2320 coords2[ind] = currentEnfVertex->coords[ind];
2321 enfVertex->coords = coords2;
2323 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2325 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2326 faceEntryList->length(currentEnfVertex->faceEntries.size());
2327 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2328 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2329 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2330 enfVertex->faceEntries = faceEntryList;
2332 mapElement->enfVertex = enfVertex;
2334 msg << "Enforced vertex: \n"
2335 << "Name: " << enfVertex->name << "\n";
2336 if (coords->length())
2337 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2338 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2339 << "Group Name: " << enfVertex->grpName;
2342 resultMap[i] = mapElement;
2344 return resultMap._retn();
2348 * Returns the list of enforced vertices entries for a given Face entry.
2349 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2350 * @return A map of Face entry / List of enforced vertices geom entries
2353 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2354 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2357 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2359 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2360 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2361 resultMap->length(entryEnfVertexEntryListMap.size());
2362 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2364 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2365 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2366 entryEnfVertexEntryListMap.begin();
2367 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2368 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2369 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2370 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2371 MESSAGE("Face Entry: " << mapElement->faceEntry);
2373 _enfVertexEntryList = it_entry->second;
2374 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2375 enfVertexEntryList->length(_enfVertexEntryList.size());
2376 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2378 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2379 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2380 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2381 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2383 mapElement->enfVertexEntryList = enfVertexEntryList;
2385 resultMap[i] = mapElement;
2388 return resultMap._retn();
2392 * Returns a map of enforced vertices geom entry / enforced vertex.
2393 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2395 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2396 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2399 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2400 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2401 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2402 resultMap->length(enfVertexEntryEnfVertexMap.size());
2403 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2405 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2406 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2407 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2408 MESSAGE("Enforced Vertex #" << i);
2409 currentEnfVertex = it_enfVertexEntry->second;
2410 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2411 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2412 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2414 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2416 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2418 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2420 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2421 coords->length(currentEnfVertex->coords.size());
2422 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2423 coords[ind] = currentEnfVertex->coords[ind];
2424 enfVertex->coords = coords;
2426 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2428 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2429 faceEntryList->length(currentEnfVertex->faceEntries.size());
2430 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2431 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2432 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2433 enfVertex->faceEntries = faceEntryList;
2436 msg << "Enforced vertex: \n"
2437 << "Name: " << enfVertex->name << "\n";
2438 if (coords->length())
2439 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2440 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2441 << "Group Name: " << enfVertex->grpName;
2444 mapElement->enfVertex = enfVertex;
2445 resultMap[i] = mapElement;
2447 return resultMap._retn();
2451 * Erase all enforced vertices
2453 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2455 this->GetImpl()->ClearAllEnforcedVertices();
2456 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2460 * Set/get/unset an enforced vertex on face
2462 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2463 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2466 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2467 MESSAGE("theFace shape type is not FACE or COMPOUND");
2468 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2471 string theFaceEntry = theFace->GetStudyEntry();
2473 if (theFaceEntry.empty()) {
2474 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2475 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2477 if (theFace->GetShapeType() == GEOM::FACE)
2479 if (theFace->GetShapeType() == GEOM::COMPOUND)
2480 aName = "Compound_";
2481 aName += theFace->GetEntry();
2482 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2483 if (!theSFace->_is_nil())
2484 theFaceEntry = theSFace->GetID();
2486 if (theFaceEntry.empty())
2487 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2488 MESSAGE("IDL : GetName : " << theFace->GetName());
2489 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2491 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2492 } catch (SALOME_Exception& ex) {
2493 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2498 * Set/get/unset an enforced vertex with name on face
2500 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2501 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2504 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2505 MESSAGE("theFace shape type is not FACE or COMPOUND");
2506 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2509 string theFaceEntry = theFace->GetStudyEntry();
2511 if (theFaceEntry.empty()) {
2512 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2513 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2515 if (theFace->GetShapeType() == GEOM::FACE)
2517 if (theFace->GetShapeType() == GEOM::COMPOUND)
2518 aName = "Compound_";
2519 aName += theFace->GetEntry();
2520 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2521 if (!theSFace->_is_nil())
2522 theFaceEntry = theSFace->GetID();
2524 if (theFaceEntry.empty())
2525 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2527 MESSAGE("IDL : GetName : " << theFace->GetName());
2528 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2530 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2531 } catch (SALOME_Exception& ex) {
2532 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2537 * Set/get/unset an enforced vertex with geom object on face
2539 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2540 throw (SALOME::SALOME_Exception) {
2543 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2544 MESSAGE("theFace shape type is not FACE or COMPOUND");
2545 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2548 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2549 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2550 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2553 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2554 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2555 // if (CORBA::is_nil(measureOp))
2558 // CORBA::Double x, y, z;
2560 // measureOp->PointCoordinates(theVertex, x, y, z);
2562 string theFaceEntry = theFace->GetStudyEntry();
2563 string theVertexEntry = theVertex->GetStudyEntry();
2565 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2566 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2569 if (theFaceEntry.empty()) {
2570 if (theFace->GetShapeType() == GEOM::FACE)
2572 if (theFace->GetShapeType() == GEOM::COMPOUND)
2573 aName = "Compound_";
2574 aName += theFace->GetEntry();
2575 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2576 if (!theSFace->_is_nil())
2577 theFaceEntry = theSFace->GetID();
2579 if (theFaceEntry.empty())
2580 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2582 if (theVertexEntry.empty()) {
2583 if (theVertex->GetShapeType() == GEOM::VERTEX)
2585 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2586 aName = "Compound_";
2587 aName += theVertex->GetEntry();
2588 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2589 if (!theSVertex->_is_nil())
2590 theVertexEntry = theSVertex->GetID();
2592 if (theVertexEntry.empty())
2593 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2595 string theVertexName = theVertex->GetName();
2596 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2597 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2598 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2600 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2601 } catch (SALOME_Exception& ex) {
2602 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2607 * Set an enforced vertex with group name on face
2609 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2610 throw (SALOME::SALOME_Exception)
2614 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2615 MESSAGE("theFace shape type is not FACE or COMPOUND");
2616 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2619 string theFaceEntry = theFace->GetStudyEntry();
2621 if (theFaceEntry.empty()) {
2622 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2623 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2625 if (theFace->GetShapeType() == GEOM::FACE)
2627 if (theFace->GetShapeType() == GEOM::COMPOUND)
2628 aName = "Compound_";
2629 aName += theFace->GetEntry();
2630 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2631 if (!theSFace->_is_nil())
2632 theFaceEntry = theSFace->GetID();
2634 if (theFaceEntry.empty())
2635 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2636 MESSAGE("IDL : GetName : " << theFace->GetName());
2637 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2639 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2640 } catch (SALOME_Exception& ex) {
2641 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2646 * Set an enforced vertex with name and group name on face
2648 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2649 const char* theVertexName, const char* theGroupName)
2650 throw (SALOME::SALOME_Exception)
2654 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2655 MESSAGE("theFace shape type is not FACE or COMPOUND");
2656 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2659 string theFaceEntry = theFace->GetStudyEntry();
2661 if (theFaceEntry.empty()) {
2662 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2663 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2665 if (theFace->GetShapeType() == GEOM::FACE)
2667 if (theFace->GetShapeType() == GEOM::COMPOUND)
2668 aName = "Compound_";
2669 aName += theFace->GetEntry();
2670 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2671 if (!theSFace->_is_nil())
2672 theFaceEntry = theSFace->GetID();
2674 if (theFaceEntry.empty())
2675 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2676 MESSAGE("IDL : GetName : " << theFace->GetName());
2677 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2679 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2680 } catch (SALOME_Exception& ex) {
2681 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2686 * Set an enforced vertex with geom entry and group name on face
2688 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2689 throw (SALOME::SALOME_Exception)
2693 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2694 MESSAGE("theFace shape type is not FACE or COMPOUND");
2695 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2698 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2699 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2700 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2703 string theFaceEntry = theFace->GetStudyEntry();
2704 string theVertexEntry = theVertex->GetStudyEntry();
2706 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2707 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2710 if (theFaceEntry.empty()) {
2711 if (theFace->GetShapeType() == GEOM::FACE)
2713 if (theFace->GetShapeType() == GEOM::COMPOUND)
2714 aName = "Compound_";
2715 aName += theFace->GetEntry();
2716 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2717 if (!theSFace->_is_nil())
2718 theFaceEntry = theSFace->GetID();
2720 if (theFaceEntry.empty())
2721 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2723 if (theVertexEntry.empty()) {
2724 if (theVertex->GetShapeType() == GEOM::VERTEX)
2726 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2727 aName = "Compound_";
2728 aName += theVertex->GetEntry();
2729 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2730 if (!theSVertex->_is_nil())
2731 theVertexEntry = theSVertex->GetID();
2733 if (theVertexEntry.empty())
2734 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2736 string theVertexName = theVertex->GetName();
2737 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2738 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2739 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2741 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2742 } catch (SALOME_Exception& ex) {
2743 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2747 //Enable internal enforced vertices on specific face if requested by user
2749 // * Are internal enforced vertices used for a face ?
2751 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2752 // throw (SALOME::SALOME_Exception) {
2753 // ASSERT(myBaseImpl);
2755 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2756 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2757 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2760 // string theFaceEntry = theFace->GetStudyEntry();
2762 // if (theFaceEntry.empty()) {
2763 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2764 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2766 // if (theFace->GetShapeType() == GEOM::FACE)
2768 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2769 // aName = "Compound_";
2770 // aName += theFace->GetEntry();
2771 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2772 // if (!theSFace->_is_nil())
2773 // theFaceEntry = theSFace->GetID();
2775 // if (theFaceEntry.empty())
2776 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2778 // MESSAGE("IDL : GetName : " << theFace->GetName());
2779 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2781 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2782 // } catch (SALOME_Exception& ex) {
2783 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2788 * Get the list of all enforced vertices
2790 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2791 throw (SALOME::SALOME_Exception) {
2794 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2795 MESSAGE("theFace shape type is not FACE or COMPOUND");
2796 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2799 string theFaceEntry = theFace->GetStudyEntry();
2801 if (theFaceEntry.empty()) {
2802 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2803 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2805 if (theFace->GetShapeType() == GEOM::FACE)
2807 if (theFace->GetShapeType() == GEOM::COMPOUND)
2808 aName = "Compound_";
2809 aName += theFace->GetEntry();
2810 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2811 if (!theSFace->_is_nil())
2812 theFaceEntry = theSFace->GetID();
2814 if (theFaceEntry.empty())
2815 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2817 MESSAGE("IDL : GetName : " << theFace->GetName());
2818 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2820 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2821 } catch (SALOME_Exception& ex) {
2822 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2826 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2827 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2830 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2831 MESSAGE("theFace shape type is not FACE or COMPOUND");
2832 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2835 string theFaceEntry = theFace->GetStudyEntry();
2837 if (theFaceEntry.empty()) {
2838 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2839 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2841 if (theFace->GetShapeType() == GEOM::FACE)
2843 if (theFace->GetShapeType() == GEOM::COMPOUND)
2844 aName = "Compound_";
2845 aName += theFace->GetEntry();
2846 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2847 if (!theSFace->_is_nil())
2848 theFaceEntry = theSFace->GetID();
2850 if (theFaceEntry.empty())
2851 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2852 MESSAGE("IDL : GetName : " << theFace->GetName());
2853 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2856 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2857 } catch (SALOME_Exception& ex) {
2858 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2862 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2863 throw (SALOME::SALOME_Exception) {
2866 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2867 MESSAGE("theFace shape type is not FACE or COMPOUND");
2868 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2870 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2871 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2872 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2875 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2876 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2877 // if (CORBA::is_nil(measureOp))
2880 // CORBA::Double x, y, z;
2882 // measureOp->PointCoordinates(theVertex, x, y, z);
2884 std::string theFaceEntry = theFace->GetStudyEntry();
2885 std::string theVertexEntry = theVertex->GetStudyEntry();
2887 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2888 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2891 if (theFaceEntry.empty()) {
2892 if (theFace->GetShapeType() == GEOM::FACE)
2894 if (theFace->GetShapeType() == GEOM::COMPOUND)
2895 aName = "Compound_";
2896 aName += theFace->GetEntry();
2897 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2898 if (!theSFace->_is_nil())
2899 theFaceEntry = theSFace->GetID();
2901 if (theFaceEntry.empty())
2902 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2904 if (theVertexEntry.empty()) {
2905 if (theVertex->GetShapeType() == GEOM::VERTEX)
2907 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2908 aName = "Compound_";
2909 aName += theVertex->GetEntry();
2910 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2911 if (!theSVertex->_is_nil())
2912 theVertexEntry = theSVertex->GetID();
2914 if (theVertexEntry.empty())
2915 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2917 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2920 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2921 } catch (SALOME_Exception& ex) {
2922 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2926 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2929 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2930 MESSAGE("theFace shape type is not FACE or COMPOUND");
2931 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2934 string theFaceEntry = theFace->GetStudyEntry();
2936 if (theFaceEntry.empty()) {
2937 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2938 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2940 if (theFace->GetShapeType() == GEOM::FACE)
2942 if (theFace->GetShapeType() == GEOM::COMPOUND)
2943 aName = "Compound_";
2944 aName += theFace->GetEntry();
2945 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2946 if (!theSFace->_is_nil())
2947 theFaceEntry = theSFace->GetID();
2949 if (theFaceEntry.empty())
2950 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2952 MESSAGE("IDL : GetName : " << theFace->GetName());
2953 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2956 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2957 } catch (SALOME_Exception& ex) {
2958 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2963 * Set/get/unset an enforced vertex on geom object given by entry
2965 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2966 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2967 throw (SALOME::SALOME_Exception) {
2969 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2970 bool newValue = false;
2971 if (string(theVertexEntry).empty()) {
2973 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2974 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2975 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2976 coords.push_back(x);
2977 coords.push_back(y);
2978 coords.push_back(z);
2979 if (coordsList.find(coords) == coordsList.end()) {
2980 MESSAGE("Coords not found: add it in coordsList");
2983 MESSAGE("Coords already found, compare names");
2984 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2985 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2986 MESSAGE("The names are different: update");
2987 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2991 MESSAGE("The names are identical");
2994 } catch (const std::invalid_argument& ex) {
2995 // no enforced vertex for entry
2996 MESSAGE("Face entry not found : add it to the list");
3000 if (string(theVertexName).empty()) {
3001 if (string(theGroupName).empty())
3002 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
3004 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3007 if (string(theGroupName).empty())
3008 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3010 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
3011 << theVertexName << "\", \"" << theGroupName << "\")";
3016 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3017 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3018 if ( it == enfVertexEntryList.end()) {
3019 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
3023 MESSAGE("Geom entry already found, compare names");
3024 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3025 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3026 MESSAGE("The names are different: update");
3027 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
3031 MESSAGE("The names are identical");
3034 } catch (const std::invalid_argument& ex) {
3035 // no enforced vertex for entry
3036 MESSAGE("Face entry not found : add it to the list");
3040 if (string(theGroupName).empty())
3041 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3043 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
3048 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3050 MESSAGE("IDL : SetEnforcedVertexEntry END");
3054 //Enable internal enforced vertices on specific face if requested by user
3055 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
3056 // throw (SALOME::SALOME_Exception) {
3057 // ASSERT(myBaseImpl);
3059 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
3060 // } catch (const std::exception& ex) {
3061 // std::cout << "Exception: " << ex.what() << std::endl;
3062 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3066 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3067 throw (SALOME::SALOME_Exception) {
3069 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
3072 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3073 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3074 vertexList->length(_vList.size());
3075 MESSAGE("Number of enforced vertices: " << vertexList->length());
3076 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3077 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3078 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3080 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3083 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3084 // Geom Vertex Entry
3085 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3087 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3088 coords->length(_enfVertex->coords.size());
3089 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3090 coords[ind] = _enfVertex->coords[ind];
3091 enfVertex->coords = coords;
3093 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3095 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3096 faceEntryList->length(_enfVertex->faceEntries.size());
3097 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3098 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3099 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3100 enfVertex->faceEntries = faceEntryList;
3102 vertexList[i] = enfVertex;
3104 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3105 return vertexList._retn();
3106 } catch (const std::invalid_argument& ex) {
3107 SALOME::ExceptionStruct ExDescription;
3108 ExDescription.text = ex.what();
3109 ExDescription.type = SALOME::BAD_PARAM;
3110 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3111 ExDescription.lineNumber = 1385;
3112 throw SALOME::SALOME_Exception(ExDescription);
3113 } catch (const std::exception& ex) {
3114 std::cout << "Exception: " << ex.what() << std::endl;
3115 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3119 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
3120 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
3122 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
3126 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3128 if (string(theVertexEntry).empty())
3129 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
3132 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3134 } catch (const std::invalid_argument& ex) {
3136 } catch (const std::exception& ex) {
3137 std::cout << "Exception: " << ex.what() << std::endl;
3138 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3141 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3145 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
3146 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
3147 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
3149 // bool ret = false;
3152 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
3153 // } catch (SALOME_Exception& ex) {
3154 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3158 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
3161 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
3165 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
3167 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
3170 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3171 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
3172 } catch (const std::invalid_argument& ex) {
3174 } catch (const std::exception& ex) {
3175 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3178 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
3182 //=============================================================================
3184 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3188 //=============================================================================
3189 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
3190 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
3192 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3193 std::string theValueStr = theValue ? "True" : "False";
3194 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3197 //=============================================================================
3199 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3203 //=============================================================================
3204 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
3205 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
3207 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3210 //=============================================================================
3212 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3216 //=============================================================================
3217 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
3218 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
3220 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3221 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3224 //=============================================================================
3226 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3230 //=============================================================================
3231 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
3232 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
3234 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3238 * Enable internal enforced vertices on specific face if requested by user
3240 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3241 throw (SALOME::SALOME_Exception)
3243 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3245 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3246 } catch (SALOME_Exception& ex) {
3247 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3251 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3252 throw (SALOME::SALOME_Exception)
3254 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3256 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3257 MESSAGE("theFace shape type is not FACE or COMPOUND");
3258 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3261 string theFaceEntry = theFace->GetStudyEntry();
3263 if (theFaceEntry.empty()) {
3264 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3265 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3267 if (theFace->GetShapeType() == GEOM::FACE)
3269 if (theFace->GetShapeType() == GEOM::COMPOUND)
3270 aName = "Compound_";
3271 aName += theFace->GetEntry();
3272 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3273 if (!theSFace->_is_nil())
3274 theFaceEntry = theSFace->GetID();
3276 if (theFaceEntry.empty())
3277 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3279 MESSAGE("IDL : GetName : " << theFace->GetName());
3280 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3282 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3283 } catch (SALOME_Exception& ex) {
3284 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3288 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3289 throw (SALOME::SALOME_Exception)
3291 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3294 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3295 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3296 if (string(theGroupName).empty())
3297 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3299 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3300 } catch (const std::exception& ex) {
3301 std::cout << "Exception: " << ex.what() << std::endl;
3302 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3309 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3310 throw (SALOME::SALOME_Exception)
3313 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3315 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3317 catch (const std::invalid_argument& ex) {
3318 SALOME::ExceptionStruct ExDescription;
3319 ExDescription.text = ex.what();
3320 ExDescription.type = SALOME::BAD_PARAM;
3321 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3322 ExDescription.lineNumber = 1146;
3323 throw SALOME::SALOME_Exception(ExDescription);
3325 catch (SALOME_Exception& ex) {
3326 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3328 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3333 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3334 throw (SALOME::SALOME_Exception)
3337 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3339 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3341 catch (const std::invalid_argument& ex) {
3342 SALOME::ExceptionStruct ExDescription;
3343 ExDescription.text = ex.what();
3344 ExDescription.type = SALOME::BAD_PARAM;
3345 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3346 ExDescription.lineNumber = 1170;
3347 throw SALOME::SALOME_Exception(ExDescription);
3349 catch (SALOME_Exception& ex) {
3350 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3353 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3354 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3356 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3359 ///////////////////////
3361 ///////////////////////
3363 ///////////////////////
3366 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3368 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3369 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3370 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3371 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3372 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3373 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3374 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3375 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3376 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3377 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3378 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3379 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3380 return txtShapeType;
3383 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3385 // Check shape types
3387 std::stringstream typesTxt;
3388 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3390 GEOM::shape_type theShapeType = theShapeTypes[i];
3391 if (shape->GetShapeType() == theShapeType)
3393 typesTxt << ShapeTypeToString(theShapeType);
3394 if (i < theShapeTypes.size()-1 )
3398 std::stringstream msg;
3399 msg << "shape shape type is not in" << typesTxt.str();
3401 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3405 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3408 if (shape->GetShapeType() != theShapeType) {
3409 std::stringstream msg;
3410 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3412 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3416 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3418 // Check shape is published in the object browser
3419 string shapeEntry = shape->GetStudyEntry();
3421 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3422 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3425 // Publish shape if needed
3426 if (shapeEntry.empty()) {
3427 if (shape->GetShapeType() == theShapeType)
3429 aName += shape->GetEntry();
3430 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3431 if (!theSFace1->_is_nil())
3432 shapeEntry = theSFace1->GetID();
3434 if (shapeEntry.empty())
3435 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3439 // Format the output of two vectors to use it in MESSAGE and PythonDump
3440 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3442 std::stringstream listEntriesTxt;
3444 if (!theSourceVerticesEntries.empty())
3446 listEntriesTxt << ", [" ;
3448 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3451 listEntriesTxt << ", ";
3452 listEntriesTxt << *it;
3455 listEntriesTxt << "], [" ;
3457 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3460 listEntriesTxt << ", ";
3461 listEntriesTxt << *it;
3463 listEntriesTxt << "]" ;
3465 return listEntriesTxt.str();
3469 * Erase all PreCad periodicity associations
3471 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3473 this->GetImpl()->ClearPreCadPeriodicityVectors();
3474 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3477 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3479 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3480 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3481 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3483 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3485 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3486 return periodicityList._retn();
3489 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3491 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3492 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3493 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3495 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3497 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3498 return periodicityList._retn();
3501 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3502 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3504 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3505 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3507 periodicityList->length(preCadPeriodicityVector.size());
3509 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3511 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3513 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3514 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3515 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3517 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3518 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3520 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3521 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3522 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3525 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3527 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3528 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3530 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3531 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3532 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3535 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3537 periodicityList[i] = myPreCadPeriodicity;
3541 return periodicityList._retn();
3545 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3546 throw (SALOME::SALOME_Exception)
3549 const GEOM::ListOfGO theSourceVertices;
3550 const GEOM::ListOfGO theTargetVertices;
3551 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3555 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3556 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3557 throw (SALOME::SALOME_Exception)
3560 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3562 size_t theLength = theSourceVertices.length();
3563 if (theLength != theTargetVertices.length())
3564 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3566 std::vector<GEOM::shape_type> allowedShapeTypes;
3567 allowedShapeTypes.push_back(GEOM::FACE);
3568 allowedShapeTypes.push_back(GEOM::COMPOUND);
3570 string prefix1 = "Source_face_";
3571 CheckShapeTypes(theFace1, allowedShapeTypes);
3572 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3574 string prefix2 = "Target_face_";
3575 CheckShapeTypes(theFace2, allowedShapeTypes);
3576 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3578 string prefix3 = "Source_vertex_";
3579 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3580 theSourceVerticesEntries->length(theLength);
3581 GEOM::GEOM_Object_ptr theVtx_i;
3583 for (size_t ind = 0; ind < theLength; ind++) {
3584 theVtx_i = theSourceVertices[ind];
3585 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3586 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3589 string prefix4 = "Target_vertex_";
3590 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3591 theTargetVerticesEntries->length(theLength);
3592 for (size_t ind = 0; ind < theLength; ind++) {
3593 theVtx_i = theTargetVertices[ind];
3594 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3595 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3598 string theFace2Name = theFace2->GetName();
3599 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3600 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3601 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3603 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3604 theSourceVerticesEntries, theTargetVerticesEntries);
3605 } catch (SALOME_Exception& ex) {
3606 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3611 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3612 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3613 throw (SALOME::SALOME_Exception)
3618 // Convert BLSURFPlugin::TEntryList to vector<string>
3619 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3620 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3621 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3622 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3625 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3627 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3629 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3630 theSourceVerticesEntries, theTargetVerticesEntries);
3632 SMESH::TPythonDump pd;
3633 if (!theSourceVerticesEntries.empty())
3635 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3636 pd << listEntriesTxt.c_str();
3640 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3641 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3644 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3645 throw (SALOME::SALOME_Exception)
3648 const GEOM::ListOfGO theSourceVertices;
3649 const GEOM::ListOfGO theTargetVertices;
3650 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3653 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3654 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3655 throw (SALOME::SALOME_Exception)
3657 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3660 size_t theLength = theSourceVertices.length();
3661 if (theLength != theTargetVertices.length())
3662 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3664 std::vector<GEOM::shape_type> allowedShapeTypes;
3665 allowedShapeTypes.push_back(GEOM::EDGE);
3666 allowedShapeTypes.push_back(GEOM::COMPOUND);
3668 string prefix1 = "Source_edge_";
3669 CheckShapeTypes(theEdge1, allowedShapeTypes);
3670 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3672 string prefix2 = "Target_edge_";
3673 CheckShapeTypes(theEdge2, allowedShapeTypes);
3674 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3676 string prefix3 = "Source_vertex_";
3677 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3678 theSourceVerticesEntries->length(theLength);
3679 GEOM::GEOM_Object_ptr theVtx_i;
3681 for (size_t ind = 0; ind < theLength; ind++) {
3682 theVtx_i = theSourceVertices[ind];
3683 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3684 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3687 string prefix4 = "Target_vertex_";
3688 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3689 theTargetVerticesEntries->length(theLength);
3690 for (size_t ind = 0; ind < theLength; ind++) {
3691 theVtx_i = theTargetVertices[ind];
3692 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3693 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3696 string theEdge2Name = theEdge2->GetName();
3697 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3698 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3699 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3701 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3702 theSourceVerticesEntries, theTargetVerticesEntries);
3703 } catch (SALOME_Exception& ex) {
3704 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3709 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3710 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3711 throw (SALOME::SALOME_Exception)
3716 // Convert BLSURFPlugin::TEntryList to vector<string>
3717 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3718 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3719 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3720 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3723 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3725 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3726 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3727 theSourceVerticesEntries, theTargetVerticesEntries);
3729 SMESH::TPythonDump pd;
3730 if (!theSourceVerticesEntries.empty())
3732 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3733 pd << listEntriesTxt.c_str();
3737 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3739 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3743 //================================================================================
3745 * \brief Sets the file for export resulting mesh in GMF format
3746 * \param theFileName - full name of the file (.mesh, .meshb)
3748 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3750 //================================================================================
3751 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3752 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3754 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3755 bool valueChanged/*, modeChanged*/ = false;
3757 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3758 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3759 if (valueChanged)// or (!valueChanged && modeChanged))
3760 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3761 } catch (const std::exception& ex) {
3762 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3764 if (valueChanged)// or (!valueChanged && modeChanged))
3765 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3766 MESSAGE("IDL : SetGMFFile END ");
3769 //================================================================================
3771 * \brief Gets the file name for export resulting mesh in GMF format
3772 * \retval char* - The file name
3774 * Returns the GMF file name
3776 //================================================================================
3777 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3779 // MESSAGE("IDL : GetGMFFile()");
3780 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3783 // //================================================================================
3785 // * \brief Gets the file mode for export resulting mesh in GMF format
3786 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3788 // * Returns the GMF file mode
3790 // //================================================================================
3791 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3792 // ASSERT(myBaseImpl);
3793 // MESSAGE("IDL : GetGMFFileMode()");
3794 // return this->GetImpl()->GetGMFFileMode();
3797 //=============================================================================
3799 * BLSURFPlugin_Hypothesis_i::GetImpl
3801 * Get implementation
3803 //=============================================================================
3804 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3805 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3806 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3809 //================================================================================
3811 * \brief Verify whether hypothesis supports given entity type
3812 * \param type - dimension (see SMESH::Dimension enumeration)
3813 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3815 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3817 //================================================================================
3818 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3819 return type == SMESH::DIM_2D;
3823 // Obsolete methods - To be removed in V7
3826 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3827 this->SetMinSize(theMinSize);
3829 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3830 return this->GetMinSize();
3832 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3833 this->SetMaxSize(theMaxSize);
3835 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3836 return this->GetMaxSize();
3838 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3839 this->SetMinSize(theMinSize);
3841 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3842 return this->GetMinSize();
3844 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3845 this->SetMaxSize(theMaxSize);
3847 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3848 return this->GetMaxSize();
3850 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3851 this->SetAngleMesh(theValue);
3853 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3854 return this->GetAngleMesh();
3856 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3857 this->SetAngleMesh(theValue);
3859 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3860 return this->GetAngleMesh();
3862 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3863 std::string theValueStr = theValue ? "1" : "0";
3864 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3866 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3867 std::string theValueStr = this->GetOptionValue("respect_geometry");
3868 if (theValueStr.empty() || theValueStr == "respect")
3872 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3873 std::string theValueStr = theValue ? "1" : "0";
3874 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3876 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3877 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3878 if (theValueStr == "1")
3882 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3883 std::ostringstream theValueStr;
3884 theValueStr << theValue;
3885 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3887 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3888 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3890 theValueStr >> result;