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,
51 ::SMESH_Gen* theGenImpl,
53 SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
55 myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
61 //=============================================================================
63 * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
67 //=============================================================================
68 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
72 //=============================================================================
74 //=============================================================================
76 * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
81 //=============================================================================
82 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
85 this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
86 SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
89 //=============================================================================
91 * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
95 //=============================================================================
96 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
99 return this->GetImpl()->GetPhysicalMesh();
102 //=============================================================================
104 * BLSURFPlugin_Hypothesis_i::SetGeometricMesh
109 //=============================================================================
110 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
113 this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
114 SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
117 //=============================================================================
119 * BLSURFPlugin_Hypothesis_i::GetGeometricMesh
123 //=============================================================================
124 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
127 return this->GetImpl()->GetGeometricMesh();
130 //=============================================================================
132 * BLSURFPlugin_Hypothesis_i::SetPhySize
136 //=============================================================================
137 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
140 this->GetImpl()->SetPhySize(theValue, false);
141 SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
144 //=============================================================================
146 * BLSURFPlugin_Hypothesis_i::SetPhySizeRel
148 * Set Relative PhySize
150 //=============================================================================
151 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
154 this->GetImpl()->SetPhySize(theValue, true);
155 SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
158 //=============================================================================
160 * BLSURFPlugin_Hypothesis_i::GetPhySize
164 //=============================================================================
165 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
168 return this->GetImpl()->GetPhySize();
171 //=============================================================================
173 * BLSURFPlugin_Hypothesis_i::IsPhySizeRel
175 * Returns True if PhySize is relative
177 //=============================================================================
178 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
181 return this->GetImpl()->IsPhySizeRel();
184 //=============================================================================
185 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
187 if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
188 this->GetImpl()->SetMinSize(theMinSize, false);
189 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
193 //=============================================================================
194 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
196 if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
197 this->GetImpl()->SetMinSize(theMinSize, true);
198 SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
202 //=============================================================================
203 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
205 return this->GetImpl()->GetMinSize();
208 //=============================================================================
209 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
211 return this->GetImpl()->IsMinSizeRel();
214 //=============================================================================
215 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
217 if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
218 this->GetImpl()->SetMaxSize(theMaxSize, false);
219 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
223 //=============================================================================
224 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
226 if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
227 this->GetImpl()->SetMaxSize(theMaxSize, true);
228 SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
232 //=============================================================================
233 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
235 return this->GetImpl()->GetMaxSize();
238 //=============================================================================
239 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
241 return this->GetImpl()->IsMaxSizeRel();
245 //=============================================================================
247 * BLSURFPlugin_Hypothesis_i::SetUseGradation
251 //=============================================================================
252 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
254 if ( GetImpl()->GetUseGradation() != bool( theValue ))
256 this->GetImpl()->SetUseGradation(theValue);
257 std::string theValueStr = theValue ? "True" : "False";
258 SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
262 //=============================================================================
264 * BLSURFPlugin_Hypothesis_i::GetUseGradation
268 //=============================================================================
269 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
271 return this->GetImpl()->GetUseGradation();
274 //=============================================================================
276 * BLSURFPlugin_Hypothesis_i::SetGradation
280 //=============================================================================
281 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
283 this->GetImpl()->SetGradation(theValue);
286 SetUseGradation( false );
288 SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
291 //=============================================================================
293 * BLSURFPlugin_Hypothesis_i::GetGradation
297 //=============================================================================
298 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
300 return this->GetImpl()->GetGradation();
303 //=============================================================================
305 * BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
309 //=============================================================================
310 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
312 if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
314 this->GetImpl()->SetUseVolumeGradation(theValue);
315 std::string theValueStr = theValue ? "True" : "False";
316 SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
320 //=============================================================================
322 * BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
326 //=============================================================================
327 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
329 return this->GetImpl()->GetUseVolumeGradation();
332 //=============================================================================
334 * BLSURFPlugin_Hypothesis_i::SetVolumeGradation
336 * Set VolumeGradation
338 //=============================================================================
339 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
341 this->GetImpl()->SetVolumeGradation(theValue);
343 SetUseVolumeGradation( false );
345 SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
348 //=============================================================================
350 * BLSURFPlugin_Hypothesis_i::GetVolumeGradation
352 * Get VolumeGradation
354 //=============================================================================
355 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
357 return this->GetImpl()->GetVolumeGradation();
360 //=============================================================================
362 * BLSURFPlugin_Hypothesis_i::SetQuadAllowed
366 //=============================================================================
367 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
369 this->GetImpl()->SetQuadAllowed(theValue);
370 std::string theValueStr = theValue ? "True" : "False";
371 SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
374 //=============================================================================
376 * BLSURFPlugin_Hypothesis_i::GetQuadAllowed
380 //=============================================================================
381 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed()
383 return this->GetImpl()->GetQuadAllowed();
386 //=============================================================================
388 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
392 //=============================================================================
393 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
395 this->GetImpl()->SetAngleMesh(theValue);
396 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
399 //=============================================================================
401 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
405 //=============================================================================
406 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
408 return this->GetImpl()->GetAngleMesh();
411 //=============================================================================
413 * BLSURFPlugin_Hypothesis_i::SetChordalError
417 //=============================================================================
418 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
420 this->GetImpl()->SetChordalError(theValue);
421 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
424 //=============================================================================
426 * BLSURFPlugin_Hypothesis_i::GetChordalError
430 //=============================================================================
431 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
433 return this->GetImpl()->GetChordalError();
436 //=============================================================================
438 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
442 //=============================================================================
443 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
445 this->GetImpl()->SetAnisotropic(theValue);
446 std::string theValueStr = theValue ? "True" : "False";
447 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
450 //=============================================================================
452 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
456 //=============================================================================
457 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
459 return this->GetImpl()->GetAnisotropic();
462 //=============================================================================
464 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
466 * Set Anisotropic Ratio
468 //=============================================================================
469 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
471 this->GetImpl()->SetAnisotropicRatio(theValue);
472 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
475 //=============================================================================
477 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
479 * Get Anisotropic Ratio
481 //=============================================================================
482 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
484 return this->GetImpl()->GetAnisotropicRatio();
488 //=============================================================================
490 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
494 //=============================================================================
495 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
497 this->GetImpl()->SetRemoveTinyEdges(theValue);
498 std::string theValueStr = theValue ? "True" : "False";
499 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
502 //=============================================================================
504 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
508 //=============================================================================
509 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
511 return this->GetImpl()->GetRemoveTinyEdges();
514 //=============================================================================
516 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
518 * Set Tiny Edge Length
520 //=============================================================================
521 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
523 this->GetImpl()->SetTinyEdgeLength(theValue);
524 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
527 //=============================================================================
529 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
531 * Get Tiny Edge Length
533 //=============================================================================
534 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
536 return this->GetImpl()->GetTinyEdgeLength();
539 //=============================================================================
541 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
545 //=============================================================================
546 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
548 this->GetImpl()->SetOptimiseTinyEdges(theValue);
549 std::string theValueStr = theValue ? "True" : "False";
550 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
553 //=============================================================================
555 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
559 //=============================================================================
560 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
562 return this->GetImpl()->GetOptimiseTinyEdges();
565 //=============================================================================
567 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
569 * Set Tiny Edge OptimisationLength
571 //=============================================================================
572 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
574 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
575 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
578 //=============================================================================
580 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
582 * Get Tiny Edge OptimisationLength
584 //=============================================================================
585 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
587 return this->GetImpl()->GetTinyEdgeOptimisationLength();
590 //=============================================================================
592 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
596 //=============================================================================
597 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
599 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
600 std::string theValueStr = theValue ? "True" : "False";
601 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
604 //=============================================================================
606 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
610 //=============================================================================
611 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
613 return this->GetImpl()->GetCorrectSurfaceIntersection();
616 //=============================================================================
618 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
620 * Set Tiny Edge OptimisationLength
622 //=============================================================================
623 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
625 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
626 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
629 //=============================================================================
631 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
633 * Get Tiny Edge OptimisationLength
635 //=============================================================================
636 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
638 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
641 //=============================================================================
643 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
647 //=============================================================================
648 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
650 this->GetImpl()->SetBadElementRemoval(theValue);
651 std::string theValueStr = theValue ? "True" : "False";
652 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
655 //=============================================================================
657 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
661 //=============================================================================
662 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
664 return this->GetImpl()->GetBadElementRemoval();
667 //=============================================================================
669 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
671 * Set Bad Surface Element Aspect Ratio
673 //=============================================================================
674 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
676 this->GetImpl()->SetBadElementAspectRatio(theValue);
677 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
680 //=============================================================================
682 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
684 * Get Bad Surface Element Aspect Ratio
686 //=============================================================================
687 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
689 return this->GetImpl()->GetBadElementAspectRatio();
692 //=============================================================================
694 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
698 //=============================================================================
699 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
701 this->GetImpl()->SetOptimizeMesh(theValue);
702 std::string theValueStr = theValue ? "True" : "False";
703 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
706 //=============================================================================
708 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
712 //=============================================================================
713 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
715 return this->GetImpl()->GetOptimizeMesh();
718 //=============================================================================
720 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
724 //=============================================================================
725 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
727 this->GetImpl()->SetQuadraticMesh(theValue);
728 std::string theValueStr = theValue ? "True" : "False";
729 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
732 //=============================================================================
734 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
738 //=============================================================================
739 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
741 return this->GetImpl()->GetQuadraticMesh();
749 * BLSURFPlugin_Hypothesis_i::SetTopology
754 //=============================================================================
755 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
757 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
758 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
761 //=============================================================================
763 * BLSURFPlugin_Hypothesis_i::GetTopology
767 //=============================================================================
768 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
770 return this->GetImpl()->GetTopology();
773 //=============================================================================
774 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
776 if (theVal < 0 || theVal > 100)
777 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
778 this->GetImpl()->SetVerbosity(theVal);
779 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
782 //=============================================================================
784 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
786 return (CORBA::Short) this->GetImpl()->GetVerbosity();
789 //=============================================================================
790 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
792 if ( GetEnforceCadEdgesSize() != toEnforce )
794 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
795 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
798 //=============================================================================
799 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
801 return this->GetImpl()->GetEnforceCadEdgesSize();
803 //=============================================================================
805 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
807 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
809 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
810 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
813 //=============================================================================
814 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
816 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
818 //=============================================================================
820 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
822 if ( GetJacobianRectification() != allowRectification )
824 this->GetImpl()->SetJacobianRectification(allowRectification);
825 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
828 //=============================================================================
829 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
831 return this->GetImpl()->GetJacobianRectification();
833 //=============================================================================
835 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
837 if ( GetMaxNumberOfPointsPerPatch() != nb )
840 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
842 } catch (const std::invalid_argument& ex) {
843 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
844 } catch (SALOME_Exception& ex) {
845 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
847 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
850 //=============================================================================
851 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
853 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
855 //=============================================================================
857 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
859 if ( GetRespectGeometry() != toRespect )
861 this->GetImpl()->SetRespectGeometry(toRespect);
862 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
865 //=============================================================================
866 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
868 return this->GetImpl()->GetRespectGeometry();
870 //=============================================================================
872 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
874 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
876 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
877 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
880 //=============================================================================
881 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
883 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
885 //=============================================================================
887 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
889 if ( GetClosedGeometry() != isClosed )
891 this->GetImpl()->SetClosedGeometry(isClosed);
892 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
895 //=============================================================================
896 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
898 return this->GetImpl()->GetClosedGeometry();
900 //=============================================================================
902 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
904 if ( GetDebug() != isDebug )
906 this->GetImpl()->SetDebug(isDebug);
907 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
910 //=============================================================================
911 bool BLSURFPlugin_Hypothesis_i::GetDebug()
913 return this->GetImpl()->GetDebug();
915 //=============================================================================
917 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
920 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
924 this->GetImpl()->SetPeriodicTolerance(tol);
926 } catch (const std::invalid_argument& ex) {
927 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
928 } catch (SALOME_Exception& ex) {
929 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
931 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
934 //=============================================================================
935 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
938 return this->GetImpl()->GetPeriodicTolerance();
940 } catch (const std::invalid_argument& ex) {
941 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
942 } catch (SALOME_Exception& ex) {
943 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
947 //=============================================================================
949 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
951 if ( GetImpl()->GetRequiredEntities() != howToTreat )
954 this->GetImpl()->SetRequiredEntities(howToTreat);
956 } catch (const std::invalid_argument& ex) {
957 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
958 } catch (SALOME_Exception& ex) {
959 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
961 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
964 //=============================================================================
965 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
967 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
969 //=============================================================================
971 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
974 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
978 this->GetImpl()->SetSewingTolerance(tol);
979 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
981 } catch (const std::invalid_argument& ex) {
982 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
983 } catch (SALOME_Exception& ex) {
984 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
988 //=============================================================================
989 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
993 return this->GetImpl()->GetSewingTolerance();
995 } catch (const std::invalid_argument& ex) {
996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
997 } catch (SALOME_Exception& ex) {
998 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1002 //=============================================================================
1004 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1006 if ( GetImpl()->GetTags() != howToTreat )
1009 this->GetImpl()->SetTags(howToTreat);
1011 catch (const std::invalid_argument& ex) {
1012 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1013 } catch (SALOME_Exception& ex) {
1014 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1017 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1019 //=============================================================================
1020 char* BLSURFPlugin_Hypothesis_i::GetTags()
1022 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1025 //=============================================================================
1026 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1028 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1029 SMESH_Comment hplDump;
1031 for ( size_t i = 0; i < patchList.size(); ++i )
1034 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1035 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1037 patchList[ i ].insert( tags[ j ]);
1038 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1040 hplDump << ( i+1 < patchList.size() ? "," : "]");
1042 if ( GetImpl()->GetHyperPatches() != patchList )
1044 GetImpl()->SetHyperPatches( patchList );
1045 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1049 //=============================================================================
1050 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1052 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1053 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1054 resHpl->length( hpl.size() );
1056 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1057 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1059 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1060 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1061 resHp.length( hp.size() );
1063 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1064 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1070 //=============================================================================
1072 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1076 //=============================================================================
1077 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1079 this->GetImpl()->SetPreCADMergeEdges(theValue);
1080 std::string theValueStr = theValue ? "True" : "False";
1081 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1084 //=============================================================================
1086 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1090 //=============================================================================
1091 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1093 return this->GetImpl()->GetPreCADMergeEdges();
1096 //=============================================================================
1098 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1102 //=============================================================================
1103 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1105 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1106 std::string theValueStr = theValue ? "True" : "False";
1107 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1110 //=============================================================================
1112 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1116 //=============================================================================
1117 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1119 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1122 //=============================================================================
1124 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1128 //=============================================================================
1129 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1131 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1132 std::string theValueStr = theValue ? "True" : "False";
1133 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1136 //=============================================================================
1138 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1142 //=============================================================================
1143 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1145 return this->GetImpl()->GetPreCADProcess3DTopology();
1148 //=============================================================================
1150 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1154 //=============================================================================
1155 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1157 this->GetImpl()->SetPreCADDiscardInput(theValue);
1158 std::string theValueStr = theValue ? "True" : "False";
1159 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1162 //=============================================================================
1164 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1168 //=============================================================================
1169 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1171 return this->GetImpl()->GetPreCADDiscardInput();
1175 //=============================================================================
1177 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1178 throw (SALOME::SALOME_Exception) {
1181 std::string name( optionName );
1182 if ( !optionValue || !optionValue[0] )
1183 UnsetOption( optionName );
1185 // basic options (visible in Advanced table)
1187 else if ( name == "enforce_cad_edge_sizes" )
1188 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1190 else if ( name == "jacobian_rectification_respect_geometry" )
1191 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1193 else if ( name == "max_number_of_points_per_patch" )
1194 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1196 else if ( name == "rectify_jacobian" )
1197 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1199 else if ( name == "respect_geometry" )
1200 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1202 else if ( name == "tiny_edge_avoid_surface_intersections" )
1203 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1205 else if ( name == "closed_geometry" )
1206 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1208 else if ( name == "debug" )
1209 SetDebug( GetImpl()->ToBool( optionValue ));
1211 else if ( name == "discard_input_topology" )
1212 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1214 else if ( name == "merge_edges" )
1215 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1217 else if ( name == "periodic_tolerance" )
1218 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1220 else if ( name == "remove_duplicate_cad_faces" )
1221 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1223 else if ( name == "required_entities" )
1224 SetRequiredEntities( optionValue );
1226 else if ( name == "sewing_tolerance" )
1227 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1229 else if ( name == "tags" )
1230 SetTags( optionValue );
1232 // other basic options with specific methods
1234 else if ( name == "correct_surface_intersections" )
1235 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1237 else if ( name == "optimise_tiny_edges" )
1238 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1240 else if ( name == "surface_intersections_processing_max_cost" )
1241 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1243 else if ( name == "volume_gradation" )
1244 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1246 else if ( name == "tiny_edge_optimisation_length" )
1247 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1249 // advanced options (for backward compatibility)
1251 else if ( name == "create_tag_on_collision" ||
1252 name == "tiny_edge_respect_geometry" )
1253 AddOption( optionName, optionValue );
1257 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1258 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1261 this->GetImpl()->SetOptionValue(optionName, optionValue);
1262 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1265 } catch (const std::invalid_argument& ex) {
1266 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1267 } catch (SALOME_Exception& ex) {
1268 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1272 //=============================================================================
1274 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1275 throw (SALOME::SALOME_Exception) {
1277 bool valueChanged = false;
1279 std::string name( optionName );
1280 if ( !optionValue || !optionValue[0] )
1281 UnsetOption( optionName );
1283 else if ( name == "closed_geometry" )
1284 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1286 else if ( name == "debug" )
1287 SetDebug( GetImpl()->ToBool( optionValue ));
1289 else if ( name == "discard_input_topology" )
1290 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1292 else if ( name == "merge_edges" )
1293 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1295 else if ( name == "periodic_tolerance" )
1296 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1298 else if ( name == "remove_duplicate_cad_faces" )
1299 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1301 else if ( name == "required_entities" )
1302 SetRequiredEntities( optionValue );
1304 else if ( name == "sewing_tolerance" )
1305 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1307 else if ( name == "tags" )
1308 SetTags( optionValue );
1310 // other basic options with specific methods
1312 else if ( name == "correct_surface_intersections" )
1313 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1315 else if ( name == "optimise_tiny_edges" )
1316 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1318 else if ( name == "surface_intersections_processing_max_cost" )
1319 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1321 else if ( name == "volume_gradation" )
1322 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1324 else if ( name == "tiny_edge_optimisation_length" )
1325 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1327 else if ( name == "process_3d_topology" )
1328 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1330 // advanced options (for backward compatibility)
1332 else if ( name == "create_tag_on_collision" ||
1333 name == "tiny_edge_respect_geometry" ||
1334 name == "remove_tiny_edges" ||
1335 name == "tiny_edge_length")
1336 AddPreCADOption( optionName, optionValue );
1339 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1341 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1343 } catch (const std::invalid_argument& ex) {
1344 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1345 } catch (SALOME_Exception& ex) {
1346 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1349 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1352 //=============================================================================
1354 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1358 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1359 } catch (const std::invalid_argument& ex) {
1360 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1361 } catch (SALOME_Exception& ex) {
1362 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1367 //=============================================================================
1369 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1373 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1374 } catch (const std::invalid_argument& ex) {
1375 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1376 } catch (SALOME_Exception& ex) {
1377 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1382 //=============================================================================
1384 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1386 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1388 this->GetImpl()->ClearOption(optionName);
1389 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1393 //=============================================================================
1395 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1397 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1399 this->GetImpl()->ClearPreCADOption(optionName);
1400 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1404 //=============================================================================
1406 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1408 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1410 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1411 result->length(opts.size());
1415 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1416 for (; opIt != opts.end(); ++opIt, ++i) {
1417 string name_value_type = opIt->first;
1418 if (!opIt->second.empty()) {
1419 name_value_type += ":";
1420 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1421 name_value_type += isDefault ? ":0" : ":1";
1423 result[i] = CORBA::string_dup(name_value_type.c_str());
1426 return result._retn();
1429 //=============================================================================
1431 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1433 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1435 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1436 result->length(opts.size());
1440 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1441 for (; opIt != opts.end(); ++opIt, ++i) {
1442 string name_value_type = opIt->first;
1443 if (!opIt->second.empty()) {
1444 name_value_type += ":";
1445 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1446 name_value_type += isDefault ? ":0" : ":1";
1448 result[i] = CORBA::string_dup(name_value_type.c_str());
1450 return result._retn();
1453 //=============================================================================
1455 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1457 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1459 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1460 result->length(custom_opts.size());
1463 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1464 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1465 string name_value_type = opIt->first;
1466 if (!opIt->second.empty()) {
1467 name_value_type += ":";
1468 name_value_type += opIt->second;
1469 name_value_type += ":1"; // user defined
1471 result[i] = CORBA::string_dup(name_value_type.c_str());
1473 return result._retn();
1476 //=============================================================================
1478 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1479 throw (SALOME::SALOME_Exception) {
1481 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1482 string name_value_type = options[i].in();
1483 if(name_value_type.empty())
1485 size_t colonPos = name_value_type.find(':');
1487 if (colonPos == string::npos) // ':' not found
1488 name = name_value_type;
1490 name = name_value_type.substr(0, colonPos);
1491 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1492 string value_type = name_value_type.substr(colonPos + 1);
1493 colonPos = value_type.find(':');
1494 value = value_type.substr(0, colonPos);
1495 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1496 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1500 SetOptionValue(name.c_str(), value.c_str());
1504 //=============================================================================
1506 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1507 throw (SALOME::SALOME_Exception) {
1509 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1510 string name_value_type = options[i].in();
1511 if(name_value_type.empty())
1513 size_t colonPos = name_value_type.find(':');
1515 if (colonPos == string::npos) // ':' not found
1516 name = name_value_type;
1518 name = name_value_type.substr(0, colonPos);
1519 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1520 string value_type = name_value_type.substr(colonPos + 1);
1521 colonPos = value_type.find(':');
1522 value = value_type.substr(0, colonPos);
1523 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1524 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1528 SetPreCADOptionValue(name.c_str(), value.c_str());
1532 //=============================================================================
1534 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1536 SMESH::TPythonDump dump;
1538 string optionsAndValues;
1539 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1540 string name_value_type = options[i].in();
1541 if(name_value_type.empty())
1543 size_t colonPos = name_value_type.find(':');
1545 if (colonPos == string::npos) // ':' not found
1546 name = name_value_type;
1548 name = name_value_type.substr(0, colonPos);
1549 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1550 string value_type = name_value_type.substr(colonPos + 1);
1551 colonPos = value_type.find(':');
1552 value = value_type.substr(0, colonPos);
1555 AddOption(name.c_str(), value.c_str());
1557 optionsAndValues += name + " " + value + " ";
1560 if ( !optionsAndValues.empty() )
1561 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1564 //=============================================================================
1566 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1567 throw (SALOME::SALOME_Exception)
1569 if ( !optionsAndValues ) return;
1571 SMESH::TPythonDump dump;
1573 std::istringstream strm( optionsAndValues );
1574 std::istream_iterator<std::string> sIt( strm ), sEnd;
1575 while ( sIt != sEnd )
1577 std::string option = *sIt;
1578 if ( ++sIt != sEnd )
1580 std::string value = *sIt;
1582 AddOption( option.c_str(), value.c_str() );
1586 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1589 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1592 //=============================================================================
1594 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1597 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1599 this->GetImpl()->AddOption(optionName, optionValue);
1600 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1604 //=============================================================================
1606 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1609 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1611 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1612 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1616 //=============================================================================
1618 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1621 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1624 //=============================================================================
1626 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1629 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1632 //=============================================================================
1634 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1635 throw (SALOME::SALOME_Exception) {
1637 if ( !entry || !entry[0] )
1638 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1639 bool valueChanged = false;
1641 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1643 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1644 } catch (const std::invalid_argument& ex) {
1645 SALOME::ExceptionStruct ExDescription;
1646 ExDescription.text = ex.what();
1647 ExDescription.type = SALOME::BAD_PARAM;
1648 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1649 ExDescription.lineNumber = 0;
1650 throw SALOME::SALOME_Exception(ExDescription);
1651 } catch (SALOME_Exception& ex) {
1652 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1655 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1658 //=============================================================================
1660 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1661 throw (SALOME::SALOME_Exception) {
1663 bool valueChanged = false;
1664 std::ostringstream sizeMapFunction;
1665 switch (shapeType) {
1666 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1667 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1668 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1672 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1674 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1675 } catch (const std::invalid_argument& ex) {
1676 SALOME::ExceptionStruct ExDescription;
1677 ExDescription.text = ex.what();
1678 ExDescription.type = SALOME::BAD_PARAM;
1679 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1680 ExDescription.lineNumber = 0;
1681 throw SALOME::SALOME_Exception(ExDescription);
1682 } catch (SALOME_Exception& ex) {
1683 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1686 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1689 //=============================================================================
1691 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1692 throw (SALOME::SALOME_Exception) {
1694 bool valueChanged = false;
1696 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1697 if ( valueChanged ) {
1698 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1699 if (!boost::regex_match(string(attractor), re))
1700 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1701 this->GetImpl()->SetAttractorEntry(entry, attractor);
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::SetAttractorEntry(entry,attractor)";
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() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1717 //=============================================================================
1719 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
1720 throw (SALOME::SALOME_Exception)
1723 //bool valueChanged = false;
1725 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1727 catch (const std::invalid_argument& ex) {
1728 SALOME::ExceptionStruct ExDescription;
1729 ExDescription.text = ex.what();
1730 ExDescription.type = SALOME::BAD_PARAM;
1731 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1732 ExDescription.lineNumber = 0;
1733 throw SALOME::SALOME_Exception(ExDescription);
1734 } catch (SALOME_Exception& ex) {
1735 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1737 //if ( valueChanged )
1738 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1739 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1742 //=============================================================================
1744 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1747 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1748 } catch (const std::invalid_argument& ex) {
1749 SALOME::ExceptionStruct ExDescription;
1750 ExDescription.text = ex.what();
1751 ExDescription.type = SALOME::BAD_PARAM;
1752 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1753 ExDescription.lineNumber = 0;
1754 throw SALOME::SALOME_Exception(ExDescription);
1755 } catch (SALOME_Exception& ex) {
1756 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1761 //=============================================================================
1763 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1766 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1767 } catch (const std::invalid_argument& ex) {
1768 SALOME::ExceptionStruct ExDescription;
1769 ExDescription.text = ex.what();
1770 ExDescription.type = SALOME::BAD_PARAM;
1771 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1772 ExDescription.lineNumber = 0;
1773 throw SALOME::SALOME_Exception(ExDescription);
1774 } catch (SALOME_Exception& ex) {
1775 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1780 // //=============================================================================
1782 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1783 // // A finir pour le dump
1784 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1785 // throw (SALOME::SALOME_Exception)
1787 // ASSERT(myBaseImpl);
1789 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1791 // catch (const std::invalid_argument& ex) {
1792 // SALOME::ExceptionStruct ExDescription;
1793 // ExDescription.text = ex.what();
1794 // ExDescription.type = SALOME::BAD_PARAM;
1795 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1796 // ExDescription.lineNumber = 0;
1797 // throw SALOME::SALOME_Exception(ExDescription);
1799 // catch (SALOME_Exception& ex) {
1800 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1805 //=============================================================================
1807 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1809 this->GetImpl()->ClearEntry(entry);
1810 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1813 //=============================================================================
1815 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1817 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1819 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1820 result->length(sizeMaps.size());
1822 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1823 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1824 string entry_sizemap = smIt->first;
1825 if (!smIt->second.empty()) {
1826 entry_sizemap += "|";
1827 entry_sizemap += smIt->second;
1829 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1831 return result._retn();
1834 //=============================================================================
1836 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1838 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1840 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1841 result->length(attractors.size());
1843 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1844 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1845 string entry_attractor = atIt->first;
1846 if (!atIt->second.empty()) {
1847 entry_attractor += "|";
1848 entry_attractor += atIt->second;
1850 result[i] = CORBA::string_dup(entry_attractor.c_str());
1852 return result._retn();
1855 //=============================================================================
1857 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1860 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1862 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1863 result->length( attractors.size() );
1865 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1866 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1867 string faceEntry = atIt->first;
1869 double startSize, endSize, infDist, constDist;
1870 if ( !atIt->second->Empty() ) {
1871 attEntry = atIt->second->GetAttractorEntry();
1872 std::vector<double> params = atIt->second->GetParameters();
1873 startSize = params[0];
1874 endSize = params[1];
1875 infDist = params[2];
1876 constDist = params[3];
1878 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1879 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1880 result[i].startSize = startSize;
1881 result[i].endSize = endSize;
1882 result[i].infDist = infDist;
1883 result[i].constDist = constDist;
1885 return result._retn();
1888 //=============================================================================
1890 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1891 throw (SALOME::SALOME_Exception) {
1893 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1894 string entry_sizemap = sizeMaps[i].in();
1895 size_t colonPos = entry_sizemap.find('|');
1896 string entry, sizemap;
1897 if (colonPos == string::npos) // '|' separator not found
1898 entry = entry_sizemap;
1900 entry = entry_sizemap.substr(0, colonPos);
1901 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1902 sizemap = entry_sizemap.substr(colonPos + 1);
1904 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1908 //=============================================================================
1910 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1912 this->GetImpl()->ClearSizeMaps();
1915 //=============================================================================
1917 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1918 throw (SALOME::SALOME_Exception)
1922 entry = GeomObj->GetStudyEntry();
1923 SetSizeMapEntry(entry.c_str(), sizeMap);
1926 //=============================================================================
1928 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1930 string entry = GeomObj->GetStudyEntry();
1931 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1932 if (shapeType == GEOM::COMPOUND)
1933 shapeType = GeomObj->GetMaxShapeType();
1934 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1937 //=============================================================================
1938 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1941 entry = GeomObj->GetStudyEntry();
1942 UnsetEntry(entry.c_str());
1943 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1946 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1949 entry = GeomObj->GetStudyEntry();
1950 SetAttractorEntry(entry.c_str(), attractor);
1953 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1956 entry = GeomObj->GetStudyEntry();
1957 UnsetEntry(entry.c_str());
1958 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1961 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)
1964 string theFaceEntry;
1966 theFaceEntry = theFace->GetStudyEntry();
1967 theAttEntry = theAttractor->GetStudyEntry();
1969 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1970 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1973 if (theFaceEntry.empty()) {
1975 aName += theFace->GetEntry();
1976 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1977 if (!theSFace->_is_nil())
1978 theFaceEntry = theSFace->GetID();
1980 if (theFaceEntry.empty())
1981 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1983 if (theAttEntry.empty()) {
1984 if (theAttractor->GetShapeType() == GEOM::VERTEX)
1986 if (theAttractor->GetShapeType() == GEOM::EDGE)
1988 if (theAttractor->GetShapeType() == GEOM::WIRE)
1990 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1991 aName = "Compound_";
1992 aName += theAttractor->GetEntry();
1993 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1994 if (!theSAtt->_is_nil())
1995 theAttEntry = theSAtt->GetID();
1997 if (theAttEntry.empty())
1998 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2000 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2001 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2002 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2005 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2006 GEOM::GEOM_Object_ptr theAttractor)
2009 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2010 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2012 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2013 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2016 // if (theFaceEntry.empty()) {
2018 // aName += theFace->GetEntry();
2019 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2020 // if (!theSFace->_is_nil())
2021 // theFaceEntry = theSFace->GetID();
2023 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2024 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2025 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2027 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2028 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2029 << theFace << ", " << theAttractor << " )";
2032 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2033 const char* attractorEntry)
2035 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2036 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2037 << faceEntry << "', '" << attractorEntry << "' )";
2042 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2045 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2048 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2051 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2054 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2057 this->GetImpl()->UnsetCustomSizeMap(entry);
2058 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2062 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2067 // ///////////////////////
2068 // // ENFORCED VERTICES //
2069 // ///////////////////////
2073 * Returns the list of enforced vertices for a given Face entry
2074 * @return A map of Face entry / List of enforced vertices
2077 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2080 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2082 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2083 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2084 resultMap->length(faceEntryEnfVertexListMap.size());
2086 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2087 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2088 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2089 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2090 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2091 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2093 _enfVertexList = it_entry->second;
2094 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2095 enfVertexList->length(_enfVertexList.size());
2097 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2098 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2099 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2100 currentEnfVertex = (*it_enfVertex);
2102 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2105 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2108 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2111 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2112 coords->length(currentEnfVertex->coords.size());
2113 for (CORBA::ULong i=0;i<coords->length();i++)
2114 coords[i] = currentEnfVertex->coords[i];
2115 enfVertex->coords = coords;
2118 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2121 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2122 faceEntryList->length(currentEnfVertex->faceEntries.size());
2123 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2124 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2125 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2126 enfVertex->faceEntries = faceEntryList;
2129 msg << "Enforced vertex: \n"
2130 << "Name: " << enfVertex->name << "\n";
2131 if (coords->length())
2132 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2133 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2134 << "Group Name: " << enfVertex->grpName;
2136 enfVertexList[j] = enfVertex;
2138 mapElement->enfVertexList = enfVertexList;
2140 resultMap[i] = mapElement;
2143 return resultMap._retn();
2147 * Returns the list of all enforced vertices
2148 * @return a list of enforced vertices
2151 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2153 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2154 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2155 resultMap->length(enfVertexList.size());
2157 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2158 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2159 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2160 currentEnfVertex = (*evlIt);
2161 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2163 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2165 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2167 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2168 coords->length(currentEnfVertex->coords.size());
2169 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2170 coords[ind] = currentEnfVertex->coords[ind];
2171 enfVertex->coords = coords;
2173 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2175 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2176 faceEntryList->length(currentEnfVertex->faceEntries.size());
2177 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2178 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2179 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2180 enfVertex->faceEntries = faceEntryList;
2183 msg << "Enforced vertex: \n"
2184 << "Name: " << enfVertex->name << "\n";
2185 if (coords->length())
2186 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2187 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2188 << "Group Name: " << enfVertex->grpName;
2190 resultMap[i] = enfVertex;
2192 return resultMap._retn();
2197 * Returns the list of enforced vertices coords for a given Face entry.
2198 * They are the coords of the "manual" enforced vertices.
2199 * @return A map of Face entry / List of enforced vertices coords
2202 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2205 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2207 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2208 resultMap->length(entryCoordsListMap.size());
2210 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2211 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2212 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2213 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2214 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2216 _coordsList = it_entry->second;
2217 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2218 coordsList->length(_coordsList.size());
2220 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2221 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2222 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2223 coords->length((*it_coords).size());
2224 for (CORBA::ULong i=0;i<coords->length();i++)
2225 coords[i] = (*it_coords)[i];
2226 coordsList[j] = coords;
2228 mapElement->coordsList = coordsList;
2230 resultMap[i] = mapElement;
2233 return resultMap._retn();
2237 * Returns a map of enforced vertices coords / enforced vertex.
2238 * They are the coords of the "manual" enforced vertices.
2240 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2243 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2244 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2245 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2246 resultMap->length(coordsEnfVertexMap.size());
2248 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2249 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2250 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2251 currentEnfVertex = (it_coords->second);
2252 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2253 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2254 coords->length(it_coords->first.size());
2255 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2256 coords[ind] = it_coords->first[ind];
2257 mapElement->coords = coords;
2259 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2261 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2263 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2265 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2266 coords2->length(currentEnfVertex->coords.size());
2267 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2268 coords2[ind] = currentEnfVertex->coords[ind];
2269 enfVertex->coords = coords2;
2271 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2273 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2274 faceEntryList->length(currentEnfVertex->faceEntries.size());
2275 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2276 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2277 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2278 enfVertex->faceEntries = faceEntryList;
2280 mapElement->enfVertex = enfVertex;
2282 msg << "Enforced vertex: \n"
2283 << "Name: " << enfVertex->name << "\n";
2284 if (coords->length())
2285 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2286 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2287 << "Group Name: " << enfVertex->grpName;
2289 resultMap[i] = mapElement;
2291 return resultMap._retn();
2295 * Returns the list of enforced vertices entries for a given Face entry.
2296 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2297 * @return A map of Face entry / List of enforced vertices geom entries
2300 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2303 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2305 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2306 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2307 resultMap->length(entryEnfVertexEntryListMap.size());
2309 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2310 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2311 entryEnfVertexEntryListMap.begin();
2312 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2313 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2314 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2315 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2317 _enfVertexEntryList = it_entry->second;
2318 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2319 enfVertexEntryList->length(_enfVertexEntryList.size());
2321 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2322 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2323 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2325 mapElement->enfVertexEntryList = enfVertexEntryList;
2327 resultMap[i] = mapElement;
2330 return resultMap._retn();
2334 * Returns a map of enforced vertices geom entry / enforced vertex.
2335 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2337 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2340 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2341 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2342 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2343 resultMap->length(enfVertexEntryEnfVertexMap.size());
2345 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2346 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2347 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2348 currentEnfVertex = it_enfVertexEntry->second;
2349 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2350 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2352 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2354 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2356 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2358 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2359 coords->length(currentEnfVertex->coords.size());
2360 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2361 coords[ind] = currentEnfVertex->coords[ind];
2362 enfVertex->coords = coords;
2364 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2366 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2367 faceEntryList->length(currentEnfVertex->faceEntries.size());
2368 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2369 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2370 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2371 enfVertex->faceEntries = faceEntryList;
2374 msg << "Enforced vertex: \n"
2375 << "Name: " << enfVertex->name << "\n";
2376 if (coords->length())
2377 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2378 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2379 << "Group Name: " << enfVertex->grpName;
2381 mapElement->enfVertex = enfVertex;
2382 resultMap[i] = mapElement;
2384 return resultMap._retn();
2388 * Erase all enforced vertices
2390 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2392 this->GetImpl()->ClearAllEnforcedVertices();
2393 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2397 * Set/get/unset an enforced vertex on face - OBSOLETE
2399 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2400 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2403 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2404 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2407 string theFaceEntry = theFace->GetStudyEntry();
2409 if (theFaceEntry.empty()) {
2410 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2411 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2413 if (theFace->GetShapeType() == GEOM::FACE)
2415 if (theFace->GetShapeType() == GEOM::COMPOUND)
2416 aName = "Compound_";
2417 aName += theFace->GetEntry();
2418 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2419 if (!theSFace->_is_nil())
2420 theFaceEntry = theSFace->GetID();
2422 if (theFaceEntry.empty())
2423 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2425 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2426 } catch (SALOME_Exception& ex) {
2427 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2432 * Set/get/unset an enforced vertex with name on face
2434 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2435 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2438 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2439 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2442 string theFaceEntry = theFace->GetStudyEntry();
2444 if (theFaceEntry.empty()) {
2445 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2446 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2448 if (theFace->GetShapeType() == GEOM::FACE)
2450 if (theFace->GetShapeType() == GEOM::COMPOUND)
2451 aName = "Compound_";
2452 aName += theFace->GetEntry();
2453 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2454 if (!theSFace->_is_nil())
2455 theFaceEntry = theSFace->GetID();
2457 if (theFaceEntry.empty())
2458 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2461 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2462 } catch (SALOME_Exception& ex) {
2463 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2468 * Set/get/unset an enforced vertex with geom object on face
2470 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2471 throw (SALOME::SALOME_Exception) {
2474 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2475 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2478 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2479 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2482 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2483 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2484 // if (CORBA::is_nil(measureOp))
2487 // CORBA::Double x, y, z;
2489 // measureOp->PointCoordinates(theVertex, x, y, z);
2491 string theFaceEntry = theFace->GetStudyEntry();
2492 string theVertexEntry = theVertex->GetStudyEntry();
2494 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2495 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2498 if (theFaceEntry.empty()) {
2499 if (theFace->GetShapeType() == GEOM::FACE)
2501 if (theFace->GetShapeType() == GEOM::COMPOUND)
2502 aName = "Compound_";
2503 aName += theFace->GetEntry();
2504 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2505 if (!theSFace->_is_nil())
2506 theFaceEntry = theSFace->GetID();
2508 if (theFaceEntry.empty())
2509 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2511 if (theVertexEntry.empty()) {
2512 if (theVertex->GetShapeType() == GEOM::VERTEX)
2514 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2515 aName = "Compound_";
2516 aName += theVertex->GetEntry();
2517 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2518 if (!theSVertex->_is_nil())
2519 theVertexEntry = theSVertex->GetID();
2521 if (theVertexEntry.empty())
2522 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2524 string theVertexName = theVertex->GetName();
2526 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2527 } catch (SALOME_Exception& ex) {
2528 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2533 * Set an enforced vertex with group name on face
2535 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2536 throw (SALOME::SALOME_Exception)
2540 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2541 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2544 string theFaceEntry = theFace->GetStudyEntry();
2546 if (theFaceEntry.empty()) {
2547 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2548 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2550 if (theFace->GetShapeType() == GEOM::FACE)
2552 if (theFace->GetShapeType() == GEOM::COMPOUND)
2553 aName = "Compound_";
2554 aName += theFace->GetEntry();
2555 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2556 if (!theSFace->_is_nil())
2557 theFaceEntry = theSFace->GetID();
2559 if (theFaceEntry.empty())
2560 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2562 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2563 } catch (SALOME_Exception& ex) {
2564 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2569 * Set an enforced vertex with name and group name on face
2571 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2572 const char* theVertexName, const char* theGroupName)
2573 throw (SALOME::SALOME_Exception)
2577 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2578 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2581 string theFaceEntry = theFace->GetStudyEntry();
2583 if (theFaceEntry.empty()) {
2584 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2585 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2587 if (theFace->GetShapeType() == GEOM::FACE)
2589 if (theFace->GetShapeType() == GEOM::COMPOUND)
2590 aName = "Compound_";
2591 aName += theFace->GetEntry();
2592 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2593 if (!theSFace->_is_nil())
2594 theFaceEntry = theSFace->GetID();
2596 if (theFaceEntry.empty())
2597 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2599 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2600 } catch (SALOME_Exception& ex) {
2601 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2606 * Set an enforced vertex with geom entry and group name on face
2608 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2609 throw (SALOME::SALOME_Exception)
2613 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2614 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2617 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2618 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2621 string theFaceEntry = theFace->GetStudyEntry();
2622 string theVertexEntry = theVertex->GetStudyEntry();
2624 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2625 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2628 if (theFaceEntry.empty()) {
2629 if (theFace->GetShapeType() == GEOM::FACE)
2631 if (theFace->GetShapeType() == GEOM::COMPOUND)
2632 aName = "Compound_";
2633 aName += theFace->GetEntry();
2634 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2635 if (!theSFace->_is_nil())
2636 theFaceEntry = theSFace->GetID();
2638 if (theFaceEntry.empty())
2639 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2641 if (theVertexEntry.empty()) {
2642 if (theVertex->GetShapeType() == GEOM::VERTEX)
2644 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2645 aName = "Compound_";
2646 aName += theVertex->GetEntry();
2647 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2648 if (!theSVertex->_is_nil())
2649 theVertexEntry = theSVertex->GetID();
2651 if (theVertexEntry.empty())
2652 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2654 string theVertexName = theVertex->GetName();
2656 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2657 } catch (SALOME_Exception& ex) {
2658 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2662 //Enable internal enforced vertices on specific face if requested by user
2664 // * Are internal enforced vertices used for a face ?
2666 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2667 // throw (SALOME::SALOME_Exception) {
2668 // ASSERT(myBaseImpl);
2670 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2671 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2674 // string theFaceEntry = theFace->GetStudyEntry();
2676 // if (theFaceEntry.empty()) {
2677 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2678 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
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(smeshGen->GetCurrentStudy(), 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 );
2693 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2694 // } catch (SALOME_Exception& ex) {
2695 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2700 * Get the list of all enforced vertices
2702 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2703 throw (SALOME::SALOME_Exception) {
2706 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2707 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2710 string theFaceEntry = theFace->GetStudyEntry();
2712 if (theFaceEntry.empty()) {
2713 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2714 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2716 if (theFace->GetShapeType() == GEOM::FACE)
2718 if (theFace->GetShapeType() == GEOM::COMPOUND)
2719 aName = "Compound_";
2720 aName += theFace->GetEntry();
2721 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2722 if (!theSFace->_is_nil())
2723 theFaceEntry = theSFace->GetID();
2725 if (theFaceEntry.empty())
2726 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2729 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2730 } catch (SALOME_Exception& ex) {
2731 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2735 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2736 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2739 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2740 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2743 string theFaceEntry = theFace->GetStudyEntry();
2745 if (theFaceEntry.empty()) {
2746 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2747 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2749 if (theFace->GetShapeType() == GEOM::FACE)
2751 if (theFace->GetShapeType() == GEOM::COMPOUND)
2752 aName = "Compound_";
2753 aName += theFace->GetEntry();
2754 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2755 if (!theSFace->_is_nil())
2756 theFaceEntry = theSFace->GetID();
2758 if (theFaceEntry.empty())
2759 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2762 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2763 } catch (SALOME_Exception& ex) {
2764 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2768 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2769 throw (SALOME::SALOME_Exception) {
2772 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2773 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2775 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2776 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2779 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2780 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2781 // if (CORBA::is_nil(measureOp))
2784 // CORBA::Double x, y, z;
2786 // measureOp->PointCoordinates(theVertex, x, y, z);
2788 std::string theFaceEntry = theFace->GetStudyEntry();
2789 std::string theVertexEntry = theVertex->GetStudyEntry();
2791 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2792 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2795 if (theFaceEntry.empty()) {
2796 if (theFace->GetShapeType() == GEOM::FACE)
2798 if (theFace->GetShapeType() == GEOM::COMPOUND)
2799 aName = "Compound_";
2800 aName += theFace->GetEntry();
2801 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2802 if (!theSFace->_is_nil())
2803 theFaceEntry = theSFace->GetID();
2805 if (theFaceEntry.empty())
2806 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2808 if (theVertexEntry.empty()) {
2809 if (theVertex->GetShapeType() == GEOM::VERTEX)
2811 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2812 aName = "Compound_";
2813 aName += theVertex->GetEntry();
2814 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2815 if (!theSVertex->_is_nil())
2816 theVertexEntry = theSVertex->GetID();
2818 if (theVertexEntry.empty())
2819 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2823 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2824 } catch (SALOME_Exception& ex) {
2825 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2829 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2832 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2833 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2836 string theFaceEntry = theFace->GetStudyEntry();
2838 if (theFaceEntry.empty()) {
2839 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2840 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2842 if (theFace->GetShapeType() == GEOM::FACE)
2844 if (theFace->GetShapeType() == GEOM::COMPOUND)
2845 aName = "Compound_";
2846 aName += theFace->GetEntry();
2847 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2848 if (!theSFace->_is_nil())
2849 theFaceEntry = theSFace->GetID();
2851 if (theFaceEntry.empty())
2852 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2856 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2857 } catch (SALOME_Exception& ex) {
2858 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2863 * Set/get/unset an enforced vertex on face - NEW (no face)
2865 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2870 return SetEnforcedVertexEntry("", x, y, z);
2871 } catch (SALOME_Exception& ex) {
2872 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2877 * Set/get/unset an enforced vertex with name on face
2879 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2882 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2883 } catch (SALOME_Exception& ex) {
2884 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2889 * Set/get/unset an enforced vertex with geom object on face
2891 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2892 throw (SALOME::SALOME_Exception)
2894 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2895 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2897 string theVertexEntry = theVertex->GetStudyEntry();
2899 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2900 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2903 if (theVertexEntry.empty()) {
2904 if (theVertex->GetShapeType() == GEOM::VERTEX)
2906 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2907 aName = "Compound_";
2908 aName += theVertex->GetEntry();
2909 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2910 if (!theSVertex->_is_nil())
2911 theVertexEntry = theSVertex->GetID();
2913 if (theVertexEntry.empty())
2914 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2916 string theVertexName = theVertex->GetName();
2918 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2919 } catch (SALOME_Exception& ex) {
2920 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2925 * Set an enforced vertex with group name on face
2927 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2928 throw (SALOME::SALOME_Exception)
2933 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2934 } catch (SALOME_Exception& ex) {
2935 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2940 * Set an enforced vertex with name and group name on face
2942 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
2943 const char* theVertexName, const char* theGroupName)
2944 throw (SALOME::SALOME_Exception)
2949 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2950 } catch (SALOME_Exception& ex) {
2951 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2956 * Set an enforced vertex with geom entry and group name on face
2958 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2959 throw (SALOME::SALOME_Exception)
2961 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2962 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2965 string theVertexEntry = theVertex->GetStudyEntry();
2967 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2968 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2971 if (theVertexEntry.empty()) {
2972 if (theVertex->GetShapeType() == GEOM::VERTEX)
2974 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2975 aName = "Compound_";
2976 aName += theVertex->GetEntry();
2977 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2978 if (!theSVertex->_is_nil())
2979 theVertexEntry = theSVertex->GetID();
2981 if (theVertexEntry.empty())
2982 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2984 string theVertexName = theVertex->GetName();
2986 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2987 } catch (SALOME_Exception& ex) {
2988 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2992 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2995 return UnsetEnforcedVertexEntry("", x, y, z);
2996 } catch (SALOME_Exception& ex) {
2997 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3001 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3002 throw (SALOME::SALOME_Exception)
3004 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3005 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3007 std::string theVertexEntry = theVertex->GetStudyEntry();
3009 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3010 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3013 if (theVertexEntry.empty()) {
3014 if (theVertex->GetShapeType() == GEOM::VERTEX)
3016 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3017 aName = "Compound_";
3018 aName += theVertex->GetEntry();
3019 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3020 if (!theSVertex->_is_nil())
3021 theVertexEntry = theSVertex->GetID();
3023 if (theVertexEntry.empty())
3024 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3027 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3028 } catch (SALOME_Exception& ex) {
3029 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3033 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3036 return UnsetEnforcedVerticesEntry("");
3037 } catch (SALOME_Exception& ex) {
3038 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3043 * Set/get/unset an enforced vertex on geom object given by entry
3045 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3049 const char* theVertexName,
3050 const char* theVertexEntry,
3051 const char* theGroupName)
3052 throw (SALOME::SALOME_Exception)
3054 bool newValue = false;
3055 if (string(theVertexEntry).empty()) {
3057 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3058 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3059 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3060 coords.push_back(x);
3061 coords.push_back(y);
3062 coords.push_back(z);
3063 if (coordsList.find(coords) == coordsList.end()) {
3066 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3067 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3071 } catch (const std::invalid_argument& ex) {
3072 // no enforced vertex for entry
3076 if (string(theVertexName).empty()) {
3077 if (string(theGroupName).empty())
3078 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3080 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3083 if (string(theGroupName).empty())
3084 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3086 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3087 << theVertexName << "\", \"" << theGroupName << "\")";
3092 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3093 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3094 if ( it == enfVertexEntryList.end()) {
3098 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3099 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3103 } catch (const std::invalid_argument& ex) {
3104 // no enforced vertex for entry
3108 if (string(theGroupName).empty())
3109 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3111 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3116 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3121 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3122 throw (SALOME::SALOME_Exception)
3125 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3126 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3127 vertexList->length(_vList.size());
3128 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3129 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3130 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3132 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3135 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3136 // Geom Vertex Entry
3137 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3139 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3140 coords->length(_enfVertex->coords.size());
3141 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3142 coords[ind] = _enfVertex->coords[ind];
3143 enfVertex->coords = coords;
3145 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3147 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3148 faceEntryList->length(_enfVertex->faceEntries.size());
3149 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3150 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3151 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3152 enfVertex->faceEntries = faceEntryList;
3154 vertexList[i] = enfVertex;
3156 return vertexList._retn();
3157 } catch (const std::invalid_argument& ex) {
3158 SALOME::ExceptionStruct ExDescription;
3159 ExDescription.text = ex.what();
3160 ExDescription.type = SALOME::BAD_PARAM;
3161 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3162 ExDescription.lineNumber = 1385;
3163 throw SALOME::SALOME_Exception(ExDescription);
3164 } catch (const std::exception& ex) {
3165 std::cout << "Exception: " << ex.what() << std::endl;
3166 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3170 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3176 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3178 if (string(theVertexEntry).empty())
3179 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3182 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3184 } catch (const std::invalid_argument& ex) {
3186 } catch (const std::exception& ex) {
3187 std::cout << "Exception: " << ex.what() << std::endl;
3188 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3193 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3198 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3199 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3200 } catch (const std::invalid_argument& ex) {
3202 } catch (const std::exception& ex) {
3203 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3209 //=============================================================================
3211 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3215 //=============================================================================
3216 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3219 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3220 std::string theValueStr = theValue ? "True" : "False";
3221 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3224 //=============================================================================
3226 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3230 //=============================================================================
3231 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3234 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3237 //=============================================================================
3239 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3243 //=============================================================================
3244 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3247 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3248 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3251 //=============================================================================
3253 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3257 //=============================================================================
3258 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3261 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3265 * Enable internal enforced vertices on specific face if requested by user
3267 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3268 throw (SALOME::SALOME_Exception)
3271 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3272 } catch (SALOME_Exception& ex) {
3273 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3277 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3278 throw (SALOME::SALOME_Exception)
3281 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3282 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3285 string theFaceEntry = theFace->GetStudyEntry();
3287 if (theFaceEntry.empty()) {
3288 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3289 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3291 if (theFace->GetShapeType() == GEOM::FACE)
3293 if (theFace->GetShapeType() == GEOM::COMPOUND)
3294 aName = "Compound_";
3295 aName += theFace->GetEntry();
3296 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3297 if (!theSFace->_is_nil())
3298 theFaceEntry = theSFace->GetID();
3300 if (theFaceEntry.empty())
3301 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3304 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3305 } catch (SALOME_Exception& ex) {
3306 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3310 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3311 throw (SALOME::SALOME_Exception)
3315 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3316 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3317 if (string(theGroupName).empty())
3318 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3320 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3321 } catch (const std::exception& ex) {
3322 std::cout << "Exception: " << ex.what() << std::endl;
3323 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3330 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3331 throw (SALOME::SALOME_Exception)
3335 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3337 catch (const std::invalid_argument& ex) {
3338 SALOME::ExceptionStruct ExDescription;
3339 ExDescription.text = ex.what();
3340 ExDescription.type = SALOME::BAD_PARAM;
3341 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3342 ExDescription.lineNumber = 1146;
3343 throw SALOME::SALOME_Exception(ExDescription);
3345 catch (SALOME_Exception& ex) {
3346 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3352 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3353 throw (SALOME::SALOME_Exception)
3357 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3359 catch (const std::invalid_argument& ex) {
3360 SALOME::ExceptionStruct ExDescription;
3361 ExDescription.text = ex.what();
3362 ExDescription.type = SALOME::BAD_PARAM;
3363 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3364 ExDescription.lineNumber = 1170;
3365 throw SALOME::SALOME_Exception(ExDescription);
3367 catch (SALOME_Exception& ex) {
3368 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3371 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3372 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3376 ///////////////////////
3378 ///////////////////////
3380 ///////////////////////
3383 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3385 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3386 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3387 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3388 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3389 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3390 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3391 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3392 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3393 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3394 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3395 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3396 return txtShapeType;
3399 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3401 // Check shape types
3403 std::stringstream typesTxt;
3404 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3406 GEOM::shape_type theShapeType = theShapeTypes[i];
3407 if (shape->GetShapeType() == theShapeType)
3409 typesTxt << ShapeTypeToString(theShapeType);
3410 if (i < theShapeTypes.size()-1 )
3414 std::stringstream msg;
3415 msg << "shape type is not in" << typesTxt.str();
3416 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3420 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3423 if (shape->GetShapeType() != theShapeType) {
3424 std::stringstream msg;
3425 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3426 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3430 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3432 // Check shape is published in the object browser
3433 string shapeEntry = shape->GetStudyEntry();
3435 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3436 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3439 // Publish shape if needed
3440 if (shapeEntry.empty()) {
3441 if (shape->GetShapeType() == theShapeType)
3443 aName += shape->GetEntry();
3444 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3445 if (!theSFace1->_is_nil())
3446 shapeEntry = theSFace1->GetID();
3448 if (shapeEntry.empty())
3449 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3453 // Format the output of two vectors to use it in MESSAGE and PythonDump
3454 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3456 std::stringstream listEntriesTxt;
3458 if (!theSourceVerticesEntries.empty())
3460 listEntriesTxt << ", [" ;
3462 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3465 listEntriesTxt << ", ";
3466 listEntriesTxt << *it;
3469 listEntriesTxt << "], [" ;
3471 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3474 listEntriesTxt << ", ";
3475 listEntriesTxt << *it;
3477 listEntriesTxt << "]" ;
3479 return listEntriesTxt.str();
3483 * Erase all PreCad periodicity associations
3485 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3487 this->GetImpl()->ClearPreCadPeriodicityVectors();
3488 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3491 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3493 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3494 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3496 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3498 return periodicityList._retn();
3501 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3503 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3504 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3506 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3508 return periodicityList._retn();
3511 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3512 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3514 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3516 periodicityList->length(preCadPeriodicityVector.size());
3518 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3520 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3522 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3523 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3524 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3526 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3527 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3529 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3530 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3531 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3534 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3536 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3537 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3539 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3540 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3541 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3544 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3546 periodicityList[i] = myPreCadPeriodicity;
3550 return periodicityList._retn();
3554 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3555 throw (SALOME::SALOME_Exception)
3558 const GEOM::ListOfGO theSourceVertices;
3559 const GEOM::ListOfGO theTargetVertices;
3560 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3564 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3565 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3566 throw (SALOME::SALOME_Exception)
3570 size_t theLength = theSourceVertices.length();
3571 if (theLength != theTargetVertices.length())
3572 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3574 std::vector<GEOM::shape_type> allowedShapeTypes;
3575 allowedShapeTypes.push_back(GEOM::FACE);
3576 allowedShapeTypes.push_back(GEOM::COMPOUND);
3578 string prefix1 = "Source_face_";
3579 CheckShapeTypes(theFace1, allowedShapeTypes);
3580 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3582 string prefix2 = "Target_face_";
3583 CheckShapeTypes(theFace2, allowedShapeTypes);
3584 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3586 string prefix3 = "Source_vertex_";
3587 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3588 theSourceVerticesEntries->length(theLength);
3589 GEOM::GEOM_Object_ptr theVtx_i;
3591 for (size_t ind = 0; ind < theLength; ind++) {
3592 theVtx_i = theSourceVertices[ind];
3593 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3594 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3597 string prefix4 = "Target_vertex_";
3598 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3599 theTargetVerticesEntries->length(theLength);
3600 for (size_t ind = 0; ind < theLength; ind++) {
3601 theVtx_i = theTargetVertices[ind];
3602 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3603 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3606 string theFace2Name = theFace2->GetName();
3608 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3609 theSourceVerticesEntries, theTargetVerticesEntries);
3610 } catch (SALOME_Exception& ex) {
3611 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3616 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3617 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3618 throw (SALOME::SALOME_Exception)
3623 // Convert BLSURFPlugin::TEntryList to vector<string>
3624 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3625 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3626 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3627 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3630 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3633 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3634 theSourceVerticesEntries, theTargetVerticesEntries);
3636 SMESH::TPythonDump pd;
3637 if (!theSourceVerticesEntries.empty())
3639 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3640 pd << listEntriesTxt.c_str();
3644 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3647 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3648 throw (SALOME::SALOME_Exception)
3651 const GEOM::ListOfGO theSourceVertices;
3652 const GEOM::ListOfGO theTargetVertices;
3653 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3656 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3657 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3658 throw (SALOME::SALOME_Exception)
3662 size_t theLength = theSourceVertices.length();
3663 if (theLength != theTargetVertices.length())
3664 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3666 std::vector<GEOM::shape_type> allowedShapeTypes;
3667 allowedShapeTypes.push_back(GEOM::EDGE);
3668 allowedShapeTypes.push_back(GEOM::COMPOUND);
3670 string prefix1 = "Source_edge_";
3671 CheckShapeTypes(theEdge1, allowedShapeTypes);
3672 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3674 string prefix2 = "Target_edge_";
3675 CheckShapeTypes(theEdge2, allowedShapeTypes);
3676 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3678 string prefix3 = "Source_vertex_";
3679 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3680 theSourceVerticesEntries->length(theLength);
3681 GEOM::GEOM_Object_ptr theVtx_i;
3683 for (size_t ind = 0; ind < theLength; ind++) {
3684 theVtx_i = theSourceVertices[ind];
3685 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3686 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3689 string prefix4 = "Target_vertex_";
3690 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3691 theTargetVerticesEntries->length(theLength);
3692 for (size_t ind = 0; ind < theLength; ind++) {
3693 theVtx_i = theTargetVertices[ind];
3694 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3695 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3698 string theEdge2Name = theEdge2->GetName();
3700 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3701 theSourceVerticesEntries, theTargetVerticesEntries);
3702 } catch (SALOME_Exception& ex) {
3703 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3708 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3709 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3710 throw (SALOME::SALOME_Exception)
3715 // Convert BLSURFPlugin::TEntryList to vector<string>
3716 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3717 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3718 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3719 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3722 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3724 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3725 theSourceVerticesEntries, theTargetVerticesEntries);
3727 SMESH::TPythonDump pd;
3728 if (!theSourceVerticesEntries.empty())
3730 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3731 pd << listEntriesTxt.c_str();
3735 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3740 //================================================================================
3742 * \brief Sets the file for export resulting mesh in GMF format
3743 * \param theFileName - full name of the file (.mesh, .meshb)
3745 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3747 //================================================================================
3748 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3749 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3751 bool valueChanged/*, modeChanged*/ = false;
3753 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3754 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3755 if (valueChanged)// or (!valueChanged && modeChanged))
3756 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3757 } catch (const std::exception& ex) {
3758 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3760 if (valueChanged)// or (!valueChanged && modeChanged))
3761 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3764 //================================================================================
3766 * \brief Gets the file name for export resulting mesh in GMF format
3767 * \retval char* - The file name
3769 * Returns the GMF file name
3771 //================================================================================
3772 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3774 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3777 // //================================================================================
3779 // * \brief Gets the file mode for export resulting mesh in GMF format
3780 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3782 // * Returns the GMF file mode
3784 // //================================================================================
3785 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3786 // ASSERT(myBaseImpl);
3787 // return this->GetImpl()->GetGMFFileMode();
3790 //=============================================================================
3792 * BLSURFPlugin_Hypothesis_i::GetImpl
3794 * Get implementation
3796 //=============================================================================
3797 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3798 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3801 //================================================================================
3803 * \brief Verify whether hypothesis supports given entity type
3804 * \param type - dimension (see SMESH::Dimension enumeration)
3805 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3807 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3809 //================================================================================
3810 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3811 return type == SMESH::DIM_2D;
3815 // Obsolete methods - To be removed in V7
3818 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3819 this->SetMinSize(theMinSize);
3821 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3822 return this->GetMinSize();
3824 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3825 this->SetMaxSize(theMaxSize);
3827 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3828 return this->GetMaxSize();
3830 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3831 this->SetMinSize(theMinSize);
3833 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3834 return this->GetMinSize();
3836 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3837 this->SetMaxSize(theMaxSize);
3839 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3840 return this->GetMaxSize();
3842 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3843 this->SetAngleMesh(theValue);
3845 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3846 return this->GetAngleMesh();
3848 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3849 this->SetAngleMesh(theValue);
3851 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3852 return this->GetAngleMesh();
3854 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3855 std::string theValueStr = theValue ? "1" : "0";
3856 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3858 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3859 std::string theValueStr = this->GetOptionValue("respect_geometry");
3860 if (theValueStr.empty() || theValueStr == "respect")
3864 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3865 std::string theValueStr = theValue ? "1" : "0";
3866 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3868 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3869 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3870 if (theValueStr == "1")
3874 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3875 std::ostringstream theValueStr;
3876 theValueStr << theValue;
3877 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3879 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3880 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3882 theValueStr >> result;