1 // Copyright (C) 2007-2015 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>
40 //=============================================================================
42 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
46 //=============================================================================
47 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
48 ::SMESH_Gen* theGenImpl) :
49 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
50 MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
51 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
54 //=============================================================================
56 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
60 //=============================================================================
61 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
62 MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 //=============================================================================
67 //=============================================================================
69 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
74 //=============================================================================
75 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
76 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
78 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
79 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
82 //=============================================================================
84 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
88 //=============================================================================
89 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
90 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
92 return this->GetImpl()->GetPhysicalMesh();
95 //=============================================================================
97 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
102 //=============================================================================
103 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
104 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
106 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
107 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
110 //=============================================================================
112 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
116 //=============================================================================
117 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
118 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
120 return this->GetImpl()->GetGeometricMesh();
123 //=============================================================================
125 * BLSURFPlugin_Hypothesis_i::SetPhySize
129 //=============================================================================
130 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
131 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
133 this->GetImpl()->SetPhySize(theValue, false);
134 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
137 //=============================================================================
139 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
141 * Set Relative PhySize
143 //=============================================================================
144 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
145 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
147 this->GetImpl()->SetPhySize(theValue, true);
148 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
151 //=============================================================================
153 * BLSURFPlugin_Hypothesis_i::GetPhySize
157 //=============================================================================
158 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
159 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
161 return this->GetImpl()->GetPhySize();
164 //=============================================================================
166 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
168 * Returns True if PhySize is relative
170 //=============================================================================
171 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
172 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
174 return this->GetImpl()->IsPhySizeRel();
177 //=============================================================================
178 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
180 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
181 this->GetImpl()->SetMinSize(theMinSize, false);
182 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
186 //=============================================================================
187 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
189 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
190 this->GetImpl()->SetMinSize(theMinSize, true);
191 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
195 //=============================================================================
196 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
198 return this->GetImpl()->GetMinSize();
201 //=============================================================================
202 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
203 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
205 return this->GetImpl()->IsMinSizeRel();
208 //=============================================================================
209 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
211 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
212 this->GetImpl()->SetMaxSize(theMaxSize, false);
213 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
217 //=============================================================================
218 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
220 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
221 this->GetImpl()->SetMaxSize(theMaxSize, true);
222 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
226 //=============================================================================
227 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
229 return this->GetImpl()->GetMaxSize();
232 //=============================================================================
233 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
234 // MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
236 return this->GetImpl()->IsMaxSizeRel();
239 //=============================================================================
241 * BLSURFPlugin_Hypothesis_i::SetGradation
245 //=============================================================================
246 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
247 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
249 this->GetImpl()->SetGradation(theValue);
250 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
253 //=============================================================================
255 * BLSURFPlugin_Hypothesis_i::GetGradation
259 //=============================================================================
260 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
261 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
263 return this->GetImpl()->GetGradation();
266 //=============================================================================
268 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
272 //=============================================================================
273 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
274 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
276 this->GetImpl()->SetQuadAllowed(theValue);
277 std::string theValueStr = theValue ? "True" : "False";
278 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
281 //=============================================================================
283 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
287 //=============================================================================
288 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
289 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
291 return this->GetImpl()->GetQuadAllowed();
294 //=============================================================================
296 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
300 //=============================================================================
301 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
302 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
304 this->GetImpl()->SetAngleMesh(theValue);
305 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
308 //=============================================================================
310 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
314 //=============================================================================
315 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
316 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
318 return this->GetImpl()->GetAngleMesh();
321 //=============================================================================
323 * BLSURFPlugin_Hypothesis_i::SetChordalError
327 //=============================================================================
328 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
329 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
331 this->GetImpl()->SetChordalError(theValue);
332 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
335 //=============================================================================
337 * BLSURFPlugin_Hypothesis_i::GetChordalError
341 //=============================================================================
342 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
343 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
345 return this->GetImpl()->GetChordalError();
348 //=============================================================================
350 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
354 //=============================================================================
355 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
356 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
358 this->GetImpl()->SetAnisotropic(theValue);
359 std::string theValueStr = theValue ? "True" : "False";
360 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
363 //=============================================================================
365 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
369 //=============================================================================
370 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
371 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
373 return this->GetImpl()->GetAnisotropic();
376 //=============================================================================
378 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
380 * Set Anisotropic Ratio
382 //=============================================================================
383 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
384 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
386 this->GetImpl()->SetAnisotropicRatio(theValue);
387 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
394 * Get Anisotropic Ratio
396 //=============================================================================
397 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
398 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
400 return this->GetImpl()->GetAnisotropicRatio();
404 //=============================================================================
406 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
410 //=============================================================================
411 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
412 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
414 this->GetImpl()->SetRemoveTinyEdges(theValue);
415 std::string theValueStr = theValue ? "True" : "False";
416 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
419 //=============================================================================
421 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
425 //=============================================================================
426 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
427 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
429 return this->GetImpl()->GetRemoveTinyEdges();
432 //=============================================================================
434 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
436 * Set Tiny Edge Length
438 //=============================================================================
439 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
440 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
442 this->GetImpl()->SetTinyEdgeLength(theValue);
443 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
446 //=============================================================================
448 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
450 * Get Tiny Edge Length
452 //=============================================================================
453 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
454 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
456 return this->GetImpl()->GetTinyEdgeLength();
459 //=============================================================================
461 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
465 //=============================================================================
466 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
467 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
469 this->GetImpl()->SetBadElementRemoval(theValue);
470 std::string theValueStr = theValue ? "True" : "False";
471 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
474 //=============================================================================
476 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
480 //=============================================================================
481 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
482 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
484 return this->GetImpl()->GetBadElementRemoval();
487 //=============================================================================
489 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
491 * Set Bad Surface Element Aspect Ratio
493 //=============================================================================
494 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
495 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
497 this->GetImpl()->SetBadElementAspectRatio(theValue);
498 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
501 //=============================================================================
503 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
505 * Get Bad Surface Element Aspect Ratio
507 //=============================================================================
508 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
509 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
511 return this->GetImpl()->GetBadElementAspectRatio();
514 //=============================================================================
516 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
520 //=============================================================================
521 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
522 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
524 this->GetImpl()->SetOptimizeMesh(theValue);
525 std::string theValueStr = theValue ? "True" : "False";
526 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
529 //=============================================================================
531 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
535 //=============================================================================
536 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
537 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
539 return this->GetImpl()->GetOptimizeMesh();
542 //=============================================================================
544 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
548 //=============================================================================
549 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
550 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
552 this->GetImpl()->SetQuadraticMesh(theValue);
553 std::string theValueStr = theValue ? "True" : "False";
554 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
557 //=============================================================================
559 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
563 //=============================================================================
564 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
565 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
567 return this->GetImpl()->GetQuadraticMesh();
575 * BLSURFPlugin_Hypothesis_i::SetTopology
580 //=============================================================================
581 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
582 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
584 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
585 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
588 //=============================================================================
590 * BLSURFPlugin_Hypothesis_i::GetTopology
594 //=============================================================================
595 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
596 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
598 return this->GetImpl()->GetTopology();
601 //=============================================================================
602 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
604 if (theVal < 0 || theVal > 100)
605 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
606 this->GetImpl()->SetVerbosity(theVal);
607 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
610 //=============================================================================
612 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
614 return (CORBA::Short) this->GetImpl()->GetVerbosity();
617 //=============================================================================
619 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
623 //=============================================================================
624 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
625 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
627 this->GetImpl()->SetPreCADMergeEdges(theValue);
628 std::string theValueStr = theValue ? "True" : "False";
629 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
638 //=============================================================================
639 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
640 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
642 return this->GetImpl()->GetPreCADMergeEdges();
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
651 //=============================================================================
652 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
653 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
655 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
656 std::string theValueStr = theValue ? "True" : "False";
657 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
660 //=============================================================================
662 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
666 //=============================================================================
667 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
668 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
670 return this->GetImpl()->GetPreCADProcess3DTopology();
673 //=============================================================================
675 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
679 //=============================================================================
680 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
681 // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
683 this->GetImpl()->SetPreCADDiscardInput(theValue);
684 std::string theValueStr = theValue ? "True" : "False";
685 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
688 //=============================================================================
690 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
694 //=============================================================================
695 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
696 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
698 return this->GetImpl()->GetPreCADDiscardInput();
702 //=============================================================================
704 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
705 throw (SALOME::SALOME_Exception) {
707 bool valueChanged = false;
709 valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
711 this->GetImpl()->SetOptionValue(optionName, optionValue);
712 } catch (const std::invalid_argument& ex) {
713 SALOME::ExceptionStruct ExDescription;
714 ExDescription.text = ex.what();
715 ExDescription.type = SALOME::BAD_PARAM;
716 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
717 ExDescription.lineNumber = 0;
718 throw SALOME::SALOME_Exception(ExDescription);
719 } catch (SALOME_Exception& ex) {
720 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
723 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
726 //=============================================================================
728 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
729 throw (SALOME::SALOME_Exception) {
731 bool valueChanged = false;
733 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
735 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
736 } catch (const std::invalid_argument& ex) {
737 SALOME::ExceptionStruct ExDescription;
738 ExDescription.text = ex.what();
739 ExDescription.type = SALOME::BAD_PARAM;
740 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
741 ExDescription.lineNumber = 0;
742 throw SALOME::SALOME_Exception(ExDescription);
743 } catch (SALOME_Exception& ex) {
744 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
747 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
750 //=============================================================================
752 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
755 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
756 } catch (const std::invalid_argument& ex) {
757 SALOME::ExceptionStruct ExDescription;
758 ExDescription.text = ex.what();
759 ExDescription.type = SALOME::BAD_PARAM;
760 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
761 ExDescription.lineNumber = 0;
762 throw SALOME::SALOME_Exception(ExDescription);
763 } catch (SALOME_Exception& ex) {
764 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
769 //=============================================================================
771 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
774 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
775 } catch (const std::invalid_argument& ex) {
776 SALOME::ExceptionStruct ExDescription;
777 ExDescription.text = ex.what();
778 ExDescription.type = SALOME::BAD_PARAM;
779 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
780 ExDescription.lineNumber = 0;
781 throw SALOME::SALOME_Exception(ExDescription);
782 } catch (SALOME_Exception& ex) {
783 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
788 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
792 this->GetImpl()->ClearOption(optionName);
793 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
796 //=============================================================================
798 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
800 this->GetImpl()->ClearPreCADOption(optionName);
801 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
804 //=============================================================================
806 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
808 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
810 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
811 result->length(opts.size());
813 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
814 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
815 string name_value = opIt->first;
816 if (!opIt->second.empty()) {
818 name_value += opIt->second;
820 result[i] = CORBA::string_dup(name_value.c_str());
822 return result._retn();
825 //=============================================================================
827 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
829 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
831 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
832 result->length(opts.size());
834 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
835 for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
836 string name_value = opIt->first;
837 if (!opIt->second.empty()) {
839 name_value += opIt->second;
841 result[i] = CORBA::string_dup(name_value.c_str());
843 return result._retn();
846 //=============================================================================
848 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
849 throw (SALOME::SALOME_Exception) {
851 for (int i = 0; i < options.length(); ++i) {
852 string name_value = options[i].in();
853 int colonPos = name_value.find(':');
855 if (colonPos == string::npos) // ':' not found
858 name = name_value.substr(0, colonPos);
859 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
860 value = name_value.substr(colonPos + 1);
862 SetOptionValue(name.c_str(), value.c_str());
866 //=============================================================================
868 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
869 throw (SALOME::SALOME_Exception) {
871 for (int i = 0; i < options.length(); ++i) {
872 string name_value = options[i].in();
873 int colonPos = name_value.find(':');
875 if (colonPos == string::npos) // ':' not found
878 name = name_value.substr(0, colonPos);
879 if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
880 value = name_value.substr(colonPos + 1);
882 SetPreCADOptionValue(name.c_str(), value.c_str());
886 //=============================================================================
888 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
889 throw (SALOME::SALOME_Exception) {
891 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
892 bool valueChanged = false;
894 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
896 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
897 } catch (const std::invalid_argument& ex) {
898 SALOME::ExceptionStruct ExDescription;
899 ExDescription.text = ex.what();
900 ExDescription.type = SALOME::BAD_PARAM;
901 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
902 ExDescription.lineNumber = 0;
903 throw SALOME::SALOME_Exception(ExDescription);
904 } catch (SALOME_Exception& ex) {
905 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
907 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
909 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
912 //=============================================================================
914 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
915 throw (SALOME::SALOME_Exception) {
917 MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
918 bool valueChanged = false;
919 std::ostringstream sizeMapFunction;
921 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
922 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
923 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
926 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
928 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
929 } catch (const std::invalid_argument& ex) {
930 SALOME::ExceptionStruct ExDescription;
931 ExDescription.text = ex.what();
932 ExDescription.type = SALOME::BAD_PARAM;
933 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
934 ExDescription.lineNumber = 0;
935 throw SALOME::SALOME_Exception(ExDescription);
936 } catch (SALOME_Exception& ex) {
937 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
939 MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
941 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
944 //=============================================================================
946 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
947 throw (SALOME::SALOME_Exception) {
949 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
950 bool valueChanged = false;
952 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
953 if ( valueChanged ) {
954 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
955 if (!boost::regex_match(string(attractor), re))
956 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
957 this->GetImpl()->SetAttractorEntry(entry, attractor);
959 } catch (const std::invalid_argument& ex) {
960 SALOME::ExceptionStruct ExDescription;
961 ExDescription.text = ex.what();
962 ExDescription.type = SALOME::BAD_PARAM;
963 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
964 ExDescription.lineNumber = 0;
965 throw SALOME::SALOME_Exception(ExDescription);
966 } catch (SALOME_Exception& ex) {
967 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
969 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
971 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
974 //=============================================================================
976 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
977 throw (SALOME::SALOME_Exception)
980 MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
981 bool valueChanged = false;
983 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
985 catch (const std::invalid_argument& ex) {
986 SALOME::ExceptionStruct ExDescription;
987 ExDescription.text = ex.what();
988 ExDescription.type = SALOME::BAD_PARAM;
989 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
990 ExDescription.lineNumber = 0;
991 throw SALOME::SALOME_Exception(ExDescription);
992 } catch (SALOME_Exception& ex) {
993 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
996 //if ( valueChanged )
997 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( '"
998 << entry << "', '" << att_entry << "', "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1001 //=============================================================================
1003 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1006 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1007 } catch (const std::invalid_argument& ex) {
1008 SALOME::ExceptionStruct ExDescription;
1009 ExDescription.text = ex.what();
1010 ExDescription.type = SALOME::BAD_PARAM;
1011 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1012 ExDescription.lineNumber = 0;
1013 throw SALOME::SALOME_Exception(ExDescription);
1014 } catch (SALOME_Exception& ex) {
1015 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1020 //=============================================================================
1022 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1025 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1026 } catch (const std::invalid_argument& ex) {
1027 SALOME::ExceptionStruct ExDescription;
1028 ExDescription.text = ex.what();
1029 ExDescription.type = SALOME::BAD_PARAM;
1030 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1031 ExDescription.lineNumber = 0;
1032 throw SALOME::SALOME_Exception(ExDescription);
1033 } catch (SALOME_Exception& ex) {
1034 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1039 // //=============================================================================
1041 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1042 // // A finir pour le dump
1043 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1044 // throw (SALOME::SALOME_Exception)
1046 // ASSERT(myBaseImpl);
1048 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1050 // catch (const std::invalid_argument& ex) {
1051 // SALOME::ExceptionStruct ExDescription;
1052 // ExDescription.text = ex.what();
1053 // ExDescription.type = SALOME::BAD_PARAM;
1054 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1055 // ExDescription.lineNumber = 0;
1056 // throw SALOME::SALOME_Exception(ExDescription);
1058 // catch (SALOME_Exception& ex) {
1059 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1064 //=============================================================================
1066 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1068 this->GetImpl()->ClearEntry(entry);
1069 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1072 //=============================================================================
1074 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1076 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1078 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1079 result->length(sizeMaps.size());
1081 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1082 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1083 string entry_sizemap = smIt->first;
1084 if (!smIt->second.empty()) {
1085 entry_sizemap += "|";
1086 entry_sizemap += smIt->second;
1088 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1090 return result._retn();
1093 //=============================================================================
1095 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1097 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1099 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1100 result->length(attractors.size());
1102 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1103 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1104 string entry_attractor = atIt->first;
1105 if (!atIt->second.empty()) {
1106 entry_attractor += "|";
1107 entry_attractor += atIt->second;
1109 result[i] = CORBA::string_dup(entry_attractor.c_str());
1111 return result._retn();
1114 //=============================================================================
1116 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1119 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1121 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1122 result->length( attractors.size() );
1124 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1125 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1126 string faceEntry = atIt->first;
1128 double startSize, endSize, infDist, constDist;
1129 if ( !atIt->second->Empty() ) {
1130 attEntry = atIt->second->GetAttractorEntry();
1131 MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1132 std::vector<double> params = atIt->second->GetParameters();
1133 startSize = params[0];
1134 endSize = params[1];
1135 infDist = params[2];
1136 constDist = params[3];
1138 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1139 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1140 result[i].startSize = startSize;
1141 result[i].endSize = endSize;
1142 result[i].infDist = infDist;
1143 result[i].constDist = constDist;
1144 MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1145 MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1147 return result._retn();
1150 //=============================================================================
1152 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1153 throw (SALOME::SALOME_Exception) {
1155 for (int i = 0; i < sizeMaps.length(); ++i) {
1156 string entry_sizemap = sizeMaps[i].in();
1157 int colonPos = entry_sizemap.find('|');
1158 string entry, sizemap;
1159 if (colonPos == string::npos) // '|' separator not found
1160 entry = entry_sizemap;
1162 entry = entry_sizemap.substr(0, colonPos);
1163 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1164 sizemap = entry_sizemap.substr(colonPos + 1);
1166 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1170 //=============================================================================
1172 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1174 this->GetImpl()->ClearSizeMaps();
1177 //=============================================================================
1179 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {
1182 entry = GeomObj->GetStudyEntry();
1183 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1184 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1185 SetSizeMapEntry(entry.c_str(), sizeMap);
1188 //=============================================================================
1190 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1192 string entry = GeomObj->GetStudyEntry();
1193 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1194 if (shapeType == GEOM::COMPOUND)
1195 shapeType = GeomObj->GetMaxShapeType();
1196 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1197 MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1198 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1201 //=============================================================================
1202 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1205 entry = GeomObj->GetStudyEntry();
1206 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1207 MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1208 UnsetEntry(entry.c_str());
1209 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1212 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1215 entry = GeomObj->GetStudyEntry();
1216 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1217 MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1218 SetAttractorEntry(entry.c_str(), attractor);
1221 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1224 entry = GeomObj->GetStudyEntry();
1225 MESSAGE("IDL : GetName : " << GeomObj->GetName());
1226 MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1227 UnsetEntry(entry.c_str());
1228 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1231 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)
1234 string theFaceEntry;
1236 theFaceEntry = theFace->GetStudyEntry();
1237 theAttEntry = theAttractor->GetStudyEntry();
1239 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1240 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1243 if (theFaceEntry.empty()) {
1245 aName += theFace->GetEntry();
1246 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1247 if (!theSFace->_is_nil())
1248 theFaceEntry = theSFace->GetID();
1250 if (theFaceEntry.empty())
1251 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1253 if (theAttEntry.empty()) {
1254 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1256 if (theAttractor->GetShapeType() == GEOM::EDGE)
1258 if (theAttractor->GetShapeType() == GEOM::WIRE)
1260 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1261 aName = "Compound_";
1262 aName += theAttractor->GetEntry();
1263 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1264 if (!theSAtt->_is_nil())
1265 theAttEntry = theSAtt->GetID();
1267 if (theAttEntry.empty())
1268 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1270 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1271 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1272 MESSAGE("IDL : GetName : " << theFace->GetName());
1273 MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1274 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1277 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1278 GEOM::GEOM_Object_ptr theAttractor)
1281 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1282 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1284 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1285 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1288 // if (theFaceEntry.empty()) {
1290 // aName += theFace->GetEntry();
1291 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1292 // if (!theSFace->_is_nil())
1293 // theFaceEntry = theSFace->GetID();
1295 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1296 !theAttrEntry.in() || !theAttrEntry.in()[0] )
1297 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1299 MESSAGE("IDL : GetName : " << theFace->GetName());
1300 MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1301 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1302 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1303 << theFace << ", " << theAttractor << " )";
1306 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1307 const char* attractorEntry)
1309 GetImpl()->ClearEntry( faceEntry, attractorEntry );
1310 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1311 << faceEntry << "', '" << attractorEntry << "' )";
1316 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1319 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1322 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
1325 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
1328 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1331 this->GetImpl()->UnsetCustomSizeMap(entry);
1332 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1336 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1341 // ///////////////////////
1342 // // ENFORCED VERTICES //
1343 // ///////////////////////
1347 * Returns the list of enforced vertices for a given Face entry
1348 * @return A map of Face entry / List of enforced vertices
1351 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1352 MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1355 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1357 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1358 this->GetImpl()->_GetAllEnforcedVerticesByFace();
1359 resultMap->length(faceEntryEnfVertexListMap.size());
1360 MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1362 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1363 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1364 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1365 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1366 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1367 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1368 MESSAGE("Face Entry: " << mapElement->faceEntry);
1370 _enfVertexList = it_entry->second;
1371 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1372 enfVertexList->length(_enfVertexList.size());
1373 MESSAGE("Number of enf vertex: " << enfVertexList->length());
1375 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1376 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1377 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1378 currentEnfVertex = (*it_enfVertex);
1380 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1383 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1386 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1389 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1390 coords->length(currentEnfVertex->coords.size());
1391 for (int i=0;i<coords->length();i++)
1392 coords[i] = currentEnfVertex->coords[i];
1393 enfVertex->coords = coords;
1396 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1399 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1400 faceEntryList->length(currentEnfVertex->faceEntries.size());
1401 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1402 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1403 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1404 enfVertex->faceEntries = faceEntryList;
1407 msg << "Enforced vertex: \n"
1408 << "Name: " << enfVertex->name << "\n";
1409 if (coords->length())
1410 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1411 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1412 << "Group Name: " << enfVertex->grpName;
1415 enfVertexList[j] = enfVertex;
1417 mapElement->enfVertexList = enfVertexList;
1419 resultMap[i] = mapElement;
1422 return resultMap._retn();
1426 * Returns the list of all enforced vertices
1427 * @return a list of enforced vertices
1430 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1431 MESSAGE("IDL: GetAllEnforcedVertices()");
1433 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1434 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1435 resultMap->length(enfVertexList.size());
1436 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1438 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1439 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1440 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1441 MESSAGE("Enforced Vertex #" << i);
1442 currentEnfVertex = (*evlIt);
1443 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1445 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1447 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1449 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1450 coords->length(currentEnfVertex->coords.size());
1451 for (int ind = 0; ind < coords->length(); ind++)
1452 coords[ind] = currentEnfVertex->coords[ind];
1453 enfVertex->coords = coords;
1455 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1457 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1458 faceEntryList->length(currentEnfVertex->faceEntries.size());
1459 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1460 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1461 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1462 enfVertex->faceEntries = faceEntryList;
1465 msg << "Enforced vertex: \n"
1466 << "Name: " << enfVertex->name << "\n";
1467 if (coords->length())
1468 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1469 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1470 << "Group Name: " << enfVertex->grpName;
1473 resultMap[i] = enfVertex;
1475 return resultMap._retn();
1480 * Returns the list of enforced vertices coords for a given Face entry.
1481 * They are the coords of the "manual" enforced vertices.
1482 * @return A map of Face entry / List of enforced vertices coords
1485 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1486 MESSAGE("IDL: GetAllCoordsByFace()");
1489 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1491 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1492 resultMap->length(entryCoordsListMap.size());
1493 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1495 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1496 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1497 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1498 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1499 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1500 MESSAGE("Face Entry: " << mapElement->faceEntry);
1502 _coordsList = it_entry->second;
1503 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1504 coordsList->length(_coordsList.size());
1505 MESSAGE("Number of coords: " << coordsList->length());
1507 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1508 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1509 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1510 coords->length((*it_coords).size());
1511 for (int i=0;i<coords->length();i++)
1512 coords[i] = (*it_coords)[i];
1513 coordsList[j] = coords;
1514 MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1516 mapElement->coordsList = coordsList;
1518 resultMap[i] = mapElement;
1521 return resultMap._retn();
1525 * Returns a map of enforced vertices coords / enforced vertex.
1526 * They are the coords of the "manual" enforced vertices.
1528 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1529 MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1532 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1533 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1534 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1535 resultMap->length(coordsEnfVertexMap.size());
1536 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1538 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1539 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1540 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1541 MESSAGE("Enforced Vertex #" << i);
1542 currentEnfVertex = (it_coords->second);
1543 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1544 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1545 coords->length(it_coords->first.size());
1546 for (int ind=0;ind<coords->length();ind++)
1547 coords[ind] = it_coords->first[ind];
1548 mapElement->coords = coords;
1549 MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1551 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1553 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1555 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1557 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1558 coords2->length(currentEnfVertex->coords.size());
1559 for (int ind=0;ind<coords2->length();ind++)
1560 coords2[ind] = currentEnfVertex->coords[ind];
1561 enfVertex->coords = coords2;
1563 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1565 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1566 faceEntryList->length(currentEnfVertex->faceEntries.size());
1567 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1568 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1569 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1570 enfVertex->faceEntries = faceEntryList;
1572 mapElement->enfVertex = enfVertex;
1574 msg << "Enforced vertex: \n"
1575 << "Name: " << enfVertex->name << "\n";
1576 if (coords->length())
1577 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1578 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1579 << "Group Name: " << enfVertex->grpName;
1582 resultMap[i] = mapElement;
1584 return resultMap._retn();
1588 * Returns the list of enforced vertices entries for a given Face entry.
1589 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1590 * @return A map of Face entry / List of enforced vertices geom entries
1593 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1594 MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1597 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1599 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1600 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1601 resultMap->length(entryEnfVertexEntryListMap.size());
1602 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1604 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1605 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1606 entryEnfVertexEntryListMap.begin();
1607 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1608 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1609 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1610 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1611 MESSAGE("Face Entry: " << mapElement->faceEntry);
1613 _enfVertexEntryList = it_entry->second;
1614 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1615 enfVertexEntryList->length(_enfVertexEntryList.size());
1616 MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1618 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1619 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1620 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1621 MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1623 mapElement->enfVertexEntryList = enfVertexEntryList;
1625 resultMap[i] = mapElement;
1628 return resultMap._retn();
1632 * Returns a map of enforced vertices geom entry / enforced vertex.
1633 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1635 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1636 MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1639 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1640 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1641 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1642 resultMap->length(enfVertexEntryEnfVertexMap.size());
1643 MESSAGE("Enforced Vertex map size is " << resultMap->length());
1645 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1646 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1647 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1648 MESSAGE("Enforced Vertex #" << i);
1649 currentEnfVertex = it_enfVertexEntry->second;
1650 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1651 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1652 MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1654 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1656 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1658 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1660 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1661 coords->length(currentEnfVertex->coords.size());
1662 for (int ind=0;ind<coords->length();ind++)
1663 coords[ind] = currentEnfVertex->coords[ind];
1664 enfVertex->coords = coords;
1666 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1668 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1669 faceEntryList->length(currentEnfVertex->faceEntries.size());
1670 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1671 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1672 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1673 enfVertex->faceEntries = faceEntryList;
1676 msg << "Enforced vertex: \n"
1677 << "Name: " << enfVertex->name << "\n";
1678 if (coords->length())
1679 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1680 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1681 << "Group Name: " << enfVertex->grpName;
1684 mapElement->enfVertex = enfVertex;
1685 resultMap[i] = mapElement;
1687 return resultMap._retn();
1691 * Erase all enforced vertices
1693 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1695 this->GetImpl()->ClearAllEnforcedVertices();
1696 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1700 * Set/get/unset an enforced vertex on face
1702 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1703 CORBA::Double z) throw (SALOME::SALOME_Exception) {
1706 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1707 MESSAGE("theFace shape type is not FACE or COMPOUND");
1708 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1711 string theFaceEntry = theFace->GetStudyEntry();
1713 if (theFaceEntry.empty()) {
1714 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1715 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1717 if (theFace->GetShapeType() == GEOM::FACE)
1719 if (theFace->GetShapeType() == GEOM::COMPOUND)
1720 aName = "Compound_";
1721 aName += theFace->GetEntry();
1722 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1723 if (!theSFace->_is_nil())
1724 theFaceEntry = theSFace->GetID();
1726 if (theFaceEntry.empty())
1727 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1728 MESSAGE("IDL : GetName : " << theFace->GetName());
1729 MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1731 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1732 } catch (SALOME_Exception& ex) {
1733 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1738 * Set/get/unset an enforced vertex with name on face
1740 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1741 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1744 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1745 MESSAGE("theFace shape type is not FACE or COMPOUND");
1746 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1749 string theFaceEntry = theFace->GetStudyEntry();
1751 if (theFaceEntry.empty()) {
1752 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1753 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1755 if (theFace->GetShapeType() == GEOM::FACE)
1757 if (theFace->GetShapeType() == GEOM::COMPOUND)
1758 aName = "Compound_";
1759 aName += theFace->GetEntry();
1760 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1761 if (!theSFace->_is_nil())
1762 theFaceEntry = theSFace->GetID();
1764 if (theFaceEntry.empty())
1765 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1767 MESSAGE("IDL : GetName : " << theFace->GetName());
1768 MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1770 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1771 } catch (SALOME_Exception& ex) {
1772 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1777 * Set/get/unset an enforced vertex with geom object on face
1779 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1780 throw (SALOME::SALOME_Exception) {
1783 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1784 MESSAGE("theFace shape type is not FACE or COMPOUND");
1785 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1788 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1789 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1790 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1793 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1794 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1795 // if (CORBA::is_nil(measureOp))
1798 // CORBA::Double x, y, z;
1800 // measureOp->PointCoordinates(theVertex, x, y, z);
1802 string theFaceEntry = theFace->GetStudyEntry();
1803 string theVertexEntry = theVertex->GetStudyEntry();
1805 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1806 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1809 if (theFaceEntry.empty()) {
1810 if (theFace->GetShapeType() == GEOM::FACE)
1812 if (theFace->GetShapeType() == GEOM::COMPOUND)
1813 aName = "Compound_";
1814 aName += theFace->GetEntry();
1815 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1816 if (!theSFace->_is_nil())
1817 theFaceEntry = theSFace->GetID();
1819 if (theFaceEntry.empty())
1820 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1822 if (theVertexEntry.empty()) {
1823 if (theVertex->GetShapeType() == GEOM::VERTEX)
1825 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1826 aName = "Compound_";
1827 aName += theVertex->GetEntry();
1828 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1829 if (!theSVertex->_is_nil())
1830 theVertexEntry = theSVertex->GetID();
1832 if (theVertexEntry.empty())
1833 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1835 string theVertexName = theVertex->GetName();
1836 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1837 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1838 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1840 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1841 } catch (SALOME_Exception& ex) {
1842 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1847 * Set an enforced vertex with group name on face
1849 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1850 throw (SALOME::SALOME_Exception)
1854 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1855 MESSAGE("theFace shape type is not FACE or COMPOUND");
1856 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1859 string theFaceEntry = theFace->GetStudyEntry();
1861 if (theFaceEntry.empty()) {
1862 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1863 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1865 if (theFace->GetShapeType() == GEOM::FACE)
1867 if (theFace->GetShapeType() == GEOM::COMPOUND)
1868 aName = "Compound_";
1869 aName += theFace->GetEntry();
1870 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1871 if (!theSFace->_is_nil())
1872 theFaceEntry = theSFace->GetID();
1874 if (theFaceEntry.empty())
1875 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1876 MESSAGE("IDL : GetName : " << theFace->GetName());
1877 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1879 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1880 } catch (SALOME_Exception& ex) {
1881 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1886 * Set an enforced vertex with name and group name on face
1888 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
1889 const char* theVertexName, const char* theGroupName)
1890 throw (SALOME::SALOME_Exception)
1894 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1895 MESSAGE("theFace shape type is not FACE or COMPOUND");
1896 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1899 string theFaceEntry = theFace->GetStudyEntry();
1901 if (theFaceEntry.empty()) {
1902 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1903 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1905 if (theFace->GetShapeType() == GEOM::FACE)
1907 if (theFace->GetShapeType() == GEOM::COMPOUND)
1908 aName = "Compound_";
1909 aName += theFace->GetEntry();
1910 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1911 if (!theSFace->_is_nil())
1912 theFaceEntry = theSFace->GetID();
1914 if (theFaceEntry.empty())
1915 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1916 MESSAGE("IDL : GetName : " << theFace->GetName());
1917 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
1919 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
1920 } catch (SALOME_Exception& ex) {
1921 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1926 * Set an enforced vertex with geom entry and group name on face
1928 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
1929 throw (SALOME::SALOME_Exception)
1933 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1934 MESSAGE("theFace shape type is not FACE or COMPOUND");
1935 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1938 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1939 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1940 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1943 string theFaceEntry = theFace->GetStudyEntry();
1944 string theVertexEntry = theVertex->GetStudyEntry();
1946 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1947 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1950 if (theFaceEntry.empty()) {
1951 if (theFace->GetShapeType() == GEOM::FACE)
1953 if (theFace->GetShapeType() == GEOM::COMPOUND)
1954 aName = "Compound_";
1955 aName += theFace->GetEntry();
1956 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1957 if (!theSFace->_is_nil())
1958 theFaceEntry = theSFace->GetID();
1960 if (theFaceEntry.empty())
1961 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1963 if (theVertexEntry.empty()) {
1964 if (theVertex->GetShapeType() == GEOM::VERTEX)
1966 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1967 aName = "Compound_";
1968 aName += theVertex->GetEntry();
1969 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1970 if (!theSVertex->_is_nil())
1971 theVertexEntry = theSVertex->GetID();
1973 if (theVertexEntry.empty())
1974 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1976 string theVertexName = theVertex->GetName();
1977 MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1978 MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1979 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
1981 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
1982 } catch (SALOME_Exception& ex) {
1983 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1987 //Enable internal enforced vertices on specific face if requested by user
1989 // * Are internal enforced vertices used for a face ?
1991 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
1992 // throw (SALOME::SALOME_Exception) {
1993 // ASSERT(myBaseImpl);
1995 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1996 // MESSAGE("theFace shape type is not FACE or COMPOUND");
1997 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2000 // string theFaceEntry = theFace->GetStudyEntry();
2002 // if (theFaceEntry.empty()) {
2003 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2004 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2006 // if (theFace->GetShapeType() == GEOM::FACE)
2008 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2009 // aName = "Compound_";
2010 // aName += theFace->GetEntry();
2011 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2012 // if (!theSFace->_is_nil())
2013 // theFaceEntry = theSFace->GetID();
2015 // if (theFaceEntry.empty())
2016 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2018 // MESSAGE("IDL : GetName : " << theFace->GetName());
2019 // MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2021 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2022 // } catch (SALOME_Exception& ex) {
2023 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2028 * Get the list of all enforced vertices
2030 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2031 throw (SALOME::SALOME_Exception) {
2034 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2035 MESSAGE("theFace shape type is not FACE or COMPOUND");
2036 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2039 string theFaceEntry = theFace->GetStudyEntry();
2041 if (theFaceEntry.empty()) {
2042 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2043 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2045 if (theFace->GetShapeType() == GEOM::FACE)
2047 if (theFace->GetShapeType() == GEOM::COMPOUND)
2048 aName = "Compound_";
2049 aName += theFace->GetEntry();
2050 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2051 if (!theSFace->_is_nil())
2052 theFaceEntry = theSFace->GetID();
2054 if (theFaceEntry.empty())
2055 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2057 MESSAGE("IDL : GetName : " << theFace->GetName());
2058 MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2060 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2061 } catch (SALOME_Exception& ex) {
2062 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2066 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2067 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2070 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2071 MESSAGE("theFace shape type is not FACE or COMPOUND");
2072 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2075 string theFaceEntry = theFace->GetStudyEntry();
2077 if (theFaceEntry.empty()) {
2078 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2079 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2081 if (theFace->GetShapeType() == GEOM::FACE)
2083 if (theFace->GetShapeType() == GEOM::COMPOUND)
2084 aName = "Compound_";
2085 aName += theFace->GetEntry();
2086 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2087 if (!theSFace->_is_nil())
2088 theFaceEntry = theSFace->GetID();
2090 if (theFaceEntry.empty())
2091 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2092 MESSAGE("IDL : GetName : " << theFace->GetName());
2093 MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2096 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2097 } catch (SALOME_Exception& ex) {
2098 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2102 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2103 throw (SALOME::SALOME_Exception) {
2106 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2107 MESSAGE("theFace shape type is not FACE or COMPOUND");
2108 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2110 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2111 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2112 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2115 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2116 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2117 // if (CORBA::is_nil(measureOp))
2120 // CORBA::Double x, y, z;
2122 // measureOp->PointCoordinates(theVertex, x, y, z);
2124 std::string theFaceEntry = theFace->GetStudyEntry();
2125 std::string theVertexEntry = theVertex->GetStudyEntry();
2127 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2128 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2131 if (theFaceEntry.empty()) {
2132 if (theFace->GetShapeType() == GEOM::FACE)
2134 if (theFace->GetShapeType() == GEOM::COMPOUND)
2135 aName = "Compound_";
2136 aName += theFace->GetEntry();
2137 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2138 if (!theSFace->_is_nil())
2139 theFaceEntry = theSFace->GetID();
2141 if (theFaceEntry.empty())
2142 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2144 if (theVertexEntry.empty()) {
2145 if (theVertex->GetShapeType() == GEOM::VERTEX)
2147 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2148 aName = "Compound_";
2149 aName += theVertex->GetEntry();
2150 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2151 if (!theSVertex->_is_nil())
2152 theVertexEntry = theSVertex->GetID();
2154 if (theVertexEntry.empty())
2155 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2157 MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2160 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2161 } catch (SALOME_Exception& ex) {
2162 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2166 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2169 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2170 MESSAGE("theFace shape type is not FACE or COMPOUND");
2171 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2174 string theFaceEntry = theFace->GetStudyEntry();
2176 if (theFaceEntry.empty()) {
2177 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2178 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2180 if (theFace->GetShapeType() == GEOM::FACE)
2182 if (theFace->GetShapeType() == GEOM::COMPOUND)
2183 aName = "Compound_";
2184 aName += theFace->GetEntry();
2185 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2186 if (!theSFace->_is_nil())
2187 theFaceEntry = theSFace->GetID();
2189 if (theFaceEntry.empty())
2190 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2192 MESSAGE("IDL : GetName : " << theFace->GetName());
2193 MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2196 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2197 } catch (SALOME_Exception& ex) {
2198 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2203 * Set/get/unset an enforced vertex on geom object given by entry
2205 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2206 CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2207 throw (SALOME::SALOME_Exception) {
2209 MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2210 bool newValue = false;
2211 if (string(theVertexEntry).empty()) {
2213 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2214 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2215 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2216 coords.push_back(x);
2217 coords.push_back(y);
2218 coords.push_back(z);
2219 if (coordsList.find(coords) == coordsList.end()) {
2220 MESSAGE("Coords not found: add it in coordsList");
2223 MESSAGE("Coords already found, compare names");
2224 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2225 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2226 MESSAGE("The names are different: update");
2227 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2231 MESSAGE("The names are identical");
2234 } catch (const std::invalid_argument& ex) {
2235 // no enforced vertex for entry
2236 MESSAGE("Face entry not found : add it to the list");
2240 if (string(theVertexName).empty())
2241 if (string(theGroupName).empty())
2242 SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2244 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2246 if (string(theGroupName).empty())
2247 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2249 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2250 << theVertexName << "\", \"" << theGroupName << "\")";
2253 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2254 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2255 if ( it == enfVertexEntryList.end()) {
2256 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2260 MESSAGE("Geom entry already found, compare names");
2261 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2262 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2263 MESSAGE("The names are different: update");
2264 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2268 MESSAGE("The names are identical");
2271 } catch (const std::invalid_argument& ex) {
2272 // no enforced vertex for entry
2273 MESSAGE("Face entry not found : add it to the list");
2277 if (string(theGroupName).empty())
2278 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2280 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2284 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2286 MESSAGE("IDL : SetEnforcedVertexEntry END");
2290 //Enable internal enforced vertices on specific face if requested by user
2291 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2292 // throw (SALOME::SALOME_Exception) {
2293 // ASSERT(myBaseImpl);
2295 // return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2296 // } catch (const std::exception& ex) {
2297 // std::cout << "Exception: " << ex.what() << std::endl;
2298 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2302 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2303 throw (SALOME::SALOME_Exception) {
2305 MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2308 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2309 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2310 vertexList->length(_vList.size());
2311 MESSAGE("Number of enforced vertices: " << vertexList->length());
2312 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2313 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2314 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2316 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2319 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2320 // Geom Vertex Entry
2321 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2323 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2324 coords->length(_enfVertex->coords.size());
2325 for (int ind=0;ind<coords->length();ind++)
2326 coords[ind] = _enfVertex->coords[ind];
2327 enfVertex->coords = coords;
2329 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2331 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2332 faceEntryList->length(_enfVertex->faceEntries.size());
2333 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2334 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2335 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2336 enfVertex->faceEntries = faceEntryList;
2338 vertexList[i] = enfVertex;
2340 MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2341 return vertexList._retn();
2342 } catch (const std::invalid_argument& ex) {
2343 SALOME::ExceptionStruct ExDescription;
2344 ExDescription.text = ex.what();
2345 ExDescription.type = SALOME::BAD_PARAM;
2346 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2347 ExDescription.lineNumber = 1385;
2348 throw SALOME::SALOME_Exception(ExDescription);
2349 } catch (const std::exception& ex) {
2350 std::cout << "Exception: " << ex.what() << std::endl;
2351 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2355 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2356 CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2358 MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2362 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2364 if (string(theVertexEntry).empty())
2365 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2368 SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2370 } catch (const std::invalid_argument& ex) {
2372 } catch (const std::exception& ex) {
2373 std::cout << "Exception: " << ex.what() << std::endl;
2374 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2377 MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2381 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2382 // CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2383 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2385 // bool ret = false;
2388 // ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2389 // } catch (SALOME_Exception& ex) {
2390 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2394 // SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2397 // MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2401 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2403 MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2406 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2407 SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2408 } catch (const std::invalid_argument& ex) {
2410 } catch (const std::exception& ex) {
2411 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2414 MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2418 //=============================================================================
2420 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2424 //=============================================================================
2425 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2426 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2428 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2429 std::string theValueStr = theValue ? "True" : "False";
2430 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2433 //=============================================================================
2435 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2439 //=============================================================================
2440 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2441 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2443 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2446 //=============================================================================
2448 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2452 //=============================================================================
2453 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
2454 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2456 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2457 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2460 //=============================================================================
2462 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2466 //=============================================================================
2467 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2468 MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2470 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2474 * Enable internal enforced vertices on specific face if requested by user
2476 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2477 throw (SALOME::SALOME_Exception)
2479 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2481 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2482 } catch (SALOME_Exception& ex) {
2483 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2487 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2488 throw (SALOME::SALOME_Exception)
2490 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2492 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2493 MESSAGE("theFace shape type is not FACE or COMPOUND");
2494 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2497 string theFaceEntry = theFace->GetStudyEntry();
2499 if (theFaceEntry.empty()) {
2500 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2501 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2503 if (theFace->GetShapeType() == GEOM::FACE)
2505 if (theFace->GetShapeType() == GEOM::COMPOUND)
2506 aName = "Compound_";
2507 aName += theFace->GetEntry();
2508 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2509 if (!theSFace->_is_nil())
2510 theFaceEntry = theSFace->GetID();
2512 if (theFaceEntry.empty())
2513 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2515 MESSAGE("IDL : GetName : " << theFace->GetName());
2516 MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2518 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2519 } catch (SALOME_Exception& ex) {
2520 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2524 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2525 throw (SALOME::SALOME_Exception)
2527 MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2530 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2531 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2532 if (string(theGroupName).empty())
2533 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2535 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2536 } catch (const std::exception& ex) {
2537 std::cout << "Exception: " << ex.what() << std::endl;
2538 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2545 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2546 throw (SALOME::SALOME_Exception)
2549 MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2551 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2553 catch (const std::invalid_argument& ex) {
2554 SALOME::ExceptionStruct ExDescription;
2555 ExDescription.text = ex.what();
2556 ExDescription.type = SALOME::BAD_PARAM;
2557 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2558 ExDescription.lineNumber = 1146;
2559 throw SALOME::SALOME_Exception(ExDescription);
2561 catch (SALOME_Exception& ex) {
2562 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2564 MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2569 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2570 throw (SALOME::SALOME_Exception)
2573 MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2575 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2577 catch (const std::invalid_argument& ex) {
2578 SALOME::ExceptionStruct ExDescription;
2579 ExDescription.text = ex.what();
2580 ExDescription.type = SALOME::BAD_PARAM;
2581 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2582 ExDescription.lineNumber = 1170;
2583 throw SALOME::SALOME_Exception(ExDescription);
2585 catch (SALOME_Exception& ex) {
2586 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2589 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2590 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2592 MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2595 ///////////////////////
2597 ///////////////////////
2599 ///////////////////////
2602 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2604 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2605 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2606 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2607 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2608 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2609 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2610 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2611 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2612 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2613 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2614 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2615 std::string txtShapeType = MapShapeTypeToString[theShapeType];
2616 return txtShapeType;
2619 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2621 // Check shape types
2623 std::stringstream typesTxt;
2624 for (std::size_t i=0; i<theShapeTypes.size(); i++)
2626 GEOM::shape_type theShapeType = theShapeTypes[i];
2627 if (shape->GetShapeType() == theShapeType)
2629 typesTxt << ShapeTypeToString(theShapeType);
2630 if (i < theShapeTypes.size()-1 )
2634 std::stringstream msg;
2635 msg << "shape shape type is not in" << typesTxt;
2637 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2641 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2644 if (shape->GetShapeType() != theShapeType) {
2645 std::stringstream msg;
2646 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2648 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2652 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2654 // Check shape is published in the object browser
2655 string shapeEntry = shape->GetStudyEntry();
2657 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2658 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2661 // Publish shape if needed
2662 if (shapeEntry.empty()) {
2663 if (shape->GetShapeType() == theShapeType)
2665 aName += shape->GetEntry();
2666 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2667 if (!theSFace1->_is_nil())
2668 shapeEntry = theSFace1->GetID();
2670 if (shapeEntry.empty())
2671 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2675 // Format the output of two vectors to use it in MESSAGE and PythonDump
2676 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2678 std::stringstream listEntriesTxt;
2680 if (!theSourceVerticesEntries.empty())
2682 listEntriesTxt << ", [" ;
2684 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2687 listEntriesTxt << ", ";
2688 listEntriesTxt << *it;
2691 listEntriesTxt << "], [" ;
2693 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2696 listEntriesTxt << ", ";
2697 listEntriesTxt << *it;
2699 listEntriesTxt << "]" ;
2701 return listEntriesTxt.str();
2705 * Erase all PreCad periodicity associations
2707 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2709 this->GetImpl()->ClearPreCadPeriodicityVectors();
2710 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2713 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2715 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2716 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2717 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2719 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2721 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2722 return periodicityList._retn();
2725 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2727 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2728 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2729 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2731 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2733 MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2734 return periodicityList._retn();
2737 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2738 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2740 MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2741 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2743 periodicityList->length(preCadPeriodicityVector.size());
2745 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2747 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2749 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2750 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2751 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2753 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2754 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2756 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2757 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2758 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2761 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2763 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2764 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2766 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2767 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2768 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2771 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2773 periodicityList[i] = myPreCadPeriodicity;
2777 return periodicityList._retn();
2781 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2782 throw (SALOME::SALOME_Exception)
2785 const GEOM::ListOfGO theSourceVertices;
2786 const GEOM::ListOfGO theTargetVertices;
2787 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2791 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2792 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2793 throw (SALOME::SALOME_Exception)
2796 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2798 size_t theLength = theSourceVertices.length();
2799 if (theLength != theTargetVertices.length())
2800 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2802 std::vector<GEOM::shape_type> allowedShapeTypes;
2803 allowedShapeTypes.push_back(GEOM::FACE);
2804 allowedShapeTypes.push_back(GEOM::COMPOUND);
2806 string prefix1 = "Source_face_";
2807 CheckShapeTypes(theFace1, allowedShapeTypes);
2808 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2810 string prefix2 = "Target_face_";
2811 CheckShapeTypes(theFace2, allowedShapeTypes);
2812 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2814 string prefix3 = "Source_vertex_";
2815 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2816 theSourceVerticesEntries->length(theLength);
2817 GEOM::GEOM_Object_ptr theVtx_i;
2819 for (size_t ind = 0; ind < theLength; ind++) {
2820 theVtx_i = theSourceVertices[ind];
2821 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2822 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2825 string prefix4 = "Target_vertex_";
2826 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2827 theTargetVerticesEntries->length(theLength);
2828 for (size_t ind = 0; ind < theLength; ind++) {
2829 theVtx_i = theTargetVertices[ind];
2830 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2831 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2834 string theFace2Name = theFace2->GetName();
2835 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2836 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2837 MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2839 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2840 theSourceVerticesEntries, theTargetVerticesEntries);
2841 } catch (SALOME_Exception& ex) {
2842 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2847 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2848 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2849 throw (SALOME::SALOME_Exception)
2854 // Convert BLSURFPlugin::TEntryList to vector<string>
2855 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2856 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2857 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2858 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2861 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2863 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2865 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2866 theSourceVerticesEntries, theTargetVerticesEntries);
2868 SMESH::TPythonDump pd;
2869 if (!theSourceVerticesEntries.empty())
2871 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2872 pd << listEntriesTxt.c_str();
2876 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2877 MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2880 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2881 throw (SALOME::SALOME_Exception)
2884 const GEOM::ListOfGO theSourceVertices;
2885 const GEOM::ListOfGO theTargetVertices;
2886 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2889 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2890 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2891 throw (SALOME::SALOME_Exception)
2893 MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2896 size_t theLength = theSourceVertices.length();
2897 if (theLength != theTargetVertices.length())
2898 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2900 std::vector<GEOM::shape_type> allowedShapeTypes;
2901 allowedShapeTypes.push_back(GEOM::EDGE);
2902 allowedShapeTypes.push_back(GEOM::COMPOUND);
2904 string prefix1 = "Source_edge_";
2905 CheckShapeTypes(theEdge1, allowedShapeTypes);
2906 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
2908 string prefix2 = "Target_edge_";
2909 CheckShapeTypes(theEdge2, allowedShapeTypes);
2910 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
2912 string prefix3 = "Source_vertex_";
2913 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2914 theSourceVerticesEntries->length(theLength);
2915 GEOM::GEOM_Object_ptr theVtx_i;
2917 for (size_t ind = 0; ind < theLength; ind++) {
2918 theVtx_i = theSourceVertices[ind];
2919 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2920 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2923 string prefix4 = "Target_vertex_";
2924 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2925 theTargetVerticesEntries->length(theLength);
2926 for (size_t ind = 0; ind < theLength; ind++) {
2927 theVtx_i = theTargetVertices[ind];
2928 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2929 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2932 string theEdge2Name = theEdge2->GetName();
2933 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
2934 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
2935 MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
2937 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
2938 theSourceVerticesEntries, theTargetVerticesEntries);
2939 } catch (SALOME_Exception& ex) {
2940 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2945 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
2946 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2947 throw (SALOME::SALOME_Exception)
2952 // Convert BLSURFPlugin::TEntryList to vector<string>
2953 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2954 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2955 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2956 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2959 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2961 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
2962 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
2963 theSourceVerticesEntries, theTargetVerticesEntries);
2965 SMESH::TPythonDump pd;
2966 if (!theSourceVerticesEntries.empty())
2968 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
2969 pd << listEntriesTxt.c_str();
2973 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
2975 MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
2978 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2979 throw (SALOME::SALOME_Exception)
2983 string prefix1 = "Source_face_";
2984 CheckShapeType(theFace1, GEOM::FACE);
2985 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2986 string prefix2 = "Target_face_";
2987 CheckShapeType(theFace2, GEOM::FACE);
2988 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2990 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2991 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2992 MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
2994 AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
2995 } catch (SALOME_Exception& ex) {
2996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3002 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3003 throw (SALOME::SALOME_Exception){
3007 MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3008 this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3009 SMESH::TPythonDump pd;
3010 pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3011 MESSAGE("IDL : AddFacePeriodicityEntry END");
3015 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3016 GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3017 CORBA::Long edge_orientation)
3018 throw (SALOME::SALOME_Exception){
3021 string prefix_theFace1 = "Source_face_";
3022 CheckShapeType(theFace1, GEOM::FACE);
3023 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3024 string prefix_theFace2 = "Target_face_";
3025 CheckShapeType(theFace2, GEOM::FACE);
3026 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3028 string prefix_theEdge1 = "Source_edge_";
3029 CheckShapeType(theEdge1, GEOM::EDGE);
3030 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3031 string prefix_theEdge2 = "Target_edge_";
3032 CheckShapeType(theEdge2, GEOM::EDGE);
3033 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3035 MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3036 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3037 MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3038 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3039 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3041 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3042 } catch (SALOME_Exception& ex) {
3043 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3049 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3050 GEOM::GEOM_Object_ptr theEdge2,
3051 CORBA::Long edge_orientation)
3052 throw (SALOME::SALOME_Exception){
3055 string theFace1Entry = "";
3056 string theFace2Entry = "";
3058 string prefix_theEdge1 = "Source_edge_";
3059 CheckShapeType(theEdge1, GEOM::EDGE);
3060 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3061 string prefix_theEdge2 = "Target_edge_";
3062 CheckShapeType(theEdge2, GEOM::EDGE);
3063 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3065 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3066 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3067 MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3069 AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3070 } catch (SALOME_Exception& ex) {
3071 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3077 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3078 throw (SALOME::SALOME_Exception){
3082 MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation << ")");
3083 this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3084 SMESH::TPythonDump pd;
3086 pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3088 pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3089 MESSAGE("IDL : AddEdgePeriodicityEntry END");
3092 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3093 GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3094 throw (SALOME::SALOME_Exception){
3097 string prefix_theEdge1 = "Source_edge_";
3098 CheckShapeType(theEdge1, GEOM::EDGE);
3099 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3100 string prefix_theEdge2 = "Target_edge_";
3101 CheckShapeType(theEdge2, GEOM::EDGE);
3102 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3104 string prefix_theVertex1 = "Source_vertex_";
3105 CheckShapeType(theVertex1, GEOM::VERTEX);
3106 string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3107 string prefix_theVertex2 = "Target_vertex_";
3108 CheckShapeType(theVertex2, GEOM::VERTEX);
3109 string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3111 MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3112 MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3113 MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3114 MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3115 MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3117 AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3118 } catch (SALOME_Exception& ex) {
3119 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3125 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3126 throw (SALOME::SALOME_Exception){
3130 MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")");
3131 this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3132 SMESH::TPythonDump pd;
3133 pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", " << theVertex2Entry << ")";
3134 MESSAGE("IDL : AddVertexPeriodicityEntry END");
3138 //================================================================================
3140 * \brief Sets the file for export resulting mesh in GMF format
3141 * \param theFileName - full name of the file (.mesh, .meshb)
3143 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3145 //================================================================================
3146 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3147 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3149 MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3150 bool valueChanged/*, modeChanged*/ = false;
3152 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3153 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3154 if (valueChanged)// or (!valueChanged && modeChanged))
3155 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3156 } catch (const std::exception& ex) {
3157 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3159 if (valueChanged)// or (!valueChanged && modeChanged))
3160 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3161 MESSAGE("IDL : SetGMFFile END ");
3164 //================================================================================
3166 * \brief Gets the file name for export resulting mesh in GMF format
3167 * \retval char* - The file name
3169 * Returns the GMF file name
3171 //================================================================================
3172 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3174 // MESSAGE("IDL : GetGMFFile()");
3175 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3178 // //================================================================================
3180 // * \brief Gets the file mode for export resulting mesh in GMF format
3181 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3183 // * Returns the GMF file mode
3185 // //================================================================================
3186 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3187 // ASSERT(myBaseImpl);
3188 // MESSAGE("IDL : GetGMFFileMode()");
3189 // return this->GetImpl()->GetGMFFileMode();
3192 //=============================================================================
3194 * BLSURFPlugin_Hypothesis_i::GetImpl
3196 * Get implementation
3198 //=============================================================================
3199 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3200 // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3201 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3204 //================================================================================
3206 * \brief Verify whether hypothesis supports given entity type
3207 * \param type - dimension (see SMESH::Dimension enumeration)
3208 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3210 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3212 //================================================================================
3213 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3214 return type == SMESH::DIM_2D;
3218 // Obsolete methods - To be removed in V7
3221 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3222 this->SetMinSize(theMinSize);
3224 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3225 return this->GetMinSize();
3227 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3228 this->SetMaxSize(theMaxSize);
3230 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3231 return this->GetMaxSize();
3233 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3234 this->SetMinSize(theMinSize);
3236 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3237 return this->GetMinSize();
3239 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3240 this->SetMaxSize(theMaxSize);
3242 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3243 return this->GetMaxSize();
3245 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3246 this->SetAngleMesh(theValue);
3248 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3249 return this->GetAngleMesh();
3251 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3252 this->SetAngleMesh(theValue);
3254 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3255 return this->GetAngleMesh();
3257 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3258 std::string theValueStr = theValue ? "1" : "0";
3259 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3261 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3262 std::string theValueStr = this->GetOptionValue("respect_geometry");
3263 if (theValueStr.empty() || theValueStr == "respect")
3267 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3268 std::string theValueStr = theValue ? "1" : "0";
3269 this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3271 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3272 std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3273 if (theValueStr == "1")
3277 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3278 std::ostringstream theValueStr;
3279 theValueStr << theValue;
3280 this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3282 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3283 std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3285 theValueStr >> result;