1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
50 ::SMESH_Gen* theGenImpl) :
51 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
52 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
53 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
56 //=============================================================================
58 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
62 //=============================================================================
63 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
64 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
67 //=============================================================================
69 //=============================================================================
71 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
76 //=============================================================================
77 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
78 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
80 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
81 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
84 //=============================================================================
86 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
90 //=============================================================================
91 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
92 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
94 return this->GetImpl()->GetPhysicalMesh();
97 //=============================================================================
99 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
104 //=============================================================================
105 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
106 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
108 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
109 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
112 //=============================================================================
114 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
118 //=============================================================================
119 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
120 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
122 return this->GetImpl()->GetGeometricMesh();
125 //=============================================================================
127 * BLSURFPlugin_Hypothesis_i::SetPhySize
131 //=============================================================================
132 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
133 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
135 this->GetImpl()->SetPhySize(theValue, false);
136 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
139 //=============================================================================
141 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
143 * Set Relative PhySize
145 //=============================================================================
146 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
147 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
149 this->GetImpl()->SetPhySize(theValue, true);
150 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
153 //=============================================================================
155 * BLSURFPlugin_Hypothesis_i::GetPhySize
159 //=============================================================================
160 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
161 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
163 return this->GetImpl()->GetPhySize();
166 //=============================================================================
168 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
170 * Returns True if PhySize is relative
172 //=============================================================================
173 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
174 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
176 return this->GetImpl()->IsPhySizeRel();
179 //=============================================================================
180 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
182 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
183 this->GetImpl()->SetMinSize(theMinSize, false);
184 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
188 //=============================================================================
189 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
191 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
192 this->GetImpl()->SetMinSize(theMinSize, true);
193 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
197 //=============================================================================
198 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
200 return this->GetImpl()->GetMinSize();
203 //=============================================================================
204 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
205 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
207 return this->GetImpl()->IsMinSizeRel();
210 //=============================================================================
211 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
213 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
214 this->GetImpl()->SetMaxSize(theMaxSize, false);
215 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
219 //=============================================================================
220 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
222 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
223 this->GetImpl()->SetMaxSize(theMaxSize, true);
224 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
228 //=============================================================================
229 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
231 return this->GetImpl()->GetMaxSize();
234 //=============================================================================
235 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
236 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
238 return this->GetImpl()->IsMaxSizeRel();
242 //=============================================================================
244 * BLSURFPlugin_Hypothesis_i::SetUseGradation
248 //=============================================================================
249 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
250 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
252 this->GetImpl()->SetUseGradation(theValue);
253 std::string theValueStr = theValue ? "True" : "False";
254 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
257 //=============================================================================
259 * BLSURFPlugin_Hypothesis_i::GetUseGradation
263 //=============================================================================
264 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
265 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
267 return this->GetImpl()->GetUseGradation();
270 //=============================================================================
272 * BLSURFPlugin_Hypothesis_i::SetGradation
276 //=============================================================================
277 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
278 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
280 this->GetImpl()->SetGradation(theValue);
281 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
284 //=============================================================================
286 * BLSURFPlugin_Hypothesis_i::GetGradation
290 //=============================================================================
291 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
292 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
294 return this->GetImpl()->GetGradation();
297 //=============================================================================
299 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
303 //=============================================================================
304 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
305 MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
307 this->GetImpl()->SetUseVolumeGradation(theValue);
308 std::string theValueStr = theValue ? "True" : "False";
309 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
312 //=============================================================================
314 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
318 //=============================================================================
319 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
320 MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
322 return this->GetImpl()->GetUseVolumeGradation();
325 //=============================================================================
327 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
329 * Set VolumeGradation
331 //=============================================================================
332 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
333 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
335 this->GetImpl()->SetVolumeGradation(theValue);
336 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
339 //=============================================================================
341 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
343 * Get VolumeGradation
345 //=============================================================================
346 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
347 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
349 return this->GetImpl()->GetVolumeGradation();
352 //=============================================================================
354 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
358 //=============================================================================
359 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
360 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
362 this->GetImpl()->SetQuadAllowed(theValue);
363 std::string theValueStr = theValue ? "True" : "False";
364 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
367 //=============================================================================
369 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
373 //=============================================================================
374 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
375 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
377 return this->GetImpl()->GetQuadAllowed();
380 //=============================================================================
382 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
386 //=============================================================================
387 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
388 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
390 this->GetImpl()->SetAngleMesh(theValue);
391 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
394 //=============================================================================
396 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
400 //=============================================================================
401 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
402 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
404 return this->GetImpl()->GetAngleMesh();
407 //=============================================================================
409 * BLSURFPlugin_Hypothesis_i::SetChordalError
413 //=============================================================================
414 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
415 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
417 this->GetImpl()->SetChordalError(theValue);
418 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
421 //=============================================================================
423 * BLSURFPlugin_Hypothesis_i::GetChordalError
427 //=============================================================================
428 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
429 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
431 return this->GetImpl()->GetChordalError();
434 //=============================================================================
436 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
440 //=============================================================================
441 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
442 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
444 this->GetImpl()->SetAnisotropic(theValue);
445 std::string theValueStr = theValue ? "True" : "False";
446 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
449 //=============================================================================
451 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
455 //=============================================================================
456 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
457 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
459 return this->GetImpl()->GetAnisotropic();
462 //=============================================================================
464 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
466 * Set Anisotropic Ratio
468 //=============================================================================
469 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
470 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
472 this->GetImpl()->SetAnisotropicRatio(theValue);
473 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
476 //=============================================================================
478 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
480 * Get Anisotropic Ratio
482 //=============================================================================
483 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
484 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
486 return this->GetImpl()->GetAnisotropicRatio();
490 //=============================================================================
492 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
496 //=============================================================================
497 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
498 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
500 this->GetImpl()->SetRemoveTinyEdges(theValue);
501 std::string theValueStr = theValue ? "True" : "False";
502 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
505 //=============================================================================
507 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
511 //=============================================================================
512 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
513 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
515 return this->GetImpl()->GetRemoveTinyEdges();
518 //=============================================================================
520 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
522 * Set Tiny Edge Length
524 //=============================================================================
525 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
526 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
528 this->GetImpl()->SetTinyEdgeLength(theValue);
529 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
532 //=============================================================================
534 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
536 * Get Tiny Edge Length
538 //=============================================================================
539 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
540 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
542 return this->GetImpl()->GetTinyEdgeLength();
545 //=============================================================================
547 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
551 //=============================================================================
552 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
553 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
555 this->GetImpl()->SetOptimiseTinyEdges(theValue);
556 std::string theValueStr = theValue ? "True" : "False";
557 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
560 //=============================================================================
562 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
566 //=============================================================================
567 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
568 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
570 return this->GetImpl()->GetOptimiseTinyEdges();
573 //=============================================================================
575 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
577 * Set Tiny Edge OptimisationLength
579 //=============================================================================
580 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
581 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
583 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
584 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
587 //=============================================================================
589 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
591 * Get Tiny Edge OptimisationLength
593 //=============================================================================
594 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
595 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
597 return this->GetImpl()->GetTinyEdgeOptimisationLength();
600 //=============================================================================
602 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
606 //=============================================================================
607 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
608 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
610 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
611 std::string theValueStr = theValue ? "True" : "False";
612 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
615 //=============================================================================
617 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
621 //=============================================================================
622 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
623 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
625 return this->GetImpl()->GetCorrectSurfaceIntersection();
628 //=============================================================================
630 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
632 * Set Tiny Edge OptimisationLength
634 //=============================================================================
635 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
636 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
638 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
639 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
642 //=============================================================================
644 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
646 * Get Tiny Edge OptimisationLength
648 //=============================================================================
649 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
650 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
652 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
655 //=============================================================================
657 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
661 //=============================================================================
662 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
663 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
665 this->GetImpl()->SetBadElementRemoval(theValue);
666 std::string theValueStr = theValue ? "True" : "False";
667 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
670 //=============================================================================
672 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
676 //=============================================================================
677 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
678 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
680 return this->GetImpl()->GetBadElementRemoval();
683 //=============================================================================
685 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
687 * Set Bad Surface Element Aspect Ratio
689 //=============================================================================
690 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
691 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
693 this->GetImpl()->SetBadElementAspectRatio(theValue);
694 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
697 //=============================================================================
699 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
701 * Get Bad Surface Element Aspect Ratio
703 //=============================================================================
704 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
705 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
707 return this->GetImpl()->GetBadElementAspectRatio();
710 //=============================================================================
712 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
716 //=============================================================================
717 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
718 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
720 this->GetImpl()->SetOptimizeMesh(theValue);
721 std::string theValueStr = theValue ? "True" : "False";
722 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
725 //=============================================================================
727 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
731 //=============================================================================
732 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
733 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
735 return this->GetImpl()->GetOptimizeMesh();
738 //=============================================================================
740 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
744 //=============================================================================
745 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
746 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
748 this->GetImpl()->SetQuadraticMesh(theValue);
749 std::string theValueStr = theValue ? "True" : "False";
750 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
753 //=============================================================================
755 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
759 //=============================================================================
760 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
761 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
763 return this->GetImpl()->GetQuadraticMesh();
771 * BLSURFPlugin_Hypothesis_i::SetTopology
776 //=============================================================================
777 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
778 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
780 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
781 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
784 //=============================================================================
786 * BLSURFPlugin_Hypothesis_i::GetTopology
790 //=============================================================================
791 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
792 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
794 return this->GetImpl()->GetTopology();
797 //=============================================================================
798 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
800 if (theVal < 0 || theVal > 100)
801 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
802 this->GetImpl()->SetVerbosity(theVal);
803 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
806 //=============================================================================
808 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
810 return (CORBA::Short) this->GetImpl()->GetVerbosity();
813 //=============================================================================
814 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
816 if ( GetEnforceCadEdgesSize() != toEnforce )
818 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
819 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
822 //=============================================================================
823 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
825 return this->GetImpl()->GetEnforceCadEdgesSize();
827 //=============================================================================
829 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
831 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
833 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
834 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
837 //=============================================================================
838 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
840 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
842 //=============================================================================
844 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
846 if ( GetJacobianRectification() != allowRectification )
848 this->GetImpl()->SetJacobianRectification(allowRectification);
849 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
852 //=============================================================================
853 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
855 return this->GetImpl()->GetJacobianRectification();
857 //=============================================================================
859 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
861 if ( GetMaxNumberOfPointsPerPatch() != nb )
864 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
866 } catch (const std::invalid_argument& ex) {
867 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
868 } catch (SALOME_Exception& ex) {
869 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
871 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
874 //=============================================================================
875 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
877 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
879 //=============================================================================
881 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
883 if ( GetRespectGeometry() != toRespect )
885 this->GetImpl()->SetRespectGeometry(toRespect);
886 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
889 //=============================================================================
890 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
892 return this->GetImpl()->GetRespectGeometry();
894 //=============================================================================
896 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
898 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
900 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
901 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
904 //=============================================================================
905 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
907 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
909 //=============================================================================
911 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
913 if ( GetClosedGeometry() != isClosed )
915 this->GetImpl()->SetClosedGeometry(isClosed);
916 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
919 //=============================================================================
920 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
922 return this->GetImpl()->GetClosedGeometry();
924 //=============================================================================
926 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
928 if ( GetDebug() != isDebug )
930 this->GetImpl()->SetDebug(isDebug);
931 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
934 //=============================================================================
935 bool BLSURFPlugin_Hypothesis_i::GetDebug()
937 return this->GetImpl()->GetDebug();
939 //=============================================================================
941 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
944 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != 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)
998 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1002 this->GetImpl()->SetSewingTolerance(tol);
1003 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1005 } catch (const std::invalid_argument& ex) {
1006 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1007 } catch (SALOME_Exception& ex) {
1008 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1012 //=============================================================================
1013 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1017 return this->GetImpl()->GetSewingTolerance();
1019 } catch (const std::invalid_argument& ex) {
1020 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1021 } catch (SALOME_Exception& ex) {
1022 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1026 //=============================================================================
1028 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1030 if ( GetImpl()->GetTags() != howToTreat )
1033 this->GetImpl()->SetTags(howToTreat);
1035 catch (const std::invalid_argument& ex) {
1036 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1037 } catch (SALOME_Exception& ex) {
1038 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1041 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1043 //=============================================================================
1044 char* BLSURFPlugin_Hypothesis_i::GetTags()
1046 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1049 //=============================================================================
1051 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1055 //=============================================================================
1056 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1057 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
1059 this->GetImpl()->SetPreCADMergeEdges(theValue);
1060 std::string theValueStr = theValue ? "True" : "False";
1061 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1064 //=============================================================================
1066 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1070 //=============================================================================
1071 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1072 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
1074 return this->GetImpl()->GetPreCADMergeEdges();
1077 //=============================================================================
1079 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
1083 //=============================================================================
1084 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1085 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1087 this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1088 std::string theValueStr = theValue ? "True" : "False";
1089 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1092 //=============================================================================
1094 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1098 //=============================================================================
1099 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1100 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1102 return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1105 //=============================================================================
1107 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1111 //=============================================================================
1112 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1113 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1115 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1116 std::string theValueStr = theValue ? "True" : "False";
1117 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1120 //=============================================================================
1122 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1126 //=============================================================================
1127 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1128 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1130 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1133 //=============================================================================
1135 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1139 //=============================================================================
1140 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1141 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1143 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1144 std::string theValueStr = theValue ? "True" : "False";
1145 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1148 //=============================================================================
1150 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1154 //=============================================================================
1155 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1156 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1158 return this->GetImpl()->GetPreCADProcess3DTopology();
1161 //=============================================================================
1163 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1167 //=============================================================================
1168 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1169 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1171 this->GetImpl()->SetPreCADDiscardInput(theValue);
1172 std::string theValueStr = theValue ? "True" : "False";
1173 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1176 //=============================================================================
1178 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1182 //=============================================================================
1183 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1184 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1186 return this->GetImpl()->GetPreCADDiscardInput();
1190 //=============================================================================
1192 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1193 throw (SALOME::SALOME_Exception) {
1196 std::string name( optionName );
1197 if ( !optionValue || !optionValue[0] )
1198 UnsetOption( optionName );
1200 // basic options (visible in Advanced table)
1202 else if ( name == "enforce_cad_edge_sizes" )
1203 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1205 else if ( name == "jacobian_rectification_respect_geometry" )
1206 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1208 else if ( name == "max_number_of_points_per_patch" )
1209 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1211 else if ( name == "rectify_jacobian" )
1212 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1214 else if ( name == "respect_geometry" )
1215 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1217 else if ( name == "tiny_edge_avoid_surface_intersections" )
1218 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1220 else if ( name == "closed_geometry" )
1221 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1223 else if ( name == "debug" )
1224 SetDebug( GetImpl()->ToBool( optionValue ));
1226 else if ( name == "discard_input_topology" )
1227 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1229 else if ( name == "merge_edges" )
1230 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1232 else if ( name == "periodic_tolerance" )
1233 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1235 else if ( name == "remove_duplicate_cad_faces" )
1236 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1238 else if ( name == "required_entities" )
1239 SetRequiredEntities( optionValue );
1241 else if ( name == "sewing_tolerance" )
1242 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1244 else if ( name == "tags" )
1245 SetTags( optionValue );
1247 // other basic options with specific methods
1249 else if ( name == "correct_surface_intersections" )
1250 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1252 else if ( name == "optimise_tiny_edges" )
1253 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1255 else if ( name == "surface_intersections_processing_max_cost" )
1256 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1258 else if ( name == "volume_gradation" )
1259 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1261 else if ( name == "tiny_edge_optimisation_length" )
1262 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1264 // advanced options (for backward compatibility)
1266 else if ( name == "create_tag_on_collision" ||
1267 name == "tiny_edge_respect_geometry" )
1268 AddOption( optionName, optionValue );
1272 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1273 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1276 this->GetImpl()->SetOptionValue(optionName, optionValue);
1277 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1280 } catch (const std::invalid_argument& ex) {
1281 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1282 } catch (SALOME_Exception& ex) {
1283 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1287 //=============================================================================
1289 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1290 throw (SALOME::SALOME_Exception) {
1292 bool valueChanged = false;
1294 std::string name( optionName );
1295 if ( !optionValue || !optionValue[0] )
1296 UnsetOption( optionName );
1298 else if ( name == "closed_geometry" )
1299 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1301 else if ( name == "debug" )
1302 SetDebug( GetImpl()->ToBool( optionValue ));
1304 else if ( name == "discard_input_topology" )
1305 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1307 else if ( name == "merge_edges" )
1308 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1310 else if ( name == "periodic_tolerance" )
1311 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1313 else if ( name == "remove_duplicate_cad_faces" )
1314 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1316 else if ( name == "required_entities" )
1317 SetRequiredEntities( optionValue );
1319 else if ( name == "sewing_tolerance" )
1320 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1322 else if ( name == "tags" )
1323 SetTags( optionValue );
1325 // other basic options with specific methods
1327 else if ( name == "correct_surface_intersections" )
1328 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1330 else if ( name == "optimise_tiny_edges" )
1331 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1333 else if ( name == "surface_intersections_processing_max_cost" )
1334 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1336 else if ( name == "volume_gradation" )
1337 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1339 else if ( name == "tiny_edge_optimisation_length" )
1340 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1342 // advanced options (for backward compatibility)
1344 else if ( name == "create_tag_on_collision" ||
1345 name == "tiny_edge_respect_geometry" )
1346 AddOption( optionName, optionValue );
1349 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1351 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1353 } catch (const std::invalid_argument& ex) {
1354 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1355 } catch (SALOME_Exception& ex) {
1356 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1359 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1362 //=============================================================================
1364 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1368 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1369 } catch (const std::invalid_argument& ex) {
1370 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1371 } catch (SALOME_Exception& ex) {
1372 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1377 //=============================================================================
1379 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1383 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1384 } catch (const std::invalid_argument& ex) {
1385 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1386 } catch (SALOME_Exception& ex) {
1387 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1392 //=============================================================================
1394 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1396 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1398 this->GetImpl()->ClearOption(optionName);
1399 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1403 //=============================================================================
1405 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1407 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1409 this->GetImpl()->ClearPreCADOption(optionName);
1410 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1414 //=============================================================================
1416 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1418 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1420 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1421 result->length(opts.size());
1425 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1426 for (; opIt != opts.end(); ++opIt, ++i) {
1427 string name_value_type = opIt->first;
1428 if (!opIt->second.empty()) {
1429 name_value_type += ":";
1430 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1431 name_value_type += isDefault ? ":0" : ":1";
1433 result[i] = CORBA::string_dup(name_value_type.c_str());
1436 return result._retn();
1439 //=============================================================================
1441 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1443 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1445 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1446 result->length(opts.size());
1450 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1451 for (; opIt != opts.end(); ++opIt, ++i) {
1452 string name_value_type = opIt->first;
1453 if (!opIt->second.empty()) {
1454 name_value_type += ":";
1455 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1456 name_value_type += isDefault ? ":0" : ":1";
1458 result[i] = CORBA::string_dup(name_value_type.c_str());
1460 return result._retn();
1463 //=============================================================================
1465 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1467 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1469 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1470 result->length(custom_opts.size());
1473 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1474 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1475 string name_value_type = opIt->first;
1476 if (!opIt->second.empty()) {
1477 name_value_type += ":";
1478 name_value_type += opIt->second;
1479 name_value_type += ":1"; // user defined
1481 result[i] = CORBA::string_dup(name_value_type.c_str());
1483 return result._retn();
1486 //=============================================================================
1488 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1489 throw (SALOME::SALOME_Exception) {
1491 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1492 string name_value_type = options[i].in();
1493 if(name_value_type.empty())
1495 size_t colonPos = name_value_type.find(':');
1497 if (colonPos == string::npos) // ':' not found
1498 name = name_value_type;
1500 name = name_value_type.substr(0, colonPos);
1501 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1502 string value_type = name_value_type.substr(colonPos + 1);
1503 colonPos = value_type.find(':');
1504 value = value_type.substr(0, colonPos);
1505 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1506 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1510 SetOptionValue(name.c_str(), value.c_str());
1514 //=============================================================================
1516 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1517 throw (SALOME::SALOME_Exception) {
1519 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1520 string name_value_type = options[i].in();
1521 if(name_value_type.empty())
1523 size_t colonPos = name_value_type.find(':');
1525 if (colonPos == string::npos) // ':' not found
1526 name = name_value_type;
1528 name = name_value_type.substr(0, colonPos);
1529 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1530 string value_type = name_value_type.substr(colonPos + 1);
1531 colonPos = value_type.find(':');
1532 value = value_type.substr(0, colonPos);
1533 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1534 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1538 SetPreCADOptionValue(name.c_str(), value.c_str());
1542 //=============================================================================
1544 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1546 SMESH::TPythonDump dump;
1548 string optionsAndValues;
1549 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1550 string name_value_type = options[i].in();
1551 if(name_value_type.empty())
1553 size_t colonPos = name_value_type.find(':');
1555 if (colonPos == string::npos) // ':' not found
1556 name = name_value_type;
1558 name = name_value_type.substr(0, colonPos);
1559 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1560 string value_type = name_value_type.substr(colonPos + 1);
1561 colonPos = value_type.find(':');
1562 value = value_type.substr(0, colonPos);
1565 AddOption(name.c_str(), value.c_str());
1567 optionsAndValues += name + " " + value + " ";
1570 if ( !optionsAndValues.empty() )
1571 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1574 //=============================================================================
1576 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1577 throw (SALOME::SALOME_Exception)
1579 if ( !optionsAndValues ) return;
1581 SMESH::TPythonDump dump;
1583 std::istringstream strm( optionsAndValues );
1584 std::istream_iterator<std::string> sIt( strm ), sEnd;
1585 while ( sIt != sEnd )
1587 std::string option = *sIt;
1588 if ( ++sIt != sEnd )
1590 std::string value = *sIt;
1592 AddOption( option.c_str(), value.c_str() );
1596 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1599 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1602 //=============================================================================
1604 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1607 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1609 this->GetImpl()->AddOption(optionName, optionValue);
1610 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1614 //=============================================================================
1616 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1619 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1621 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1622 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1626 //=============================================================================
1628 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1631 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1634 //=============================================================================
1636 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1639 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1642 //=============================================================================
1644 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1645 throw (SALOME::SALOME_Exception) {
1647 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1648 if ( !entry || !entry[0] )
1649 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1650 bool valueChanged = false;
1652 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1654 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1655 } catch (const std::invalid_argument& ex) {
1656 SALOME::ExceptionStruct ExDescription;
1657 ExDescription.text = ex.what();
1658 ExDescription.type = SALOME::BAD_PARAM;
1659 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1660 ExDescription.lineNumber = 0;
1661 throw SALOME::SALOME_Exception(ExDescription);
1662 } catch (SALOME_Exception& ex) {
1663 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1665 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1667 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1670 //=============================================================================
1672 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1673 throw (SALOME::SALOME_Exception) {
1675 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1676 bool valueChanged = false;
1677 std::ostringstream sizeMapFunction;
1678 switch (shapeType) {
1679 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1680 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1681 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1685 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1687 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1688 } catch (const std::invalid_argument& ex) {
1689 SALOME::ExceptionStruct ExDescription;
1690 ExDescription.text = ex.what();
1691 ExDescription.type = SALOME::BAD_PARAM;
1692 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1693 ExDescription.lineNumber = 0;
1694 throw SALOME::SALOME_Exception(ExDescription);
1695 } catch (SALOME_Exception& ex) {
1696 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1698 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1700 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1703 //=============================================================================
1705 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1706 throw (SALOME::SALOME_Exception) {
1708 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1709 bool valueChanged = false;
1711 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1712 if ( valueChanged ) {
1713 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1714 if (!boost::regex_match(string(attractor), re))
1715 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1716 this->GetImpl()->SetAttractorEntry(entry, attractor);
1718 } catch (const std::invalid_argument& ex) {
1719 SALOME::ExceptionStruct ExDescription;
1720 ExDescription.text = ex.what();
1721 ExDescription.type = SALOME::BAD_PARAM;
1722 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1723 ExDescription.lineNumber = 0;
1724 throw SALOME::SALOME_Exception(ExDescription);
1725 } catch (SALOME_Exception& ex) {
1726 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1728 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1730 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1733 //=============================================================================
1735 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
1736 throw (SALOME::SALOME_Exception)
1739 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1740 //bool valueChanged = false;
1742 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1744 catch (const std::invalid_argument& ex) {
1745 SALOME::ExceptionStruct ExDescription;
1746 ExDescription.text = ex.what();
1747 ExDescription.type = SALOME::BAD_PARAM;
1748 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1749 ExDescription.lineNumber = 0;
1750 throw SALOME::SALOME_Exception(ExDescription);
1751 } catch (SALOME_Exception& ex) {
1752 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1754 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1755 //if ( valueChanged )
1756 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1757 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1760 //=============================================================================
1762 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1765 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1766 } catch (const std::invalid_argument& ex) {
1767 SALOME::ExceptionStruct ExDescription;
1768 ExDescription.text = ex.what();
1769 ExDescription.type = SALOME::BAD_PARAM;
1770 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1771 ExDescription.lineNumber = 0;
1772 throw SALOME::SALOME_Exception(ExDescription);
1773 } catch (SALOME_Exception& ex) {
1774 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1779 //=============================================================================
1781 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1784 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1785 } catch (const std::invalid_argument& ex) {
1786 SALOME::ExceptionStruct ExDescription;
1787 ExDescription.text = ex.what();
1788 ExDescription.type = SALOME::BAD_PARAM;
1789 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1790 ExDescription.lineNumber = 0;
1791 throw SALOME::SALOME_Exception(ExDescription);
1792 } catch (SALOME_Exception& ex) {
1793 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1798 // //=============================================================================
1800 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1801 // // A finir pour le dump
1802 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1803 // throw (SALOME::SALOME_Exception)
1805 // ASSERT(myBaseImpl);
1807 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1809 // catch (const std::invalid_argument& ex) {
1810 // SALOME::ExceptionStruct ExDescription;
1811 // ExDescription.text = ex.what();
1812 // ExDescription.type = SALOME::BAD_PARAM;
1813 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1814 // ExDescription.lineNumber = 0;
1815 // throw SALOME::SALOME_Exception(ExDescription);
1817 // catch (SALOME_Exception& ex) {
1818 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1823 //=============================================================================
1825 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1827 this->GetImpl()->ClearEntry(entry);
1828 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1831 //=============================================================================
1833 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1835 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1837 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1838 result->length(sizeMaps.size());
1840 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1841 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1842 string entry_sizemap = smIt->first;
1843 if (!smIt->second.empty()) {
1844 entry_sizemap += "|";
1845 entry_sizemap += smIt->second;
1847 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1849 return result._retn();
1852 //=============================================================================
1854 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1856 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1858 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1859 result->length(attractors.size());
1861 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1862 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1863 string entry_attractor = atIt->first;
1864 if (!atIt->second.empty()) {
1865 entry_attractor += "|";
1866 entry_attractor += atIt->second;
1868 result[i] = CORBA::string_dup(entry_attractor.c_str());
1870 return result._retn();
1873 //=============================================================================
1875 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1878 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1880 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1881 result->length( attractors.size() );
1883 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1884 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1885 string faceEntry = atIt->first;
1887 double startSize, endSize, infDist, constDist;
1888 if ( !atIt->second->Empty() ) {
1889 attEntry = atIt->second->GetAttractorEntry();
1890 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1891 std::vector<double> params = atIt->second->GetParameters();
1892 startSize = params[0];
1893 endSize = params[1];
1894 infDist = params[2];
1895 constDist = params[3];
1897 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1898 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1899 result[i].startSize = startSize;
1900 result[i].endSize = endSize;
1901 result[i].infDist = infDist;
1902 result[i].constDist = constDist;
1903 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1904 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1906 return result._retn();
1909 //=============================================================================
1911 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1912 throw (SALOME::SALOME_Exception) {
1914 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1915 string entry_sizemap = sizeMaps[i].in();
1916 size_t colonPos = entry_sizemap.find('|');
1917 string entry, sizemap;
1918 if (colonPos == string::npos) // '|' separator not found
1919 entry = entry_sizemap;
1921 entry = entry_sizemap.substr(0, colonPos);
1922 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1923 sizemap = entry_sizemap.substr(colonPos + 1);
1925 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1929 //=============================================================================
1931 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1933 this->GetImpl()->ClearSizeMaps();
1936 //=============================================================================
1938 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1939 throw (SALOME::SALOME_Exception)
1943 entry = GeomObj->GetStudyEntry();
1944 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1945 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1946 SetSizeMapEntry(entry.c_str(), sizeMap);
1949 //=============================================================================
1951 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1953 string entry = GeomObj->GetStudyEntry();
1954 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1955 if (shapeType == GEOM::COMPOUND)
1956 shapeType = GeomObj->GetMaxShapeType();
1957 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1958 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1959 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1962 //=============================================================================
1963 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1966 entry = GeomObj->GetStudyEntry();
1967 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1968 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1969 UnsetEntry(entry.c_str());
1970 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1973 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1976 entry = GeomObj->GetStudyEntry();
1977 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1978 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1979 SetAttractorEntry(entry.c_str(), attractor);
1982 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1985 entry = GeomObj->GetStudyEntry();
1986 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1987 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1988 UnsetEntry(entry.c_str());
1989 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1992 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)
1995 string theFaceEntry;
1997 theFaceEntry = theFace->GetStudyEntry();
1998 theAttEntry = theAttractor->GetStudyEntry();
2000 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2001 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2004 if (theFaceEntry.empty()) {
2006 aName += theFace->GetEntry();
2007 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2008 if (!theSFace->_is_nil())
2009 theFaceEntry = theSFace->GetID();
2011 if (theFaceEntry.empty())
2012 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2014 if (theAttEntry.empty()) {
2015 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2017 if (theAttractor->GetShapeType() == GEOM::EDGE)
2019 if (theAttractor->GetShapeType() == GEOM::WIRE)
2021 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2022 aName = "Compound_";
2023 aName += theAttractor->GetEntry();
2024 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2025 if (!theSAtt->_is_nil())
2026 theAttEntry = theSAtt->GetID();
2028 if (theAttEntry.empty())
2029 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2031 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2032 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2033 MESSAGE("IDL : GetName : " << theFace->GetName());
2034 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2035 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2038 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2039 GEOM::GEOM_Object_ptr theAttractor)
2042 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2043 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2045 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2046 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2049 // if (theFaceEntry.empty()) {
2051 // aName += theFace->GetEntry();
2052 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2053 // if (!theSFace->_is_nil())
2054 // theFaceEntry = theSFace->GetID();
2056 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2057 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2058 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2060 MESSAGE("IDL : GetName : " << theFace->GetName());
2061 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2062 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2063 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2064 << theFace << ", " << theAttractor << " )";
2067 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2068 const char* attractorEntry)
2070 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2071 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2072 << faceEntry << "', '" << attractorEntry << "' )";
2077 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2080 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2083 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2086 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2089 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2092 this->GetImpl()->UnsetCustomSizeMap(entry);
2093 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2097 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2102 // ///////////////////////
2103 // // ENFORCED VERTICES //
2104 // ///////////////////////
2108 * Returns the list of enforced vertices for a given Face entry
2109 * @return A map of Face entry / List of enforced vertices
2112 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2113 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2116 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2118 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2119 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2120 resultMap->length(faceEntryEnfVertexListMap.size());
2121 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2123 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2124 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2125 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2126 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2127 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2128 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2129 MESSAGE("Face Entry: " << mapElement->faceEntry);
2131 _enfVertexList = it_entry->second;
2132 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2133 enfVertexList->length(_enfVertexList.size());
2134 MESSAGE("Number of enf vertex: " << enfVertexList->length());
2136 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2137 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2138 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2139 currentEnfVertex = (*it_enfVertex);
2141 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2144 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2147 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2150 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2151 coords->length(currentEnfVertex->coords.size());
2152 for (CORBA::ULong i=0;i<coords->length();i++)
2153 coords[i] = currentEnfVertex->coords[i];
2154 enfVertex->coords = coords;
2157 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2160 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2161 faceEntryList->length(currentEnfVertex->faceEntries.size());
2162 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2163 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2164 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2165 enfVertex->faceEntries = faceEntryList;
2168 msg << "Enforced vertex: \n"
2169 << "Name: " << enfVertex->name << "\n";
2170 if (coords->length())
2171 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2172 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2173 << "Group Name: " << enfVertex->grpName;
2176 enfVertexList[j] = enfVertex;
2178 mapElement->enfVertexList = enfVertexList;
2180 resultMap[i] = mapElement;
2183 return resultMap._retn();
2187 * Returns the list of all enforced vertices
2188 * @return a list of enforced vertices
2191 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2192 MESSAGE("IDL: GetAllEnforcedVertices()");
2194 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2195 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2196 resultMap->length(enfVertexList.size());
2197 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2199 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2200 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2201 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2202 MESSAGE("Enforced Vertex #" << i);
2203 currentEnfVertex = (*evlIt);
2204 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2206 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2208 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2210 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2211 coords->length(currentEnfVertex->coords.size());
2212 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2213 coords[ind] = currentEnfVertex->coords[ind];
2214 enfVertex->coords = coords;
2216 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2218 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2219 faceEntryList->length(currentEnfVertex->faceEntries.size());
2220 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2221 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2222 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2223 enfVertex->faceEntries = faceEntryList;
2226 msg << "Enforced vertex: \n"
2227 << "Name: " << enfVertex->name << "\n";
2228 if (coords->length())
2229 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2230 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2231 << "Group Name: " << enfVertex->grpName;
2234 resultMap[i] = enfVertex;
2236 return resultMap._retn();
2241 * Returns the list of enforced vertices coords for a given Face entry.
2242 * They are the coords of the "manual" enforced vertices.
2243 * @return A map of Face entry / List of enforced vertices coords
2246 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2247 MESSAGE("IDL: GetAllCoordsByFace()");
2250 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2252 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2253 resultMap->length(entryCoordsListMap.size());
2254 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2256 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2257 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2258 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2259 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2260 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2261 MESSAGE("Face Entry: " << mapElement->faceEntry);
2263 _coordsList = it_entry->second;
2264 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2265 coordsList->length(_coordsList.size());
2266 MESSAGE("Number of coords: " << coordsList->length());
2268 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2269 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2270 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2271 coords->length((*it_coords).size());
2272 for (CORBA::ULong i=0;i<coords->length();i++)
2273 coords[i] = (*it_coords)[i];
2274 coordsList[j] = coords;
2275 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2277 mapElement->coordsList = coordsList;
2279 resultMap[i] = mapElement;
2282 return resultMap._retn();
2286 * Returns a map of enforced vertices coords / enforced vertex.
2287 * They are the coords of the "manual" enforced vertices.
2289 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2290 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2293 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2294 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2295 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2296 resultMap->length(coordsEnfVertexMap.size());
2297 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2299 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2300 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2301 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2302 MESSAGE("Enforced Vertex #" << i);
2303 currentEnfVertex = (it_coords->second);
2304 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2305 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2306 coords->length(it_coords->first.size());
2307 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2308 coords[ind] = it_coords->first[ind];
2309 mapElement->coords = coords;
2310 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2312 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2314 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2316 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2318 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2319 coords2->length(currentEnfVertex->coords.size());
2320 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2321 coords2[ind] = currentEnfVertex->coords[ind];
2322 enfVertex->coords = coords2;
2324 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2326 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2327 faceEntryList->length(currentEnfVertex->faceEntries.size());
2328 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2329 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2330 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2331 enfVertex->faceEntries = faceEntryList;
2333 mapElement->enfVertex = enfVertex;
2335 msg << "Enforced vertex: \n"
2336 << "Name: " << enfVertex->name << "\n";
2337 if (coords->length())
2338 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2339 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2340 << "Group Name: " << enfVertex->grpName;
2343 resultMap[i] = mapElement;
2345 return resultMap._retn();
2349 * Returns the list of enforced vertices entries for a given Face entry.
2350 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2351 * @return A map of Face entry / List of enforced vertices geom entries
2354 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2355 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2358 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2360 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2361 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2362 resultMap->length(entryEnfVertexEntryListMap.size());
2363 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2365 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2366 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2367 entryEnfVertexEntryListMap.begin();
2368 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2369 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2370 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2371 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2372 MESSAGE("Face Entry: " << mapElement->faceEntry);
2374 _enfVertexEntryList = it_entry->second;
2375 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2376 enfVertexEntryList->length(_enfVertexEntryList.size());
2377 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2379 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2380 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2381 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2382 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2384 mapElement->enfVertexEntryList = enfVertexEntryList;
2386 resultMap[i] = mapElement;
2389 return resultMap._retn();
2393 * Returns a map of enforced vertices geom entry / enforced vertex.
2394 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2396 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2397 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2400 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2401 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2402 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2403 resultMap->length(enfVertexEntryEnfVertexMap.size());
2404 MESSAGE("Enforced Vertex map size is " << resultMap->length());
2406 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2407 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2408 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2409 MESSAGE("Enforced Vertex #" << i);
2410 currentEnfVertex = it_enfVertexEntry->second;
2411 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2412 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2413 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2415 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2417 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2419 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2421 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2422 coords->length(currentEnfVertex->coords.size());
2423 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2424 coords[ind] = currentEnfVertex->coords[ind];
2425 enfVertex->coords = coords;
2427 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2429 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2430 faceEntryList->length(currentEnfVertex->faceEntries.size());
2431 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2432 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2433 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2434 enfVertex->faceEntries = faceEntryList;
2437 msg << "Enforced vertex: \n"
2438 << "Name: " << enfVertex->name << "\n";
2439 if (coords->length())
2440 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2441 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2442 << "Group Name: " << enfVertex->grpName;
2445 mapElement->enfVertex = enfVertex;
2446 resultMap[i] = mapElement;
2448 return resultMap._retn();
2452 * Erase all enforced vertices
2454 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2456 this->GetImpl()->ClearAllEnforcedVertices();
2457 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2461 * Set/get/unset an enforced vertex on face
2463 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2464 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2467 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2468 MESSAGE("theFace shape type is not FACE or COMPOUND");
2469 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2472 string theFaceEntry = theFace->GetStudyEntry();
2474 if (theFaceEntry.empty()) {
2475 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2476 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2478 if (theFace->GetShapeType() == GEOM::FACE)
2480 if (theFace->GetShapeType() == GEOM::COMPOUND)
2481 aName = "Compound_";
2482 aName += theFace->GetEntry();
2483 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2484 if (!theSFace->_is_nil())
2485 theFaceEntry = theSFace->GetID();
2487 if (theFaceEntry.empty())
2488 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2489 MESSAGE("IDL : GetName : " << theFace->GetName());
2490 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2492 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2493 } catch (SALOME_Exception& ex) {
2494 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2499 * Set/get/unset an enforced vertex with name on face
2501 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2502 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2505 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2506 MESSAGE("theFace shape type is not FACE or COMPOUND");
2507 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2510 string theFaceEntry = theFace->GetStudyEntry();
2512 if (theFaceEntry.empty()) {
2513 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2514 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2516 if (theFace->GetShapeType() == GEOM::FACE)
2518 if (theFace->GetShapeType() == GEOM::COMPOUND)
2519 aName = "Compound_";
2520 aName += theFace->GetEntry();
2521 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2522 if (!theSFace->_is_nil())
2523 theFaceEntry = theSFace->GetID();
2525 if (theFaceEntry.empty())
2526 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2528 MESSAGE("IDL : GetName : " << theFace->GetName());
2529 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2531 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2532 } catch (SALOME_Exception& ex) {
2533 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2538 * Set/get/unset an enforced vertex with geom object on face
2540 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2541 throw (SALOME::SALOME_Exception) {
2544 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2545 MESSAGE("theFace shape type is not FACE or COMPOUND");
2546 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2549 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2550 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2551 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2554 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2555 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2556 // if (CORBA::is_nil(measureOp))
2559 // CORBA::Double x, y, z;
2561 // measureOp->PointCoordinates(theVertex, x, y, z);
2563 string theFaceEntry = theFace->GetStudyEntry();
2564 string theVertexEntry = theVertex->GetStudyEntry();
2566 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2567 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2570 if (theFaceEntry.empty()) {
2571 if (theFace->GetShapeType() == GEOM::FACE)
2573 if (theFace->GetShapeType() == GEOM::COMPOUND)
2574 aName = "Compound_";
2575 aName += theFace->GetEntry();
2576 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2577 if (!theSFace->_is_nil())
2578 theFaceEntry = theSFace->GetID();
2580 if (theFaceEntry.empty())
2581 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2583 if (theVertexEntry.empty()) {
2584 if (theVertex->GetShapeType() == GEOM::VERTEX)
2586 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2587 aName = "Compound_";
2588 aName += theVertex->GetEntry();
2589 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2590 if (!theSVertex->_is_nil())
2591 theVertexEntry = theSVertex->GetID();
2593 if (theVertexEntry.empty())
2594 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2596 string theVertexName = theVertex->GetName();
2597 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2598 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2599 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2601 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2602 } catch (SALOME_Exception& ex) {
2603 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2608 * Set an enforced vertex with group name on face
2610 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2611 throw (SALOME::SALOME_Exception)
2615 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2616 MESSAGE("theFace shape type is not FACE or COMPOUND");
2617 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2620 string theFaceEntry = theFace->GetStudyEntry();
2622 if (theFaceEntry.empty()) {
2623 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2624 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2626 if (theFace->GetShapeType() == GEOM::FACE)
2628 if (theFace->GetShapeType() == GEOM::COMPOUND)
2629 aName = "Compound_";
2630 aName += theFace->GetEntry();
2631 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2632 if (!theSFace->_is_nil())
2633 theFaceEntry = theSFace->GetID();
2635 if (theFaceEntry.empty())
2636 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2637 MESSAGE("IDL : GetName : " << theFace->GetName());
2638 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2640 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2641 } catch (SALOME_Exception& ex) {
2642 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2647 * Set an enforced vertex with name and group name on face
2649 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2650 const char* theVertexName, const char* theGroupName)
2651 throw (SALOME::SALOME_Exception)
2655 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2656 MESSAGE("theFace shape type is not FACE or COMPOUND");
2657 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2660 string theFaceEntry = theFace->GetStudyEntry();
2662 if (theFaceEntry.empty()) {
2663 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2664 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2666 if (theFace->GetShapeType() == GEOM::FACE)
2668 if (theFace->GetShapeType() == GEOM::COMPOUND)
2669 aName = "Compound_";
2670 aName += theFace->GetEntry();
2671 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2672 if (!theSFace->_is_nil())
2673 theFaceEntry = theSFace->GetID();
2675 if (theFaceEntry.empty())
2676 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2677 MESSAGE("IDL : GetName : " << theFace->GetName());
2678 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2680 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2681 } catch (SALOME_Exception& ex) {
2682 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2687 * Set an enforced vertex with geom entry and group name on face
2689 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2690 throw (SALOME::SALOME_Exception)
2694 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2695 MESSAGE("theFace shape type is not FACE or COMPOUND");
2696 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2699 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2700 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2701 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2704 string theFaceEntry = theFace->GetStudyEntry();
2705 string theVertexEntry = theVertex->GetStudyEntry();
2707 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2708 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2711 if (theFaceEntry.empty()) {
2712 if (theFace->GetShapeType() == GEOM::FACE)
2714 if (theFace->GetShapeType() == GEOM::COMPOUND)
2715 aName = "Compound_";
2716 aName += theFace->GetEntry();
2717 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2718 if (!theSFace->_is_nil())
2719 theFaceEntry = theSFace->GetID();
2721 if (theFaceEntry.empty())
2722 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2724 if (theVertexEntry.empty()) {
2725 if (theVertex->GetShapeType() == GEOM::VERTEX)
2727 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2728 aName = "Compound_";
2729 aName += theVertex->GetEntry();
2730 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2731 if (!theSVertex->_is_nil())
2732 theVertexEntry = theSVertex->GetID();
2734 if (theVertexEntry.empty())
2735 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2737 string theVertexName = theVertex->GetName();
2738 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2739 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2740 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2742 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2743 } catch (SALOME_Exception& ex) {
2744 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2748 //Enable internal enforced vertices on specific face if requested by user
2750 // * Are internal enforced vertices used for a face ?
2752 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2753 // throw (SALOME::SALOME_Exception) {
2754 // ASSERT(myBaseImpl);
2756 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2757 // MESSAGE("theFace shape type is not FACE or COMPOUND");
2758 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2761 // string theFaceEntry = theFace->GetStudyEntry();
2763 // if (theFaceEntry.empty()) {
2764 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2765 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2767 // if (theFace->GetShapeType() == GEOM::FACE)
2769 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2770 // aName = "Compound_";
2771 // aName += theFace->GetEntry();
2772 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2773 // if (!theSFace->_is_nil())
2774 // theFaceEntry = theSFace->GetID();
2776 // if (theFaceEntry.empty())
2777 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2779 // MESSAGE("IDL : GetName : " << theFace->GetName());
2780 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2782 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2783 // } catch (SALOME_Exception& ex) {
2784 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2789 * Get the list of all enforced vertices
2791 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2792 throw (SALOME::SALOME_Exception) {
2795 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2796 MESSAGE("theFace shape type is not FACE or COMPOUND");
2797 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2800 string theFaceEntry = theFace->GetStudyEntry();
2802 if (theFaceEntry.empty()) {
2803 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2804 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2806 if (theFace->GetShapeType() == GEOM::FACE)
2808 if (theFace->GetShapeType() == GEOM::COMPOUND)
2809 aName = "Compound_";
2810 aName += theFace->GetEntry();
2811 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2812 if (!theSFace->_is_nil())
2813 theFaceEntry = theSFace->GetID();
2815 if (theFaceEntry.empty())
2816 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2818 MESSAGE("IDL : GetName : " << theFace->GetName());
2819 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2821 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2822 } catch (SALOME_Exception& ex) {
2823 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2827 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2828 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2831 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2832 MESSAGE("theFace shape type is not FACE or COMPOUND");
2833 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2836 string theFaceEntry = theFace->GetStudyEntry();
2838 if (theFaceEntry.empty()) {
2839 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2840 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2842 if (theFace->GetShapeType() == GEOM::FACE)
2844 if (theFace->GetShapeType() == GEOM::COMPOUND)
2845 aName = "Compound_";
2846 aName += theFace->GetEntry();
2847 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2848 if (!theSFace->_is_nil())
2849 theFaceEntry = theSFace->GetID();
2851 if (theFaceEntry.empty())
2852 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2853 MESSAGE("IDL : GetName : " << theFace->GetName());
2854 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2857 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2858 } catch (SALOME_Exception& ex) {
2859 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2863 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2864 throw (SALOME::SALOME_Exception) {
2867 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2868 MESSAGE("theFace shape type is not FACE or COMPOUND");
2869 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2871 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2872 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2873 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2876 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2877 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2878 // if (CORBA::is_nil(measureOp))
2881 // CORBA::Double x, y, z;
2883 // measureOp->PointCoordinates(theVertex, x, y, z);
2885 std::string theFaceEntry = theFace->GetStudyEntry();
2886 std::string theVertexEntry = theVertex->GetStudyEntry();
2888 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2889 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2892 if (theFaceEntry.empty()) {
2893 if (theFace->GetShapeType() == GEOM::FACE)
2895 if (theFace->GetShapeType() == GEOM::COMPOUND)
2896 aName = "Compound_";
2897 aName += theFace->GetEntry();
2898 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2899 if (!theSFace->_is_nil())
2900 theFaceEntry = theSFace->GetID();
2902 if (theFaceEntry.empty())
2903 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2905 if (theVertexEntry.empty()) {
2906 if (theVertex->GetShapeType() == GEOM::VERTEX)
2908 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2909 aName = "Compound_";
2910 aName += theVertex->GetEntry();
2911 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2912 if (!theSVertex->_is_nil())
2913 theVertexEntry = theSVertex->GetID();
2915 if (theVertexEntry.empty())
2916 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2918 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2921 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2922 } catch (SALOME_Exception& ex) {
2923 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2927 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2930 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2931 MESSAGE("theFace shape type is not FACE or COMPOUND");
2932 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2935 string theFaceEntry = theFace->GetStudyEntry();
2937 if (theFaceEntry.empty()) {
2938 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2939 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2941 if (theFace->GetShapeType() == GEOM::FACE)
2943 if (theFace->GetShapeType() == GEOM::COMPOUND)
2944 aName = "Compound_";
2945 aName += theFace->GetEntry();
2946 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2947 if (!theSFace->_is_nil())
2948 theFaceEntry = theSFace->GetID();
2950 if (theFaceEntry.empty())
2951 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2953 MESSAGE("IDL : GetName : " << theFace->GetName());
2954 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2957 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2958 } catch (SALOME_Exception& ex) {
2959 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2964 * Set/get/unset an enforced vertex on geom object given by entry
2966 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2967 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2968 throw (SALOME::SALOME_Exception) {
2970 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2971 bool newValue = false;
2972 if (string(theVertexEntry).empty()) {
2974 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2975 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2976 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2977 coords.push_back(x);
2978 coords.push_back(y);
2979 coords.push_back(z);
2980 if (coordsList.find(coords) == coordsList.end()) {
2981 MESSAGE("Coords not found: add it in coordsList");
2984 MESSAGE("Coords already found, compare names");
2985 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2986 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2987 MESSAGE("The names are different: update");
2988 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2992 MESSAGE("The names are identical");
2995 } catch (const std::invalid_argument& ex) {
2996 // no enforced vertex for entry
2997 MESSAGE("Face entry not found : add it to the list");
3001 if (string(theVertexName).empty()) {
3002 if (string(theGroupName).empty())
3003 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
3005 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3008 if (string(theGroupName).empty())
3009 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3011 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
3012 << theVertexName << "\", \"" << theGroupName << "\")";
3017 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3018 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3019 if ( it == enfVertexEntryList.end()) {
3020 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
3024 MESSAGE("Geom entry already found, compare names");
3025 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3026 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3027 MESSAGE("The names are different: update");
3028 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
3032 MESSAGE("The names are identical");
3035 } catch (const std::invalid_argument& ex) {
3036 // no enforced vertex for entry
3037 MESSAGE("Face entry not found : add it to the list");
3041 if (string(theGroupName).empty())
3042 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3044 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
3049 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3051 MESSAGE("IDL : SetEnforcedVertexEntry END");
3055 //Enable internal enforced vertices on specific face if requested by user
3056 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
3057 // throw (SALOME::SALOME_Exception) {
3058 // ASSERT(myBaseImpl);
3060 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
3061 // } catch (const std::exception& ex) {
3062 // std::cout << "Exception: " << ex.what() << std::endl;
3063 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3067 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3068 throw (SALOME::SALOME_Exception) {
3070 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
3073 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3074 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3075 vertexList->length(_vList.size());
3076 MESSAGE("Number of enforced vertices: " << vertexList->length());
3077 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3078 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3079 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3081 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3084 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3085 // Geom Vertex Entry
3086 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3088 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3089 coords->length(_enfVertex->coords.size());
3090 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3091 coords[ind] = _enfVertex->coords[ind];
3092 enfVertex->coords = coords;
3094 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3096 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3097 faceEntryList->length(_enfVertex->faceEntries.size());
3098 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3099 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3100 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3101 enfVertex->faceEntries = faceEntryList;
3103 vertexList[i] = enfVertex;
3105 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3106 return vertexList._retn();
3107 } catch (const std::invalid_argument& ex) {
3108 SALOME::ExceptionStruct ExDescription;
3109 ExDescription.text = ex.what();
3110 ExDescription.type = SALOME::BAD_PARAM;
3111 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3112 ExDescription.lineNumber = 1385;
3113 throw SALOME::SALOME_Exception(ExDescription);
3114 } catch (const std::exception& ex) {
3115 std::cout << "Exception: " << ex.what() << std::endl;
3116 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3120 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
3121 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
3123 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
3127 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3129 if (string(theVertexEntry).empty())
3130 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
3133 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3135 } catch (const std::invalid_argument& ex) {
3137 } catch (const std::exception& ex) {
3138 std::cout << "Exception: " << ex.what() << std::endl;
3139 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3142 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3146 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
3147 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
3148 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
3150 // bool ret = false;
3153 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
3154 // } catch (SALOME_Exception& ex) {
3155 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3159 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
3162 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
3166 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
3168 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
3171 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3172 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
3173 } catch (const std::invalid_argument& ex) {
3175 } catch (const std::exception& ex) {
3176 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3179 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
3183 //=============================================================================
3185 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3189 //=============================================================================
3190 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
3191 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
3193 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3194 std::string theValueStr = theValue ? "True" : "False";
3195 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3198 //=============================================================================
3200 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3204 //=============================================================================
3205 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
3206 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
3208 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3211 //=============================================================================
3213 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3217 //=============================================================================
3218 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
3219 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
3221 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3222 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3225 //=============================================================================
3227 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3231 //=============================================================================
3232 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
3233 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
3235 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3239 * Enable internal enforced vertices on specific face if requested by user
3241 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3242 throw (SALOME::SALOME_Exception)
3244 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3246 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3247 } catch (SALOME_Exception& ex) {
3248 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3252 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3253 throw (SALOME::SALOME_Exception)
3255 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3257 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3258 MESSAGE("theFace shape type is not FACE or COMPOUND");
3259 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3262 string theFaceEntry = theFace->GetStudyEntry();
3264 if (theFaceEntry.empty()) {
3265 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3266 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3268 if (theFace->GetShapeType() == GEOM::FACE)
3270 if (theFace->GetShapeType() == GEOM::COMPOUND)
3271 aName = "Compound_";
3272 aName += theFace->GetEntry();
3273 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3274 if (!theSFace->_is_nil())
3275 theFaceEntry = theSFace->GetID();
3277 if (theFaceEntry.empty())
3278 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3280 MESSAGE("IDL : GetName : " << theFace->GetName());
3281 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3283 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3284 } catch (SALOME_Exception& ex) {
3285 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3289 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3290 throw (SALOME::SALOME_Exception)
3292 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3295 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3296 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3297 if (string(theGroupName).empty())
3298 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3300 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3301 } catch (const std::exception& ex) {
3302 std::cout << "Exception: " << ex.what() << std::endl;
3303 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3310 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3311 throw (SALOME::SALOME_Exception)
3314 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3316 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3318 catch (const std::invalid_argument& ex) {
3319 SALOME::ExceptionStruct ExDescription;
3320 ExDescription.text = ex.what();
3321 ExDescription.type = SALOME::BAD_PARAM;
3322 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3323 ExDescription.lineNumber = 1146;
3324 throw SALOME::SALOME_Exception(ExDescription);
3326 catch (SALOME_Exception& ex) {
3327 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3329 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3334 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3335 throw (SALOME::SALOME_Exception)
3338 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3340 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3342 catch (const std::invalid_argument& ex) {
3343 SALOME::ExceptionStruct ExDescription;
3344 ExDescription.text = ex.what();
3345 ExDescription.type = SALOME::BAD_PARAM;
3346 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3347 ExDescription.lineNumber = 1170;
3348 throw SALOME::SALOME_Exception(ExDescription);
3350 catch (SALOME_Exception& ex) {
3351 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3354 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3355 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3357 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3360 ///////////////////////
3362 ///////////////////////
3364 ///////////////////////
3367 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3369 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3370 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3371 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3372 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3373 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3374 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3375 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3376 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3377 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3378 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3379 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3380 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3381 return txtShapeType;
3384 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3386 // Check shape types
3388 std::stringstream typesTxt;
3389 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3391 GEOM::shape_type theShapeType = theShapeTypes[i];
3392 if (shape->GetShapeType() == theShapeType)
3394 typesTxt << ShapeTypeToString(theShapeType);
3395 if (i < theShapeTypes.size()-1 )
3399 std::stringstream msg;
3400 msg << "shape shape type is not in" << typesTxt.str();
3402 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3406 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3409 if (shape->GetShapeType() != theShapeType) {
3410 std::stringstream msg;
3411 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3413 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3417 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3419 // Check shape is published in the object browser
3420 string shapeEntry = shape->GetStudyEntry();
3422 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3423 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3426 // Publish shape if needed
3427 if (shapeEntry.empty()) {
3428 if (shape->GetShapeType() == theShapeType)
3430 aName += shape->GetEntry();
3431 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3432 if (!theSFace1->_is_nil())
3433 shapeEntry = theSFace1->GetID();
3435 if (shapeEntry.empty())
3436 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3440 // Format the output of two vectors to use it in MESSAGE and PythonDump
3441 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3443 std::stringstream listEntriesTxt;
3445 if (!theSourceVerticesEntries.empty())
3447 listEntriesTxt << ", [" ;
3449 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3452 listEntriesTxt << ", ";
3453 listEntriesTxt << *it;
3456 listEntriesTxt << "], [" ;
3458 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3461 listEntriesTxt << ", ";
3462 listEntriesTxt << *it;
3464 listEntriesTxt << "]" ;
3466 return listEntriesTxt.str();
3470 * Erase all PreCad periodicity associations
3472 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3474 this->GetImpl()->ClearPreCadPeriodicityVectors();
3475 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3478 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3480 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3481 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3482 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3484 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3486 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3487 return periodicityList._retn();
3490 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3492 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3493 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3494 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3496 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3498 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3499 return periodicityList._retn();
3502 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3503 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3505 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3506 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3508 periodicityList->length(preCadPeriodicityVector.size());
3510 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3512 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3514 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3515 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3516 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3518 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3519 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3521 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3522 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3523 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3526 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3528 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3529 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3531 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3532 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3533 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3536 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3538 periodicityList[i] = myPreCadPeriodicity;
3542 return periodicityList._retn();
3546 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3547 throw (SALOME::SALOME_Exception)
3550 const GEOM::ListOfGO theSourceVertices;
3551 const GEOM::ListOfGO theTargetVertices;
3552 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3556 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3557 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3558 throw (SALOME::SALOME_Exception)
3561 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3563 size_t theLength = theSourceVertices.length();
3564 if (theLength != theTargetVertices.length())
3565 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3567 std::vector<GEOM::shape_type> allowedShapeTypes;
3568 allowedShapeTypes.push_back(GEOM::FACE);
3569 allowedShapeTypes.push_back(GEOM::COMPOUND);
3571 string prefix1 = "Source_face_";
3572 CheckShapeTypes(theFace1, allowedShapeTypes);
3573 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3575 string prefix2 = "Target_face_";
3576 CheckShapeTypes(theFace2, allowedShapeTypes);
3577 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3579 string prefix3 = "Source_vertex_";
3580 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3581 theSourceVerticesEntries->length(theLength);
3582 GEOM::GEOM_Object_ptr theVtx_i;
3584 for (size_t ind = 0; ind < theLength; ind++) {
3585 theVtx_i = theSourceVertices[ind];
3586 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3587 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3590 string prefix4 = "Target_vertex_";
3591 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3592 theTargetVerticesEntries->length(theLength);
3593 for (size_t ind = 0; ind < theLength; ind++) {
3594 theVtx_i = theTargetVertices[ind];
3595 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3596 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3599 string theFace2Name = theFace2->GetName();
3600 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3601 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3602 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3604 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3605 theSourceVerticesEntries, theTargetVerticesEntries);
3606 } catch (SALOME_Exception& ex) {
3607 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3612 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3613 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3614 throw (SALOME::SALOME_Exception)
3619 // Convert BLSURFPlugin::TEntryList to vector<string>
3620 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3621 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3622 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3623 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3626 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3628 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3630 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3631 theSourceVerticesEntries, theTargetVerticesEntries);
3633 SMESH::TPythonDump pd;
3634 if (!theSourceVerticesEntries.empty())
3636 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3637 pd << listEntriesTxt.c_str();
3641 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3642 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3645 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3646 throw (SALOME::SALOME_Exception)
3649 const GEOM::ListOfGO theSourceVertices;
3650 const GEOM::ListOfGO theTargetVertices;
3651 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3654 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3655 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3656 throw (SALOME::SALOME_Exception)
3658 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3661 size_t theLength = theSourceVertices.length();
3662 if (theLength != theTargetVertices.length())
3663 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3665 std::vector<GEOM::shape_type> allowedShapeTypes;
3666 allowedShapeTypes.push_back(GEOM::EDGE);
3667 allowedShapeTypes.push_back(GEOM::COMPOUND);
3669 string prefix1 = "Source_edge_";
3670 CheckShapeTypes(theEdge1, allowedShapeTypes);
3671 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3673 string prefix2 = "Target_edge_";
3674 CheckShapeTypes(theEdge2, allowedShapeTypes);
3675 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3677 string prefix3 = "Source_vertex_";
3678 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3679 theSourceVerticesEntries->length(theLength);
3680 GEOM::GEOM_Object_ptr theVtx_i;
3682 for (size_t ind = 0; ind < theLength; ind++) {
3683 theVtx_i = theSourceVertices[ind];
3684 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3685 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3688 string prefix4 = "Target_vertex_";
3689 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3690 theTargetVerticesEntries->length(theLength);
3691 for (size_t ind = 0; ind < theLength; ind++) {
3692 theVtx_i = theTargetVertices[ind];
3693 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3694 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3697 string theEdge2Name = theEdge2->GetName();
3698 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3699 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3700 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3702 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3703 theSourceVerticesEntries, theTargetVerticesEntries);
3704 } catch (SALOME_Exception& ex) {
3705 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3710 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3711 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3712 throw (SALOME::SALOME_Exception)
3717 // Convert BLSURFPlugin::TEntryList to vector<string>
3718 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3719 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3720 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3721 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3724 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3726 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3727 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3728 theSourceVerticesEntries, theTargetVerticesEntries);
3730 SMESH::TPythonDump pd;
3731 if (!theSourceVerticesEntries.empty())
3733 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3734 pd << listEntriesTxt.c_str();
3738 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3740 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3744 //================================================================================
3746 * \brief Sets the file for export resulting mesh in GMF format
3747 * \param theFileName - full name of the file (.mesh, .meshb)
3749 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3751 //================================================================================
3752 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3753 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3755 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3756 bool valueChanged/*, modeChanged*/ = false;
3758 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3759 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3760 if (valueChanged)// or (!valueChanged && modeChanged))
3761 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3762 } catch (const std::exception& ex) {
3763 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3765 if (valueChanged)// or (!valueChanged && modeChanged))
3766 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3767 MESSAGE("IDL : SetGMFFile END ");
3770 //================================================================================
3772 * \brief Gets the file name for export resulting mesh in GMF format
3773 * \retval char* - The file name
3775 * Returns the GMF file name
3777 //================================================================================
3778 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3780 // MESSAGE("IDL : GetGMFFile()");
3781 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3784 // //================================================================================
3786 // * \brief Gets the file mode for export resulting mesh in GMF format
3787 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3789 // * Returns the GMF file mode
3791 // //================================================================================
3792 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3793 // ASSERT(myBaseImpl);
3794 // MESSAGE("IDL : GetGMFFileMode()");
3795 // return this->GetImpl()->GetGMFFileMode();
3798 //=============================================================================
3800 * BLSURFPlugin_Hypothesis_i::GetImpl
3802 * Get implementation
3804 //=============================================================================
3805 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3806 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3807 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3810 //================================================================================
3812 * \brief Verify whether hypothesis supports given entity type
3813 * \param type - dimension (see SMESH::Dimension enumeration)
3814 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3816 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3818 //================================================================================
3819 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3820 return type == SMESH::DIM_2D;
3824 // Obsolete methods - To be removed in V7
3827 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3828 this->SetMinSize(theMinSize);
3830 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3831 return this->GetMinSize();
3833 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3834 this->SetMaxSize(theMaxSize);
3836 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3837 return this->GetMaxSize();
3839 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3840 this->SetMinSize(theMinSize);
3842 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3843 return this->GetMinSize();
3845 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3846 this->SetMaxSize(theMaxSize);
3848 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3849 return this->GetMaxSize();
3851 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3852 this->SetAngleMesh(theValue);
3854 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3855 return this->GetAngleMesh();
3857 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3858 this->SetAngleMesh(theValue);
3860 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3861 return this->GetAngleMesh();
3863 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3864 std::string theValueStr = theValue ? "1" : "0";
3865 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3867 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3868 std::string theValueStr = this->GetOptionValue("respect_geometry");
3869 if (theValueStr.empty() || theValueStr == "respect")
3873 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3874 std::string theValueStr = theValue ? "1" : "0";
3875 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3877 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3878 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3879 if (theValueStr == "1")
3883 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3884 std::ostringstream theValueStr;
3885 theValueStr << theValue;
3886 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3888 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3889 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3891 theValueStr >> result;