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::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
859 if ( GetMaxNumberOfThreads() != nb )
862 this->GetImpl()->SetMaxNumberOfThreads(nb);
864 } catch (const std::invalid_argument& ex) {
865 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
866 } catch (SALOME_Exception& ex) {
867 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
869 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
872 //=============================================================================
873 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
875 return this->GetImpl()->GetMaxNumberOfThreads();
877 //=============================================================================
879 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
881 if ( GetRespectGeometry() != toRespect )
883 this->GetImpl()->SetRespectGeometry(toRespect);
884 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
887 //=============================================================================
888 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
890 return this->GetImpl()->GetRespectGeometry();
892 //=============================================================================
894 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
896 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
898 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
899 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
902 //=============================================================================
903 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
905 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
907 //=============================================================================
909 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
911 if ( GetClosedGeometry() != isClosed )
913 this->GetImpl()->SetClosedGeometry(isClosed);
914 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
917 //=============================================================================
918 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
920 return this->GetImpl()->GetClosedGeometry();
922 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
926 if ( GetDebug() != isDebug )
928 this->GetImpl()->SetDebug(isDebug);
929 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
932 //=============================================================================
933 bool BLSURFPlugin_Hypothesis_i::GetDebug()
935 return this->GetImpl()->GetDebug();
937 //=============================================================================
939 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
942 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
946 this->GetImpl()->SetPeriodicTolerance(tol);
948 } catch (const std::invalid_argument& ex) {
949 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
950 } catch (SALOME_Exception& ex) {
951 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
953 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
956 //=============================================================================
957 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
960 return this->GetImpl()->GetPeriodicTolerance();
962 } catch (const std::invalid_argument& ex) {
963 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
964 } catch (SALOME_Exception& ex) {
965 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
969 //=============================================================================
971 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
973 if ( GetImpl()->GetRequiredEntities() != howToTreat )
976 this->GetImpl()->SetRequiredEntities(howToTreat);
978 } catch (const std::invalid_argument& ex) {
979 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
980 } catch (SALOME_Exception& ex) {
981 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
983 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
986 //=============================================================================
987 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
989 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
991 //=============================================================================
993 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
996 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1000 this->GetImpl()->SetSewingTolerance(tol);
1001 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1003 } catch (const std::invalid_argument& ex) {
1004 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1005 } catch (SALOME_Exception& ex) {
1006 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1010 //=============================================================================
1011 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1015 return this->GetImpl()->GetSewingTolerance();
1017 } catch (const std::invalid_argument& ex) {
1018 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1019 } catch (SALOME_Exception& ex) {
1020 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1024 //=============================================================================
1026 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1028 if ( GetImpl()->GetTags() != howToTreat )
1031 this->GetImpl()->SetTags(howToTreat);
1033 catch (const std::invalid_argument& ex) {
1034 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1035 } catch (SALOME_Exception& ex) {
1036 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1039 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1041 //=============================================================================
1042 char* BLSURFPlugin_Hypothesis_i::GetTags()
1044 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1047 //=============================================================================
1048 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1050 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1051 SMESH_Comment hplDump;
1053 for ( size_t i = 0; i < patchList.size(); ++i )
1056 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1057 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1059 patchList[ i ].insert( tags[ j ]);
1060 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1062 hplDump << ( i+1 < patchList.size() ? "," : "]");
1064 if ( GetImpl()->GetHyperPatches() != patchList )
1066 GetImpl()->SetHyperPatches( patchList );
1067 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1071 //=============================================================================
1072 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1074 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1075 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1076 resHpl->length( hpl.size() );
1078 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1079 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1081 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1082 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1083 resHp.length( hp.size() );
1085 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1086 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1092 //=============================================================================
1094 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1098 //=============================================================================
1099 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1101 this->GetImpl()->SetPreCADMergeEdges(theValue);
1102 std::string theValueStr = theValue ? "True" : "False";
1103 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1106 //=============================================================================
1108 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1112 //=============================================================================
1113 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1115 return this->GetImpl()->GetPreCADMergeEdges();
1118 //=============================================================================
1120 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1124 //=============================================================================
1125 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1127 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1128 std::string theValueStr = theValue ? "True" : "False";
1129 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1132 //=============================================================================
1134 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1138 //=============================================================================
1139 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1141 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1144 //=============================================================================
1146 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1150 //=============================================================================
1151 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1153 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1154 std::string theValueStr = theValue ? "True" : "False";
1155 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1158 //=============================================================================
1160 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1164 //=============================================================================
1165 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1167 return this->GetImpl()->GetPreCADProcess3DTopology();
1170 //=============================================================================
1172 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1176 //=============================================================================
1177 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1179 this->GetImpl()->SetPreCADDiscardInput(theValue);
1180 std::string theValueStr = theValue ? "True" : "False";
1181 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1184 //=============================================================================
1186 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1190 //=============================================================================
1191 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1193 return this->GetImpl()->GetPreCADDiscardInput();
1197 //=============================================================================
1199 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1200 throw (SALOME::SALOME_Exception) {
1203 std::string name( optionName );
1204 if ( !optionValue || !optionValue[0] )
1205 UnsetOption( optionName );
1207 // basic options (visible in Advanced table)
1209 else if ( name == "enforce_cad_edge_sizes" )
1210 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1212 else if ( name == "jacobian_rectification_respect_geometry" )
1213 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1215 else if ( name == "max_number_of_points_per_patch" )
1216 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1218 else if ( name == "max_number_of_threads" )
1219 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1221 else if ( name == "rectify_jacobian" )
1222 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1224 else if ( name == "respect_geometry" )
1225 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1227 else if ( name == "tiny_edge_avoid_surface_intersections" )
1228 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1230 else if ( name == "closed_geometry" )
1231 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1233 else if ( name == "debug" )
1234 SetDebug( GetImpl()->ToBool( optionValue ));
1236 else if ( name == "discard_input_topology" )
1237 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1239 else if ( name == "merge_edges" )
1240 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1242 else if ( name == "periodic_tolerance" )
1243 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1245 else if ( name == "remove_duplicate_cad_faces" )
1246 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1248 else if ( name == "required_entities" )
1249 SetRequiredEntities( optionValue );
1251 else if ( name == "sewing_tolerance" )
1252 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1254 else if ( name == "tags" )
1255 SetTags( optionValue );
1257 // other basic options with specific methods
1259 else if ( name == "correct_surface_intersections" )
1260 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1262 else if ( name == "optimise_tiny_edges" )
1263 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1265 else if ( name == "surface_intersections_processing_max_cost" )
1266 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1268 else if ( name == "volume_gradation" )
1269 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1271 else if ( name == "tiny_edge_optimisation_length" )
1272 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1274 // advanced options (for backward compatibility)
1276 else if ( name == "create_tag_on_collision" ||
1277 name == "tiny_edge_respect_geometry" )
1278 AddOption( optionName, optionValue );
1282 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1283 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1286 this->GetImpl()->SetOptionValue(optionName, optionValue);
1287 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1290 } catch (const std::invalid_argument& ex) {
1291 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1292 } catch (SALOME_Exception& ex) {
1293 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1297 //=============================================================================
1299 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1300 throw (SALOME::SALOME_Exception) {
1302 bool valueChanged = false;
1304 std::string name( optionName );
1305 if ( !optionValue || !optionValue[0] )
1306 UnsetOption( optionName );
1308 else if ( name == "closed_geometry" )
1309 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1311 else if ( name == "debug" )
1312 SetDebug( GetImpl()->ToBool( optionValue ));
1314 else if ( name == "discard_input_topology" )
1315 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1317 else if ( name == "merge_edges" )
1318 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1320 else if ( name == "periodic_tolerance" )
1321 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1323 else if ( name == "remove_duplicate_cad_faces" )
1324 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1326 else if ( name == "required_entities" )
1327 SetRequiredEntities( optionValue );
1329 else if ( name == "sewing_tolerance" )
1330 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1332 else if ( name == "tags" )
1333 SetTags( optionValue );
1335 // other basic options with specific methods
1337 else if ( name == "correct_surface_intersections" )
1338 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1340 else if ( name == "optimise_tiny_edges" )
1341 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1343 else if ( name == "surface_intersections_processing_max_cost" )
1344 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1346 else if ( name == "volume_gradation" )
1347 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1349 else if ( name == "tiny_edge_optimisation_length" )
1350 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1352 else if ( name == "process_3d_topology" )
1353 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1355 // advanced options (for backward compatibility)
1357 else if ( name == "create_tag_on_collision" ||
1358 name == "tiny_edge_respect_geometry" ||
1359 name == "remove_tiny_edges" ||
1360 name == "tiny_edge_length")
1361 AddPreCADOption( optionName, optionValue );
1364 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1366 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1368 } catch (const std::invalid_argument& ex) {
1369 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1370 } catch (SALOME_Exception& ex) {
1371 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1374 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1377 //=============================================================================
1379 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1383 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1384 } catch (const std::invalid_argument& ex) {
1385 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1386 } catch (SALOME_Exception& ex) {
1387 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1392 //=============================================================================
1394 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1398 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1399 } catch (const std::invalid_argument& ex) {
1400 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1401 } catch (SALOME_Exception& ex) {
1402 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1407 //=============================================================================
1409 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1411 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1413 this->GetImpl()->ClearOption(optionName);
1414 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1418 //=============================================================================
1420 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1422 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1424 this->GetImpl()->ClearPreCADOption(optionName);
1425 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1429 //=============================================================================
1431 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1433 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1435 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
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()->GetOptionValue( opIt->first, &isDefault );
1446 name_value_type += isDefault ? ":0" : ":1";
1448 result[i] = CORBA::string_dup(name_value_type.c_str());
1451 return result._retn();
1454 //=============================================================================
1456 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1458 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1460 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1461 result->length(opts.size());
1465 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1466 for (; opIt != opts.end(); ++opIt, ++i) {
1467 string name_value_type = opIt->first;
1468 if (!opIt->second.empty()) {
1469 name_value_type += ":";
1470 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1471 name_value_type += isDefault ? ":0" : ":1";
1473 result[i] = CORBA::string_dup(name_value_type.c_str());
1475 return result._retn();
1478 //=============================================================================
1480 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1482 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1484 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1485 result->length(custom_opts.size());
1488 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1489 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1490 string name_value_type = opIt->first;
1491 if (!opIt->second.empty()) {
1492 name_value_type += ":";
1493 name_value_type += opIt->second;
1494 name_value_type += ":1"; // user defined
1496 result[i] = CORBA::string_dup(name_value_type.c_str());
1498 return result._retn();
1501 //=============================================================================
1503 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1504 throw (SALOME::SALOME_Exception) {
1506 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1507 string name_value_type = options[i].in();
1508 if(name_value_type.empty())
1510 size_t colonPos = name_value_type.find(':');
1512 if (colonPos == string::npos) // ':' not found
1513 name = name_value_type;
1515 name = name_value_type.substr(0, colonPos);
1516 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1517 string value_type = name_value_type.substr(colonPos + 1);
1518 colonPos = value_type.find(':');
1519 value = value_type.substr(0, colonPos);
1520 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1521 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1525 SetOptionValue(name.c_str(), value.c_str());
1529 //=============================================================================
1531 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1532 throw (SALOME::SALOME_Exception) {
1534 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1535 string name_value_type = options[i].in();
1536 if(name_value_type.empty())
1538 size_t colonPos = name_value_type.find(':');
1540 if (colonPos == string::npos) // ':' not found
1541 name = name_value_type;
1543 name = name_value_type.substr(0, colonPos);
1544 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1545 string value_type = name_value_type.substr(colonPos + 1);
1546 colonPos = value_type.find(':');
1547 value = value_type.substr(0, colonPos);
1548 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1549 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1553 SetPreCADOptionValue(name.c_str(), value.c_str());
1557 //=============================================================================
1559 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1561 SMESH::TPythonDump dump;
1563 string optionsAndValues;
1564 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1565 string name_value_type = options[i].in();
1566 if(name_value_type.empty())
1568 size_t colonPos = name_value_type.find(':');
1570 if (colonPos == string::npos) // ':' not found
1571 name = name_value_type;
1573 name = name_value_type.substr(0, colonPos);
1574 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1575 string value_type = name_value_type.substr(colonPos + 1);
1576 colonPos = value_type.find(':');
1577 value = value_type.substr(0, colonPos);
1580 AddOption(name.c_str(), value.c_str());
1582 optionsAndValues += name + " " + value + " ";
1585 if ( !optionsAndValues.empty() )
1586 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1589 //=============================================================================
1591 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1592 throw (SALOME::SALOME_Exception)
1594 if ( !optionsAndValues ) return;
1596 SMESH::TPythonDump dump;
1598 std::istringstream strm( optionsAndValues );
1599 std::istream_iterator<std::string> sIt( strm ), sEnd;
1600 while ( sIt != sEnd )
1602 std::string option = *sIt;
1603 if ( ++sIt != sEnd )
1605 std::string value = *sIt;
1607 AddOption( option.c_str(), value.c_str() );
1611 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1614 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1617 //=============================================================================
1619 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1622 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1624 this->GetImpl()->AddOption(optionName, optionValue);
1625 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1629 //=============================================================================
1631 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1634 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1636 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1637 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1641 //=============================================================================
1643 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1646 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1649 //=============================================================================
1651 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1654 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1657 //=============================================================================
1659 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1660 throw (SALOME::SALOME_Exception) {
1662 if ( !entry || !entry[0] )
1663 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1664 bool valueChanged = false;
1666 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1668 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1669 } catch (const std::invalid_argument& ex) {
1670 SALOME::ExceptionStruct ExDescription;
1671 ExDescription.text = ex.what();
1672 ExDescription.type = SALOME::BAD_PARAM;
1673 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1674 ExDescription.lineNumber = 0;
1675 throw SALOME::SALOME_Exception(ExDescription);
1676 } catch (SALOME_Exception& ex) {
1677 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1680 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1683 //=============================================================================
1685 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1686 throw (SALOME::SALOME_Exception) {
1688 bool valueChanged = false;
1689 std::ostringstream sizeMapFunction;
1690 switch (shapeType) {
1691 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1692 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1693 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1697 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1699 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1700 } catch (const std::invalid_argument& ex) {
1701 SALOME::ExceptionStruct ExDescription;
1702 ExDescription.text = ex.what();
1703 ExDescription.type = SALOME::BAD_PARAM;
1704 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1705 ExDescription.lineNumber = 0;
1706 throw SALOME::SALOME_Exception(ExDescription);
1707 } catch (SALOME_Exception& ex) {
1708 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1711 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1714 //=============================================================================
1716 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1717 throw (SALOME::SALOME_Exception) {
1719 bool valueChanged = false;
1721 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1722 if ( valueChanged ) {
1723 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1724 if (!boost::regex_match(string(attractor), re))
1725 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1726 this->GetImpl()->SetAttractorEntry(entry, attractor);
1728 } catch (const std::invalid_argument& ex) {
1729 SALOME::ExceptionStruct ExDescription;
1730 ExDescription.text = ex.what();
1731 ExDescription.type = SALOME::BAD_PARAM;
1732 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1733 ExDescription.lineNumber = 0;
1734 throw SALOME::SALOME_Exception(ExDescription);
1735 } catch (SALOME_Exception& ex) {
1736 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1739 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1742 //=============================================================================
1744 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
1745 throw (SALOME::SALOME_Exception)
1748 //bool valueChanged = false;
1750 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1752 catch (const std::invalid_argument& ex) {
1753 SALOME::ExceptionStruct ExDescription;
1754 ExDescription.text = ex.what();
1755 ExDescription.type = SALOME::BAD_PARAM;
1756 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1757 ExDescription.lineNumber = 0;
1758 throw SALOME::SALOME_Exception(ExDescription);
1759 } catch (SALOME_Exception& ex) {
1760 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1762 //if ( valueChanged )
1763 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1764 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1767 //=============================================================================
1769 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1772 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1773 } catch (const std::invalid_argument& ex) {
1774 SALOME::ExceptionStruct ExDescription;
1775 ExDescription.text = ex.what();
1776 ExDescription.type = SALOME::BAD_PARAM;
1777 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1778 ExDescription.lineNumber = 0;
1779 throw SALOME::SALOME_Exception(ExDescription);
1780 } catch (SALOME_Exception& ex) {
1781 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1786 //=============================================================================
1788 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1791 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1792 } catch (const std::invalid_argument& ex) {
1793 SALOME::ExceptionStruct ExDescription;
1794 ExDescription.text = ex.what();
1795 ExDescription.type = SALOME::BAD_PARAM;
1796 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1797 ExDescription.lineNumber = 0;
1798 throw SALOME::SALOME_Exception(ExDescription);
1799 } catch (SALOME_Exception& ex) {
1800 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1805 // //=============================================================================
1807 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1808 // // A finir pour le dump
1809 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1810 // throw (SALOME::SALOME_Exception)
1812 // ASSERT(myBaseImpl);
1814 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1816 // catch (const std::invalid_argument& ex) {
1817 // SALOME::ExceptionStruct ExDescription;
1818 // ExDescription.text = ex.what();
1819 // ExDescription.type = SALOME::BAD_PARAM;
1820 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1821 // ExDescription.lineNumber = 0;
1822 // throw SALOME::SALOME_Exception(ExDescription);
1824 // catch (SALOME_Exception& ex) {
1825 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1830 //=============================================================================
1832 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1834 this->GetImpl()->ClearEntry(entry);
1835 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1838 //=============================================================================
1840 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1842 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1844 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1845 result->length(sizeMaps.size());
1847 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1848 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1849 string entry_sizemap = smIt->first;
1850 if (!smIt->second.empty()) {
1851 entry_sizemap += "|";
1852 entry_sizemap += smIt->second;
1854 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1856 return result._retn();
1859 //=============================================================================
1861 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1863 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1865 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1866 result->length(attractors.size());
1868 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1869 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1870 string entry_attractor = atIt->first;
1871 if (!atIt->second.empty()) {
1872 entry_attractor += "|";
1873 entry_attractor += atIt->second;
1875 result[i] = CORBA::string_dup(entry_attractor.c_str());
1877 return result._retn();
1880 //=============================================================================
1882 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1885 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1887 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1888 result->length( attractors.size() );
1890 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1891 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1892 string faceEntry = atIt->first;
1894 double startSize, endSize, infDist, constDist;
1895 if ( !atIt->second->Empty() ) {
1896 attEntry = atIt->second->GetAttractorEntry();
1897 std::vector<double> params = atIt->second->GetParameters();
1898 startSize = params[0];
1899 endSize = params[1];
1900 infDist = params[2];
1901 constDist = params[3];
1903 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1904 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1905 result[i].startSize = startSize;
1906 result[i].endSize = endSize;
1907 result[i].infDist = infDist;
1908 result[i].constDist = constDist;
1910 return result._retn();
1913 //=============================================================================
1915 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1916 throw (SALOME::SALOME_Exception) {
1918 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1919 string entry_sizemap = sizeMaps[i].in();
1920 size_t colonPos = entry_sizemap.find('|');
1921 string entry, sizemap;
1922 if (colonPos == string::npos) // '|' separator not found
1923 entry = entry_sizemap;
1925 entry = entry_sizemap.substr(0, colonPos);
1926 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1927 sizemap = entry_sizemap.substr(colonPos + 1);
1929 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1933 //=============================================================================
1935 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1937 this->GetImpl()->ClearSizeMaps();
1940 //=============================================================================
1942 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1943 throw (SALOME::SALOME_Exception)
1947 entry = GeomObj->GetStudyEntry();
1948 SetSizeMapEntry(entry.c_str(), sizeMap);
1951 //=============================================================================
1953 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1955 string entry = GeomObj->GetStudyEntry();
1956 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1957 if (shapeType == GEOM::COMPOUND)
1958 shapeType = GeomObj->GetMaxShapeType();
1959 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1962 //=============================================================================
1963 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1966 entry = GeomObj->GetStudyEntry();
1967 UnsetEntry(entry.c_str());
1968 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1971 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1974 entry = GeomObj->GetStudyEntry();
1975 SetAttractorEntry(entry.c_str(), attractor);
1978 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1981 entry = GeomObj->GetStudyEntry();
1982 UnsetEntry(entry.c_str());
1983 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1986 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)
1989 string theFaceEntry;
1991 theFaceEntry = theFace->GetStudyEntry();
1992 theAttEntry = theAttractor->GetStudyEntry();
1994 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1995 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1998 if (theFaceEntry.empty()) {
2000 aName += theFace->GetEntry();
2001 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2002 if (!theSFace->_is_nil())
2003 theFaceEntry = theSFace->GetID();
2005 if (theFaceEntry.empty())
2006 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2008 if (theAttEntry.empty()) {
2009 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2011 if (theAttractor->GetShapeType() == GEOM::EDGE)
2013 if (theAttractor->GetShapeType() == GEOM::WIRE)
2015 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2016 aName = "Compound_";
2017 aName += theAttractor->GetEntry();
2018 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2019 if (!theSAtt->_is_nil())
2020 theAttEntry = theSAtt->GetID();
2022 if (theAttEntry.empty())
2023 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2025 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2026 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2027 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2030 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2031 GEOM::GEOM_Object_ptr theAttractor)
2034 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2035 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2037 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2038 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2041 // if (theFaceEntry.empty()) {
2043 // aName += theFace->GetEntry();
2044 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2045 // if (!theSFace->_is_nil())
2046 // theFaceEntry = theSFace->GetID();
2048 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2049 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2050 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2052 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2053 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2054 << theFace << ", " << theAttractor << " )";
2057 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2058 const char* attractorEntry)
2060 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2061 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2062 << faceEntry << "', '" << attractorEntry << "' )";
2067 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2070 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2073 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2076 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2079 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2082 this->GetImpl()->UnsetCustomSizeMap(entry);
2083 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2087 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2092 // ///////////////////////
2093 // // ENFORCED VERTICES //
2094 // ///////////////////////
2098 * Returns the list of enforced vertices for a given Face entry
2099 * @return A map of Face entry / List of enforced vertices
2102 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2105 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2107 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2108 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2109 resultMap->length(faceEntryEnfVertexListMap.size());
2111 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2112 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2113 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2114 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2115 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2116 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2118 _enfVertexList = it_entry->second;
2119 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2120 enfVertexList->length(_enfVertexList.size());
2122 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2123 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2124 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2125 currentEnfVertex = (*it_enfVertex);
2127 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2130 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2133 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2136 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2137 coords->length(currentEnfVertex->coords.size());
2138 for (CORBA::ULong i=0;i<coords->length();i++)
2139 coords[i] = currentEnfVertex->coords[i];
2140 enfVertex->coords = coords;
2143 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2146 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2147 faceEntryList->length(currentEnfVertex->faceEntries.size());
2148 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2149 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2150 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2151 enfVertex->faceEntries = faceEntryList;
2154 msg << "Enforced vertex: \n"
2155 << "Name: " << enfVertex->name << "\n";
2156 if (coords->length())
2157 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2158 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2159 << "Group Name: " << enfVertex->grpName;
2161 enfVertexList[j] = enfVertex;
2163 mapElement->enfVertexList = enfVertexList;
2165 resultMap[i] = mapElement;
2168 return resultMap._retn();
2172 * Returns the list of all enforced vertices
2173 * @return a list of enforced vertices
2176 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2178 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2179 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2180 resultMap->length(enfVertexList.size());
2182 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2183 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2184 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2185 currentEnfVertex = (*evlIt);
2186 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2188 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2190 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2192 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2193 coords->length(currentEnfVertex->coords.size());
2194 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2195 coords[ind] = currentEnfVertex->coords[ind];
2196 enfVertex->coords = coords;
2198 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2200 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2201 faceEntryList->length(currentEnfVertex->faceEntries.size());
2202 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2203 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2204 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2205 enfVertex->faceEntries = faceEntryList;
2208 msg << "Enforced vertex: \n"
2209 << "Name: " << enfVertex->name << "\n";
2210 if (coords->length())
2211 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2212 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2213 << "Group Name: " << enfVertex->grpName;
2215 resultMap[i] = enfVertex;
2217 return resultMap._retn();
2222 * Returns the list of enforced vertices coords for a given Face entry.
2223 * They are the coords of the "manual" enforced vertices.
2224 * @return A map of Face entry / List of enforced vertices coords
2227 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2230 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2232 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2233 resultMap->length(entryCoordsListMap.size());
2235 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2236 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2237 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2238 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2239 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2241 _coordsList = it_entry->second;
2242 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2243 coordsList->length(_coordsList.size());
2245 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2246 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2247 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2248 coords->length((*it_coords).size());
2249 for (CORBA::ULong i=0;i<coords->length();i++)
2250 coords[i] = (*it_coords)[i];
2251 coordsList[j] = coords;
2253 mapElement->coordsList = coordsList;
2255 resultMap[i] = mapElement;
2258 return resultMap._retn();
2262 * Returns a map of enforced vertices coords / enforced vertex.
2263 * They are the coords of the "manual" enforced vertices.
2265 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2268 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2269 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2270 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2271 resultMap->length(coordsEnfVertexMap.size());
2273 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2274 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2275 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2276 currentEnfVertex = (it_coords->second);
2277 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2278 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2279 coords->length(it_coords->first.size());
2280 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2281 coords[ind] = it_coords->first[ind];
2282 mapElement->coords = coords;
2284 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2286 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2288 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2290 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2291 coords2->length(currentEnfVertex->coords.size());
2292 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2293 coords2[ind] = currentEnfVertex->coords[ind];
2294 enfVertex->coords = coords2;
2296 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2298 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2299 faceEntryList->length(currentEnfVertex->faceEntries.size());
2300 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2301 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2302 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2303 enfVertex->faceEntries = faceEntryList;
2305 mapElement->enfVertex = enfVertex;
2307 msg << "Enforced vertex: \n"
2308 << "Name: " << enfVertex->name << "\n";
2309 if (coords->length())
2310 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2311 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2312 << "Group Name: " << enfVertex->grpName;
2314 resultMap[i] = mapElement;
2316 return resultMap._retn();
2320 * Returns the list of enforced vertices entries for a given Face entry.
2321 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2322 * @return A map of Face entry / List of enforced vertices geom entries
2325 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2328 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2330 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2331 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2332 resultMap->length(entryEnfVertexEntryListMap.size());
2334 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2335 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2336 entryEnfVertexEntryListMap.begin();
2337 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2338 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2339 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2340 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2342 _enfVertexEntryList = it_entry->second;
2343 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2344 enfVertexEntryList->length(_enfVertexEntryList.size());
2346 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2347 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2348 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2350 mapElement->enfVertexEntryList = enfVertexEntryList;
2352 resultMap[i] = mapElement;
2355 return resultMap._retn();
2359 * Returns a map of enforced vertices geom entry / enforced vertex.
2360 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2362 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2365 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2366 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2367 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2368 resultMap->length(enfVertexEntryEnfVertexMap.size());
2370 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2371 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2372 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2373 currentEnfVertex = it_enfVertexEntry->second;
2374 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2375 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2377 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2379 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2381 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2383 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2384 coords->length(currentEnfVertex->coords.size());
2385 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2386 coords[ind] = currentEnfVertex->coords[ind];
2387 enfVertex->coords = coords;
2389 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2391 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2392 faceEntryList->length(currentEnfVertex->faceEntries.size());
2393 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2394 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2395 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2396 enfVertex->faceEntries = faceEntryList;
2399 msg << "Enforced vertex: \n"
2400 << "Name: " << enfVertex->name << "\n";
2401 if (coords->length())
2402 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2403 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2404 << "Group Name: " << enfVertex->grpName;
2406 mapElement->enfVertex = enfVertex;
2407 resultMap[i] = mapElement;
2409 return resultMap._retn();
2413 * Erase all enforced vertices
2415 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2417 this->GetImpl()->ClearAllEnforcedVertices();
2418 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2422 * Set/get/unset an enforced vertex on face - OBSOLETE
2424 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2425 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2428 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2429 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2432 string theFaceEntry = theFace->GetStudyEntry();
2434 if (theFaceEntry.empty()) {
2435 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2436 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2438 if (theFace->GetShapeType() == GEOM::FACE)
2440 if (theFace->GetShapeType() == GEOM::COMPOUND)
2441 aName = "Compound_";
2442 aName += theFace->GetEntry();
2443 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2444 if (!theSFace->_is_nil())
2445 theFaceEntry = theSFace->GetID();
2447 if (theFaceEntry.empty())
2448 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2450 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2451 } catch (SALOME_Exception& ex) {
2452 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2457 * Set/get/unset an enforced vertex with name on face
2459 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2460 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2463 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2464 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2467 string theFaceEntry = theFace->GetStudyEntry();
2469 if (theFaceEntry.empty()) {
2470 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2471 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2473 if (theFace->GetShapeType() == GEOM::FACE)
2475 if (theFace->GetShapeType() == GEOM::COMPOUND)
2476 aName = "Compound_";
2477 aName += theFace->GetEntry();
2478 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2479 if (!theSFace->_is_nil())
2480 theFaceEntry = theSFace->GetID();
2482 if (theFaceEntry.empty())
2483 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2486 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2487 } catch (SALOME_Exception& ex) {
2488 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2493 * Set/get/unset an enforced vertex with geom object on face
2495 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2496 throw (SALOME::SALOME_Exception) {
2499 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2500 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2503 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2504 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2507 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2508 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2509 // if (CORBA::is_nil(measureOp))
2512 // CORBA::Double x, y, z;
2514 // measureOp->PointCoordinates(theVertex, x, y, z);
2516 string theFaceEntry = theFace->GetStudyEntry();
2517 string theVertexEntry = theVertex->GetStudyEntry();
2519 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2520 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2523 if (theFaceEntry.empty()) {
2524 if (theFace->GetShapeType() == GEOM::FACE)
2526 if (theFace->GetShapeType() == GEOM::COMPOUND)
2527 aName = "Compound_";
2528 aName += theFace->GetEntry();
2529 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2530 if (!theSFace->_is_nil())
2531 theFaceEntry = theSFace->GetID();
2533 if (theFaceEntry.empty())
2534 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2536 if (theVertexEntry.empty()) {
2537 if (theVertex->GetShapeType() == GEOM::VERTEX)
2539 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2540 aName = "Compound_";
2541 aName += theVertex->GetEntry();
2542 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2543 if (!theSVertex->_is_nil())
2544 theVertexEntry = theSVertex->GetID();
2546 if (theVertexEntry.empty())
2547 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2549 string theVertexName = theVertex->GetName();
2551 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2552 } catch (SALOME_Exception& ex) {
2553 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2558 * Set an enforced vertex with group name on face
2560 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2561 throw (SALOME::SALOME_Exception)
2565 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2566 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2569 string theFaceEntry = theFace->GetStudyEntry();
2571 if (theFaceEntry.empty()) {
2572 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2573 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2575 if (theFace->GetShapeType() == GEOM::FACE)
2577 if (theFace->GetShapeType() == GEOM::COMPOUND)
2578 aName = "Compound_";
2579 aName += theFace->GetEntry();
2580 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2581 if (!theSFace->_is_nil())
2582 theFaceEntry = theSFace->GetID();
2584 if (theFaceEntry.empty())
2585 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2587 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2588 } catch (SALOME_Exception& ex) {
2589 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2594 * Set an enforced vertex with name and group name on face
2596 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2597 const char* theVertexName, const char* theGroupName)
2598 throw (SALOME::SALOME_Exception)
2602 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2603 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2606 string theFaceEntry = theFace->GetStudyEntry();
2608 if (theFaceEntry.empty()) {
2609 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2610 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2612 if (theFace->GetShapeType() == GEOM::FACE)
2614 if (theFace->GetShapeType() == GEOM::COMPOUND)
2615 aName = "Compound_";
2616 aName += theFace->GetEntry();
2617 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2618 if (!theSFace->_is_nil())
2619 theFaceEntry = theSFace->GetID();
2621 if (theFaceEntry.empty())
2622 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2624 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2625 } catch (SALOME_Exception& ex) {
2626 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2631 * Set an enforced vertex with geom entry and group name on face
2633 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2634 throw (SALOME::SALOME_Exception)
2638 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2639 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2642 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2643 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2646 string theFaceEntry = theFace->GetStudyEntry();
2647 string theVertexEntry = theVertex->GetStudyEntry();
2649 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2650 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2653 if (theFaceEntry.empty()) {
2654 if (theFace->GetShapeType() == GEOM::FACE)
2656 if (theFace->GetShapeType() == GEOM::COMPOUND)
2657 aName = "Compound_";
2658 aName += theFace->GetEntry();
2659 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2660 if (!theSFace->_is_nil())
2661 theFaceEntry = theSFace->GetID();
2663 if (theFaceEntry.empty())
2664 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2666 if (theVertexEntry.empty()) {
2667 if (theVertex->GetShapeType() == GEOM::VERTEX)
2669 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2670 aName = "Compound_";
2671 aName += theVertex->GetEntry();
2672 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2673 if (!theSVertex->_is_nil())
2674 theVertexEntry = theSVertex->GetID();
2676 if (theVertexEntry.empty())
2677 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2679 string theVertexName = theVertex->GetName();
2681 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2682 } catch (SALOME_Exception& ex) {
2683 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2687 //Enable internal enforced vertices on specific face if requested by user
2689 // * Are internal enforced vertices used for a face ?
2691 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2692 // throw (SALOME::SALOME_Exception) {
2693 // ASSERT(myBaseImpl);
2695 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2696 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2699 // string theFaceEntry = theFace->GetStudyEntry();
2701 // if (theFaceEntry.empty()) {
2702 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2703 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2705 // if (theFace->GetShapeType() == GEOM::FACE)
2707 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2708 // aName = "Compound_";
2709 // aName += theFace->GetEntry();
2710 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2711 // if (!theSFace->_is_nil())
2712 // theFaceEntry = theSFace->GetID();
2714 // if (theFaceEntry.empty())
2715 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2718 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2719 // } catch (SALOME_Exception& ex) {
2720 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2725 * Get the list of all enforced vertices
2727 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2728 throw (SALOME::SALOME_Exception) {
2731 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2732 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2735 string theFaceEntry = theFace->GetStudyEntry();
2737 if (theFaceEntry.empty()) {
2738 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2739 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2741 if (theFace->GetShapeType() == GEOM::FACE)
2743 if (theFace->GetShapeType() == GEOM::COMPOUND)
2744 aName = "Compound_";
2745 aName += theFace->GetEntry();
2746 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2747 if (!theSFace->_is_nil())
2748 theFaceEntry = theSFace->GetID();
2750 if (theFaceEntry.empty())
2751 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2754 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2755 } catch (SALOME_Exception& ex) {
2756 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2760 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2761 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2764 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2765 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2768 string theFaceEntry = theFace->GetStudyEntry();
2770 if (theFaceEntry.empty()) {
2771 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2772 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2774 if (theFace->GetShapeType() == GEOM::FACE)
2776 if (theFace->GetShapeType() == GEOM::COMPOUND)
2777 aName = "Compound_";
2778 aName += theFace->GetEntry();
2779 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2780 if (!theSFace->_is_nil())
2781 theFaceEntry = theSFace->GetID();
2783 if (theFaceEntry.empty())
2784 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2787 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2788 } catch (SALOME_Exception& ex) {
2789 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2793 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2794 throw (SALOME::SALOME_Exception) {
2797 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2798 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2800 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2801 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2804 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2805 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2806 // if (CORBA::is_nil(measureOp))
2809 // CORBA::Double x, y, z;
2811 // measureOp->PointCoordinates(theVertex, x, y, z);
2813 std::string theFaceEntry = theFace->GetStudyEntry();
2814 std::string theVertexEntry = theVertex->GetStudyEntry();
2816 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2817 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2820 if (theFaceEntry.empty()) {
2821 if (theFace->GetShapeType() == GEOM::FACE)
2823 if (theFace->GetShapeType() == GEOM::COMPOUND)
2824 aName = "Compound_";
2825 aName += theFace->GetEntry();
2826 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2827 if (!theSFace->_is_nil())
2828 theFaceEntry = theSFace->GetID();
2830 if (theFaceEntry.empty())
2831 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2833 if (theVertexEntry.empty()) {
2834 if (theVertex->GetShapeType() == GEOM::VERTEX)
2836 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2837 aName = "Compound_";
2838 aName += theVertex->GetEntry();
2839 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2840 if (!theSVertex->_is_nil())
2841 theVertexEntry = theSVertex->GetID();
2843 if (theVertexEntry.empty())
2844 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2848 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2849 } catch (SALOME_Exception& ex) {
2850 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2854 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2857 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2858 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2861 string theFaceEntry = theFace->GetStudyEntry();
2863 if (theFaceEntry.empty()) {
2864 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2865 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2867 if (theFace->GetShapeType() == GEOM::FACE)
2869 if (theFace->GetShapeType() == GEOM::COMPOUND)
2870 aName = "Compound_";
2871 aName += theFace->GetEntry();
2872 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2873 if (!theSFace->_is_nil())
2874 theFaceEntry = theSFace->GetID();
2876 if (theFaceEntry.empty())
2877 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2881 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2882 } catch (SALOME_Exception& ex) {
2883 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2888 * Set/get/unset an enforced vertex on face - NEW (no face)
2890 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2895 return SetEnforcedVertexEntry("", x, y, z);
2896 } catch (SALOME_Exception& ex) {
2897 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2902 * Set/get/unset an enforced vertex with name on face
2904 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2907 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2908 } catch (SALOME_Exception& ex) {
2909 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2914 * Set/get/unset an enforced vertex with geom object on face
2916 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2917 throw (SALOME::SALOME_Exception)
2919 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2920 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2922 string theVertexEntry = theVertex->GetStudyEntry();
2924 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2925 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2928 if (theVertexEntry.empty()) {
2929 if (theVertex->GetShapeType() == GEOM::VERTEX)
2931 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2932 aName = "Compound_";
2933 aName += theVertex->GetEntry();
2934 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2935 if (!theSVertex->_is_nil())
2936 theVertexEntry = theSVertex->GetID();
2938 if (theVertexEntry.empty())
2939 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2941 string theVertexName = theVertex->GetName();
2943 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2944 } catch (SALOME_Exception& ex) {
2945 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2950 * Set an enforced vertex with group name on face
2952 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2953 throw (SALOME::SALOME_Exception)
2958 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2959 } catch (SALOME_Exception& ex) {
2960 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2965 * Set an enforced vertex with name and group name on face
2967 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
2968 const char* theVertexName, const char* theGroupName)
2969 throw (SALOME::SALOME_Exception)
2974 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2975 } catch (SALOME_Exception& ex) {
2976 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2981 * Set an enforced vertex with geom entry and group name on face
2983 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2984 throw (SALOME::SALOME_Exception)
2986 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2987 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2990 string theVertexEntry = theVertex->GetStudyEntry();
2992 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2993 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2996 if (theVertexEntry.empty()) {
2997 if (theVertex->GetShapeType() == GEOM::VERTEX)
2999 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3000 aName = "Compound_";
3001 aName += theVertex->GetEntry();
3002 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3003 if (!theSVertex->_is_nil())
3004 theVertexEntry = theSVertex->GetID();
3006 if (theVertexEntry.empty())
3007 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3009 string theVertexName = theVertex->GetName();
3011 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3012 } catch (SALOME_Exception& ex) {
3013 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3017 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3020 return UnsetEnforcedVertexEntry("", x, y, z);
3021 } catch (SALOME_Exception& ex) {
3022 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3026 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3027 throw (SALOME::SALOME_Exception)
3029 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3030 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3032 std::string theVertexEntry = theVertex->GetStudyEntry();
3034 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3035 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3038 if (theVertexEntry.empty()) {
3039 if (theVertex->GetShapeType() == GEOM::VERTEX)
3041 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3042 aName = "Compound_";
3043 aName += theVertex->GetEntry();
3044 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3045 if (!theSVertex->_is_nil())
3046 theVertexEntry = theSVertex->GetID();
3048 if (theVertexEntry.empty())
3049 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3052 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3053 } catch (SALOME_Exception& ex) {
3054 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3058 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3061 return UnsetEnforcedVerticesEntry("");
3062 } catch (SALOME_Exception& ex) {
3063 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3068 * Set/get/unset an enforced vertex on geom object given by entry
3070 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3074 const char* theVertexName,
3075 const char* theVertexEntry,
3076 const char* theGroupName)
3077 throw (SALOME::SALOME_Exception)
3079 bool newValue = false;
3080 if (string(theVertexEntry).empty()) {
3082 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3083 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3084 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3085 coords.push_back(x);
3086 coords.push_back(y);
3087 coords.push_back(z);
3088 if (coordsList.find(coords) == coordsList.end()) {
3091 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3092 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3096 } catch (const std::invalid_argument& ex) {
3097 // no enforced vertex for entry
3101 if (string(theVertexName).empty()) {
3102 if (string(theGroupName).empty())
3103 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3105 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3108 if (string(theGroupName).empty())
3109 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3111 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3112 << theVertexName << "\", \"" << theGroupName << "\")";
3117 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3118 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3119 if ( it == enfVertexEntryList.end()) {
3123 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3124 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3128 } catch (const std::invalid_argument& ex) {
3129 // no enforced vertex for entry
3133 if (string(theGroupName).empty())
3134 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3136 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3141 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3146 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3147 throw (SALOME::SALOME_Exception)
3150 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3151 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3152 vertexList->length(_vList.size());
3153 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3154 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3155 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3157 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3160 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3161 // Geom Vertex Entry
3162 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3164 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3165 coords->length(_enfVertex->coords.size());
3166 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3167 coords[ind] = _enfVertex->coords[ind];
3168 enfVertex->coords = coords;
3170 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3172 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3173 faceEntryList->length(_enfVertex->faceEntries.size());
3174 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3175 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3176 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3177 enfVertex->faceEntries = faceEntryList;
3179 vertexList[i] = enfVertex;
3181 return vertexList._retn();
3182 } catch (const std::invalid_argument& ex) {
3183 SALOME::ExceptionStruct ExDescription;
3184 ExDescription.text = ex.what();
3185 ExDescription.type = SALOME::BAD_PARAM;
3186 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3187 ExDescription.lineNumber = 1385;
3188 throw SALOME::SALOME_Exception(ExDescription);
3189 } catch (const std::exception& ex) {
3190 std::cout << "Exception: " << ex.what() << std::endl;
3191 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3195 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3201 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3203 if (string(theVertexEntry).empty())
3204 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3207 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3209 } catch (const std::invalid_argument& ex) {
3211 } catch (const std::exception& ex) {
3212 std::cout << "Exception: " << ex.what() << std::endl;
3213 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3218 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3223 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3224 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3225 } catch (const std::invalid_argument& ex) {
3227 } catch (const std::exception& ex) {
3228 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3234 //=============================================================================
3236 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3240 //=============================================================================
3241 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3244 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3245 std::string theValueStr = theValue ? "True" : "False";
3246 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3249 //=============================================================================
3251 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3255 //=============================================================================
3256 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3259 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3262 //=============================================================================
3264 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3268 //=============================================================================
3269 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3272 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3273 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3276 //=============================================================================
3278 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3282 //=============================================================================
3283 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3286 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3290 * Enable internal enforced vertices on specific face if requested by user
3292 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3293 throw (SALOME::SALOME_Exception)
3296 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3297 } catch (SALOME_Exception& ex) {
3298 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3302 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3303 throw (SALOME::SALOME_Exception)
3306 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3307 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3310 string theFaceEntry = theFace->GetStudyEntry();
3312 if (theFaceEntry.empty()) {
3313 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3314 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3316 if (theFace->GetShapeType() == GEOM::FACE)
3318 if (theFace->GetShapeType() == GEOM::COMPOUND)
3319 aName = "Compound_";
3320 aName += theFace->GetEntry();
3321 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3322 if (!theSFace->_is_nil())
3323 theFaceEntry = theSFace->GetID();
3325 if (theFaceEntry.empty())
3326 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3329 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3330 } catch (SALOME_Exception& ex) {
3331 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3335 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3336 throw (SALOME::SALOME_Exception)
3340 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3341 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3342 if (string(theGroupName).empty())
3343 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3345 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3346 } catch (const std::exception& ex) {
3347 std::cout << "Exception: " << ex.what() << std::endl;
3348 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3355 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3356 throw (SALOME::SALOME_Exception)
3360 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3362 catch (const std::invalid_argument& ex) {
3363 SALOME::ExceptionStruct ExDescription;
3364 ExDescription.text = ex.what();
3365 ExDescription.type = SALOME::BAD_PARAM;
3366 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3367 ExDescription.lineNumber = 1146;
3368 throw SALOME::SALOME_Exception(ExDescription);
3370 catch (SALOME_Exception& ex) {
3371 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3377 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3378 throw (SALOME::SALOME_Exception)
3382 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3384 catch (const std::invalid_argument& ex) {
3385 SALOME::ExceptionStruct ExDescription;
3386 ExDescription.text = ex.what();
3387 ExDescription.type = SALOME::BAD_PARAM;
3388 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3389 ExDescription.lineNumber = 1170;
3390 throw SALOME::SALOME_Exception(ExDescription);
3392 catch (SALOME_Exception& ex) {
3393 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3396 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3397 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3401 ///////////////////////
3403 ///////////////////////
3405 ///////////////////////
3408 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3410 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3411 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3412 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3413 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3414 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3415 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3416 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3417 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3418 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3419 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3420 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3421 return txtShapeType;
3424 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3426 // Check shape types
3428 std::stringstream typesTxt;
3429 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3431 GEOM::shape_type theShapeType = theShapeTypes[i];
3432 if (shape->GetShapeType() == theShapeType)
3434 typesTxt << ShapeTypeToString(theShapeType);
3435 if (i < theShapeTypes.size()-1 )
3439 std::stringstream msg;
3440 msg << "shape type is not in" << typesTxt.str();
3441 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3445 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3448 if (shape->GetShapeType() != theShapeType) {
3449 std::stringstream msg;
3450 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3451 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3455 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3457 // Check shape is published in the object browser
3458 string shapeEntry = shape->GetStudyEntry();
3460 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3461 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3464 // Publish shape if needed
3465 if (shapeEntry.empty()) {
3466 if (shape->GetShapeType() == theShapeType)
3468 aName += shape->GetEntry();
3469 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3470 if (!theSFace1->_is_nil())
3471 shapeEntry = theSFace1->GetID();
3473 if (shapeEntry.empty())
3474 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3478 // Format the output of two vectors to use it in MESSAGE and PythonDump
3479 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3481 std::stringstream listEntriesTxt;
3483 if (!theSourceVerticesEntries.empty())
3485 listEntriesTxt << ", [" ;
3487 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3490 listEntriesTxt << ", ";
3491 listEntriesTxt << *it;
3494 listEntriesTxt << "], [" ;
3496 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3499 listEntriesTxt << ", ";
3500 listEntriesTxt << *it;
3502 listEntriesTxt << "]" ;
3504 return listEntriesTxt.str();
3508 * Erase all PreCad periodicity associations
3510 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3512 this->GetImpl()->ClearPreCadPeriodicityVectors();
3513 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3516 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3518 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3519 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3521 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3523 return periodicityList._retn();
3526 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3528 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3529 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3531 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3533 return periodicityList._retn();
3536 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3537 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3539 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3541 periodicityList->length(preCadPeriodicityVector.size());
3543 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3545 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3547 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3548 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3549 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3551 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3552 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3554 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3555 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3556 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3559 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3561 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3562 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3564 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3565 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3566 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3569 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3571 periodicityList[i] = myPreCadPeriodicity;
3575 return periodicityList._retn();
3579 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3580 throw (SALOME::SALOME_Exception)
3583 const GEOM::ListOfGO theSourceVertices;
3584 const GEOM::ListOfGO theTargetVertices;
3585 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3589 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3590 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3591 throw (SALOME::SALOME_Exception)
3595 size_t theLength = theSourceVertices.length();
3596 if (theLength != theTargetVertices.length())
3597 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3599 std::vector<GEOM::shape_type> allowedShapeTypes;
3600 allowedShapeTypes.push_back(GEOM::FACE);
3601 allowedShapeTypes.push_back(GEOM::COMPOUND);
3603 string prefix1 = "Source_face_";
3604 CheckShapeTypes(theFace1, allowedShapeTypes);
3605 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3607 string prefix2 = "Target_face_";
3608 CheckShapeTypes(theFace2, allowedShapeTypes);
3609 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3611 string prefix3 = "Source_vertex_";
3612 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3613 theSourceVerticesEntries->length(theLength);
3614 GEOM::GEOM_Object_ptr theVtx_i;
3616 for (size_t ind = 0; ind < theLength; ind++) {
3617 theVtx_i = theSourceVertices[ind];
3618 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3619 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3622 string prefix4 = "Target_vertex_";
3623 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3624 theTargetVerticesEntries->length(theLength);
3625 for (size_t ind = 0; ind < theLength; ind++) {
3626 theVtx_i = theTargetVertices[ind];
3627 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3628 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3631 string theFace2Name = theFace2->GetName();
3633 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3634 theSourceVerticesEntries, theTargetVerticesEntries);
3635 } catch (SALOME_Exception& ex) {
3636 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3641 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3642 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3643 throw (SALOME::SALOME_Exception)
3648 // Convert BLSURFPlugin::TEntryList to vector<string>
3649 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3650 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3651 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3652 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3655 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3658 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3659 theSourceVerticesEntries, theTargetVerticesEntries);
3661 SMESH::TPythonDump pd;
3662 if (!theSourceVerticesEntries.empty())
3664 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3665 pd << listEntriesTxt.c_str();
3669 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3672 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3673 throw (SALOME::SALOME_Exception)
3676 const GEOM::ListOfGO theSourceVertices;
3677 const GEOM::ListOfGO theTargetVertices;
3678 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3681 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3682 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3683 throw (SALOME::SALOME_Exception)
3687 size_t theLength = theSourceVertices.length();
3688 if (theLength != theTargetVertices.length())
3689 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3691 std::vector<GEOM::shape_type> allowedShapeTypes;
3692 allowedShapeTypes.push_back(GEOM::EDGE);
3693 allowedShapeTypes.push_back(GEOM::COMPOUND);
3695 string prefix1 = "Source_edge_";
3696 CheckShapeTypes(theEdge1, allowedShapeTypes);
3697 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3699 string prefix2 = "Target_edge_";
3700 CheckShapeTypes(theEdge2, allowedShapeTypes);
3701 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3703 string prefix3 = "Source_vertex_";
3704 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3705 theSourceVerticesEntries->length(theLength);
3706 GEOM::GEOM_Object_ptr theVtx_i;
3708 for (size_t ind = 0; ind < theLength; ind++) {
3709 theVtx_i = theSourceVertices[ind];
3710 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3711 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3714 string prefix4 = "Target_vertex_";
3715 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3716 theTargetVerticesEntries->length(theLength);
3717 for (size_t ind = 0; ind < theLength; ind++) {
3718 theVtx_i = theTargetVertices[ind];
3719 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3720 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3723 string theEdge2Name = theEdge2->GetName();
3725 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3726 theSourceVerticesEntries, theTargetVerticesEntries);
3727 } catch (SALOME_Exception& ex) {
3728 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3733 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3734 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3735 throw (SALOME::SALOME_Exception)
3740 // Convert BLSURFPlugin::TEntryList to vector<string>
3741 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3742 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3743 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3744 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3747 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3749 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3750 theSourceVerticesEntries, theTargetVerticesEntries);
3752 SMESH::TPythonDump pd;
3753 if (!theSourceVerticesEntries.empty())
3755 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3756 pd << listEntriesTxt.c_str();
3760 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3765 //================================================================================
3767 * \brief Sets the file for export resulting mesh in GMF format
3768 * \param theFileName - full name of the file (.mesh, .meshb)
3770 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3772 //================================================================================
3773 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3774 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3776 bool valueChanged/*, modeChanged*/ = false;
3778 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3779 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3780 if (valueChanged)// or (!valueChanged && modeChanged))
3781 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3782 } catch (const std::exception& ex) {
3783 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3785 if (valueChanged)// or (!valueChanged && modeChanged))
3786 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3789 //================================================================================
3791 * \brief Gets the file name for export resulting mesh in GMF format
3792 * \retval char* - The file name
3794 * Returns the GMF file name
3796 //================================================================================
3797 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3799 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3802 // //================================================================================
3804 // * \brief Gets the file mode for export resulting mesh in GMF format
3805 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3807 // * Returns the GMF file mode
3809 // //================================================================================
3810 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3811 // ASSERT(myBaseImpl);
3812 // return this->GetImpl()->GetGMFFileMode();
3815 //=============================================================================
3817 * BLSURFPlugin_Hypothesis_i::GetImpl
3819 * Get implementation
3821 //=============================================================================
3822 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3823 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3826 //================================================================================
3828 * \brief Verify whether hypothesis supports given entity type
3829 * \param type - dimension (see SMESH::Dimension enumeration)
3830 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3832 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3834 //================================================================================
3835 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3836 return type == SMESH::DIM_2D;
3840 // Obsolete methods - To be removed in V7
3843 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3844 this->SetMinSize(theMinSize);
3846 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3847 return this->GetMinSize();
3849 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3850 this->SetMaxSize(theMaxSize);
3852 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3853 return this->GetMaxSize();
3855 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3856 this->SetMinSize(theMinSize);
3858 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3859 return this->GetMinSize();
3861 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3862 this->SetMaxSize(theMaxSize);
3864 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3865 return this->GetMaxSize();
3867 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3868 this->SetAngleMesh(theValue);
3870 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3871 return this->GetAngleMesh();
3873 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3874 this->SetAngleMesh(theValue);
3876 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3877 return this->GetAngleMesh();
3879 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3880 std::string theValueStr = theValue ? "1" : "0";
3881 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3883 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3884 std::string theValueStr = this->GetOptionValue("respect_geometry");
3885 if (theValueStr.empty() || theValueStr == "respect")
3889 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3890 std::string theValueStr = theValue ? "1" : "0";
3891 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3893 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3894 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3895 if (theValueStr == "1")
3899 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3900 std::ostringstream theValueStr;
3901 theValueStr << theValue;
3902 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3904 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3905 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3907 theValueStr >> result;