1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
32 #include <SALOMEDS_wrap.hxx>
33 #include <Utils_CorbaException.hxx>
34 #include <utilities.h>
38 #include <boost/regex.hpp>
42 //=============================================================================
44 * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
48 //=============================================================================
49 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
50 ::SMESH_Gen* theGenImpl,
52 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
54 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
60 //=============================================================================
62 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
66 //=============================================================================
67 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
71 //=============================================================================
73 //=============================================================================
75 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
80 //=============================================================================
81 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
84 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
85 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
88 //=============================================================================
90 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
94 //=============================================================================
95 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
98 return this->GetImpl()->GetPhysicalMesh();
101 //=============================================================================
103 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
108 //=============================================================================
109 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
112 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
113 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
116 //=============================================================================
118 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
122 //=============================================================================
123 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
126 return this->GetImpl()->GetGeometricMesh();
129 //=============================================================================
131 * BLSURFPlugin_Hypothesis_i::SetPhySize
135 //=============================================================================
136 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
139 this->GetImpl()->SetPhySize(theValue, false);
140 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
143 //=============================================================================
145 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
147 * Set Relative PhySize
149 //=============================================================================
150 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
153 this->GetImpl()->SetPhySize(theValue, true);
154 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
157 //=============================================================================
159 * BLSURFPlugin_Hypothesis_i::GetPhySize
163 //=============================================================================
164 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
167 return this->GetImpl()->GetPhySize();
170 //=============================================================================
172 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
174 * Returns True if PhySize is relative
176 //=============================================================================
177 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
180 return this->GetImpl()->IsPhySizeRel();
183 //=============================================================================
184 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
186 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
187 this->GetImpl()->SetMinSize(theMinSize, false);
188 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
192 //=============================================================================
193 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
195 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
196 this->GetImpl()->SetMinSize(theMinSize, true);
197 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
201 //=============================================================================
202 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
204 return this->GetImpl()->GetMinSize();
207 //=============================================================================
208 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
210 return this->GetImpl()->IsMinSizeRel();
213 //=============================================================================
214 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
216 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
217 this->GetImpl()->SetMaxSize(theMaxSize, false);
218 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
222 //=============================================================================
223 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
225 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
226 this->GetImpl()->SetMaxSize(theMaxSize, true);
227 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
231 //=============================================================================
232 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
234 return this->GetImpl()->GetMaxSize();
237 //=============================================================================
238 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
240 return this->GetImpl()->IsMaxSizeRel();
244 //=============================================================================
246 * BLSURFPlugin_Hypothesis_i::SetUseGradation
250 //=============================================================================
251 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
253 if ( GetImpl()->GetUseGradation() != bool( theValue ))
255 this->GetImpl()->SetUseGradation(theValue);
256 std::string theValueStr = theValue ? "True" : "False";
257 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
261 //=============================================================================
263 * BLSURFPlugin_Hypothesis_i::GetUseGradation
267 //=============================================================================
268 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
270 return this->GetImpl()->GetUseGradation();
273 //=============================================================================
275 * BLSURFPlugin_Hypothesis_i::SetGradation
279 //=============================================================================
280 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
282 this->GetImpl()->SetGradation(theValue);
285 SetUseGradation( false );
287 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
290 //=============================================================================
292 * BLSURFPlugin_Hypothesis_i::GetGradation
296 //=============================================================================
297 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
299 return this->GetImpl()->GetGradation();
302 //=============================================================================
304 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
308 //=============================================================================
309 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
311 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
313 this->GetImpl()->SetUseVolumeGradation(theValue);
314 std::string theValueStr = theValue ? "True" : "False";
315 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
319 //=============================================================================
321 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
325 //=============================================================================
326 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
328 return this->GetImpl()->GetUseVolumeGradation();
331 //=============================================================================
333 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
335 * Set VolumeGradation
337 //=============================================================================
338 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
340 this->GetImpl()->SetVolumeGradation(theValue);
342 SetUseVolumeGradation( false );
344 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
347 //=============================================================================
349 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
351 * Get VolumeGradation
353 //=============================================================================
354 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
356 return this->GetImpl()->GetVolumeGradation();
359 //=============================================================================
361 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
365 * DEPRACATED, kept for python script compatibility
367 * TO be removed in Salome 9
369 //=============================================================================
370 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
372 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
373 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
374 this->GetImpl()->SetElementType(theElementType);
375 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
378 //=============================================================================
380 * BLSURFPlugin_Hypothesis_i::SetElementType
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
387 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
388 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
390 //=============================================================================
392 * BLSURFPlugin_Hypothesis_i::GetElementType
396 //=============================================================================
397 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
399 return this->GetImpl()->GetElementType();
402 //=============================================================================
404 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
408 //=============================================================================
409 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
411 this->GetImpl()->SetAngleMesh(theValue);
412 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
415 //=============================================================================
417 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
421 //=============================================================================
422 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
424 return this->GetImpl()->GetAngleMesh();
427 //=============================================================================
429 * BLSURFPlugin_Hypothesis_i::SetChordalError
433 //=============================================================================
434 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
436 this->GetImpl()->SetChordalError(theValue);
437 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
440 //=============================================================================
442 * BLSURFPlugin_Hypothesis_i::GetChordalError
446 //=============================================================================
447 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
449 return this->GetImpl()->GetChordalError();
452 //=============================================================================
454 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
458 //=============================================================================
459 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
461 this->GetImpl()->SetAnisotropic(theValue);
462 std::string theValueStr = theValue ? "True" : "False";
463 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
466 //=============================================================================
468 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
472 //=============================================================================
473 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
475 return this->GetImpl()->GetAnisotropic();
478 //=============================================================================
480 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
482 * Set Anisotropic Ratio
484 //=============================================================================
485 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
487 this->GetImpl()->SetAnisotropicRatio(theValue);
488 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
491 //=============================================================================
493 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
495 * Get Anisotropic Ratio
497 //=============================================================================
498 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
500 return this->GetImpl()->GetAnisotropicRatio();
504 //=============================================================================
506 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
510 //=============================================================================
511 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
513 this->GetImpl()->SetRemoveTinyEdges(theValue);
514 std::string theValueStr = theValue ? "True" : "False";
515 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
518 //=============================================================================
520 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
524 //=============================================================================
525 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
527 return this->GetImpl()->GetRemoveTinyEdges();
530 //=============================================================================
532 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
534 * Set Tiny Edge Length
536 //=============================================================================
537 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
539 this->GetImpl()->SetTinyEdgeLength(theValue);
540 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
543 //=============================================================================
545 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
547 * Get Tiny Edge Length
549 //=============================================================================
550 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
552 return this->GetImpl()->GetTinyEdgeLength();
555 //=============================================================================
557 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
561 //=============================================================================
562 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
564 this->GetImpl()->SetOptimiseTinyEdges(theValue);
565 std::string theValueStr = theValue ? "True" : "False";
566 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
569 //=============================================================================
571 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
575 //=============================================================================
576 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
578 return this->GetImpl()->GetOptimiseTinyEdges();
581 //=============================================================================
583 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
585 * Set Tiny Edge OptimisationLength
587 //=============================================================================
588 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
590 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
591 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
594 //=============================================================================
596 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
598 * Get Tiny Edge OptimisationLength
600 //=============================================================================
601 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
603 return this->GetImpl()->GetTinyEdgeOptimisationLength();
606 //=============================================================================
608 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
612 //=============================================================================
613 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
615 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
616 std::string theValueStr = theValue ? "True" : "False";
617 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
620 //=============================================================================
622 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
626 //=============================================================================
627 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
629 return this->GetImpl()->GetCorrectSurfaceIntersection();
632 //=============================================================================
634 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
636 * Set Tiny Edge OptimisationLength
638 //=============================================================================
639 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
641 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
642 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
645 //=============================================================================
647 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
649 * Get Tiny Edge OptimisationLength
651 //=============================================================================
652 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
654 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
657 //=============================================================================
659 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
663 //=============================================================================
664 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
666 this->GetImpl()->SetBadElementRemoval(theValue);
667 std::string theValueStr = theValue ? "True" : "False";
668 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
671 //=============================================================================
673 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
680 return this->GetImpl()->GetBadElementRemoval();
683 //=============================================================================
685 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
687 * Set Bad Surface Element Aspect Ratio
689 //=============================================================================
690 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
692 this->GetImpl()->SetBadElementAspectRatio(theValue);
693 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
696 //=============================================================================
698 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
700 * Get Bad Surface Element Aspect Ratio
702 //=============================================================================
703 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
705 return this->GetImpl()->GetBadElementAspectRatio();
708 //=============================================================================
710 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
714 //=============================================================================
715 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
717 this->GetImpl()->SetOptimizeMesh(theValue);
718 std::string theValueStr = theValue ? "True" : "False";
719 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
722 //=============================================================================
724 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
728 //=============================================================================
729 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
731 return this->GetImpl()->GetOptimizeMesh();
734 //=============================================================================
736 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
740 //=============================================================================
741 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
743 this->GetImpl()->SetQuadraticMesh(theValue);
744 std::string theValueStr = theValue ? "True" : "False";
745 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
748 //=============================================================================
750 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
754 //=============================================================================
755 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
757 return this->GetImpl()->GetQuadraticMesh();
765 * BLSURFPlugin_Hypothesis_i::SetTopology
770 //=============================================================================
771 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
773 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
774 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
777 //=============================================================================
779 * BLSURFPlugin_Hypothesis_i::GetTopology
783 //=============================================================================
784 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
786 return this->GetImpl()->GetTopology();
789 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
792 if (theVal < 0 || theVal > 100)
793 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
794 this->GetImpl()->SetVerbosity(theVal);
795 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
798 //=============================================================================
800 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
802 return (CORBA::Short) this->GetImpl()->GetVerbosity();
805 //=============================================================================
806 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
808 if ( GetEnforceCadEdgesSize() != toEnforce )
810 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
811 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
814 //=============================================================================
815 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
817 return this->GetImpl()->GetEnforceCadEdgesSize();
819 //=============================================================================
821 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
823 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
825 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
826 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
829 //=============================================================================
830 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
832 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
834 //=============================================================================
836 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
838 if ( GetJacobianRectification() != allowRectification )
840 this->GetImpl()->SetJacobianRectification(allowRectification);
841 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
844 //=============================================================================
845 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
847 return this->GetImpl()->GetJacobianRectification();
849 //=============================================================================
851 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
853 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
855 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
856 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
859 //=============================================================================
860 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
862 return this->GetImpl()->GetUseDeprecatedPatchMesher();
864 //=============================================================================
866 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
868 if ( GetMaxNumberOfPointsPerPatch() != nb )
871 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
873 } catch (const std::invalid_argument& ex) {
874 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
875 } catch (SALOME_Exception& ex) {
876 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
878 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
881 //=============================================================================
882 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
884 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
886 //=============================================================================
888 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
890 if ( GetMaxNumberOfThreads() != nb )
893 this->GetImpl()->SetMaxNumberOfThreads(nb);
895 } catch (const std::invalid_argument& ex) {
896 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
897 } catch (SALOME_Exception& ex) {
898 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
900 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
903 //=============================================================================
904 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
906 return this->GetImpl()->GetMaxNumberOfThreads();
908 //=============================================================================
910 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
912 if ( GetRespectGeometry() != toRespect )
914 this->GetImpl()->SetRespectGeometry(toRespect);
915 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
918 //=============================================================================
919 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
921 return this->GetImpl()->GetRespectGeometry();
923 //=============================================================================
925 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
927 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
929 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
930 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
933 //=============================================================================
934 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
936 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
938 //=============================================================================
940 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
942 if ( GetClosedGeometry() != isClosed )
944 this->GetImpl()->SetClosedGeometry(isClosed);
945 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
948 //=============================================================================
949 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
951 return this->GetImpl()->GetClosedGeometry();
953 //=============================================================================
955 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
957 if ( GetDebug() != isDebug )
959 this->GetImpl()->SetDebug(isDebug);
960 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
963 //=============================================================================
964 bool BLSURFPlugin_Hypothesis_i::GetDebug()
966 return this->GetImpl()->GetDebug();
968 //=============================================================================
970 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
973 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
977 this->GetImpl()->SetPeriodicTolerance(tol);
979 } catch (const std::invalid_argument& ex) {
980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
981 } catch (SALOME_Exception& ex) {
982 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
987 //=============================================================================
988 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
991 return this->GetImpl()->GetPeriodicTolerance();
993 } catch (const std::invalid_argument& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 } catch (SALOME_Exception& ex) {
996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1000 //=============================================================================
1002 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1004 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1007 this->GetImpl()->SetRequiredEntities(howToTreat);
1009 } catch (const std::invalid_argument& ex) {
1010 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1011 } catch (SALOME_Exception& ex) {
1012 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1014 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1017 //=============================================================================
1018 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1020 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1022 //=============================================================================
1024 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1027 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1031 this->GetImpl()->SetSewingTolerance(tol);
1032 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1034 } catch (const std::invalid_argument& ex) {
1035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1036 } catch (SALOME_Exception& ex) {
1037 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1041 //=============================================================================
1042 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1046 return this->GetImpl()->GetSewingTolerance();
1048 } catch (const std::invalid_argument& ex) {
1049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1050 } catch (SALOME_Exception& ex) {
1051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1055 //=============================================================================
1057 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1059 if ( GetImpl()->GetTags() != howToTreat )
1062 this->GetImpl()->SetTags(howToTreat);
1064 catch (const std::invalid_argument& ex) {
1065 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1066 } catch (SALOME_Exception& ex) {
1067 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1070 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1072 //=============================================================================
1073 char* BLSURFPlugin_Hypothesis_i::GetTags()
1075 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1078 //=============================================================================
1079 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1081 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1082 SMESH_Comment hplDump;
1084 for ( size_t i = 0; i < patchList.size(); ++i )
1087 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1088 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1090 patchList[ i ].insert( tags[ j ]);
1091 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1093 hplDump << ( i+1 < patchList.size() ? "," : "]");
1095 if ( GetImpl()->GetHyperPatches() != patchList )
1097 GetImpl()->SetHyperPatches( patchList );
1098 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1102 //=============================================================================
1103 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1105 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1106 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1107 resHpl->length( hpl.size() );
1109 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1110 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1112 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1113 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1114 resHp.length( hp.size() );
1116 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1117 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1123 //=============================================================================
1125 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1129 //=============================================================================
1130 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1132 this->GetImpl()->SetPreCADMergeEdges(theValue);
1133 std::string theValueStr = theValue ? "True" : "False";
1134 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1137 //=============================================================================
1139 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1143 //=============================================================================
1144 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1146 return this->GetImpl()->GetPreCADMergeEdges();
1149 //=============================================================================
1151 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1155 //=============================================================================
1156 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1158 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1159 std::string theValueStr = theValue ? "True" : "False";
1160 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1163 //=============================================================================
1165 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1169 //=============================================================================
1170 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1172 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1175 //=============================================================================
1177 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1181 //=============================================================================
1182 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1184 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1185 std::string theValueStr = theValue ? "True" : "False";
1186 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1189 //=============================================================================
1191 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1195 //=============================================================================
1196 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1198 return this->GetImpl()->GetPreCADProcess3DTopology();
1201 //=============================================================================
1203 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1207 //=============================================================================
1208 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1210 this->GetImpl()->SetPreCADDiscardInput(theValue);
1211 std::string theValueStr = theValue ? "True" : "False";
1212 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1215 //=============================================================================
1217 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1221 //=============================================================================
1222 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1224 return this->GetImpl()->GetPreCADDiscardInput();
1228 //=============================================================================
1230 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1231 throw (SALOME::SALOME_Exception) {
1234 std::string name( optionName );
1235 if ( !optionValue || !optionValue[0] )
1236 UnsetOption( optionName );
1238 // basic options (visible in Advanced table)
1240 else if ( name == "enforce_cad_edge_sizes" )
1241 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1243 else if ( name == "jacobian_rectification_respect_geometry" )
1244 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1246 else if ( name == "max_number_of_points_per_patch" )
1247 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1249 else if ( name == "max_number_of_threads" )
1250 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1252 else if ( name == "rectify_jacobian" )
1253 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1255 else if ( name == "use_deprecated_patch_mesher" )
1256 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1258 else if ( name == "respect_geometry" )
1259 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1261 else if ( name == "tiny_edge_avoid_surface_intersections" )
1262 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1264 else if ( name == "closed_geometry" )
1265 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1267 else if ( name == "debug" )
1268 SetDebug( GetImpl()->ToBool( optionValue ));
1270 else if ( name == "discard_input_topology" )
1271 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1273 else if ( name == "merge_edges" )
1274 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1276 else if ( name == "periodic_tolerance" )
1277 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1279 else if ( name == "remove_duplicate_cad_faces" )
1280 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1282 else if ( name == "required_entities" )
1283 SetRequiredEntities( optionValue );
1285 else if ( name == "sewing_tolerance" )
1286 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1288 else if ( name == "tags" )
1289 SetTags( optionValue );
1291 // other basic options with specific methods
1293 else if ( name == "correct_surface_intersections" )
1294 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1296 else if ( name == "optimise_tiny_edges" )
1297 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1299 else if ( name == "surface_intersections_processing_max_cost" )
1300 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1302 else if ( name == "volume_gradation" )
1303 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1305 else if ( name == "tiny_edge_optimisation_length" )
1306 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1308 // advanced options (for backward compatibility)
1310 else if ( name == "create_tag_on_collision" ||
1311 name == "tiny_edge_respect_geometry" )
1312 AddOption( optionName, optionValue );
1316 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1317 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1320 this->GetImpl()->SetOptionValue(optionName, optionValue);
1321 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1324 } catch (const std::invalid_argument& ex) {
1325 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1326 } catch (SALOME_Exception& ex) {
1327 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1331 //=============================================================================
1333 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1334 throw (SALOME::SALOME_Exception) {
1336 bool valueChanged = false;
1338 std::string name( optionName );
1339 if ( !optionValue || !optionValue[0] )
1340 UnsetOption( optionName );
1342 else if ( name == "closed_geometry" )
1343 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1345 else if ( name == "debug" )
1346 SetDebug( GetImpl()->ToBool( optionValue ));
1348 else if ( name == "discard_input_topology" )
1349 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1351 else if ( name == "merge_edges" )
1352 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1354 else if ( name == "periodic_tolerance" )
1355 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1357 else if ( name == "remove_duplicate_cad_faces" )
1358 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1360 else if ( name == "required_entities" )
1361 SetRequiredEntities( optionValue );
1363 else if ( name == "sewing_tolerance" )
1364 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1366 else if ( name == "tags" )
1367 SetTags( optionValue );
1369 // other basic options with specific methods
1371 else if ( name == "correct_surface_intersections" )
1372 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1374 else if ( name == "optimise_tiny_edges" )
1375 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1377 else if ( name == "surface_intersections_processing_max_cost" )
1378 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1380 else if ( name == "volume_gradation" )
1381 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1383 else if ( name == "tiny_edge_optimisation_length" )
1384 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1386 else if ( name == "process_3d_topology" )
1387 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1389 // advanced options (for backward compatibility)
1391 else if ( name == "create_tag_on_collision" ||
1392 name == "tiny_edge_respect_geometry" ||
1393 name == "remove_tiny_edges" ||
1394 name == "tiny_edge_length")
1395 AddPreCADOption( optionName, optionValue );
1398 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1400 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1402 } catch (const std::invalid_argument& ex) {
1403 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1404 } catch (SALOME_Exception& ex) {
1405 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1408 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1411 //=============================================================================
1413 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1417 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1418 } catch (const std::invalid_argument& ex) {
1419 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1420 } catch (SALOME_Exception& ex) {
1421 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1426 //=============================================================================
1428 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1432 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1433 } catch (const std::invalid_argument& ex) {
1434 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1435 } catch (SALOME_Exception& ex) {
1436 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1441 //=============================================================================
1443 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1445 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1447 this->GetImpl()->ClearOption(optionName);
1448 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1452 //=============================================================================
1454 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1456 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1458 this->GetImpl()->ClearPreCADOption(optionName);
1459 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1463 //=============================================================================
1465 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1467 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1469 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1470 result->length(opts.size());
1474 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1475 for (; opIt != opts.end(); ++opIt, ++i) {
1476 string name_value_type = opIt->first;
1477 if (!opIt->second.empty()) {
1478 name_value_type += ":";
1479 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1480 name_value_type += isDefault ? ":0" : ":1";
1482 result[i] = CORBA::string_dup(name_value_type.c_str());
1485 return result._retn();
1488 //=============================================================================
1490 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1492 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1494 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1495 result->length(opts.size());
1499 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1500 for (; opIt != opts.end(); ++opIt, ++i) {
1501 string name_value_type = opIt->first;
1502 if (!opIt->second.empty()) {
1503 name_value_type += ":";
1504 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1505 name_value_type += isDefault ? ":0" : ":1";
1507 result[i] = CORBA::string_dup(name_value_type.c_str());
1509 return result._retn();
1512 //=============================================================================
1514 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1516 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1518 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1519 result->length(custom_opts.size());
1522 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1523 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1524 string name_value_type = opIt->first;
1525 if (!opIt->second.empty()) {
1526 name_value_type += ":";
1527 name_value_type += opIt->second;
1528 name_value_type += ":1"; // user defined
1530 result[i] = CORBA::string_dup(name_value_type.c_str());
1532 return result._retn();
1535 //=============================================================================
1537 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1538 throw (SALOME::SALOME_Exception) {
1540 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1541 string name_value_type = options[i].in();
1542 if(name_value_type.empty())
1544 size_t colonPos = name_value_type.find(':');
1546 if (colonPos == string::npos) // ':' not found
1547 name = name_value_type;
1549 name = name_value_type.substr(0, colonPos);
1550 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1551 string value_type = name_value_type.substr(colonPos + 1);
1552 colonPos = value_type.find(':');
1553 value = value_type.substr(0, colonPos);
1554 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1555 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1559 SetOptionValue(name.c_str(), value.c_str());
1563 //=============================================================================
1565 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1566 throw (SALOME::SALOME_Exception) {
1568 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1569 string name_value_type = options[i].in();
1570 if(name_value_type.empty())
1572 size_t colonPos = name_value_type.find(':');
1574 if (colonPos == string::npos) // ':' not found
1575 name = name_value_type;
1577 name = name_value_type.substr(0, colonPos);
1578 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1579 string value_type = name_value_type.substr(colonPos + 1);
1580 colonPos = value_type.find(':');
1581 value = value_type.substr(0, colonPos);
1582 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1583 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1587 SetPreCADOptionValue(name.c_str(), value.c_str());
1591 //=============================================================================
1593 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1595 SMESH::TPythonDump dump;
1597 string optionsAndValues;
1598 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1599 string name_value_type = options[i].in();
1600 if(name_value_type.empty())
1602 size_t colonPos = name_value_type.find(':');
1604 if (colonPos == string::npos) // ':' not found
1605 name = name_value_type;
1607 name = name_value_type.substr(0, colonPos);
1608 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1609 string value_type = name_value_type.substr(colonPos + 1);
1610 colonPos = value_type.find(':');
1611 value = value_type.substr(0, colonPos);
1614 AddOption(name.c_str(), value.c_str());
1616 optionsAndValues += name + " " + value + " ";
1619 if ( !optionsAndValues.empty() )
1620 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1623 //=============================================================================
1625 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1626 throw (SALOME::SALOME_Exception)
1628 if ( !optionsAndValues ) return;
1630 SMESH::TPythonDump dump;
1632 std::istringstream strm( optionsAndValues );
1633 std::istream_iterator<std::string> sIt( strm ), sEnd;
1634 while ( sIt != sEnd )
1636 std::string option = *sIt;
1637 if ( ++sIt != sEnd )
1639 std::string value = *sIt;
1641 AddOption( option.c_str(), value.c_str() );
1645 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1648 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1651 //=============================================================================
1653 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1656 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1658 this->GetImpl()->AddOption(optionName, optionValue);
1659 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1663 //=============================================================================
1665 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1668 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1670 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1671 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1675 //=============================================================================
1677 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1680 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1683 //=============================================================================
1685 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1688 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1691 //=============================================================================
1693 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1694 throw (SALOME::SALOME_Exception) {
1696 if ( !entry || !entry[0] )
1697 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1698 bool valueChanged = false;
1700 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1702 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1703 } catch (const std::invalid_argument& ex) {
1704 SALOME::ExceptionStruct ExDescription;
1705 ExDescription.text = ex.what();
1706 ExDescription.type = SALOME::BAD_PARAM;
1707 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1708 ExDescription.lineNumber = 0;
1709 throw SALOME::SALOME_Exception(ExDescription);
1710 } catch (SALOME_Exception& ex) {
1711 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1714 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1717 //=============================================================================
1719 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1720 throw (SALOME::SALOME_Exception) {
1722 bool valueChanged = false;
1723 std::ostringstream sizeMapFunction;
1724 switch (shapeType) {
1725 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1726 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1727 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1731 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1733 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1734 } catch (const std::invalid_argument& ex) {
1735 SALOME::ExceptionStruct ExDescription;
1736 ExDescription.text = ex.what();
1737 ExDescription.type = SALOME::BAD_PARAM;
1738 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1739 ExDescription.lineNumber = 0;
1740 throw SALOME::SALOME_Exception(ExDescription);
1741 } catch (SALOME_Exception& ex) {
1742 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1745 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1748 //=============================================================================
1750 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1751 throw (SALOME::SALOME_Exception) {
1753 bool valueChanged = false;
1755 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1756 if ( valueChanged ) {
1757 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1758 if (!boost::regex_match(string(attractor), re))
1759 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1760 this->GetImpl()->SetAttractorEntry(entry, attractor);
1762 } catch (const std::invalid_argument& ex) {
1763 SALOME::ExceptionStruct ExDescription;
1764 ExDescription.text = ex.what();
1765 ExDescription.type = SALOME::BAD_PARAM;
1766 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1767 ExDescription.lineNumber = 0;
1768 throw SALOME::SALOME_Exception(ExDescription);
1769 } catch (SALOME_Exception& ex) {
1770 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1773 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1776 //=============================================================================
1778 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
1779 throw (SALOME::SALOME_Exception)
1782 //bool valueChanged = false;
1784 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1786 catch (const std::invalid_argument& ex) {
1787 SALOME::ExceptionStruct ExDescription;
1788 ExDescription.text = ex.what();
1789 ExDescription.type = SALOME::BAD_PARAM;
1790 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1791 ExDescription.lineNumber = 0;
1792 throw SALOME::SALOME_Exception(ExDescription);
1793 } catch (SALOME_Exception& ex) {
1794 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1796 //if ( valueChanged )
1797 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1798 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1801 //=============================================================================
1803 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1806 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1807 } catch (const std::invalid_argument& ex) {
1808 SALOME::ExceptionStruct ExDescription;
1809 ExDescription.text = ex.what();
1810 ExDescription.type = SALOME::BAD_PARAM;
1811 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1812 ExDescription.lineNumber = 0;
1813 throw SALOME::SALOME_Exception(ExDescription);
1814 } catch (SALOME_Exception& ex) {
1815 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1820 //=============================================================================
1822 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1825 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1826 } catch (const std::invalid_argument& ex) {
1827 SALOME::ExceptionStruct ExDescription;
1828 ExDescription.text = ex.what();
1829 ExDescription.type = SALOME::BAD_PARAM;
1830 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1831 ExDescription.lineNumber = 0;
1832 throw SALOME::SALOME_Exception(ExDescription);
1833 } catch (SALOME_Exception& ex) {
1834 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1839 // //=============================================================================
1841 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1842 // // A finir pour le dump
1843 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1844 // throw (SALOME::SALOME_Exception)
1846 // ASSERT(myBaseImpl);
1848 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1850 // catch (const std::invalid_argument& ex) {
1851 // SALOME::ExceptionStruct ExDescription;
1852 // ExDescription.text = ex.what();
1853 // ExDescription.type = SALOME::BAD_PARAM;
1854 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1855 // ExDescription.lineNumber = 0;
1856 // throw SALOME::SALOME_Exception(ExDescription);
1858 // catch (SALOME_Exception& ex) {
1859 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1864 //=============================================================================
1866 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1868 this->GetImpl()->ClearEntry(entry);
1869 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1872 //=============================================================================
1874 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1876 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1878 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1879 result->length(sizeMaps.size());
1881 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1882 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1883 string entry_sizemap = smIt->first;
1884 if (!smIt->second.empty()) {
1885 entry_sizemap += "|";
1886 entry_sizemap += smIt->second;
1888 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1890 return result._retn();
1893 //=============================================================================
1895 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1897 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1899 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1900 result->length(attractors.size());
1902 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1903 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1904 string entry_attractor = atIt->first;
1905 if (!atIt->second.empty()) {
1906 entry_attractor += "|";
1907 entry_attractor += atIt->second;
1909 result[i] = CORBA::string_dup(entry_attractor.c_str());
1911 return result._retn();
1914 //=============================================================================
1916 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1919 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1921 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1922 result->length( attractors.size() );
1924 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1925 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1926 string faceEntry = atIt->first;
1928 double startSize, endSize, infDist, constDist;
1929 if ( !atIt->second->Empty() ) {
1930 attEntry = atIt->second->GetAttractorEntry();
1931 std::vector<double> params = atIt->second->GetParameters();
1932 startSize = params[0];
1933 endSize = params[1];
1934 infDist = params[2];
1935 constDist = params[3];
1937 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1938 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1939 result[i].startSize = startSize;
1940 result[i].endSize = endSize;
1941 result[i].infDist = infDist;
1942 result[i].constDist = constDist;
1944 return result._retn();
1947 //=============================================================================
1949 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1950 throw (SALOME::SALOME_Exception) {
1952 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1953 string entry_sizemap = sizeMaps[i].in();
1954 size_t colonPos = entry_sizemap.find('|');
1955 string entry, sizemap;
1956 if (colonPos == string::npos) // '|' separator not found
1957 entry = entry_sizemap;
1959 entry = entry_sizemap.substr(0, colonPos);
1960 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1961 sizemap = entry_sizemap.substr(colonPos + 1);
1963 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1967 //=============================================================================
1969 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1971 this->GetImpl()->ClearSizeMaps();
1974 //=============================================================================
1976 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1977 throw (SALOME::SALOME_Exception)
1981 entry = GeomObj->GetStudyEntry();
1982 SetSizeMapEntry(entry.c_str(), sizeMap);
1985 //=============================================================================
1987 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1989 string entry = GeomObj->GetStudyEntry();
1990 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1991 if (shapeType == GEOM::COMPOUND)
1992 shapeType = GeomObj->GetMaxShapeType();
1993 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1996 //=============================================================================
1997 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2000 entry = GeomObj->GetStudyEntry();
2001 UnsetEntry(entry.c_str());
2002 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2005 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2008 entry = GeomObj->GetStudyEntry();
2009 SetAttractorEntry(entry.c_str(), attractor);
2012 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2015 entry = GeomObj->GetStudyEntry();
2016 UnsetEntry(entry.c_str());
2017 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2020 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)
2023 string theFaceEntry;
2025 theFaceEntry = theFace->GetStudyEntry();
2026 theAttEntry = theAttractor->GetStudyEntry();
2028 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2031 if (theFaceEntry.empty()) {
2033 aName += theFace->GetEntry();
2034 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2035 if (!theSFace->_is_nil())
2036 theFaceEntry = theSFace->GetID();
2038 if (theFaceEntry.empty())
2039 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2041 if (theAttEntry.empty()) {
2042 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2044 if (theAttractor->GetShapeType() == GEOM::EDGE)
2046 if (theAttractor->GetShapeType() == GEOM::WIRE)
2048 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2049 aName = "Compound_";
2050 aName += theAttractor->GetEntry();
2051 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2052 if (!theSAtt->_is_nil())
2053 theAttEntry = theSAtt->GetID();
2055 if (theAttEntry.empty())
2056 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2058 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2059 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2060 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2063 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2064 GEOM::GEOM_Object_ptr theAttractor)
2067 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2068 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2070 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2073 // if (theFaceEntry.empty()) {
2075 // aName += theFace->GetEntry();
2076 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2077 // if (!theSFace->_is_nil())
2078 // theFaceEntry = theSFace->GetID();
2080 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2081 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2082 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2084 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2085 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2086 << theFace << ", " << theAttractor << " )";
2089 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2090 const char* attractorEntry)
2092 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2093 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2094 << faceEntry << "', '" << attractorEntry << "' )";
2099 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2102 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2105 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2108 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2111 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2114 this->GetImpl()->UnsetCustomSizeMap(entry);
2115 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2119 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2124 // ///////////////////////
2125 // // ENFORCED VERTICES //
2126 // ///////////////////////
2130 * Returns the list of enforced vertices for a given Face entry
2131 * @return A map of Face entry / List of enforced vertices
2134 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2137 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2139 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2140 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2141 resultMap->length(faceEntryEnfVertexListMap.size());
2143 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2144 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2145 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2146 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2147 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2148 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2150 _enfVertexList = it_entry->second;
2151 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2152 enfVertexList->length(_enfVertexList.size());
2154 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2155 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2156 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2157 currentEnfVertex = (*it_enfVertex);
2159 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2162 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2165 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2168 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2169 coords->length(currentEnfVertex->coords.size());
2170 for (CORBA::ULong i=0;i<coords->length();i++)
2171 coords[i] = currentEnfVertex->coords[i];
2172 enfVertex->coords = coords;
2175 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2178 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2179 faceEntryList->length(currentEnfVertex->faceEntries.size());
2180 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2181 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2182 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2183 enfVertex->faceEntries = faceEntryList;
2186 msg << "Enforced vertex: \n"
2187 << "Name: " << enfVertex->name << "\n";
2188 if (coords->length())
2189 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2190 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2191 << "Group Name: " << enfVertex->grpName;
2193 enfVertexList[j] = enfVertex;
2195 mapElement->enfVertexList = enfVertexList;
2197 resultMap[i] = mapElement;
2200 return resultMap._retn();
2204 * Returns the list of all enforced vertices
2205 * @return a list of enforced vertices
2208 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2210 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2211 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2212 resultMap->length(enfVertexList.size());
2214 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2215 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2216 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2217 currentEnfVertex = (*evlIt);
2218 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2220 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2222 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2224 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2225 coords->length(currentEnfVertex->coords.size());
2226 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2227 coords[ind] = currentEnfVertex->coords[ind];
2228 enfVertex->coords = coords;
2230 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2232 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2233 faceEntryList->length(currentEnfVertex->faceEntries.size());
2234 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2235 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2236 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2237 enfVertex->faceEntries = faceEntryList;
2240 msg << "Enforced vertex: \n"
2241 << "Name: " << enfVertex->name << "\n";
2242 if (coords->length())
2243 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2244 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2245 << "Group Name: " << enfVertex->grpName;
2247 resultMap[i] = enfVertex;
2249 return resultMap._retn();
2254 * Returns the list of enforced vertices coords for a given Face entry.
2255 * They are the coords of the "manual" enforced vertices.
2256 * @return A map of Face entry / List of enforced vertices coords
2259 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2262 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2264 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2265 resultMap->length(entryCoordsListMap.size());
2267 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2268 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2269 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2270 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2271 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2273 _coordsList = it_entry->second;
2274 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2275 coordsList->length(_coordsList.size());
2277 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2278 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2279 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2280 coords->length((*it_coords).size());
2281 for (CORBA::ULong i=0;i<coords->length();i++)
2282 coords[i] = (*it_coords)[i];
2283 coordsList[j] = coords;
2285 mapElement->coordsList = coordsList;
2287 resultMap[i] = mapElement;
2290 return resultMap._retn();
2294 * Returns a map of enforced vertices coords / enforced vertex.
2295 * They are the coords of the "manual" enforced vertices.
2297 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2300 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2301 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2302 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2303 resultMap->length(coordsEnfVertexMap.size());
2305 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2306 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2307 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2308 currentEnfVertex = (it_coords->second);
2309 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2310 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2311 coords->length(it_coords->first.size());
2312 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2313 coords[ind] = it_coords->first[ind];
2314 mapElement->coords = coords;
2316 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2318 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2320 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2322 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2323 coords2->length(currentEnfVertex->coords.size());
2324 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2325 coords2[ind] = currentEnfVertex->coords[ind];
2326 enfVertex->coords = coords2;
2328 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2330 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2331 faceEntryList->length(currentEnfVertex->faceEntries.size());
2332 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2333 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2334 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2335 enfVertex->faceEntries = faceEntryList;
2337 mapElement->enfVertex = enfVertex;
2339 msg << "Enforced vertex: \n"
2340 << "Name: " << enfVertex->name << "\n";
2341 if (coords->length())
2342 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2343 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2344 << "Group Name: " << enfVertex->grpName;
2346 resultMap[i] = mapElement;
2348 return resultMap._retn();
2352 * Returns the list of enforced vertices entries for a given Face entry.
2353 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2354 * @return A map of Face entry / List of enforced vertices geom entries
2357 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2360 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2362 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2363 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2364 resultMap->length(entryEnfVertexEntryListMap.size());
2366 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2367 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2368 entryEnfVertexEntryListMap.begin();
2369 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2370 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2371 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2372 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2374 _enfVertexEntryList = it_entry->second;
2375 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2376 enfVertexEntryList->length(_enfVertexEntryList.size());
2378 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2379 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2380 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2382 mapElement->enfVertexEntryList = enfVertexEntryList;
2384 resultMap[i] = mapElement;
2387 return resultMap._retn();
2391 * Returns a map of enforced vertices geom entry / enforced vertex.
2392 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2394 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2397 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2398 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2399 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2400 resultMap->length(enfVertexEntryEnfVertexMap.size());
2402 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2403 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2404 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2405 currentEnfVertex = it_enfVertexEntry->second;
2406 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2407 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2409 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2411 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2413 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2415 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2416 coords->length(currentEnfVertex->coords.size());
2417 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2418 coords[ind] = currentEnfVertex->coords[ind];
2419 enfVertex->coords = coords;
2421 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2423 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2424 faceEntryList->length(currentEnfVertex->faceEntries.size());
2425 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2426 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2427 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2428 enfVertex->faceEntries = faceEntryList;
2431 msg << "Enforced vertex: \n"
2432 << "Name: " << enfVertex->name << "\n";
2433 if (coords->length())
2434 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2435 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2436 << "Group Name: " << enfVertex->grpName;
2438 mapElement->enfVertex = enfVertex;
2439 resultMap[i] = mapElement;
2441 return resultMap._retn();
2445 * Erase all enforced vertices
2447 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2449 this->GetImpl()->ClearAllEnforcedVertices();
2450 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2454 * Set/get/unset an enforced vertex on face - OBSOLETE
2456 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2457 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2460 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2461 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2464 string theFaceEntry = theFace->GetStudyEntry();
2466 if (theFaceEntry.empty()) {
2467 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2469 if (theFace->GetShapeType() == GEOM::FACE)
2471 if (theFace->GetShapeType() == GEOM::COMPOUND)
2472 aName = "Compound_";
2473 aName += theFace->GetEntry();
2474 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2475 if (!theSFace->_is_nil())
2476 theFaceEntry = theSFace->GetID();
2478 if (theFaceEntry.empty())
2479 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2481 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2482 } catch (SALOME_Exception& ex) {
2483 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2488 * Set/get/unset an enforced vertex with name on face
2490 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2491 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2494 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2495 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2498 string theFaceEntry = theFace->GetStudyEntry();
2500 if (theFaceEntry.empty()) {
2501 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
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(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 );
2516 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2517 } catch (SALOME_Exception& ex) {
2518 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2523 * Set/get/unset an enforced vertex with geom object on face
2525 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2526 throw (SALOME::SALOME_Exception) {
2529 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2530 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2533 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2534 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2537 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2538 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2539 // if (CORBA::is_nil(measureOp))
2542 // CORBA::Double x, y, z;
2544 // measureOp->PointCoordinates(theVertex, x, y, z);
2546 string theFaceEntry = theFace->GetStudyEntry();
2547 string theVertexEntry = theVertex->GetStudyEntry();
2549 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2552 if (theFaceEntry.empty()) {
2553 if (theFace->GetShapeType() == GEOM::FACE)
2555 if (theFace->GetShapeType() == GEOM::COMPOUND)
2556 aName = "Compound_";
2557 aName += theFace->GetEntry();
2558 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2559 if (!theSFace->_is_nil())
2560 theFaceEntry = theSFace->GetID();
2562 if (theFaceEntry.empty())
2563 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2565 if (theVertexEntry.empty()) {
2566 if (theVertex->GetShapeType() == GEOM::VERTEX)
2568 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2569 aName = "Compound_";
2570 aName += theVertex->GetEntry();
2571 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2572 if (!theSVertex->_is_nil())
2573 theVertexEntry = theSVertex->GetID();
2575 if (theVertexEntry.empty())
2576 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2578 string theVertexName = theVertex->GetName();
2580 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2581 } catch (SALOME_Exception& ex) {
2582 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2587 * Set an enforced vertex with group name on face
2589 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2590 throw (SALOME::SALOME_Exception)
2594 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2595 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2598 string theFaceEntry = theFace->GetStudyEntry();
2600 if (theFaceEntry.empty()) {
2601 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2603 if (theFace->GetShapeType() == GEOM::FACE)
2605 if (theFace->GetShapeType() == GEOM::COMPOUND)
2606 aName = "Compound_";
2607 aName += theFace->GetEntry();
2608 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2609 if (!theSFace->_is_nil())
2610 theFaceEntry = theSFace->GetID();
2612 if (theFaceEntry.empty())
2613 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2615 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2616 } catch (SALOME_Exception& ex) {
2617 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2622 * Set an enforced vertex with name and group name on face
2624 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2625 const char* theVertexName, const char* theGroupName)
2626 throw (SALOME::SALOME_Exception)
2630 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2631 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2634 string theFaceEntry = theFace->GetStudyEntry();
2636 if (theFaceEntry.empty()) {
2637 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2639 if (theFace->GetShapeType() == GEOM::FACE)
2641 if (theFace->GetShapeType() == GEOM::COMPOUND)
2642 aName = "Compound_";
2643 aName += theFace->GetEntry();
2644 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2645 if (!theSFace->_is_nil())
2646 theFaceEntry = theSFace->GetID();
2648 if (theFaceEntry.empty())
2649 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2651 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2652 } catch (SALOME_Exception& ex) {
2653 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2658 * Set an enforced vertex with geom entry and group name on face
2660 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2661 throw (SALOME::SALOME_Exception)
2665 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2666 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2669 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2670 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2673 string theFaceEntry = theFace->GetStudyEntry();
2674 string theVertexEntry = theVertex->GetStudyEntry();
2676 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2679 if (theFaceEntry.empty()) {
2680 if (theFace->GetShapeType() == GEOM::FACE)
2682 if (theFace->GetShapeType() == GEOM::COMPOUND)
2683 aName = "Compound_";
2684 aName += theFace->GetEntry();
2685 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2686 if (!theSFace->_is_nil())
2687 theFaceEntry = theSFace->GetID();
2689 if (theFaceEntry.empty())
2690 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2692 if (theVertexEntry.empty()) {
2693 if (theVertex->GetShapeType() == GEOM::VERTEX)
2695 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2696 aName = "Compound_";
2697 aName += theVertex->GetEntry();
2698 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2699 if (!theSVertex->_is_nil())
2700 theVertexEntry = theSVertex->GetID();
2702 if (theVertexEntry.empty())
2703 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2705 string theVertexName = theVertex->GetName();
2707 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2708 } catch (SALOME_Exception& ex) {
2709 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2713 //Enable internal enforced vertices on specific face if requested by user
2715 // * Are internal enforced vertices used for a face ?
2717 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2718 // throw (SALOME::SALOME_Exception) {
2719 // ASSERT(myBaseImpl);
2721 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2722 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2725 // string theFaceEntry = theFace->GetStudyEntry();
2727 // if (theFaceEntry.empty()) {
2728 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2730 // if (theFace->GetShapeType() == GEOM::FACE)
2732 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2733 // aName = "Compound_";
2734 // aName += theFace->GetEntry();
2735 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2736 // if (!theSFace->_is_nil())
2737 // theFaceEntry = theSFace->GetID();
2739 // if (theFaceEntry.empty())
2740 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2743 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2744 // } catch (SALOME_Exception& ex) {
2745 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2750 * Get the list of all enforced vertices
2752 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2753 throw (SALOME::SALOME_Exception) {
2756 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2757 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2760 string theFaceEntry = theFace->GetStudyEntry();
2762 if (theFaceEntry.empty()) {
2763 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2765 if (theFace->GetShapeType() == GEOM::FACE)
2767 if (theFace->GetShapeType() == GEOM::COMPOUND)
2768 aName = "Compound_";
2769 aName += theFace->GetEntry();
2770 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2771 if (!theSFace->_is_nil())
2772 theFaceEntry = theSFace->GetID();
2774 if (theFaceEntry.empty())
2775 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2778 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2779 } catch (SALOME_Exception& ex) {
2780 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2784 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2785 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2788 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2789 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2792 string theFaceEntry = theFace->GetStudyEntry();
2794 if (theFaceEntry.empty()) {
2795 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2797 if (theFace->GetShapeType() == GEOM::FACE)
2799 if (theFace->GetShapeType() == GEOM::COMPOUND)
2800 aName = "Compound_";
2801 aName += theFace->GetEntry();
2802 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2803 if (!theSFace->_is_nil())
2804 theFaceEntry = theSFace->GetID();
2806 if (theFaceEntry.empty())
2807 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2810 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2811 } catch (SALOME_Exception& ex) {
2812 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2816 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2817 throw (SALOME::SALOME_Exception) {
2820 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2821 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2823 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2824 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2827 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2828 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2829 // if (CORBA::is_nil(measureOp))
2832 // CORBA::Double x, y, z;
2834 // measureOp->PointCoordinates(theVertex, x, y, z);
2836 std::string theFaceEntry = theFace->GetStudyEntry();
2837 std::string theVertexEntry = theVertex->GetStudyEntry();
2839 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2842 if (theFaceEntry.empty()) {
2843 if (theFace->GetShapeType() == GEOM::FACE)
2845 if (theFace->GetShapeType() == GEOM::COMPOUND)
2846 aName = "Compound_";
2847 aName += theFace->GetEntry();
2848 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2849 if (!theSFace->_is_nil())
2850 theFaceEntry = theSFace->GetID();
2852 if (theFaceEntry.empty())
2853 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2855 if (theVertexEntry.empty()) {
2856 if (theVertex->GetShapeType() == GEOM::VERTEX)
2858 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2859 aName = "Compound_";
2860 aName += theVertex->GetEntry();
2861 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2862 if (!theSVertex->_is_nil())
2863 theVertexEntry = theSVertex->GetID();
2865 if (theVertexEntry.empty())
2866 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2870 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2871 } catch (SALOME_Exception& ex) {
2872 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2876 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2879 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2880 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2883 string theFaceEntry = theFace->GetStudyEntry();
2885 if (theFaceEntry.empty()) {
2886 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2888 if (theFace->GetShapeType() == GEOM::FACE)
2890 if (theFace->GetShapeType() == GEOM::COMPOUND)
2891 aName = "Compound_";
2892 aName += theFace->GetEntry();
2893 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2894 if (!theSFace->_is_nil())
2895 theFaceEntry = theSFace->GetID();
2897 if (theFaceEntry.empty())
2898 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2902 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2903 } catch (SALOME_Exception& ex) {
2904 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2909 * Set/get/unset an enforced vertex on face - NEW (no face)
2911 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2916 return SetEnforcedVertexEntry("", x, y, z);
2917 } catch (SALOME_Exception& ex) {
2918 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2923 * Set/get/unset an enforced vertex with name on face
2925 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2928 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2929 } catch (SALOME_Exception& ex) {
2930 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2935 * Set/get/unset an enforced vertex with geom object on face
2937 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2938 throw (SALOME::SALOME_Exception)
2940 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2941 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2943 string theVertexEntry = theVertex->GetStudyEntry();
2945 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2946 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2949 if (theVertexEntry.empty()) {
2950 if (theVertex->GetShapeType() == GEOM::VERTEX)
2952 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2953 aName = "Compound_";
2954 aName += theVertex->GetEntry();
2955 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
2956 if (!theSVertex->_is_nil())
2957 theVertexEntry = theSVertex->GetID();
2959 if (theVertexEntry.empty())
2960 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2962 string theVertexName = theVertex->GetName();
2964 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2965 } catch (SALOME_Exception& ex) {
2966 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2971 * Set an enforced vertex with group name on face
2973 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2974 throw (SALOME::SALOME_Exception)
2979 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2980 } catch (SALOME_Exception& ex) {
2981 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2986 * Set an enforced vertex with name and group name on face
2988 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
2989 const char* theVertexName, const char* theGroupName)
2990 throw (SALOME::SALOME_Exception)
2995 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2996 } catch (SALOME_Exception& ex) {
2997 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3002 * Set an enforced vertex with geom entry and group name on face
3004 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3005 throw (SALOME::SALOME_Exception)
3007 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3008 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3011 string theVertexEntry = theVertex->GetStudyEntry();
3013 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3014 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3017 if (theVertexEntry.empty()) {
3018 if (theVertex->GetShapeType() == GEOM::VERTEX)
3020 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3021 aName = "Compound_";
3022 aName += theVertex->GetEntry();
3023 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3024 if (!theSVertex->_is_nil())
3025 theVertexEntry = theSVertex->GetID();
3027 if (theVertexEntry.empty())
3028 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3030 string theVertexName = theVertex->GetName();
3032 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3033 } catch (SALOME_Exception& ex) {
3034 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3038 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3041 return UnsetEnforcedVertexEntry("", x, y, z);
3042 } catch (SALOME_Exception& ex) {
3043 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3047 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3048 throw (SALOME::SALOME_Exception)
3050 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3051 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3053 std::string theVertexEntry = theVertex->GetStudyEntry();
3055 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3056 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3059 if (theVertexEntry.empty()) {
3060 if (theVertex->GetShapeType() == GEOM::VERTEX)
3062 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3063 aName = "Compound_";
3064 aName += theVertex->GetEntry();
3065 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3066 if (!theSVertex->_is_nil())
3067 theVertexEntry = theSVertex->GetID();
3069 if (theVertexEntry.empty())
3070 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3073 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3074 } catch (SALOME_Exception& ex) {
3075 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3079 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3082 return UnsetEnforcedVerticesEntry("");
3083 } catch (SALOME_Exception& ex) {
3084 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3089 * Set/get/unset an enforced vertex on geom object given by entry
3091 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3095 const char* theVertexName,
3096 const char* theVertexEntry,
3097 const char* theGroupName)
3098 throw (SALOME::SALOME_Exception)
3100 bool newValue = false;
3101 if (string(theVertexEntry).empty()) {
3103 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3104 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3105 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3106 coords.push_back(x);
3107 coords.push_back(y);
3108 coords.push_back(z);
3109 if (coordsList.find(coords) == coordsList.end()) {
3112 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3113 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3117 } catch (const std::invalid_argument& ex) {
3118 // no enforced vertex for entry
3122 if (string(theVertexName).empty()) {
3123 if (string(theGroupName).empty())
3124 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3126 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3129 if (string(theGroupName).empty())
3130 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3132 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3133 << theVertexName << "\", \"" << theGroupName << "\")";
3138 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3139 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3140 if ( it == enfVertexEntryList.end()) {
3144 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3145 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3149 } catch (const std::invalid_argument& ex) {
3150 // no enforced vertex for entry
3154 if (string(theGroupName).empty())
3155 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3157 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3162 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3167 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3168 throw (SALOME::SALOME_Exception)
3171 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3172 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3173 vertexList->length(_vList.size());
3174 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3175 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3176 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3178 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3181 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3182 // Geom Vertex Entry
3183 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3185 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3186 coords->length(_enfVertex->coords.size());
3187 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3188 coords[ind] = _enfVertex->coords[ind];
3189 enfVertex->coords = coords;
3191 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3193 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3194 faceEntryList->length(_enfVertex->faceEntries.size());
3195 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3196 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3197 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3198 enfVertex->faceEntries = faceEntryList;
3200 vertexList[i] = enfVertex;
3202 return vertexList._retn();
3203 } catch (const std::invalid_argument& ex) {
3204 SALOME::ExceptionStruct ExDescription;
3205 ExDescription.text = ex.what();
3206 ExDescription.type = SALOME::BAD_PARAM;
3207 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3208 ExDescription.lineNumber = 1385;
3209 throw SALOME::SALOME_Exception(ExDescription);
3210 } catch (const std::exception& ex) {
3211 std::cout << "Exception: " << ex.what() << std::endl;
3212 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3216 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3222 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3224 if (string(theVertexEntry).empty())
3225 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3228 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3230 } catch (const std::invalid_argument& ex) {
3232 } catch (const std::exception& ex) {
3233 std::cout << "Exception: " << ex.what() << std::endl;
3234 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3239 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3244 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3245 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3246 } catch (const std::invalid_argument& ex) {
3248 } catch (const std::exception& ex) {
3249 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3255 //=============================================================================
3257 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3261 //=============================================================================
3262 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3265 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3266 std::string theValueStr = theValue ? "True" : "False";
3267 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3270 //=============================================================================
3272 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3276 //=============================================================================
3277 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3280 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3283 //=============================================================================
3285 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3289 //=============================================================================
3290 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3293 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3294 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3297 //=============================================================================
3299 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3303 //=============================================================================
3304 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3307 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3311 * Enable internal enforced vertices on specific face if requested by user
3313 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3314 throw (SALOME::SALOME_Exception)
3317 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3318 } catch (SALOME_Exception& ex) {
3319 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3323 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3324 throw (SALOME::SALOME_Exception)
3327 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3328 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3331 string theFaceEntry = theFace->GetStudyEntry();
3333 if (theFaceEntry.empty()) {
3334 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3335 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3337 if (theFace->GetShapeType() == GEOM::FACE)
3339 if (theFace->GetShapeType() == GEOM::COMPOUND)
3340 aName = "Compound_";
3341 aName += theFace->GetEntry();
3342 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3343 if (!theSFace->_is_nil())
3344 theFaceEntry = theSFace->GetID();
3346 if (theFaceEntry.empty())
3347 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3350 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3351 } catch (SALOME_Exception& ex) {
3352 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3356 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3357 throw (SALOME::SALOME_Exception)
3361 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3362 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3363 if (string(theGroupName).empty())
3364 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3366 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3367 } catch (const std::exception& ex) {
3368 std::cout << "Exception: " << ex.what() << std::endl;
3369 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3376 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3377 throw (SALOME::SALOME_Exception)
3381 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3383 catch (const std::invalid_argument& ex) {
3384 SALOME::ExceptionStruct ExDescription;
3385 ExDescription.text = ex.what();
3386 ExDescription.type = SALOME::BAD_PARAM;
3387 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3388 ExDescription.lineNumber = 1146;
3389 throw SALOME::SALOME_Exception(ExDescription);
3391 catch (SALOME_Exception& ex) {
3392 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3398 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3399 throw (SALOME::SALOME_Exception)
3403 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3405 catch (const std::invalid_argument& ex) {
3406 SALOME::ExceptionStruct ExDescription;
3407 ExDescription.text = ex.what();
3408 ExDescription.type = SALOME::BAD_PARAM;
3409 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3410 ExDescription.lineNumber = 1170;
3411 throw SALOME::SALOME_Exception(ExDescription);
3413 catch (SALOME_Exception& ex) {
3414 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3417 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3418 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3422 ///////////////////////
3424 ///////////////////////
3426 ///////////////////////
3429 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3431 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3432 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3433 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3434 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3435 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3436 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3437 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3438 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3439 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3440 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3441 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3442 return txtShapeType;
3445 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3447 // Check shape types
3449 std::stringstream typesTxt;
3450 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3452 GEOM::shape_type theShapeType = theShapeTypes[i];
3453 if (shape->GetShapeType() == theShapeType)
3455 typesTxt << ShapeTypeToString(theShapeType);
3456 if (i < theShapeTypes.size()-1 )
3460 std::stringstream msg;
3461 msg << "shape type is not in" << typesTxt.str();
3462 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3466 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3469 if (shape->GetShapeType() != theShapeType) {
3470 std::stringstream msg;
3471 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3472 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3476 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3478 // Check shape is published in the object browser
3479 string shapeEntry = shape->GetStudyEntry();
3481 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3484 // Publish shape if needed
3485 if (shapeEntry.empty()) {
3486 if (shape->GetShapeType() == theShapeType)
3488 aName += shape->GetEntry();
3489 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3490 if (!theSFace1->_is_nil())
3491 shapeEntry = theSFace1->GetID();
3493 if (shapeEntry.empty())
3494 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3498 // Format the output of two vectors to use it in MESSAGE and PythonDump
3499 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3501 std::stringstream listEntriesTxt;
3503 if (!theSourceVerticesEntries.empty())
3505 listEntriesTxt << ", [" ;
3507 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3510 listEntriesTxt << ", ";
3511 listEntriesTxt << *it;
3514 listEntriesTxt << "], [" ;
3516 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3519 listEntriesTxt << ", ";
3520 listEntriesTxt << *it;
3522 listEntriesTxt << "]" ;
3524 return listEntriesTxt.str();
3528 * Erase all PreCad periodicity associations
3530 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3532 this->GetImpl()->ClearPreCadPeriodicityVectors();
3533 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3536 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3538 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3539 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3541 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3543 return periodicityList._retn();
3546 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3548 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3549 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3551 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3553 return periodicityList._retn();
3556 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3557 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3559 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3561 periodicityList->length(preCadPeriodicityVector.size());
3563 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3565 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3567 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3568 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3569 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3571 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3572 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3574 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3575 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3576 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3579 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3581 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3582 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3584 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3585 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3586 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3589 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3591 periodicityList[i] = myPreCadPeriodicity;
3595 return periodicityList._retn();
3599 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3600 throw (SALOME::SALOME_Exception)
3603 const GEOM::ListOfGO theSourceVertices;
3604 const GEOM::ListOfGO theTargetVertices;
3605 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3609 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3610 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3611 throw (SALOME::SALOME_Exception)
3615 size_t theLength = theSourceVertices.length();
3616 if (theLength != theTargetVertices.length())
3617 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3619 std::vector<GEOM::shape_type> allowedShapeTypes;
3620 allowedShapeTypes.push_back(GEOM::FACE);
3621 allowedShapeTypes.push_back(GEOM::COMPOUND);
3623 string prefix1 = "Source_face_";
3624 CheckShapeTypes(theFace1, allowedShapeTypes);
3625 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3627 string prefix2 = "Target_face_";
3628 CheckShapeTypes(theFace2, allowedShapeTypes);
3629 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3631 string prefix3 = "Source_vertex_";
3632 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3633 theSourceVerticesEntries->length(theLength);
3634 GEOM::GEOM_Object_ptr theVtx_i;
3636 for (size_t ind = 0; ind < theLength; ind++) {
3637 theVtx_i = theSourceVertices[ind];
3638 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3639 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3642 string prefix4 = "Target_vertex_";
3643 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3644 theTargetVerticesEntries->length(theLength);
3645 for (size_t ind = 0; ind < theLength; ind++) {
3646 theVtx_i = theTargetVertices[ind];
3647 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3648 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3651 string theFace2Name = theFace2->GetName();
3653 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3654 theSourceVerticesEntries, theTargetVerticesEntries);
3655 } catch (SALOME_Exception& ex) {
3656 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3661 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3662 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3663 throw (SALOME::SALOME_Exception)
3668 // Convert BLSURFPlugin::TEntryList to vector<string>
3669 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3670 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3671 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3672 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3675 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3678 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3679 theSourceVerticesEntries, theTargetVerticesEntries);
3681 SMESH::TPythonDump pd;
3682 if (!theSourceVerticesEntries.empty())
3684 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3685 pd << listEntriesTxt.c_str();
3689 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3692 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3693 throw (SALOME::SALOME_Exception)
3696 const GEOM::ListOfGO theSourceVertices;
3697 const GEOM::ListOfGO theTargetVertices;
3698 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3701 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3702 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3703 throw (SALOME::SALOME_Exception)
3707 size_t theLength = theSourceVertices.length();
3708 if (theLength != theTargetVertices.length())
3709 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3711 std::vector<GEOM::shape_type> allowedShapeTypes;
3712 allowedShapeTypes.push_back(GEOM::EDGE);
3713 allowedShapeTypes.push_back(GEOM::COMPOUND);
3715 string prefix1 = "Source_edge_";
3716 CheckShapeTypes(theEdge1, allowedShapeTypes);
3717 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3719 string prefix2 = "Target_edge_";
3720 CheckShapeTypes(theEdge2, allowedShapeTypes);
3721 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3723 string prefix3 = "Source_vertex_";
3724 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3725 theSourceVerticesEntries->length(theLength);
3726 GEOM::GEOM_Object_ptr theVtx_i;
3728 for (size_t ind = 0; ind < theLength; ind++) {
3729 theVtx_i = theSourceVertices[ind];
3730 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3731 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3734 string prefix4 = "Target_vertex_";
3735 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3736 theTargetVerticesEntries->length(theLength);
3737 for (size_t ind = 0; ind < theLength; ind++) {
3738 theVtx_i = theTargetVertices[ind];
3739 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3740 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3743 string theEdge2Name = theEdge2->GetName();
3745 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3746 theSourceVerticesEntries, theTargetVerticesEntries);
3747 } catch (SALOME_Exception& ex) {
3748 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3753 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3754 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3755 throw (SALOME::SALOME_Exception)
3760 // Convert BLSURFPlugin::TEntryList to vector<string>
3761 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3762 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3763 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3764 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3767 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3769 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3770 theSourceVerticesEntries, theTargetVerticesEntries);
3772 SMESH::TPythonDump pd;
3773 if (!theSourceVerticesEntries.empty())
3775 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3776 pd << listEntriesTxt.c_str();
3780 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3785 //================================================================================
3787 * \brief Sets the file for export resulting mesh in GMF format
3788 * \param theFileName - full name of the file (.mesh, .meshb)
3790 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3792 //================================================================================
3793 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3794 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3796 bool valueChanged/*, modeChanged*/ = false;
3798 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3799 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3800 if (valueChanged)// or (!valueChanged && modeChanged))
3801 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3802 } catch (const std::exception& ex) {
3803 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3805 if (valueChanged)// or (!valueChanged && modeChanged))
3806 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3809 //================================================================================
3811 * \brief Gets the file name for export resulting mesh in GMF format
3812 * \retval char* - The file name
3814 * Returns the GMF file name
3816 //================================================================================
3817 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3819 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3822 // //================================================================================
3824 // * \brief Gets the file mode for export resulting mesh in GMF format
3825 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3827 // * Returns the GMF file mode
3829 // //================================================================================
3830 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3831 // ASSERT(myBaseImpl);
3832 // return this->GetImpl()->GetGMFFileMode();
3835 //=============================================================================
3837 * BLSURFPlugin_Hypothesis_i::GetImpl
3839 * Get implementation
3841 //=============================================================================
3842 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3843 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3846 //================================================================================
3848 * \brief Verify whether hypothesis supports given entity type
3849 * \param type - dimension (see SMESH::Dimension enumeration)
3850 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3852 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3854 //================================================================================
3855 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3856 return type == SMESH::DIM_2D;
3860 // Obsolete methods - To be removed in V7
3863 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3864 this->SetMinSize(theMinSize);
3866 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3867 return this->GetMinSize();
3869 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3870 this->SetMaxSize(theMaxSize);
3872 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3873 return this->GetMaxSize();
3875 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3876 this->SetMinSize(theMinSize);
3878 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3879 return this->GetMinSize();
3881 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3882 this->SetMaxSize(theMaxSize);
3884 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3885 return this->GetMaxSize();
3887 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3888 this->SetAngleMesh(theValue);
3890 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3891 return this->GetAngleMesh();
3893 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3894 this->SetAngleMesh(theValue);
3896 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3897 return this->GetAngleMesh();
3899 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3900 std::string theValueStr = theValue ? "1" : "0";
3901 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3903 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3904 std::string theValueStr = this->GetOptionValue("respect_geometry");
3905 if (theValueStr.empty() || theValueStr == "respect")
3909 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3910 std::string theValueStr = theValue ? "1" : "0";
3911 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3913 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3914 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3915 if (theValueStr == "1")
3919 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3920 std::ostringstream theValueStr;
3921 theValueStr << theValue;
3922 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3924 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3925 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3927 theValueStr >> result;