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::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
837 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
839 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
840 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
843 //=============================================================================
844 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
846 return this->GetImpl()->GetUseDeprecatedPatchMesher();
848 //=============================================================================
850 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
852 if ( GetMaxNumberOfPointsPerPatch() != nb )
855 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
857 } catch (const std::invalid_argument& ex) {
858 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
859 } catch (SALOME_Exception& ex) {
860 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
862 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
865 //=============================================================================
866 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
868 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
870 //=============================================================================
872 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
874 if ( GetMaxNumberOfThreads() != nb )
877 this->GetImpl()->SetMaxNumberOfThreads(nb);
879 } catch (const std::invalid_argument& ex) {
880 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
881 } catch (SALOME_Exception& ex) {
882 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
884 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
887 //=============================================================================
888 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
890 return this->GetImpl()->GetMaxNumberOfThreads();
892 //=============================================================================
894 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
896 if ( GetRespectGeometry() != toRespect )
898 this->GetImpl()->SetRespectGeometry(toRespect);
899 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
902 //=============================================================================
903 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
905 return this->GetImpl()->GetRespectGeometry();
907 //=============================================================================
909 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
911 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
913 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
914 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
917 //=============================================================================
918 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
920 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
922 //=============================================================================
924 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
926 if ( GetClosedGeometry() != isClosed )
928 this->GetImpl()->SetClosedGeometry(isClosed);
929 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
932 //=============================================================================
933 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
935 return this->GetImpl()->GetClosedGeometry();
937 //=============================================================================
939 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
941 if ( GetDebug() != isDebug )
943 this->GetImpl()->SetDebug(isDebug);
944 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
947 //=============================================================================
948 bool BLSURFPlugin_Hypothesis_i::GetDebug()
950 return this->GetImpl()->GetDebug();
952 //=============================================================================
954 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
957 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
961 this->GetImpl()->SetPeriodicTolerance(tol);
963 } catch (const std::invalid_argument& ex) {
964 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
965 } catch (SALOME_Exception& ex) {
966 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
968 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
971 //=============================================================================
972 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
975 return this->GetImpl()->GetPeriodicTolerance();
977 } catch (const std::invalid_argument& ex) {
978 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
979 } catch (SALOME_Exception& ex) {
980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984 //=============================================================================
986 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
988 if ( GetImpl()->GetRequiredEntities() != howToTreat )
991 this->GetImpl()->SetRequiredEntities(howToTreat);
993 } catch (const std::invalid_argument& ex) {
994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
995 } catch (SALOME_Exception& ex) {
996 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
998 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1001 //=============================================================================
1002 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1004 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1006 //=============================================================================
1008 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1011 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1015 this->GetImpl()->SetSewingTolerance(tol);
1016 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1018 } catch (const std::invalid_argument& ex) {
1019 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1020 } catch (SALOME_Exception& ex) {
1021 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1025 //=============================================================================
1026 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1030 return this->GetImpl()->GetSewingTolerance();
1032 } catch (const std::invalid_argument& ex) {
1033 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1034 } catch (SALOME_Exception& ex) {
1035 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1039 //=============================================================================
1041 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1043 if ( GetImpl()->GetTags() != howToTreat )
1046 this->GetImpl()->SetTags(howToTreat);
1048 catch (const std::invalid_argument& ex) {
1049 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1050 } catch (SALOME_Exception& ex) {
1051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1054 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1056 //=============================================================================
1057 char* BLSURFPlugin_Hypothesis_i::GetTags()
1059 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1062 //=============================================================================
1063 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1065 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1066 SMESH_Comment hplDump;
1068 for ( size_t i = 0; i < patchList.size(); ++i )
1071 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1072 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1074 patchList[ i ].insert( tags[ j ]);
1075 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1077 hplDump << ( i+1 < patchList.size() ? "," : "]");
1079 if ( GetImpl()->GetHyperPatches() != patchList )
1081 GetImpl()->SetHyperPatches( patchList );
1082 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1086 //=============================================================================
1087 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1089 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1090 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1091 resHpl->length( hpl.size() );
1093 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1094 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1096 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1097 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1098 resHp.length( hp.size() );
1100 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1101 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1107 //=============================================================================
1109 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1113 //=============================================================================
1114 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1116 this->GetImpl()->SetPreCADMergeEdges(theValue);
1117 std::string theValueStr = theValue ? "True" : "False";
1118 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1121 //=============================================================================
1123 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1127 //=============================================================================
1128 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1130 return this->GetImpl()->GetPreCADMergeEdges();
1133 //=============================================================================
1135 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1139 //=============================================================================
1140 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1142 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1143 std::string theValueStr = theValue ? "True" : "False";
1144 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1147 //=============================================================================
1149 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1153 //=============================================================================
1154 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1156 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1159 //=============================================================================
1161 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1165 //=============================================================================
1166 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1168 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1169 std::string theValueStr = theValue ? "True" : "False";
1170 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1173 //=============================================================================
1175 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1179 //=============================================================================
1180 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1182 return this->GetImpl()->GetPreCADProcess3DTopology();
1185 //=============================================================================
1187 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1191 //=============================================================================
1192 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1194 this->GetImpl()->SetPreCADDiscardInput(theValue);
1195 std::string theValueStr = theValue ? "True" : "False";
1196 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1199 //=============================================================================
1201 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1205 //=============================================================================
1206 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1208 return this->GetImpl()->GetPreCADDiscardInput();
1212 //=============================================================================
1214 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1215 throw (SALOME::SALOME_Exception) {
1218 std::string name( optionName );
1219 if ( !optionValue || !optionValue[0] )
1220 UnsetOption( optionName );
1222 // basic options (visible in Advanced table)
1224 else if ( name == "enforce_cad_edge_sizes" )
1225 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1227 else if ( name == "jacobian_rectification_respect_geometry" )
1228 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1230 else if ( name == "max_number_of_points_per_patch" )
1231 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1233 else if ( name == "max_number_of_threads" )
1234 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1236 else if ( name == "rectify_jacobian" )
1237 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1239 else if ( name == "use_deprecated_patch_mesher" )
1240 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1242 else if ( name == "respect_geometry" )
1243 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1245 else if ( name == "tiny_edge_avoid_surface_intersections" )
1246 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1248 else if ( name == "closed_geometry" )
1249 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1251 else if ( name == "debug" )
1252 SetDebug( GetImpl()->ToBool( optionValue ));
1254 else if ( name == "discard_input_topology" )
1255 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1257 else if ( name == "merge_edges" )
1258 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1260 else if ( name == "periodic_tolerance" )
1261 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1263 else if ( name == "remove_duplicate_cad_faces" )
1264 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1266 else if ( name == "required_entities" )
1267 SetRequiredEntities( optionValue );
1269 else if ( name == "sewing_tolerance" )
1270 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1272 else if ( name == "tags" )
1273 SetTags( optionValue );
1275 // other basic options with specific methods
1277 else if ( name == "correct_surface_intersections" )
1278 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1280 else if ( name == "optimise_tiny_edges" )
1281 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1283 else if ( name == "surface_intersections_processing_max_cost" )
1284 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1286 else if ( name == "volume_gradation" )
1287 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1289 else if ( name == "tiny_edge_optimisation_length" )
1290 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1292 // advanced options (for backward compatibility)
1294 else if ( name == "create_tag_on_collision" ||
1295 name == "tiny_edge_respect_geometry" )
1296 AddOption( optionName, optionValue );
1300 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1301 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1304 this->GetImpl()->SetOptionValue(optionName, optionValue);
1305 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1308 } catch (const std::invalid_argument& ex) {
1309 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1310 } catch (SALOME_Exception& ex) {
1311 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1315 //=============================================================================
1317 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1318 throw (SALOME::SALOME_Exception) {
1320 bool valueChanged = false;
1322 std::string name( optionName );
1323 if ( !optionValue || !optionValue[0] )
1324 UnsetOption( optionName );
1326 else if ( name == "closed_geometry" )
1327 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1329 else if ( name == "debug" )
1330 SetDebug( GetImpl()->ToBool( optionValue ));
1332 else if ( name == "discard_input_topology" )
1333 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1335 else if ( name == "merge_edges" )
1336 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1338 else if ( name == "periodic_tolerance" )
1339 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1341 else if ( name == "remove_duplicate_cad_faces" )
1342 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1344 else if ( name == "required_entities" )
1345 SetRequiredEntities( optionValue );
1347 else if ( name == "sewing_tolerance" )
1348 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1350 else if ( name == "tags" )
1351 SetTags( optionValue );
1353 // other basic options with specific methods
1355 else if ( name == "correct_surface_intersections" )
1356 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1358 else if ( name == "optimise_tiny_edges" )
1359 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1361 else if ( name == "surface_intersections_processing_max_cost" )
1362 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1364 else if ( name == "volume_gradation" )
1365 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1367 else if ( name == "tiny_edge_optimisation_length" )
1368 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1370 else if ( name == "process_3d_topology" )
1371 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1373 // advanced options (for backward compatibility)
1375 else if ( name == "create_tag_on_collision" ||
1376 name == "tiny_edge_respect_geometry" ||
1377 name == "remove_tiny_edges" ||
1378 name == "tiny_edge_length")
1379 AddPreCADOption( optionName, optionValue );
1382 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1384 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1386 } catch (const std::invalid_argument& ex) {
1387 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1388 } catch (SALOME_Exception& ex) {
1389 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1392 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1395 //=============================================================================
1397 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1401 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1402 } catch (const std::invalid_argument& ex) {
1403 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1404 } catch (SALOME_Exception& ex) {
1405 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1410 //=============================================================================
1412 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1416 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1417 } catch (const std::invalid_argument& ex) {
1418 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1419 } catch (SALOME_Exception& ex) {
1420 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1425 //=============================================================================
1427 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1429 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1431 this->GetImpl()->ClearOption(optionName);
1432 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1436 //=============================================================================
1438 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1440 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1442 this->GetImpl()->ClearPreCADOption(optionName);
1443 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1447 //=============================================================================
1449 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1451 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1453 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1454 result->length(opts.size());
1458 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1459 for (; opIt != opts.end(); ++opIt, ++i) {
1460 string name_value_type = opIt->first;
1461 if (!opIt->second.empty()) {
1462 name_value_type += ":";
1463 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1464 name_value_type += isDefault ? ":0" : ":1";
1466 result[i] = CORBA::string_dup(name_value_type.c_str());
1469 return result._retn();
1472 //=============================================================================
1474 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1476 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1478 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1479 result->length(opts.size());
1483 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1484 for (; opIt != opts.end(); ++opIt, ++i) {
1485 string name_value_type = opIt->first;
1486 if (!opIt->second.empty()) {
1487 name_value_type += ":";
1488 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1489 name_value_type += isDefault ? ":0" : ":1";
1491 result[i] = CORBA::string_dup(name_value_type.c_str());
1493 return result._retn();
1496 //=============================================================================
1498 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1500 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1502 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1503 result->length(custom_opts.size());
1506 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1507 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1508 string name_value_type = opIt->first;
1509 if (!opIt->second.empty()) {
1510 name_value_type += ":";
1511 name_value_type += opIt->second;
1512 name_value_type += ":1"; // user defined
1514 result[i] = CORBA::string_dup(name_value_type.c_str());
1516 return result._retn();
1519 //=============================================================================
1521 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1522 throw (SALOME::SALOME_Exception) {
1524 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1525 string name_value_type = options[i].in();
1526 if(name_value_type.empty())
1528 size_t colonPos = name_value_type.find(':');
1530 if (colonPos == string::npos) // ':' not found
1531 name = name_value_type;
1533 name = name_value_type.substr(0, colonPos);
1534 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1535 string value_type = name_value_type.substr(colonPos + 1);
1536 colonPos = value_type.find(':');
1537 value = value_type.substr(0, colonPos);
1538 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1539 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1543 SetOptionValue(name.c_str(), value.c_str());
1547 //=============================================================================
1549 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1550 throw (SALOME::SALOME_Exception) {
1552 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1553 string name_value_type = options[i].in();
1554 if(name_value_type.empty())
1556 size_t colonPos = name_value_type.find(':');
1558 if (colonPos == string::npos) // ':' not found
1559 name = name_value_type;
1561 name = name_value_type.substr(0, colonPos);
1562 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1563 string value_type = name_value_type.substr(colonPos + 1);
1564 colonPos = value_type.find(':');
1565 value = value_type.substr(0, colonPos);
1566 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1567 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1571 SetPreCADOptionValue(name.c_str(), value.c_str());
1575 //=============================================================================
1577 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1579 SMESH::TPythonDump dump;
1581 string optionsAndValues;
1582 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1583 string name_value_type = options[i].in();
1584 if(name_value_type.empty())
1586 size_t colonPos = name_value_type.find(':');
1588 if (colonPos == string::npos) // ':' not found
1589 name = name_value_type;
1591 name = name_value_type.substr(0, colonPos);
1592 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1593 string value_type = name_value_type.substr(colonPos + 1);
1594 colonPos = value_type.find(':');
1595 value = value_type.substr(0, colonPos);
1598 AddOption(name.c_str(), value.c_str());
1600 optionsAndValues += name + " " + value + " ";
1603 if ( !optionsAndValues.empty() )
1604 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1607 //=============================================================================
1609 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1610 throw (SALOME::SALOME_Exception)
1612 if ( !optionsAndValues ) return;
1614 SMESH::TPythonDump dump;
1616 std::istringstream strm( optionsAndValues );
1617 std::istream_iterator<std::string> sIt( strm ), sEnd;
1618 while ( sIt != sEnd )
1620 std::string option = *sIt;
1621 if ( ++sIt != sEnd )
1623 std::string value = *sIt;
1625 AddOption( option.c_str(), value.c_str() );
1629 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1632 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1635 //=============================================================================
1637 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1640 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1642 this->GetImpl()->AddOption(optionName, optionValue);
1643 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1647 //=============================================================================
1649 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1652 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1654 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1655 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1659 //=============================================================================
1661 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1664 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1667 //=============================================================================
1669 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1672 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1675 //=============================================================================
1677 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1678 throw (SALOME::SALOME_Exception) {
1680 if ( !entry || !entry[0] )
1681 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1682 bool valueChanged = false;
1684 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1686 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1687 } catch (const std::invalid_argument& ex) {
1688 SALOME::ExceptionStruct ExDescription;
1689 ExDescription.text = ex.what();
1690 ExDescription.type = SALOME::BAD_PARAM;
1691 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1692 ExDescription.lineNumber = 0;
1693 throw SALOME::SALOME_Exception(ExDescription);
1694 } catch (SALOME_Exception& ex) {
1695 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1698 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1701 //=============================================================================
1703 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1704 throw (SALOME::SALOME_Exception) {
1706 bool valueChanged = false;
1707 std::ostringstream sizeMapFunction;
1708 switch (shapeType) {
1709 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1710 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1711 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1715 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1717 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1718 } catch (const std::invalid_argument& ex) {
1719 SALOME::ExceptionStruct ExDescription;
1720 ExDescription.text = ex.what();
1721 ExDescription.type = SALOME::BAD_PARAM;
1722 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1723 ExDescription.lineNumber = 0;
1724 throw SALOME::SALOME_Exception(ExDescription);
1725 } catch (SALOME_Exception& ex) {
1726 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1729 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1732 //=============================================================================
1734 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1735 throw (SALOME::SALOME_Exception) {
1737 bool valueChanged = false;
1739 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1740 if ( valueChanged ) {
1741 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1742 if (!boost::regex_match(string(attractor), re))
1743 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1744 this->GetImpl()->SetAttractorEntry(entry, attractor);
1746 } catch (const std::invalid_argument& ex) {
1747 SALOME::ExceptionStruct ExDescription;
1748 ExDescription.text = ex.what();
1749 ExDescription.type = SALOME::BAD_PARAM;
1750 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1751 ExDescription.lineNumber = 0;
1752 throw SALOME::SALOME_Exception(ExDescription);
1753 } catch (SALOME_Exception& ex) {
1754 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1757 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1760 //=============================================================================
1762 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
1763 throw (SALOME::SALOME_Exception)
1766 //bool valueChanged = false;
1768 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1770 catch (const std::invalid_argument& ex) {
1771 SALOME::ExceptionStruct ExDescription;
1772 ExDescription.text = ex.what();
1773 ExDescription.type = SALOME::BAD_PARAM;
1774 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1775 ExDescription.lineNumber = 0;
1776 throw SALOME::SALOME_Exception(ExDescription);
1777 } catch (SALOME_Exception& ex) {
1778 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1780 //if ( valueChanged )
1781 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1782 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1785 //=============================================================================
1787 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1790 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1791 } catch (const std::invalid_argument& ex) {
1792 SALOME::ExceptionStruct ExDescription;
1793 ExDescription.text = ex.what();
1794 ExDescription.type = SALOME::BAD_PARAM;
1795 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1796 ExDescription.lineNumber = 0;
1797 throw SALOME::SALOME_Exception(ExDescription);
1798 } catch (SALOME_Exception& ex) {
1799 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1804 //=============================================================================
1806 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1809 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1810 } catch (const std::invalid_argument& ex) {
1811 SALOME::ExceptionStruct ExDescription;
1812 ExDescription.text = ex.what();
1813 ExDescription.type = SALOME::BAD_PARAM;
1814 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1815 ExDescription.lineNumber = 0;
1816 throw SALOME::SALOME_Exception(ExDescription);
1817 } catch (SALOME_Exception& ex) {
1818 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1823 // //=============================================================================
1825 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1826 // // A finir pour le dump
1827 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1828 // throw (SALOME::SALOME_Exception)
1830 // ASSERT(myBaseImpl);
1832 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1834 // catch (const std::invalid_argument& ex) {
1835 // SALOME::ExceptionStruct ExDescription;
1836 // ExDescription.text = ex.what();
1837 // ExDescription.type = SALOME::BAD_PARAM;
1838 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1839 // ExDescription.lineNumber = 0;
1840 // throw SALOME::SALOME_Exception(ExDescription);
1842 // catch (SALOME_Exception& ex) {
1843 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1848 //=============================================================================
1850 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1852 this->GetImpl()->ClearEntry(entry);
1853 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1856 //=============================================================================
1858 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1860 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1862 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1863 result->length(sizeMaps.size());
1865 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1866 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1867 string entry_sizemap = smIt->first;
1868 if (!smIt->second.empty()) {
1869 entry_sizemap += "|";
1870 entry_sizemap += smIt->second;
1872 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1874 return result._retn();
1877 //=============================================================================
1879 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1881 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1883 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1884 result->length(attractors.size());
1886 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1887 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1888 string entry_attractor = atIt->first;
1889 if (!atIt->second.empty()) {
1890 entry_attractor += "|";
1891 entry_attractor += atIt->second;
1893 result[i] = CORBA::string_dup(entry_attractor.c_str());
1895 return result._retn();
1898 //=============================================================================
1900 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1903 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1905 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1906 result->length( attractors.size() );
1908 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1909 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1910 string faceEntry = atIt->first;
1912 double startSize, endSize, infDist, constDist;
1913 if ( !atIt->second->Empty() ) {
1914 attEntry = atIt->second->GetAttractorEntry();
1915 std::vector<double> params = atIt->second->GetParameters();
1916 startSize = params[0];
1917 endSize = params[1];
1918 infDist = params[2];
1919 constDist = params[3];
1921 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1922 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1923 result[i].startSize = startSize;
1924 result[i].endSize = endSize;
1925 result[i].infDist = infDist;
1926 result[i].constDist = constDist;
1928 return result._retn();
1931 //=============================================================================
1933 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1934 throw (SALOME::SALOME_Exception) {
1936 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1937 string entry_sizemap = sizeMaps[i].in();
1938 size_t colonPos = entry_sizemap.find('|');
1939 string entry, sizemap;
1940 if (colonPos == string::npos) // '|' separator not found
1941 entry = entry_sizemap;
1943 entry = entry_sizemap.substr(0, colonPos);
1944 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1945 sizemap = entry_sizemap.substr(colonPos + 1);
1947 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1951 //=============================================================================
1953 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1955 this->GetImpl()->ClearSizeMaps();
1958 //=============================================================================
1960 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1961 throw (SALOME::SALOME_Exception)
1965 entry = GeomObj->GetStudyEntry();
1966 SetSizeMapEntry(entry.c_str(), sizeMap);
1969 //=============================================================================
1971 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1973 string entry = GeomObj->GetStudyEntry();
1974 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1975 if (shapeType == GEOM::COMPOUND)
1976 shapeType = GeomObj->GetMaxShapeType();
1977 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1980 //=============================================================================
1981 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1984 entry = GeomObj->GetStudyEntry();
1985 UnsetEntry(entry.c_str());
1986 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1989 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1992 entry = GeomObj->GetStudyEntry();
1993 SetAttractorEntry(entry.c_str(), attractor);
1996 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1999 entry = GeomObj->GetStudyEntry();
2000 UnsetEntry(entry.c_str());
2001 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2004 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)
2007 string theFaceEntry;
2009 theFaceEntry = theFace->GetStudyEntry();
2010 theAttEntry = theAttractor->GetStudyEntry();
2012 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2013 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2016 if (theFaceEntry.empty()) {
2018 aName += theFace->GetEntry();
2019 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2020 if (!theSFace->_is_nil())
2021 theFaceEntry = theSFace->GetID();
2023 if (theFaceEntry.empty())
2024 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2026 if (theAttEntry.empty()) {
2027 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2029 if (theAttractor->GetShapeType() == GEOM::EDGE)
2031 if (theAttractor->GetShapeType() == GEOM::WIRE)
2033 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2034 aName = "Compound_";
2035 aName += theAttractor->GetEntry();
2036 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2037 if (!theSAtt->_is_nil())
2038 theAttEntry = theSAtt->GetID();
2040 if (theAttEntry.empty())
2041 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2043 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2044 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2045 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2048 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2049 GEOM::GEOM_Object_ptr theAttractor)
2052 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2053 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2055 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2056 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2059 // if (theFaceEntry.empty()) {
2061 // aName += theFace->GetEntry();
2062 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2063 // if (!theSFace->_is_nil())
2064 // theFaceEntry = theSFace->GetID();
2066 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2067 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2068 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2070 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2071 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2072 << theFace << ", " << theAttractor << " )";
2075 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2076 const char* attractorEntry)
2078 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2079 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2080 << faceEntry << "', '" << attractorEntry << "' )";
2085 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2088 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2091 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2094 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2097 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2100 this->GetImpl()->UnsetCustomSizeMap(entry);
2101 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2105 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2110 // ///////////////////////
2111 // // ENFORCED VERTICES //
2112 // ///////////////////////
2116 * Returns the list of enforced vertices for a given Face entry
2117 * @return A map of Face entry / List of enforced vertices
2120 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2123 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2125 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2126 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2127 resultMap->length(faceEntryEnfVertexListMap.size());
2129 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2130 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2131 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2132 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2133 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2134 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2136 _enfVertexList = it_entry->second;
2137 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2138 enfVertexList->length(_enfVertexList.size());
2140 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2141 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2142 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2143 currentEnfVertex = (*it_enfVertex);
2145 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2148 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2151 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2154 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2155 coords->length(currentEnfVertex->coords.size());
2156 for (CORBA::ULong i=0;i<coords->length();i++)
2157 coords[i] = currentEnfVertex->coords[i];
2158 enfVertex->coords = coords;
2161 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2164 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2165 faceEntryList->length(currentEnfVertex->faceEntries.size());
2166 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2167 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2168 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2169 enfVertex->faceEntries = faceEntryList;
2172 msg << "Enforced vertex: \n"
2173 << "Name: " << enfVertex->name << "\n";
2174 if (coords->length())
2175 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2176 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2177 << "Group Name: " << enfVertex->grpName;
2179 enfVertexList[j] = enfVertex;
2181 mapElement->enfVertexList = enfVertexList;
2183 resultMap[i] = mapElement;
2186 return resultMap._retn();
2190 * Returns the list of all enforced vertices
2191 * @return a list of enforced vertices
2194 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2196 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2197 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2198 resultMap->length(enfVertexList.size());
2200 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2201 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2202 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2203 currentEnfVertex = (*evlIt);
2204 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2206 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2208 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2210 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2211 coords->length(currentEnfVertex->coords.size());
2212 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2213 coords[ind] = currentEnfVertex->coords[ind];
2214 enfVertex->coords = coords;
2216 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2218 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2219 faceEntryList->length(currentEnfVertex->faceEntries.size());
2220 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2221 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2222 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2223 enfVertex->faceEntries = faceEntryList;
2226 msg << "Enforced vertex: \n"
2227 << "Name: " << enfVertex->name << "\n";
2228 if (coords->length())
2229 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2230 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2231 << "Group Name: " << enfVertex->grpName;
2233 resultMap[i] = enfVertex;
2235 return resultMap._retn();
2240 * Returns the list of enforced vertices coords for a given Face entry.
2241 * They are the coords of the "manual" enforced vertices.
2242 * @return A map of Face entry / List of enforced vertices coords
2245 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2248 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2250 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2251 resultMap->length(entryCoordsListMap.size());
2253 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2254 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2255 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2256 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2257 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2259 _coordsList = it_entry->second;
2260 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2261 coordsList->length(_coordsList.size());
2263 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2264 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2265 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2266 coords->length((*it_coords).size());
2267 for (CORBA::ULong i=0;i<coords->length();i++)
2268 coords[i] = (*it_coords)[i];
2269 coordsList[j] = coords;
2271 mapElement->coordsList = coordsList;
2273 resultMap[i] = mapElement;
2276 return resultMap._retn();
2280 * Returns a map of enforced vertices coords / enforced vertex.
2281 * They are the coords of the "manual" enforced vertices.
2283 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2286 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2287 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2288 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2289 resultMap->length(coordsEnfVertexMap.size());
2291 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2292 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2293 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2294 currentEnfVertex = (it_coords->second);
2295 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2296 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2297 coords->length(it_coords->first.size());
2298 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2299 coords[ind] = it_coords->first[ind];
2300 mapElement->coords = coords;
2302 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2304 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2306 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2308 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2309 coords2->length(currentEnfVertex->coords.size());
2310 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2311 coords2[ind] = currentEnfVertex->coords[ind];
2312 enfVertex->coords = coords2;
2314 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2316 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2317 faceEntryList->length(currentEnfVertex->faceEntries.size());
2318 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2319 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2320 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2321 enfVertex->faceEntries = faceEntryList;
2323 mapElement->enfVertex = enfVertex;
2325 msg << "Enforced vertex: \n"
2326 << "Name: " << enfVertex->name << "\n";
2327 if (coords->length())
2328 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2329 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2330 << "Group Name: " << enfVertex->grpName;
2332 resultMap[i] = mapElement;
2334 return resultMap._retn();
2338 * Returns the list of enforced vertices entries for a given Face entry.
2339 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2340 * @return A map of Face entry / List of enforced vertices geom entries
2343 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2346 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2348 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2349 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2350 resultMap->length(entryEnfVertexEntryListMap.size());
2352 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2353 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2354 entryEnfVertexEntryListMap.begin();
2355 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2356 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2357 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2358 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2360 _enfVertexEntryList = it_entry->second;
2361 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2362 enfVertexEntryList->length(_enfVertexEntryList.size());
2364 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2365 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2366 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2368 mapElement->enfVertexEntryList = enfVertexEntryList;
2370 resultMap[i] = mapElement;
2373 return resultMap._retn();
2377 * Returns a map of enforced vertices geom entry / enforced vertex.
2378 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2380 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2383 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2384 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2385 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2386 resultMap->length(enfVertexEntryEnfVertexMap.size());
2388 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2389 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2390 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2391 currentEnfVertex = it_enfVertexEntry->second;
2392 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2393 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2395 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2397 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2399 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2401 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2402 coords->length(currentEnfVertex->coords.size());
2403 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2404 coords[ind] = currentEnfVertex->coords[ind];
2405 enfVertex->coords = coords;
2407 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2409 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2410 faceEntryList->length(currentEnfVertex->faceEntries.size());
2411 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2412 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2413 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2414 enfVertex->faceEntries = faceEntryList;
2417 msg << "Enforced vertex: \n"
2418 << "Name: " << enfVertex->name << "\n";
2419 if (coords->length())
2420 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2421 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2422 << "Group Name: " << enfVertex->grpName;
2424 mapElement->enfVertex = enfVertex;
2425 resultMap[i] = mapElement;
2427 return resultMap._retn();
2431 * Erase all enforced vertices
2433 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2435 this->GetImpl()->ClearAllEnforcedVertices();
2436 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2440 * Set/get/unset an enforced vertex on face - OBSOLETE
2442 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2443 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2446 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2447 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2450 string theFaceEntry = theFace->GetStudyEntry();
2452 if (theFaceEntry.empty()) {
2453 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2454 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2456 if (theFace->GetShapeType() == GEOM::FACE)
2458 if (theFace->GetShapeType() == GEOM::COMPOUND)
2459 aName = "Compound_";
2460 aName += theFace->GetEntry();
2461 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2462 if (!theSFace->_is_nil())
2463 theFaceEntry = theSFace->GetID();
2465 if (theFaceEntry.empty())
2466 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2468 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2469 } catch (SALOME_Exception& ex) {
2470 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2475 * Set/get/unset an enforced vertex with name on face
2477 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2478 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2481 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2482 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2485 string theFaceEntry = theFace->GetStudyEntry();
2487 if (theFaceEntry.empty()) {
2488 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2489 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2491 if (theFace->GetShapeType() == GEOM::FACE)
2493 if (theFace->GetShapeType() == GEOM::COMPOUND)
2494 aName = "Compound_";
2495 aName += theFace->GetEntry();
2496 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2497 if (!theSFace->_is_nil())
2498 theFaceEntry = theSFace->GetID();
2500 if (theFaceEntry.empty())
2501 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2504 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2505 } catch (SALOME_Exception& ex) {
2506 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2511 * Set/get/unset an enforced vertex with geom object on face
2513 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2514 throw (SALOME::SALOME_Exception) {
2517 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2518 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2521 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2522 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2525 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2526 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2527 // if (CORBA::is_nil(measureOp))
2530 // CORBA::Double x, y, z;
2532 // measureOp->PointCoordinates(theVertex, x, y, z);
2534 string theFaceEntry = theFace->GetStudyEntry();
2535 string theVertexEntry = theVertex->GetStudyEntry();
2537 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2538 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2541 if (theFaceEntry.empty()) {
2542 if (theFace->GetShapeType() == GEOM::FACE)
2544 if (theFace->GetShapeType() == GEOM::COMPOUND)
2545 aName = "Compound_";
2546 aName += theFace->GetEntry();
2547 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2548 if (!theSFace->_is_nil())
2549 theFaceEntry = theSFace->GetID();
2551 if (theFaceEntry.empty())
2552 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2554 if (theVertexEntry.empty()) {
2555 if (theVertex->GetShapeType() == GEOM::VERTEX)
2557 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2558 aName = "Compound_";
2559 aName += theVertex->GetEntry();
2560 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2561 if (!theSVertex->_is_nil())
2562 theVertexEntry = theSVertex->GetID();
2564 if (theVertexEntry.empty())
2565 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2567 string theVertexName = theVertex->GetName();
2569 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2570 } catch (SALOME_Exception& ex) {
2571 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2576 * Set an enforced vertex with group name on face
2578 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2579 throw (SALOME::SALOME_Exception)
2583 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2584 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2587 string theFaceEntry = theFace->GetStudyEntry();
2589 if (theFaceEntry.empty()) {
2590 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2591 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2593 if (theFace->GetShapeType() == GEOM::FACE)
2595 if (theFace->GetShapeType() == GEOM::COMPOUND)
2596 aName = "Compound_";
2597 aName += theFace->GetEntry();
2598 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2599 if (!theSFace->_is_nil())
2600 theFaceEntry = theSFace->GetID();
2602 if (theFaceEntry.empty())
2603 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2605 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2606 } catch (SALOME_Exception& ex) {
2607 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2612 * Set an enforced vertex with name and group name on face
2614 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2615 const char* theVertexName, const char* theGroupName)
2616 throw (SALOME::SALOME_Exception)
2620 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2621 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2624 string theFaceEntry = theFace->GetStudyEntry();
2626 if (theFaceEntry.empty()) {
2627 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2628 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2630 if (theFace->GetShapeType() == GEOM::FACE)
2632 if (theFace->GetShapeType() == GEOM::COMPOUND)
2633 aName = "Compound_";
2634 aName += theFace->GetEntry();
2635 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2636 if (!theSFace->_is_nil())
2637 theFaceEntry = theSFace->GetID();
2639 if (theFaceEntry.empty())
2640 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2642 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2643 } catch (SALOME_Exception& ex) {
2644 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2649 * Set an enforced vertex with geom entry and group name on face
2651 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2652 throw (SALOME::SALOME_Exception)
2656 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2657 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2660 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2661 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2664 string theFaceEntry = theFace->GetStudyEntry();
2665 string theVertexEntry = theVertex->GetStudyEntry();
2667 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2668 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2671 if (theFaceEntry.empty()) {
2672 if (theFace->GetShapeType() == GEOM::FACE)
2674 if (theFace->GetShapeType() == GEOM::COMPOUND)
2675 aName = "Compound_";
2676 aName += theFace->GetEntry();
2677 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2678 if (!theSFace->_is_nil())
2679 theFaceEntry = theSFace->GetID();
2681 if (theFaceEntry.empty())
2682 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2684 if (theVertexEntry.empty()) {
2685 if (theVertex->GetShapeType() == GEOM::VERTEX)
2687 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2688 aName = "Compound_";
2689 aName += theVertex->GetEntry();
2690 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2691 if (!theSVertex->_is_nil())
2692 theVertexEntry = theSVertex->GetID();
2694 if (theVertexEntry.empty())
2695 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2697 string theVertexName = theVertex->GetName();
2699 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2700 } catch (SALOME_Exception& ex) {
2701 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2705 //Enable internal enforced vertices on specific face if requested by user
2707 // * Are internal enforced vertices used for a face ?
2709 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2710 // throw (SALOME::SALOME_Exception) {
2711 // ASSERT(myBaseImpl);
2713 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2714 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2717 // string theFaceEntry = theFace->GetStudyEntry();
2719 // if (theFaceEntry.empty()) {
2720 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2721 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2723 // if (theFace->GetShapeType() == GEOM::FACE)
2725 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2726 // aName = "Compound_";
2727 // aName += theFace->GetEntry();
2728 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2729 // if (!theSFace->_is_nil())
2730 // theFaceEntry = theSFace->GetID();
2732 // if (theFaceEntry.empty())
2733 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2736 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2737 // } catch (SALOME_Exception& ex) {
2738 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2743 * Get the list of all enforced vertices
2745 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2746 throw (SALOME::SALOME_Exception) {
2749 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2750 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2753 string theFaceEntry = theFace->GetStudyEntry();
2755 if (theFaceEntry.empty()) {
2756 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2757 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2759 if (theFace->GetShapeType() == GEOM::FACE)
2761 if (theFace->GetShapeType() == GEOM::COMPOUND)
2762 aName = "Compound_";
2763 aName += theFace->GetEntry();
2764 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2765 if (!theSFace->_is_nil())
2766 theFaceEntry = theSFace->GetID();
2768 if (theFaceEntry.empty())
2769 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2772 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2773 } catch (SALOME_Exception& ex) {
2774 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2778 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2779 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2782 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2783 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2786 string theFaceEntry = theFace->GetStudyEntry();
2788 if (theFaceEntry.empty()) {
2789 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2790 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2792 if (theFace->GetShapeType() == GEOM::FACE)
2794 if (theFace->GetShapeType() == GEOM::COMPOUND)
2795 aName = "Compound_";
2796 aName += theFace->GetEntry();
2797 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2798 if (!theSFace->_is_nil())
2799 theFaceEntry = theSFace->GetID();
2801 if (theFaceEntry.empty())
2802 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2805 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2806 } catch (SALOME_Exception& ex) {
2807 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2811 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2812 throw (SALOME::SALOME_Exception) {
2815 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2816 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2818 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2819 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2822 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2823 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2824 // if (CORBA::is_nil(measureOp))
2827 // CORBA::Double x, y, z;
2829 // measureOp->PointCoordinates(theVertex, x, y, z);
2831 std::string theFaceEntry = theFace->GetStudyEntry();
2832 std::string theVertexEntry = theVertex->GetStudyEntry();
2834 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2835 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2838 if (theFaceEntry.empty()) {
2839 if (theFace->GetShapeType() == GEOM::FACE)
2841 if (theFace->GetShapeType() == GEOM::COMPOUND)
2842 aName = "Compound_";
2843 aName += theFace->GetEntry();
2844 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2845 if (!theSFace->_is_nil())
2846 theFaceEntry = theSFace->GetID();
2848 if (theFaceEntry.empty())
2849 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2851 if (theVertexEntry.empty()) {
2852 if (theVertex->GetShapeType() == GEOM::VERTEX)
2854 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2855 aName = "Compound_";
2856 aName += theVertex->GetEntry();
2857 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2858 if (!theSVertex->_is_nil())
2859 theVertexEntry = theSVertex->GetID();
2861 if (theVertexEntry.empty())
2862 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2866 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2867 } catch (SALOME_Exception& ex) {
2868 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2872 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2875 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2876 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2879 string theFaceEntry = theFace->GetStudyEntry();
2881 if (theFaceEntry.empty()) {
2882 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2883 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2885 if (theFace->GetShapeType() == GEOM::FACE)
2887 if (theFace->GetShapeType() == GEOM::COMPOUND)
2888 aName = "Compound_";
2889 aName += theFace->GetEntry();
2890 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2891 if (!theSFace->_is_nil())
2892 theFaceEntry = theSFace->GetID();
2894 if (theFaceEntry.empty())
2895 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2899 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2900 } catch (SALOME_Exception& ex) {
2901 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2906 * Set/get/unset an enforced vertex on face - NEW (no face)
2908 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2913 return SetEnforcedVertexEntry("", x, y, z);
2914 } catch (SALOME_Exception& ex) {
2915 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2920 * Set/get/unset an enforced vertex with name on face
2922 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2925 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2926 } catch (SALOME_Exception& ex) {
2927 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2932 * Set/get/unset an enforced vertex with geom object on face
2934 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2935 throw (SALOME::SALOME_Exception)
2937 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2938 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2940 string theVertexEntry = theVertex->GetStudyEntry();
2942 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2943 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2946 if (theVertexEntry.empty()) {
2947 if (theVertex->GetShapeType() == GEOM::VERTEX)
2949 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2950 aName = "Compound_";
2951 aName += theVertex->GetEntry();
2952 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2953 if (!theSVertex->_is_nil())
2954 theVertexEntry = theSVertex->GetID();
2956 if (theVertexEntry.empty())
2957 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2959 string theVertexName = theVertex->GetName();
2961 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2962 } catch (SALOME_Exception& ex) {
2963 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2968 * Set an enforced vertex with group name on face
2970 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2971 throw (SALOME::SALOME_Exception)
2976 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2977 } catch (SALOME_Exception& ex) {
2978 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2983 * Set an enforced vertex with name and group name on face
2985 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
2986 const char* theVertexName, const char* theGroupName)
2987 throw (SALOME::SALOME_Exception)
2992 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
2993 } catch (SALOME_Exception& ex) {
2994 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2999 * Set an enforced vertex with geom entry and group name on face
3001 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3002 throw (SALOME::SALOME_Exception)
3004 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3005 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3008 string theVertexEntry = theVertex->GetStudyEntry();
3010 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3011 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3014 if (theVertexEntry.empty()) {
3015 if (theVertex->GetShapeType() == GEOM::VERTEX)
3017 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3018 aName = "Compound_";
3019 aName += theVertex->GetEntry();
3020 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3021 if (!theSVertex->_is_nil())
3022 theVertexEntry = theSVertex->GetID();
3024 if (theVertexEntry.empty())
3025 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3027 string theVertexName = theVertex->GetName();
3029 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3030 } catch (SALOME_Exception& ex) {
3031 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3035 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3038 return UnsetEnforcedVertexEntry("", x, y, z);
3039 } catch (SALOME_Exception& ex) {
3040 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3044 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3045 throw (SALOME::SALOME_Exception)
3047 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3048 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3050 std::string theVertexEntry = theVertex->GetStudyEntry();
3052 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3053 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3056 if (theVertexEntry.empty()) {
3057 if (theVertex->GetShapeType() == GEOM::VERTEX)
3059 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3060 aName = "Compound_";
3061 aName += theVertex->GetEntry();
3062 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3063 if (!theSVertex->_is_nil())
3064 theVertexEntry = theSVertex->GetID();
3066 if (theVertexEntry.empty())
3067 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3070 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3071 } catch (SALOME_Exception& ex) {
3072 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3076 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3079 return UnsetEnforcedVerticesEntry("");
3080 } catch (SALOME_Exception& ex) {
3081 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3086 * Set/get/unset an enforced vertex on geom object given by entry
3088 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3092 const char* theVertexName,
3093 const char* theVertexEntry,
3094 const char* theGroupName)
3095 throw (SALOME::SALOME_Exception)
3097 bool newValue = false;
3098 if (string(theVertexEntry).empty()) {
3100 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3101 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3102 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3103 coords.push_back(x);
3104 coords.push_back(y);
3105 coords.push_back(z);
3106 if (coordsList.find(coords) == coordsList.end()) {
3109 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3110 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3114 } catch (const std::invalid_argument& ex) {
3115 // no enforced vertex for entry
3119 if (string(theVertexName).empty()) {
3120 if (string(theGroupName).empty())
3121 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3123 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3126 if (string(theGroupName).empty())
3127 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3129 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3130 << theVertexName << "\", \"" << theGroupName << "\")";
3135 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3136 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3137 if ( it == enfVertexEntryList.end()) {
3141 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3142 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3146 } catch (const std::invalid_argument& ex) {
3147 // no enforced vertex for entry
3151 if (string(theGroupName).empty())
3152 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3154 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3159 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3164 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3165 throw (SALOME::SALOME_Exception)
3168 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3169 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3170 vertexList->length(_vList.size());
3171 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3172 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3173 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3175 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3178 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3179 // Geom Vertex Entry
3180 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3182 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3183 coords->length(_enfVertex->coords.size());
3184 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3185 coords[ind] = _enfVertex->coords[ind];
3186 enfVertex->coords = coords;
3188 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3190 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3191 faceEntryList->length(_enfVertex->faceEntries.size());
3192 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3193 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3194 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3195 enfVertex->faceEntries = faceEntryList;
3197 vertexList[i] = enfVertex;
3199 return vertexList._retn();
3200 } catch (const std::invalid_argument& ex) {
3201 SALOME::ExceptionStruct ExDescription;
3202 ExDescription.text = ex.what();
3203 ExDescription.type = SALOME::BAD_PARAM;
3204 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3205 ExDescription.lineNumber = 1385;
3206 throw SALOME::SALOME_Exception(ExDescription);
3207 } catch (const std::exception& ex) {
3208 std::cout << "Exception: " << ex.what() << std::endl;
3209 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3213 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3219 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3221 if (string(theVertexEntry).empty())
3222 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3225 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3227 } catch (const std::invalid_argument& ex) {
3229 } catch (const std::exception& ex) {
3230 std::cout << "Exception: " << ex.what() << std::endl;
3231 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3236 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3241 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3242 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3243 } catch (const std::invalid_argument& ex) {
3245 } catch (const std::exception& ex) {
3246 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3252 //=============================================================================
3254 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3258 //=============================================================================
3259 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3262 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3263 std::string theValueStr = theValue ? "True" : "False";
3264 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3267 //=============================================================================
3269 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3273 //=============================================================================
3274 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3277 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3280 //=============================================================================
3282 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3286 //=============================================================================
3287 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3290 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3291 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3294 //=============================================================================
3296 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3300 //=============================================================================
3301 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3304 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3308 * Enable internal enforced vertices on specific face if requested by user
3310 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3311 throw (SALOME::SALOME_Exception)
3314 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3315 } catch (SALOME_Exception& ex) {
3316 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3320 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3321 throw (SALOME::SALOME_Exception)
3324 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3325 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3328 string theFaceEntry = theFace->GetStudyEntry();
3330 if (theFaceEntry.empty()) {
3331 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3332 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3334 if (theFace->GetShapeType() == GEOM::FACE)
3336 if (theFace->GetShapeType() == GEOM::COMPOUND)
3337 aName = "Compound_";
3338 aName += theFace->GetEntry();
3339 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3340 if (!theSFace->_is_nil())
3341 theFaceEntry = theSFace->GetID();
3343 if (theFaceEntry.empty())
3344 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3347 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3348 } catch (SALOME_Exception& ex) {
3349 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3353 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3354 throw (SALOME::SALOME_Exception)
3358 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3359 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3360 if (string(theGroupName).empty())
3361 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3363 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3364 } catch (const std::exception& ex) {
3365 std::cout << "Exception: " << ex.what() << std::endl;
3366 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3373 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3374 throw (SALOME::SALOME_Exception)
3378 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3380 catch (const std::invalid_argument& ex) {
3381 SALOME::ExceptionStruct ExDescription;
3382 ExDescription.text = ex.what();
3383 ExDescription.type = SALOME::BAD_PARAM;
3384 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3385 ExDescription.lineNumber = 1146;
3386 throw SALOME::SALOME_Exception(ExDescription);
3388 catch (SALOME_Exception& ex) {
3389 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3395 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3396 throw (SALOME::SALOME_Exception)
3400 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3402 catch (const std::invalid_argument& ex) {
3403 SALOME::ExceptionStruct ExDescription;
3404 ExDescription.text = ex.what();
3405 ExDescription.type = SALOME::BAD_PARAM;
3406 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3407 ExDescription.lineNumber = 1170;
3408 throw SALOME::SALOME_Exception(ExDescription);
3410 catch (SALOME_Exception& ex) {
3411 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3414 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3415 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3419 ///////////////////////
3421 ///////////////////////
3423 ///////////////////////
3426 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3428 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3429 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3430 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3431 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3432 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3433 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3434 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3435 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3436 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3437 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3438 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3439 return txtShapeType;
3442 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3444 // Check shape types
3446 std::stringstream typesTxt;
3447 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3449 GEOM::shape_type theShapeType = theShapeTypes[i];
3450 if (shape->GetShapeType() == theShapeType)
3452 typesTxt << ShapeTypeToString(theShapeType);
3453 if (i < theShapeTypes.size()-1 )
3457 std::stringstream msg;
3458 msg << "shape type is not in" << typesTxt.str();
3459 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3463 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3466 if (shape->GetShapeType() != theShapeType) {
3467 std::stringstream msg;
3468 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3469 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3473 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3475 // Check shape is published in the object browser
3476 string shapeEntry = shape->GetStudyEntry();
3478 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3479 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3482 // Publish shape if needed
3483 if (shapeEntry.empty()) {
3484 if (shape->GetShapeType() == theShapeType)
3486 aName += shape->GetEntry();
3487 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3488 if (!theSFace1->_is_nil())
3489 shapeEntry = theSFace1->GetID();
3491 if (shapeEntry.empty())
3492 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3496 // Format the output of two vectors to use it in MESSAGE and PythonDump
3497 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3499 std::stringstream listEntriesTxt;
3501 if (!theSourceVerticesEntries.empty())
3503 listEntriesTxt << ", [" ;
3505 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3508 listEntriesTxt << ", ";
3509 listEntriesTxt << *it;
3512 listEntriesTxt << "], [" ;
3514 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3517 listEntriesTxt << ", ";
3518 listEntriesTxt << *it;
3520 listEntriesTxt << "]" ;
3522 return listEntriesTxt.str();
3526 * Erase all PreCad periodicity associations
3528 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3530 this->GetImpl()->ClearPreCadPeriodicityVectors();
3531 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3534 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3536 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3537 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3539 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3541 return periodicityList._retn();
3544 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3546 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3547 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3549 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3551 return periodicityList._retn();
3554 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3555 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3557 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3559 periodicityList->length(preCadPeriodicityVector.size());
3561 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3563 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3565 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3566 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3567 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3569 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3570 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3572 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3573 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3574 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3577 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3579 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3580 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3582 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3583 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3584 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3587 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3589 periodicityList[i] = myPreCadPeriodicity;
3593 return periodicityList._retn();
3597 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3598 throw (SALOME::SALOME_Exception)
3601 const GEOM::ListOfGO theSourceVertices;
3602 const GEOM::ListOfGO theTargetVertices;
3603 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3607 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3608 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3609 throw (SALOME::SALOME_Exception)
3613 size_t theLength = theSourceVertices.length();
3614 if (theLength != theTargetVertices.length())
3615 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3617 std::vector<GEOM::shape_type> allowedShapeTypes;
3618 allowedShapeTypes.push_back(GEOM::FACE);
3619 allowedShapeTypes.push_back(GEOM::COMPOUND);
3621 string prefix1 = "Source_face_";
3622 CheckShapeTypes(theFace1, allowedShapeTypes);
3623 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3625 string prefix2 = "Target_face_";
3626 CheckShapeTypes(theFace2, allowedShapeTypes);
3627 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3629 string prefix3 = "Source_vertex_";
3630 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3631 theSourceVerticesEntries->length(theLength);
3632 GEOM::GEOM_Object_ptr theVtx_i;
3634 for (size_t ind = 0; ind < theLength; ind++) {
3635 theVtx_i = theSourceVertices[ind];
3636 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3637 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3640 string prefix4 = "Target_vertex_";
3641 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3642 theTargetVerticesEntries->length(theLength);
3643 for (size_t ind = 0; ind < theLength; ind++) {
3644 theVtx_i = theTargetVertices[ind];
3645 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3646 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3649 string theFace2Name = theFace2->GetName();
3651 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3652 theSourceVerticesEntries, theTargetVerticesEntries);
3653 } catch (SALOME_Exception& ex) {
3654 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3659 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3660 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3661 throw (SALOME::SALOME_Exception)
3666 // Convert BLSURFPlugin::TEntryList to vector<string>
3667 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3668 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3669 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3670 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3673 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3676 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3677 theSourceVerticesEntries, theTargetVerticesEntries);
3679 SMESH::TPythonDump pd;
3680 if (!theSourceVerticesEntries.empty())
3682 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3683 pd << listEntriesTxt.c_str();
3687 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3690 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3691 throw (SALOME::SALOME_Exception)
3694 const GEOM::ListOfGO theSourceVertices;
3695 const GEOM::ListOfGO theTargetVertices;
3696 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3699 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3700 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3701 throw (SALOME::SALOME_Exception)
3705 size_t theLength = theSourceVertices.length();
3706 if (theLength != theTargetVertices.length())
3707 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3709 std::vector<GEOM::shape_type> allowedShapeTypes;
3710 allowedShapeTypes.push_back(GEOM::EDGE);
3711 allowedShapeTypes.push_back(GEOM::COMPOUND);
3713 string prefix1 = "Source_edge_";
3714 CheckShapeTypes(theEdge1, allowedShapeTypes);
3715 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3717 string prefix2 = "Target_edge_";
3718 CheckShapeTypes(theEdge2, allowedShapeTypes);
3719 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3721 string prefix3 = "Source_vertex_";
3722 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3723 theSourceVerticesEntries->length(theLength);
3724 GEOM::GEOM_Object_ptr theVtx_i;
3726 for (size_t ind = 0; ind < theLength; ind++) {
3727 theVtx_i = theSourceVertices[ind];
3728 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3729 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3732 string prefix4 = "Target_vertex_";
3733 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3734 theTargetVerticesEntries->length(theLength);
3735 for (size_t ind = 0; ind < theLength; ind++) {
3736 theVtx_i = theTargetVertices[ind];
3737 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3738 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3741 string theEdge2Name = theEdge2->GetName();
3743 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3744 theSourceVerticesEntries, theTargetVerticesEntries);
3745 } catch (SALOME_Exception& ex) {
3746 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3751 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3752 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3753 throw (SALOME::SALOME_Exception)
3758 // Convert BLSURFPlugin::TEntryList to vector<string>
3759 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3760 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3761 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3762 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3765 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3767 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3768 theSourceVerticesEntries, theTargetVerticesEntries);
3770 SMESH::TPythonDump pd;
3771 if (!theSourceVerticesEntries.empty())
3773 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3774 pd << listEntriesTxt.c_str();
3778 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3783 //================================================================================
3785 * \brief Sets the file for export resulting mesh in GMF format
3786 * \param theFileName - full name of the file (.mesh, .meshb)
3788 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3790 //================================================================================
3791 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3792 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3794 bool valueChanged/*, modeChanged*/ = false;
3796 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3797 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3798 if (valueChanged)// or (!valueChanged && modeChanged))
3799 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3800 } catch (const std::exception& ex) {
3801 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3803 if (valueChanged)// or (!valueChanged && modeChanged))
3804 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3807 //================================================================================
3809 * \brief Gets the file name for export resulting mesh in GMF format
3810 * \retval char* - The file name
3812 * Returns the GMF file name
3814 //================================================================================
3815 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3817 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3820 // //================================================================================
3822 // * \brief Gets the file mode for export resulting mesh in GMF format
3823 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3825 // * Returns the GMF file mode
3827 // //================================================================================
3828 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3829 // ASSERT(myBaseImpl);
3830 // return this->GetImpl()->GetGMFFileMode();
3833 //=============================================================================
3835 * BLSURFPlugin_Hypothesis_i::GetImpl
3837 * Get implementation
3839 //=============================================================================
3840 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3841 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3844 //================================================================================
3846 * \brief Verify whether hypothesis supports given entity type
3847 * \param type - dimension (see SMESH::Dimension enumeration)
3848 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3850 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3852 //================================================================================
3853 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3854 return type == SMESH::DIM_2D;
3858 // Obsolete methods - To be removed in V7
3861 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3862 this->SetMinSize(theMinSize);
3864 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3865 return this->GetMinSize();
3867 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3868 this->SetMaxSize(theMaxSize);
3870 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3871 return this->GetMaxSize();
3873 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3874 this->SetMinSize(theMinSize);
3876 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3877 return this->GetMinSize();
3879 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3880 this->SetMaxSize(theMaxSize);
3882 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3883 return this->GetMaxSize();
3885 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3886 this->SetAngleMesh(theValue);
3888 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3889 return this->GetAngleMesh();
3891 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3892 this->SetAngleMesh(theValue);
3894 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3895 return this->GetAngleMesh();
3897 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3898 std::string theValueStr = theValue ? "1" : "0";
3899 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3901 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3902 std::string theValueStr = this->GetOptionValue("respect_geometry");
3903 if (theValueStr.empty() || theValueStr == "respect")
3907 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3908 std::string theValueStr = theValue ? "1" : "0";
3909 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3911 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3912 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3913 if (theValueStr == "1")
3917 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3918 std::ostringstream theValueStr;
3919 theValueStr << theValue;
3920 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3922 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3923 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3925 theValueStr >> result;