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 * DEPRACATED, kept for python script compatibility
368 * TO be removed in Salome 9
370 //=============================================================================
371 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
373 ::BLSURFPlugin_Hypothesis::ElementType theElementType = theValue ?
374 ::BLSURFPlugin_Hypothesis::QuadrangleDominant : ::BLSURFPlugin_Hypothesis::Triangles;
375 this->GetImpl()->SetElementType(theElementType);
376 SMESH::TPythonDump() << _this() << ".SetElementType( " << theElementType << " )";
379 //=============================================================================
381 * BLSURFPlugin_Hypothesis_i::SetElementType
385 //=============================================================================
386 void BLSURFPlugin_Hypothesis_i::SetElementType(CORBA::Long theValue)
388 this->GetImpl()->SetElementType((::BLSURFPlugin_Hypothesis::ElementType) theValue);
389 SMESH::TPythonDump() << _this() << ".SetElementType( " << theValue << " )";
391 //=============================================================================
393 * BLSURFPlugin_Hypothesis_i::GetElementType
397 //=============================================================================
398 CORBA::Long BLSURFPlugin_Hypothesis_i::GetElementType()
400 return this->GetImpl()->GetElementType();
403 //=============================================================================
405 * BLSURFPlugin_Hypothesis_i::SetAngleMesh
409 //=============================================================================
410 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
412 this->GetImpl()->SetAngleMesh(theValue);
413 SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
416 //=============================================================================
418 * BLSURFPlugin_Hypothesis_i::GetAngleMesh
422 //=============================================================================
423 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
425 return this->GetImpl()->GetAngleMesh();
428 //=============================================================================
430 * BLSURFPlugin_Hypothesis_i::SetChordalError
434 //=============================================================================
435 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
437 this->GetImpl()->SetChordalError(theValue);
438 SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
441 //=============================================================================
443 * BLSURFPlugin_Hypothesis_i::GetChordalError
447 //=============================================================================
448 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
450 return this->GetImpl()->GetChordalError();
453 //=============================================================================
455 * BLSURFPlugin_Hypothesis_i::SetAnisotropic
459 //=============================================================================
460 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
462 this->GetImpl()->SetAnisotropic(theValue);
463 std::string theValueStr = theValue ? "True" : "False";
464 SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
467 //=============================================================================
469 * BLSURFPlugin_Hypothesis_i::GetAnisotropic
473 //=============================================================================
474 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
476 return this->GetImpl()->GetAnisotropic();
479 //=============================================================================
481 * BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
483 * Set Anisotropic Ratio
485 //=============================================================================
486 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
488 this->GetImpl()->SetAnisotropicRatio(theValue);
489 SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
492 //=============================================================================
494 * BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
496 * Get Anisotropic Ratio
498 //=============================================================================
499 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
501 return this->GetImpl()->GetAnisotropicRatio();
505 //=============================================================================
507 * BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
511 //=============================================================================
512 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
514 this->GetImpl()->SetRemoveTinyEdges(theValue);
515 std::string theValueStr = theValue ? "True" : "False";
516 SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
519 //=============================================================================
521 * BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
525 //=============================================================================
526 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
528 return this->GetImpl()->GetRemoveTinyEdges();
531 //=============================================================================
533 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
535 * Set Tiny Edge Length
537 //=============================================================================
538 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
540 this->GetImpl()->SetTinyEdgeLength(theValue);
541 SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
544 //=============================================================================
546 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
548 * Get Tiny Edge Length
550 //=============================================================================
551 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
553 return this->GetImpl()->GetTinyEdgeLength();
556 //=============================================================================
558 * BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
562 //=============================================================================
563 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
565 this->GetImpl()->SetOptimiseTinyEdges(theValue);
566 std::string theValueStr = theValue ? "True" : "False";
567 SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
570 //=============================================================================
572 * BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
576 //=============================================================================
577 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
579 return this->GetImpl()->GetOptimiseTinyEdges();
582 //=============================================================================
584 * BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
586 * Set Tiny Edge OptimisationLength
588 //=============================================================================
589 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
591 this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
592 SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
595 //=============================================================================
597 * BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
599 * Get Tiny Edge OptimisationLength
601 //=============================================================================
602 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
604 return this->GetImpl()->GetTinyEdgeOptimisationLength();
607 //=============================================================================
609 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
613 //=============================================================================
614 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
616 this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
617 std::string theValueStr = theValue ? "True" : "False";
618 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
621 //=============================================================================
623 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
627 //=============================================================================
628 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
630 return this->GetImpl()->GetCorrectSurfaceIntersection();
633 //=============================================================================
635 * BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
637 * Set Tiny Edge OptimisationLength
639 //=============================================================================
640 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
642 this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
643 SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
646 //=============================================================================
648 * BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
650 * Get Tiny Edge OptimisationLength
652 //=============================================================================
653 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
655 return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
658 //=============================================================================
660 * BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
664 //=============================================================================
665 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
667 this->GetImpl()->SetBadElementRemoval(theValue);
668 std::string theValueStr = theValue ? "True" : "False";
669 SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
672 //=============================================================================
674 * BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
678 //=============================================================================
679 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
681 return this->GetImpl()->GetBadElementRemoval();
684 //=============================================================================
686 * BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
688 * Set Bad Surface Element Aspect Ratio
690 //=============================================================================
691 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
693 this->GetImpl()->SetBadElementAspectRatio(theValue);
694 SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
697 //=============================================================================
699 * BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
701 * Get Bad Surface Element Aspect Ratio
703 //=============================================================================
704 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
706 return this->GetImpl()->GetBadElementAspectRatio();
709 //=============================================================================
711 * BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
715 //=============================================================================
716 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
718 this->GetImpl()->SetOptimizeMesh(theValue);
719 std::string theValueStr = theValue ? "True" : "False";
720 SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
723 //=============================================================================
725 * BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
729 //=============================================================================
730 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
732 return this->GetImpl()->GetOptimizeMesh();
735 //=============================================================================
737 * BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
741 //=============================================================================
742 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
744 this->GetImpl()->SetQuadraticMesh(theValue);
745 std::string theValueStr = theValue ? "True" : "False";
746 SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
749 //=============================================================================
751 * BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
755 //=============================================================================
756 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
758 return this->GetImpl()->GetQuadraticMesh();
766 * BLSURFPlugin_Hypothesis_i::SetTopology
771 //=============================================================================
772 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
774 this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
775 SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
778 //=============================================================================
780 * BLSURFPlugin_Hypothesis_i::GetTopology
784 //=============================================================================
785 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
787 return this->GetImpl()->GetTopology();
790 //=============================================================================
791 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
793 if (theVal < 0 || theVal > 100)
794 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
795 this->GetImpl()->SetVerbosity(theVal);
796 SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
799 //=============================================================================
801 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
803 return (CORBA::Short) this->GetImpl()->GetVerbosity();
806 //=============================================================================
807 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
809 if ( GetEnforceCadEdgesSize() != toEnforce )
811 this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
812 SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
815 //=============================================================================
816 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
818 return this->GetImpl()->GetEnforceCadEdgesSize();
820 //=============================================================================
822 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
824 if ( GetJacobianRectificationRespectGeometry() != allowRectification )
826 this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
827 SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
830 //=============================================================================
831 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
833 return this->GetImpl()->GetJacobianRectificationRespectGeometry();
835 //=============================================================================
837 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
839 if ( GetJacobianRectification() != allowRectification )
841 this->GetImpl()->SetJacobianRectification(allowRectification);
842 SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
845 //=============================================================================
846 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
848 return this->GetImpl()->GetJacobianRectification();
850 //=============================================================================
852 void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
854 if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
856 this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
857 SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
860 //=============================================================================
861 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
863 return this->GetImpl()->GetUseDeprecatedPatchMesher();
865 //=============================================================================
867 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
869 if ( GetMaxNumberOfPointsPerPatch() != nb )
872 this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
874 } catch (const std::invalid_argument& ex) {
875 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
876 } catch (SALOME_Exception& ex) {
877 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
879 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
882 //=============================================================================
883 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
885 return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
887 //=============================================================================
889 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
891 if ( GetMaxNumberOfThreads() != nb )
894 this->GetImpl()->SetMaxNumberOfThreads(nb);
896 } catch (const std::invalid_argument& ex) {
897 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
898 } catch (SALOME_Exception& ex) {
899 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
901 SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
904 //=============================================================================
905 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
907 return this->GetImpl()->GetMaxNumberOfThreads();
909 //=============================================================================
911 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
913 if ( GetRespectGeometry() != toRespect )
915 this->GetImpl()->SetRespectGeometry(toRespect);
916 SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
919 //=============================================================================
920 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
922 return this->GetImpl()->GetRespectGeometry();
924 //=============================================================================
926 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
928 if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
930 this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
931 SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
934 //=============================================================================
935 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
937 return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
939 //=============================================================================
941 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
943 if ( GetClosedGeometry() != isClosed )
945 this->GetImpl()->SetClosedGeometry(isClosed);
946 SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
949 //=============================================================================
950 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
952 return this->GetImpl()->GetClosedGeometry();
954 //=============================================================================
956 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
958 if ( GetDebug() != isDebug )
960 this->GetImpl()->SetDebug(isDebug);
961 SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
964 //=============================================================================
965 bool BLSURFPlugin_Hypothesis_i::GetDebug()
967 return this->GetImpl()->GetDebug();
969 //=============================================================================
971 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
974 if ( GetImpl()->GetPreCADOptionValue("periodic_tolerance",&isDefault) != SMESH_Comment( tol ))
978 this->GetImpl()->SetPeriodicTolerance(tol);
980 } catch (const std::invalid_argument& ex) {
981 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
982 } catch (SALOME_Exception& ex) {
983 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
985 SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
988 //=============================================================================
989 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
992 return this->GetImpl()->GetPeriodicTolerance();
994 } catch (const std::invalid_argument& ex) {
995 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
996 } catch (SALOME_Exception& ex) {
997 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1001 //=============================================================================
1003 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1005 if ( GetImpl()->GetRequiredEntities() != howToTreat )
1008 this->GetImpl()->SetRequiredEntities(howToTreat);
1010 } catch (const std::invalid_argument& ex) {
1011 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1012 } catch (SALOME_Exception& ex) {
1013 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1015 SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
1018 //=============================================================================
1019 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
1021 return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
1023 //=============================================================================
1025 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
1028 if ( GetImpl()->GetPreCADOptionValue("sewing_tolerance",&isDefault) != SMESH_Comment( tol ))
1032 this->GetImpl()->SetSewingTolerance(tol);
1033 SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1035 } catch (const std::invalid_argument& ex) {
1036 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1037 } catch (SALOME_Exception& ex) {
1038 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1042 //=============================================================================
1043 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1047 return this->GetImpl()->GetSewingTolerance();
1049 } catch (const std::invalid_argument& ex) {
1050 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1051 } catch (SALOME_Exception& ex) {
1052 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1056 //=============================================================================
1058 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1060 if ( GetImpl()->GetTags() != howToTreat )
1063 this->GetImpl()->SetTags(howToTreat);
1065 catch (const std::invalid_argument& ex) {
1066 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1067 } catch (SALOME_Exception& ex) {
1068 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1071 SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1073 //=============================================================================
1074 char* BLSURFPlugin_Hypothesis_i::GetTags()
1076 return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1079 //=============================================================================
1080 void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
1082 ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
1083 SMESH_Comment hplDump;
1085 for ( size_t i = 0; i < patchList.size(); ++i )
1088 BLSURFPlugin::THyperPatch tags = hpl[ i ];
1089 for ( CORBA::ULong j = 0; j < tags.length(); ++j )
1091 patchList[ i ].insert( tags[ j ]);
1092 hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
1094 hplDump << ( i+1 < patchList.size() ? "," : "]");
1096 if ( GetImpl()->GetHyperPatches() != patchList )
1098 GetImpl()->SetHyperPatches( patchList );
1099 SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
1103 //=============================================================================
1104 BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
1106 const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
1107 BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
1108 resHpl->length( hpl.size() );
1110 ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
1111 for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
1113 const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
1114 BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
1115 resHp.length( hp.size() );
1117 ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
1118 for ( int j = 0; tag != hp.end(); ++tag, ++j )
1124 //=============================================================================
1126 * BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1130 //=============================================================================
1131 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1133 this->GetImpl()->SetPreCADMergeEdges(theValue);
1134 std::string theValueStr = theValue ? "True" : "False";
1135 SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1138 //=============================================================================
1140 * BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1144 //=============================================================================
1145 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1147 return this->GetImpl()->GetPreCADMergeEdges();
1150 //=============================================================================
1152 * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1156 //=============================================================================
1157 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1159 this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1160 std::string theValueStr = theValue ? "True" : "False";
1161 SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1164 //=============================================================================
1166 * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1170 //=============================================================================
1171 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1173 return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1176 //=============================================================================
1178 * BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1182 //=============================================================================
1183 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1185 this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1186 std::string theValueStr = theValue ? "True" : "False";
1187 SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1190 //=============================================================================
1192 * BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1196 //=============================================================================
1197 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1199 return this->GetImpl()->GetPreCADProcess3DTopology();
1202 //=============================================================================
1204 * BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1208 //=============================================================================
1209 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1211 this->GetImpl()->SetPreCADDiscardInput(theValue);
1212 std::string theValueStr = theValue ? "True" : "False";
1213 SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1216 //=============================================================================
1218 * BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1222 //=============================================================================
1223 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1225 return this->GetImpl()->GetPreCADDiscardInput();
1229 //=============================================================================
1231 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1232 throw (SALOME::SALOME_Exception) {
1235 std::string name( optionName );
1236 if ( !optionValue || !optionValue[0] )
1237 UnsetOption( optionName );
1239 // basic options (visible in Advanced table)
1241 else if ( name == "enforce_cad_edge_sizes" )
1242 SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1244 else if ( name == "jacobian_rectification_respect_geometry" )
1245 SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1247 else if ( name == "max_number_of_points_per_patch" )
1248 SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1250 else if ( name == "max_number_of_threads" )
1251 SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
1253 else if ( name == "rectify_jacobian" )
1254 SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1256 else if ( name == "use_deprecated_patch_mesher" )
1257 SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
1259 else if ( name == "respect_geometry" )
1260 SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1262 else if ( name == "tiny_edge_avoid_surface_intersections" )
1263 SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1265 else if ( name == "closed_geometry" )
1266 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1268 else if ( name == "debug" )
1269 SetDebug( GetImpl()->ToBool( optionValue ));
1271 else if ( name == "discard_input_topology" )
1272 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1274 else if ( name == "merge_edges" )
1275 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1277 else if ( name == "periodic_tolerance" )
1278 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1280 else if ( name == "remove_duplicate_cad_faces" )
1281 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1283 else if ( name == "required_entities" )
1284 SetRequiredEntities( optionValue );
1286 else if ( name == "sewing_tolerance" )
1287 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1289 else if ( name == "tags" )
1290 SetTags( optionValue );
1292 // other basic options with specific methods
1294 else if ( name == "correct_surface_intersections" )
1295 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1297 else if ( name == "optimise_tiny_edges" )
1298 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1300 else if ( name == "surface_intersections_processing_max_cost" )
1301 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1303 else if ( name == "volume_gradation" )
1304 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1306 else if ( name == "tiny_edge_optimisation_length" )
1307 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1309 // advanced options (for backward compatibility)
1311 else if ( name == "create_tag_on_collision" ||
1312 name == "tiny_edge_respect_geometry" )
1313 AddOption( optionName, optionValue );
1317 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1318 this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1321 this->GetImpl()->SetOptionValue(optionName, optionValue);
1322 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1325 } catch (const std::invalid_argument& ex) {
1326 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1327 } catch (SALOME_Exception& ex) {
1328 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1332 //=============================================================================
1334 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1335 throw (SALOME::SALOME_Exception) {
1337 bool valueChanged = false;
1339 std::string name( optionName );
1340 if ( !optionValue || !optionValue[0] )
1341 UnsetOption( optionName );
1343 else if ( name == "closed_geometry" )
1344 SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1346 else if ( name == "debug" )
1347 SetDebug( GetImpl()->ToBool( optionValue ));
1349 else if ( name == "discard_input_topology" )
1350 SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1352 else if ( name == "merge_edges" )
1353 SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1355 else if ( name == "periodic_tolerance" )
1356 SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1358 else if ( name == "remove_duplicate_cad_faces" )
1359 SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1361 else if ( name == "required_entities" )
1362 SetRequiredEntities( optionValue );
1364 else if ( name == "sewing_tolerance" )
1365 SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1367 else if ( name == "tags" )
1368 SetTags( optionValue );
1370 // other basic options with specific methods
1372 else if ( name == "correct_surface_intersections" )
1373 SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1375 else if ( name == "optimise_tiny_edges" )
1376 SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1378 else if ( name == "surface_intersections_processing_max_cost" )
1379 SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1381 else if ( name == "volume_gradation" )
1382 SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1384 else if ( name == "tiny_edge_optimisation_length" )
1385 SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1387 else if ( name == "process_3d_topology" )
1388 SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1390 // advanced options (for backward compatibility)
1392 else if ( name == "create_tag_on_collision" ||
1393 name == "tiny_edge_respect_geometry" ||
1394 name == "remove_tiny_edges" ||
1395 name == "tiny_edge_length")
1396 AddPreCADOption( optionName, optionValue );
1399 valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1401 this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1403 } catch (const std::invalid_argument& ex) {
1404 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1405 } catch (SALOME_Exception& ex) {
1406 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1409 SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1412 //=============================================================================
1414 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1418 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1419 } catch (const std::invalid_argument& ex) {
1420 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1421 } catch (SALOME_Exception& ex) {
1422 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1427 //=============================================================================
1429 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1433 return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1434 } catch (const std::invalid_argument& ex) {
1435 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1436 } catch (SALOME_Exception& ex) {
1437 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1442 //=============================================================================
1444 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1446 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1448 this->GetImpl()->ClearOption(optionName);
1449 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1453 //=============================================================================
1455 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1457 if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1459 this->GetImpl()->ClearPreCADOption(optionName);
1460 SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1464 //=============================================================================
1466 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1468 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1470 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1471 result->length(opts.size());
1475 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1476 for (; opIt != opts.end(); ++opIt, ++i) {
1477 string name_value_type = opIt->first;
1478 if (!opIt->second.empty()) {
1479 name_value_type += ":";
1480 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1481 name_value_type += isDefault ? ":0" : ":1";
1483 result[i] = CORBA::string_dup(name_value_type.c_str());
1486 return result._retn();
1489 //=============================================================================
1491 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1493 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1495 const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1496 result->length(opts.size());
1500 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1501 for (; opIt != opts.end(); ++opIt, ++i) {
1502 string name_value_type = opIt->first;
1503 if (!opIt->second.empty()) {
1504 name_value_type += ":";
1505 name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1506 name_value_type += isDefault ? ":0" : ":1";
1508 result[i] = CORBA::string_dup(name_value_type.c_str());
1510 return result._retn();
1513 //=============================================================================
1515 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1517 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1519 const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1520 result->length(custom_opts.size());
1523 ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1524 for (; opIt != custom_opts.end(); ++opIt, ++i) {
1525 string name_value_type = opIt->first;
1526 if (!opIt->second.empty()) {
1527 name_value_type += ":";
1528 name_value_type += opIt->second;
1529 name_value_type += ":1"; // user defined
1531 result[i] = CORBA::string_dup(name_value_type.c_str());
1533 return result._retn();
1536 //=============================================================================
1538 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1539 throw (SALOME::SALOME_Exception) {
1541 for (CORBA::ULong i = 0; i < options.length(); ++i) {
1542 string name_value_type = options[i].in();
1543 if(name_value_type.empty())
1545 size_t colonPos = name_value_type.find(':');
1547 if (colonPos == string::npos) // ':' not found
1548 name = name_value_type;
1550 name = name_value_type.substr(0, colonPos);
1551 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1552 string value_type = name_value_type.substr(colonPos + 1);
1553 colonPos = value_type.find(':');
1554 value = value_type.substr(0, colonPos);
1555 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1556 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1560 SetOptionValue(name.c_str(), value.c_str());
1564 //=============================================================================
1566 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1567 throw (SALOME::SALOME_Exception) {
1569 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1570 string name_value_type = options[i].in();
1571 if(name_value_type.empty())
1573 size_t colonPos = name_value_type.find(':');
1575 if (colonPos == string::npos) // ':' not found
1576 name = name_value_type;
1578 name = name_value_type.substr(0, colonPos);
1579 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1580 string value_type = name_value_type.substr(colonPos + 1);
1581 colonPos = value_type.find(':');
1582 value = value_type.substr(0, colonPos);
1583 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1584 if ( value_type.substr(colonPos + 1) == "0" ) // is default
1588 SetPreCADOptionValue(name.c_str(), value.c_str());
1592 //=============================================================================
1594 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1596 SMESH::TPythonDump dump;
1598 string optionsAndValues;
1599 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1600 string name_value_type = options[i].in();
1601 if(name_value_type.empty())
1603 size_t colonPos = name_value_type.find(':');
1605 if (colonPos == string::npos) // ':' not found
1606 name = name_value_type;
1608 name = name_value_type.substr(0, colonPos);
1609 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1610 string value_type = name_value_type.substr(colonPos + 1);
1611 colonPos = value_type.find(':');
1612 value = value_type.substr(0, colonPos);
1615 AddOption(name.c_str(), value.c_str());
1617 optionsAndValues += name + " " + value + " ";
1620 if ( !optionsAndValues.empty() )
1621 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1624 //=============================================================================
1626 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1627 throw (SALOME::SALOME_Exception)
1629 if ( !optionsAndValues ) return;
1631 SMESH::TPythonDump dump;
1633 std::istringstream strm( optionsAndValues );
1634 std::istream_iterator<std::string> sIt( strm ), sEnd;
1635 while ( sIt != sEnd )
1637 std::string option = *sIt;
1638 if ( ++sIt != sEnd )
1640 std::string value = *sIt;
1642 AddOption( option.c_str(), value.c_str() );
1646 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1649 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1652 //=============================================================================
1654 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1657 bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1659 this->GetImpl()->AddOption(optionName, optionValue);
1660 SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1664 //=============================================================================
1666 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1669 bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1671 this->GetImpl()->AddPreCADOption(optionName, optionValue);
1672 SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1676 //=============================================================================
1678 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1681 return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1684 //=============================================================================
1686 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1689 return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1692 //=============================================================================
1694 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1695 throw (SALOME::SALOME_Exception) {
1697 if ( !entry || !entry[0] )
1698 THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1699 bool valueChanged = false;
1701 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1703 this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1704 } catch (const std::invalid_argument& ex) {
1705 SALOME::ExceptionStruct ExDescription;
1706 ExDescription.text = ex.what();
1707 ExDescription.type = SALOME::BAD_PARAM;
1708 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1709 ExDescription.lineNumber = 0;
1710 throw SALOME::SALOME_Exception(ExDescription);
1711 } catch (SALOME_Exception& ex) {
1712 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1715 SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1718 //=============================================================================
1720 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1721 throw (SALOME::SALOME_Exception) {
1723 bool valueChanged = false;
1724 std::ostringstream sizeMapFunction;
1725 switch (shapeType) {
1726 case GEOM::FACE: sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1727 case GEOM::EDGE: sizeMapFunction << "def f(t): return " << sizeMap ; break;
1728 case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1732 valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1734 this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1735 } catch (const std::invalid_argument& ex) {
1736 SALOME::ExceptionStruct ExDescription;
1737 ExDescription.text = ex.what();
1738 ExDescription.type = SALOME::BAD_PARAM;
1739 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1740 ExDescription.lineNumber = 0;
1741 throw SALOME::SALOME_Exception(ExDescription);
1742 } catch (SALOME_Exception& ex) {
1743 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1746 SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1749 //=============================================================================
1751 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1752 throw (SALOME::SALOME_Exception) {
1754 bool valueChanged = false;
1756 valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1757 if ( valueChanged ) {
1758 boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1759 if (!boost::regex_match(string(attractor), re))
1760 throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1761 this->GetImpl()->SetAttractorEntry(entry, attractor);
1763 } catch (const std::invalid_argument& ex) {
1764 SALOME::ExceptionStruct ExDescription;
1765 ExDescription.text = ex.what();
1766 ExDescription.type = SALOME::BAD_PARAM;
1767 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1768 ExDescription.lineNumber = 0;
1769 throw SALOME::SALOME_Exception(ExDescription);
1770 } catch (SALOME_Exception& ex) {
1771 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1774 SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1777 //=============================================================================
1779 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
1780 throw (SALOME::SALOME_Exception)
1783 //bool valueChanged = false;
1785 this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1787 catch (const std::invalid_argument& ex) {
1788 SALOME::ExceptionStruct ExDescription;
1789 ExDescription.text = ex.what();
1790 ExDescription.type = SALOME::BAD_PARAM;
1791 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1792 ExDescription.lineNumber = 0;
1793 throw SALOME::SALOME_Exception(ExDescription);
1794 } catch (SALOME_Exception& ex) {
1795 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1797 //if ( valueChanged )
1798 SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1799 << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1802 //=============================================================================
1804 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1807 return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1808 } catch (const std::invalid_argument& ex) {
1809 SALOME::ExceptionStruct ExDescription;
1810 ExDescription.text = ex.what();
1811 ExDescription.type = SALOME::BAD_PARAM;
1812 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1813 ExDescription.lineNumber = 0;
1814 throw SALOME::SALOME_Exception(ExDescription);
1815 } catch (SALOME_Exception& ex) {
1816 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1821 //=============================================================================
1823 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1826 return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1827 } catch (const std::invalid_argument& ex) {
1828 SALOME::ExceptionStruct ExDescription;
1829 ExDescription.text = ex.what();
1830 ExDescription.type = SALOME::BAD_PARAM;
1831 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1832 ExDescription.lineNumber = 0;
1833 throw SALOME::SALOME_Exception(ExDescription);
1834 } catch (SALOME_Exception& ex) {
1835 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1840 // //=============================================================================
1842 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1843 // // A finir pour le dump
1844 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1845 // throw (SALOME::SALOME_Exception)
1847 // ASSERT(myBaseImpl);
1849 // return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1851 // catch (const std::invalid_argument& ex) {
1852 // SALOME::ExceptionStruct ExDescription;
1853 // ExDescription.text = ex.what();
1854 // ExDescription.type = SALOME::BAD_PARAM;
1855 // ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1856 // ExDescription.lineNumber = 0;
1857 // throw SALOME::SALOME_Exception(ExDescription);
1859 // catch (SALOME_Exception& ex) {
1860 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1865 //=============================================================================
1867 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1869 this->GetImpl()->ClearEntry(entry);
1870 // SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1873 //=============================================================================
1875 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1877 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1879 const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1880 result->length(sizeMaps.size());
1882 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1883 for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1884 string entry_sizemap = smIt->first;
1885 if (!smIt->second.empty()) {
1886 entry_sizemap += "|";
1887 entry_sizemap += smIt->second;
1889 result[i] = CORBA::string_dup(entry_sizemap.c_str());
1891 return result._retn();
1894 //=============================================================================
1896 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1898 BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1900 const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1901 result->length(attractors.size());
1903 ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1904 for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1905 string entry_attractor = atIt->first;
1906 if (!atIt->second.empty()) {
1907 entry_attractor += "|";
1908 entry_attractor += atIt->second;
1910 result[i] = CORBA::string_dup(entry_attractor.c_str());
1912 return result._retn();
1915 //=============================================================================
1917 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1920 BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1922 const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1923 result->length( attractors.size() );
1925 ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1926 for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1927 string faceEntry = atIt->first;
1929 double startSize, endSize, infDist, constDist;
1930 if ( !atIt->second->Empty() ) {
1931 attEntry = atIt->second->GetAttractorEntry();
1932 std::vector<double> params = atIt->second->GetParameters();
1933 startSize = params[0];
1934 endSize = params[1];
1935 infDist = params[2];
1936 constDist = params[3];
1938 result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1939 result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1940 result[i].startSize = startSize;
1941 result[i].endSize = endSize;
1942 result[i].infDist = infDist;
1943 result[i].constDist = constDist;
1945 return result._retn();
1948 //=============================================================================
1950 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1951 throw (SALOME::SALOME_Exception) {
1953 for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1954 string entry_sizemap = sizeMaps[i].in();
1955 size_t colonPos = entry_sizemap.find('|');
1956 string entry, sizemap;
1957 if (colonPos == string::npos) // '|' separator not found
1958 entry = entry_sizemap;
1960 entry = entry_sizemap.substr(0, colonPos);
1961 if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1962 sizemap = entry_sizemap.substr(colonPos + 1);
1964 this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1968 //=============================================================================
1970 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1972 this->GetImpl()->ClearSizeMaps();
1975 //=============================================================================
1977 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1978 throw (SALOME::SALOME_Exception)
1982 entry = GeomObj->GetStudyEntry();
1983 SetSizeMapEntry(entry.c_str(), sizeMap);
1986 //=============================================================================
1988 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1990 string entry = GeomObj->GetStudyEntry();
1991 GEOM::shape_type shapeType = GeomObj->GetShapeType();
1992 if (shapeType == GEOM::COMPOUND)
1993 shapeType = GeomObj->GetMaxShapeType();
1994 SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1997 //=============================================================================
1998 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2001 entry = GeomObj->GetStudyEntry();
2002 UnsetEntry(entry.c_str());
2003 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2006 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2009 entry = GeomObj->GetStudyEntry();
2010 SetAttractorEntry(entry.c_str(), attractor);
2013 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2016 entry = GeomObj->GetStudyEntry();
2017 UnsetEntry(entry.c_str());
2018 SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2021 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)
2024 string theFaceEntry;
2026 theFaceEntry = theFace->GetStudyEntry();
2027 theAttEntry = theAttractor->GetStudyEntry();
2029 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2030 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2033 if (theFaceEntry.empty()) {
2035 aName += theFace->GetEntry();
2036 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2037 if (!theSFace->_is_nil())
2038 theFaceEntry = theSFace->GetID();
2040 if (theFaceEntry.empty())
2041 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2043 if (theAttEntry.empty()) {
2044 if (theAttractor->GetShapeType() == GEOM::VERTEX)
2046 if (theAttractor->GetShapeType() == GEOM::EDGE)
2048 if (theAttractor->GetShapeType() == GEOM::WIRE)
2050 if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2051 aName = "Compound_";
2052 aName += theAttractor->GetEntry();
2053 SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2054 if (!theSAtt->_is_nil())
2055 theAttEntry = theSAtt->GetID();
2057 if (theAttEntry.empty())
2058 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2060 TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2061 TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2062 SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2065 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2066 GEOM::GEOM_Object_ptr theAttractor)
2069 CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2070 CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2072 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2073 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2076 // if (theFaceEntry.empty()) {
2078 // aName += theFace->GetEntry();
2079 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2080 // if (!theSFace->_is_nil())
2081 // theFaceEntry = theSFace->GetID();
2083 if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2084 !theAttrEntry.in() || !theAttrEntry.in()[0] )
2085 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2087 GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2088 SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2089 << theFace << ", " << theAttractor << " )";
2092 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2093 const char* attractorEntry)
2095 GetImpl()->ClearEntry( faceEntry, attractorEntry );
2096 SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2097 << faceEntry << "', '" << attractorEntry << "' )";
2102 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2105 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2108 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
2111 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
2114 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2117 this->GetImpl()->UnsetCustomSizeMap(entry);
2118 SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2122 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2127 // ///////////////////////
2128 // // ENFORCED VERTICES //
2129 // ///////////////////////
2133 * Returns the list of enforced vertices for a given Face entry
2134 * @return A map of Face entry / List of enforced vertices
2137 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2140 BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2142 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2143 this->GetImpl()->_GetAllEnforcedVerticesByFace();
2144 resultMap->length(faceEntryEnfVertexListMap.size());
2146 ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2147 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2148 for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2149 BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2150 new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2151 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2153 _enfVertexList = it_entry->second;
2154 BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2155 enfVertexList->length(_enfVertexList.size());
2157 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2158 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2159 for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2160 currentEnfVertex = (*it_enfVertex);
2162 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2165 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2168 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2171 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2172 coords->length(currentEnfVertex->coords.size());
2173 for (CORBA::ULong i=0;i<coords->length();i++)
2174 coords[i] = currentEnfVertex->coords[i];
2175 enfVertex->coords = coords;
2178 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2181 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2182 faceEntryList->length(currentEnfVertex->faceEntries.size());
2183 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2184 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2185 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2186 enfVertex->faceEntries = faceEntryList;
2189 msg << "Enforced vertex: \n"
2190 << "Name: " << enfVertex->name << "\n";
2191 if (coords->length())
2192 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2193 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2194 << "Group Name: " << enfVertex->grpName;
2196 enfVertexList[j] = enfVertex;
2198 mapElement->enfVertexList = enfVertexList;
2200 resultMap[i] = mapElement;
2203 return resultMap._retn();
2207 * Returns the list of all enforced vertices
2208 * @return a list of enforced vertices
2211 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2213 BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2214 const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2215 resultMap->length(enfVertexList.size());
2217 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2218 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2219 for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2220 currentEnfVertex = (*evlIt);
2221 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2223 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2225 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2227 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2228 coords->length(currentEnfVertex->coords.size());
2229 for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2230 coords[ind] = currentEnfVertex->coords[ind];
2231 enfVertex->coords = coords;
2233 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2235 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2236 faceEntryList->length(currentEnfVertex->faceEntries.size());
2237 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2238 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2239 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2240 enfVertex->faceEntries = faceEntryList;
2243 msg << "Enforced vertex: \n"
2244 << "Name: " << enfVertex->name << "\n";
2245 if (coords->length())
2246 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2247 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2248 << "Group Name: " << enfVertex->grpName;
2250 resultMap[i] = enfVertex;
2252 return resultMap._retn();
2257 * Returns the list of enforced vertices coords for a given Face entry.
2258 * They are the coords of the "manual" enforced vertices.
2259 * @return A map of Face entry / List of enforced vertices coords
2262 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2265 BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2267 const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2268 resultMap->length(entryCoordsListMap.size());
2270 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2271 ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2272 for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2273 BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2274 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2276 _coordsList = it_entry->second;
2277 BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2278 coordsList->length(_coordsList.size());
2280 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2281 for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2282 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2283 coords->length((*it_coords).size());
2284 for (CORBA::ULong i=0;i<coords->length();i++)
2285 coords[i] = (*it_coords)[i];
2286 coordsList[j] = coords;
2288 mapElement->coordsList = coordsList;
2290 resultMap[i] = mapElement;
2293 return resultMap._retn();
2297 * Returns a map of enforced vertices coords / enforced vertex.
2298 * They are the coords of the "manual" enforced vertices.
2300 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2303 BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2304 const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2305 this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2306 resultMap->length(coordsEnfVertexMap.size());
2308 ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2309 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2310 for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2311 currentEnfVertex = (it_coords->second);
2312 BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2313 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2314 coords->length(it_coords->first.size());
2315 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2316 coords[ind] = it_coords->first[ind];
2317 mapElement->coords = coords;
2319 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2321 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2323 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2325 BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2326 coords2->length(currentEnfVertex->coords.size());
2327 for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2328 coords2[ind] = currentEnfVertex->coords[ind];
2329 enfVertex->coords = coords2;
2331 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2333 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2334 faceEntryList->length(currentEnfVertex->faceEntries.size());
2335 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2336 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2337 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2338 enfVertex->faceEntries = faceEntryList;
2340 mapElement->enfVertex = enfVertex;
2342 msg << "Enforced vertex: \n"
2343 << "Name: " << enfVertex->name << "\n";
2344 if (coords->length())
2345 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2346 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2347 << "Group Name: " << enfVertex->grpName;
2349 resultMap[i] = mapElement;
2351 return resultMap._retn();
2355 * Returns the list of enforced vertices entries for a given Face entry.
2356 * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2357 * @return A map of Face entry / List of enforced vertices geom entries
2360 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2363 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2365 const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2366 this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2367 resultMap->length(entryEnfVertexEntryListMap.size());
2369 ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2370 ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2371 entryEnfVertexEntryListMap.begin();
2372 for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2373 BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2374 new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2375 mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2377 _enfVertexEntryList = it_entry->second;
2378 BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2379 enfVertexEntryList->length(_enfVertexEntryList.size());
2381 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2382 for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2383 enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2385 mapElement->enfVertexEntryList = enfVertexEntryList;
2387 resultMap[i] = mapElement;
2390 return resultMap._retn();
2394 * Returns a map of enforced vertices geom entry / enforced vertex.
2395 * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2397 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2400 BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2401 const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2402 this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2403 resultMap->length(enfVertexEntryEnfVertexMap.size());
2405 ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2406 ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2407 for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2408 currentEnfVertex = it_enfVertexEntry->second;
2409 BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2410 mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2412 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2414 enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2416 enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2418 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2419 coords->length(currentEnfVertex->coords.size());
2420 for (CORBA::ULong ind=0;ind<coords->length();ind++)
2421 coords[ind] = currentEnfVertex->coords[ind];
2422 enfVertex->coords = coords;
2424 enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2426 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2427 faceEntryList->length(currentEnfVertex->faceEntries.size());
2428 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2429 for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2430 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2431 enfVertex->faceEntries = faceEntryList;
2434 msg << "Enforced vertex: \n"
2435 << "Name: " << enfVertex->name << "\n";
2436 if (coords->length())
2437 msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2438 msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2439 << "Group Name: " << enfVertex->grpName;
2441 mapElement->enfVertex = enfVertex;
2442 resultMap[i] = mapElement;
2444 return resultMap._retn();
2448 * Erase all enforced vertices
2450 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2452 this->GetImpl()->ClearAllEnforcedVertices();
2453 SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2457 * Set/get/unset an enforced vertex on face - OBSOLETE
2459 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2460 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2463 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2464 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2467 string theFaceEntry = theFace->GetStudyEntry();
2469 if (theFaceEntry.empty()) {
2470 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2471 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2473 if (theFace->GetShapeType() == GEOM::FACE)
2475 if (theFace->GetShapeType() == GEOM::COMPOUND)
2476 aName = "Compound_";
2477 aName += theFace->GetEntry();
2478 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2479 if (!theSFace->_is_nil())
2480 theFaceEntry = theSFace->GetID();
2482 if (theFaceEntry.empty())
2483 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2485 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2486 } catch (SALOME_Exception& ex) {
2487 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2492 * Set/get/unset an enforced vertex with name on face
2494 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2495 CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2498 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2499 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2502 string theFaceEntry = theFace->GetStudyEntry();
2504 if (theFaceEntry.empty()) {
2505 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2506 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2508 if (theFace->GetShapeType() == GEOM::FACE)
2510 if (theFace->GetShapeType() == GEOM::COMPOUND)
2511 aName = "Compound_";
2512 aName += theFace->GetEntry();
2513 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2514 if (!theSFace->_is_nil())
2515 theFaceEntry = theSFace->GetID();
2517 if (theFaceEntry.empty())
2518 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2521 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2522 } catch (SALOME_Exception& ex) {
2523 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2528 * Set/get/unset an enforced vertex with geom object on face
2530 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2531 throw (SALOME::SALOME_Exception) {
2534 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2535 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2538 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2539 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2542 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2543 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2544 // if (CORBA::is_nil(measureOp))
2547 // CORBA::Double x, y, z;
2549 // measureOp->PointCoordinates(theVertex, x, y, z);
2551 string theFaceEntry = theFace->GetStudyEntry();
2552 string theVertexEntry = theVertex->GetStudyEntry();
2554 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2555 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2558 if (theFaceEntry.empty()) {
2559 if (theFace->GetShapeType() == GEOM::FACE)
2561 if (theFace->GetShapeType() == GEOM::COMPOUND)
2562 aName = "Compound_";
2563 aName += theFace->GetEntry();
2564 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2565 if (!theSFace->_is_nil())
2566 theFaceEntry = theSFace->GetID();
2568 if (theFaceEntry.empty())
2569 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2571 if (theVertexEntry.empty()) {
2572 if (theVertex->GetShapeType() == GEOM::VERTEX)
2574 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2575 aName = "Compound_";
2576 aName += theVertex->GetEntry();
2577 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2578 if (!theSVertex->_is_nil())
2579 theVertexEntry = theSVertex->GetID();
2581 if (theVertexEntry.empty())
2582 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2584 string theVertexName = theVertex->GetName();
2586 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2587 } catch (SALOME_Exception& ex) {
2588 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2593 * Set an enforced vertex with group name on face
2595 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2596 throw (SALOME::SALOME_Exception)
2600 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2601 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2604 string theFaceEntry = theFace->GetStudyEntry();
2606 if (theFaceEntry.empty()) {
2607 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2608 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2610 if (theFace->GetShapeType() == GEOM::FACE)
2612 if (theFace->GetShapeType() == GEOM::COMPOUND)
2613 aName = "Compound_";
2614 aName += theFace->GetEntry();
2615 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2616 if (!theSFace->_is_nil())
2617 theFaceEntry = theSFace->GetID();
2619 if (theFaceEntry.empty())
2620 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2622 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2623 } catch (SALOME_Exception& ex) {
2624 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2629 * Set an enforced vertex with name and group name on face
2631 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
2632 const char* theVertexName, const char* theGroupName)
2633 throw (SALOME::SALOME_Exception)
2637 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2638 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2641 string theFaceEntry = theFace->GetStudyEntry();
2643 if (theFaceEntry.empty()) {
2644 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2645 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2647 if (theFace->GetShapeType() == GEOM::FACE)
2649 if (theFace->GetShapeType() == GEOM::COMPOUND)
2650 aName = "Compound_";
2651 aName += theFace->GetEntry();
2652 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2653 if (!theSFace->_is_nil())
2654 theFaceEntry = theSFace->GetID();
2656 if (theFaceEntry.empty())
2657 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2659 return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2660 } catch (SALOME_Exception& ex) {
2661 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2666 * Set an enforced vertex with geom entry and group name on face
2668 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2669 throw (SALOME::SALOME_Exception)
2673 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2674 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2677 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2678 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2681 string theFaceEntry = theFace->GetStudyEntry();
2682 string theVertexEntry = theVertex->GetStudyEntry();
2684 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2685 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2688 if (theFaceEntry.empty()) {
2689 if (theFace->GetShapeType() == GEOM::FACE)
2691 if (theFace->GetShapeType() == GEOM::COMPOUND)
2692 aName = "Compound_";
2693 aName += theFace->GetEntry();
2694 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2695 if (!theSFace->_is_nil())
2696 theFaceEntry = theSFace->GetID();
2698 if (theFaceEntry.empty())
2699 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2701 if (theVertexEntry.empty()) {
2702 if (theVertex->GetShapeType() == GEOM::VERTEX)
2704 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2705 aName = "Compound_";
2706 aName += theVertex->GetEntry();
2707 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2708 if (!theSVertex->_is_nil())
2709 theVertexEntry = theSVertex->GetID();
2711 if (theVertexEntry.empty())
2712 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2714 string theVertexName = theVertex->GetName();
2716 return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2717 } catch (SALOME_Exception& ex) {
2718 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2722 //Enable internal enforced vertices on specific face if requested by user
2724 // * Are internal enforced vertices used for a face ?
2726 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2727 // throw (SALOME::SALOME_Exception) {
2728 // ASSERT(myBaseImpl);
2730 // if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2731 // THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2734 // string theFaceEntry = theFace->GetStudyEntry();
2736 // if (theFaceEntry.empty()) {
2737 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2738 // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2740 // if (theFace->GetShapeType() == GEOM::FACE)
2742 // if (theFace->GetShapeType() == GEOM::COMPOUND)
2743 // aName = "Compound_";
2744 // aName += theFace->GetEntry();
2745 // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2746 // if (!theSFace->_is_nil())
2747 // theFaceEntry = theSFace->GetID();
2749 // if (theFaceEntry.empty())
2750 // THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2753 // return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2754 // } catch (SALOME_Exception& ex) {
2755 // THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2760 * Get the list of all enforced vertices
2762 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2763 throw (SALOME::SALOME_Exception) {
2766 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2767 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2770 string theFaceEntry = theFace->GetStudyEntry();
2772 if (theFaceEntry.empty()) {
2773 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2774 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2776 if (theFace->GetShapeType() == GEOM::FACE)
2778 if (theFace->GetShapeType() == GEOM::COMPOUND)
2779 aName = "Compound_";
2780 aName += theFace->GetEntry();
2781 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2782 if (!theSFace->_is_nil())
2783 theFaceEntry = theSFace->GetID();
2785 if (theFaceEntry.empty())
2786 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2789 return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2790 } catch (SALOME_Exception& ex) {
2791 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2795 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2796 CORBA::Double z) throw (SALOME::SALOME_Exception) {
2799 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2800 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2803 string theFaceEntry = theFace->GetStudyEntry();
2805 if (theFaceEntry.empty()) {
2806 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2807 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2809 if (theFace->GetShapeType() == GEOM::FACE)
2811 if (theFace->GetShapeType() == GEOM::COMPOUND)
2812 aName = "Compound_";
2813 aName += theFace->GetEntry();
2814 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2815 if (!theSFace->_is_nil())
2816 theFaceEntry = theSFace->GetID();
2818 if (theFaceEntry.empty())
2819 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2822 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2823 } catch (SALOME_Exception& ex) {
2824 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2828 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2829 throw (SALOME::SALOME_Exception) {
2832 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2833 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2835 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2836 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2839 // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2840 // GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2841 // if (CORBA::is_nil(measureOp))
2844 // CORBA::Double x, y, z;
2846 // measureOp->PointCoordinates(theVertex, x, y, z);
2848 std::string theFaceEntry = theFace->GetStudyEntry();
2849 std::string theVertexEntry = theVertex->GetStudyEntry();
2851 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2852 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2855 if (theFaceEntry.empty()) {
2856 if (theFace->GetShapeType() == GEOM::FACE)
2858 if (theFace->GetShapeType() == GEOM::COMPOUND)
2859 aName = "Compound_";
2860 aName += theFace->GetEntry();
2861 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2862 if (!theSFace->_is_nil())
2863 theFaceEntry = theSFace->GetID();
2865 if (theFaceEntry.empty())
2866 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2868 if (theVertexEntry.empty()) {
2869 if (theVertex->GetShapeType() == GEOM::VERTEX)
2871 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2872 aName = "Compound_";
2873 aName += theVertex->GetEntry();
2874 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2875 if (!theSVertex->_is_nil())
2876 theVertexEntry = theSVertex->GetID();
2878 if (theVertexEntry.empty())
2879 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2883 return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2884 } catch (SALOME_Exception& ex) {
2885 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2889 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2892 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2893 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2896 string theFaceEntry = theFace->GetStudyEntry();
2898 if (theFaceEntry.empty()) {
2899 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2900 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2902 if (theFace->GetShapeType() == GEOM::FACE)
2904 if (theFace->GetShapeType() == GEOM::COMPOUND)
2905 aName = "Compound_";
2906 aName += theFace->GetEntry();
2907 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2908 if (!theSFace->_is_nil())
2909 theFaceEntry = theSFace->GetID();
2911 if (theFaceEntry.empty())
2912 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2916 return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2917 } catch (SALOME_Exception& ex) {
2918 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2923 * Set/get/unset an enforced vertex on face - NEW (no face)
2925 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
2930 return SetEnforcedVertexEntry("", x, y, z);
2931 } catch (SALOME_Exception& ex) {
2932 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2937 * Set/get/unset an enforced vertex with name on face
2939 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
2942 return SetEnforcedVertexEntry("", x, y, z, theVertexName);
2943 } catch (SALOME_Exception& ex) {
2944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2949 * Set/get/unset an enforced vertex with geom object on face
2951 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
2952 throw (SALOME::SALOME_Exception)
2954 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2955 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2957 string theVertexEntry = theVertex->GetStudyEntry();
2959 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2960 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2963 if (theVertexEntry.empty()) {
2964 if (theVertex->GetShapeType() == GEOM::VERTEX)
2966 if (theVertex->GetShapeType() == GEOM::COMPOUND)
2967 aName = "Compound_";
2968 aName += theVertex->GetEntry();
2969 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2970 if (!theSVertex->_is_nil())
2971 theVertexEntry = theSVertex->GetID();
2973 if (theVertexEntry.empty())
2974 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2976 string theVertexName = theVertex->GetName();
2978 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2979 } catch (SALOME_Exception& ex) {
2980 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2985 * Set an enforced vertex with group name on face
2987 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2988 throw (SALOME::SALOME_Exception)
2993 return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
2994 } catch (SALOME_Exception& ex) {
2995 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3000 * Set an enforced vertex with name and group name on face
3002 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
3003 const char* theVertexName, const char* theGroupName)
3004 throw (SALOME::SALOME_Exception)
3009 return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3010 } catch (SALOME_Exception& ex) {
3011 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3016 * Set an enforced vertex with geom entry and group name on face
3018 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3019 throw (SALOME::SALOME_Exception)
3021 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3022 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3025 string theVertexEntry = theVertex->GetStudyEntry();
3027 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3028 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3031 if (theVertexEntry.empty()) {
3032 if (theVertex->GetShapeType() == GEOM::VERTEX)
3034 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3035 aName = "Compound_";
3036 aName += theVertex->GetEntry();
3037 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3038 if (!theSVertex->_is_nil())
3039 theVertexEntry = theSVertex->GetID();
3041 if (theVertexEntry.empty())
3042 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3044 string theVertexName = theVertex->GetName();
3046 return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3047 } catch (SALOME_Exception& ex) {
3048 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3052 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3055 return UnsetEnforcedVertexEntry("", x, y, z);
3056 } catch (SALOME_Exception& ex) {
3057 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3061 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3062 throw (SALOME::SALOME_Exception)
3064 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3065 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3067 std::string theVertexEntry = theVertex->GetStudyEntry();
3069 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3070 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3073 if (theVertexEntry.empty()) {
3074 if (theVertex->GetShapeType() == GEOM::VERTEX)
3076 if (theVertex->GetShapeType() == GEOM::COMPOUND)
3077 aName = "Compound_";
3078 aName += theVertex->GetEntry();
3079 SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3080 if (!theSVertex->_is_nil())
3081 theVertexEntry = theSVertex->GetID();
3083 if (theVertexEntry.empty())
3084 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3087 return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3088 } catch (SALOME_Exception& ex) {
3089 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3093 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3096 return UnsetEnforcedVerticesEntry("");
3097 } catch (SALOME_Exception& ex) {
3098 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3103 * Set/get/unset an enforced vertex on geom object given by entry
3105 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3109 const char* theVertexName,
3110 const char* theVertexEntry,
3111 const char* theGroupName)
3112 throw (SALOME::SALOME_Exception)
3114 bool newValue = false;
3115 if (string(theVertexEntry).empty()) {
3117 ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3118 this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3119 ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3120 coords.push_back(x);
3121 coords.push_back(y);
3122 coords.push_back(z);
3123 if (coordsList.find(coords) == coordsList.end()) {
3126 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3127 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3131 } catch (const std::invalid_argument& ex) {
3132 // no enforced vertex for entry
3136 if (string(theVertexName).empty()) {
3137 if (string(theGroupName).empty())
3138 SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3140 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3143 if (string(theGroupName).empty())
3144 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3146 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3147 << theVertexName << "\", \"" << theGroupName << "\")";
3152 ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3153 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3154 if ( it == enfVertexEntryList.end()) {
3158 ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3159 if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3163 } catch (const std::invalid_argument& ex) {
3164 // no enforced vertex for entry
3168 if (string(theGroupName).empty())
3169 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3171 SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3176 this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3181 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3182 throw (SALOME::SALOME_Exception)
3185 BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3186 ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3187 vertexList->length(_vList.size());
3188 ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3189 for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3190 ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3192 BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3195 enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3196 // Geom Vertex Entry
3197 enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3199 BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3200 coords->length(_enfVertex->coords.size());
3201 for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3202 coords[ind] = _enfVertex->coords[ind];
3203 enfVertex->coords = coords;
3205 enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3207 BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3208 faceEntryList->length(_enfVertex->faceEntries.size());
3209 ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3210 for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3211 faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3212 enfVertex->faceEntries = faceEntryList;
3214 vertexList[i] = enfVertex;
3216 return vertexList._retn();
3217 } catch (const std::invalid_argument& ex) {
3218 SALOME::ExceptionStruct ExDescription;
3219 ExDescription.text = ex.what();
3220 ExDescription.type = SALOME::BAD_PARAM;
3221 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3222 ExDescription.lineNumber = 1385;
3223 throw SALOME::SALOME_Exception(ExDescription);
3224 } catch (const std::exception& ex) {
3225 std::cout << "Exception: " << ex.what() << std::endl;
3226 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3230 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3236 res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3238 if (string(theVertexEntry).empty())
3239 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3242 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3244 } catch (const std::invalid_argument& ex) {
3246 } catch (const std::exception& ex) {
3247 std::cout << "Exception: " << ex.what() << std::endl;
3248 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3253 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3258 this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3259 SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3260 } catch (const std::invalid_argument& ex) {
3262 } catch (const std::exception& ex) {
3263 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3269 //=============================================================================
3271 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3275 //=============================================================================
3276 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3279 this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3280 std::string theValueStr = theValue ? "True" : "False";
3281 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3284 //=============================================================================
3286 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3290 //=============================================================================
3291 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3294 return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3297 //=============================================================================
3299 * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3303 //=============================================================================
3304 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
3307 this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3308 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3311 //=============================================================================
3313 * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3317 //=============================================================================
3318 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3321 return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3325 * Enable internal enforced vertices on specific face if requested by user
3327 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3328 throw (SALOME::SALOME_Exception)
3331 SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3332 } catch (SALOME_Exception& ex) {
3333 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3337 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3338 throw (SALOME::SALOME_Exception)
3341 if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3342 THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3345 string theFaceEntry = theFace->GetStudyEntry();
3347 if (theFaceEntry.empty()) {
3348 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3349 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3351 if (theFace->GetShapeType() == GEOM::FACE)
3353 if (theFace->GetShapeType() == GEOM::COMPOUND)
3354 aName = "Compound_";
3355 aName += theFace->GetEntry();
3356 SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3357 if (!theSFace->_is_nil())
3358 theFaceEntry = theSFace->GetID();
3360 if (theFaceEntry.empty())
3361 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3364 SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3365 } catch (SALOME_Exception& ex) {
3366 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3370 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3371 throw (SALOME::SALOME_Exception)
3375 this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3376 std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3377 if (string(theGroupName).empty())
3378 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3380 SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3381 } catch (const std::exception& ex) {
3382 std::cout << "Exception: " << ex.what() << std::endl;
3383 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3390 char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3391 throw (SALOME::SALOME_Exception)
3395 return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3397 catch (const std::invalid_argument& ex) {
3398 SALOME::ExceptionStruct ExDescription;
3399 ExDescription.text = ex.what();
3400 ExDescription.type = SALOME::BAD_PARAM;
3401 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3402 ExDescription.lineNumber = 1146;
3403 throw SALOME::SALOME_Exception(ExDescription);
3405 catch (SALOME_Exception& ex) {
3406 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3412 void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3413 throw (SALOME::SALOME_Exception)
3417 this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3419 catch (const std::invalid_argument& ex) {
3420 SALOME::ExceptionStruct ExDescription;
3421 ExDescription.text = ex.what();
3422 ExDescription.type = SALOME::BAD_PARAM;
3423 ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3424 ExDescription.lineNumber = 1170;
3425 throw SALOME::SALOME_Exception(ExDescription);
3427 catch (SALOME_Exception& ex) {
3428 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3431 SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3432 << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3436 ///////////////////////
3438 ///////////////////////
3440 ///////////////////////
3443 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3445 std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3446 MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3447 MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3448 MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3449 MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3450 MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3451 MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3452 MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3453 MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3454 MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3455 std::string txtShapeType = MapShapeTypeToString[theShapeType];
3456 return txtShapeType;
3459 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3461 // Check shape types
3463 std::stringstream typesTxt;
3464 for (std::size_t i=0; i<theShapeTypes.size(); i++)
3466 GEOM::shape_type theShapeType = theShapeTypes[i];
3467 if (shape->GetShapeType() == theShapeType)
3469 typesTxt << ShapeTypeToString(theShapeType);
3470 if (i < theShapeTypes.size()-1 )
3474 std::stringstream msg;
3475 msg << "shape type is not in" << typesTxt.str();
3476 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3480 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3483 if (shape->GetShapeType() != theShapeType) {
3484 std::stringstream msg;
3485 msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3486 THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3490 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3492 // Check shape is published in the object browser
3493 string shapeEntry = shape->GetStudyEntry();
3495 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3496 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3499 // Publish shape if needed
3500 if (shapeEntry.empty()) {
3501 if (shape->GetShapeType() == theShapeType)
3503 aName += shape->GetEntry();
3504 SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3505 if (!theSFace1->_is_nil())
3506 shapeEntry = theSFace1->GetID();
3508 if (shapeEntry.empty())
3509 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3513 // Format the output of two vectors to use it in MESSAGE and PythonDump
3514 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3516 std::stringstream listEntriesTxt;
3518 if (!theSourceVerticesEntries.empty())
3520 listEntriesTxt << ", [" ;
3522 for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3525 listEntriesTxt << ", ";
3526 listEntriesTxt << *it;
3529 listEntriesTxt << "], [" ;
3531 for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3534 listEntriesTxt << ", ";
3535 listEntriesTxt << *it;
3537 listEntriesTxt << "]" ;
3539 return listEntriesTxt.str();
3543 * Erase all PreCad periodicity associations
3545 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3547 this->GetImpl()->ClearPreCadPeriodicityVectors();
3548 SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3551 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3553 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3554 this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3556 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3558 return periodicityList._retn();
3561 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3563 const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3564 this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3566 BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3568 return periodicityList._retn();
3571 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3572 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3574 BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3576 periodicityList->length(preCadPeriodicityVector.size());
3578 for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3580 ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3582 BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3583 myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3584 myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3586 BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3587 if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3589 sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3590 for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3591 sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3594 myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3596 BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3597 if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3599 targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3600 for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3601 targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3604 myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3606 periodicityList[i] = myPreCadPeriodicity;
3610 return periodicityList._retn();
3614 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3615 throw (SALOME::SALOME_Exception)
3618 const GEOM::ListOfGO theSourceVertices;
3619 const GEOM::ListOfGO theTargetVertices;
3620 AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3624 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3625 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3626 throw (SALOME::SALOME_Exception)
3630 size_t theLength = theSourceVertices.length();
3631 if (theLength != theTargetVertices.length())
3632 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3634 std::vector<GEOM::shape_type> allowedShapeTypes;
3635 allowedShapeTypes.push_back(GEOM::FACE);
3636 allowedShapeTypes.push_back(GEOM::COMPOUND);
3638 string prefix1 = "Source_face_";
3639 CheckShapeTypes(theFace1, allowedShapeTypes);
3640 string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3642 string prefix2 = "Target_face_";
3643 CheckShapeTypes(theFace2, allowedShapeTypes);
3644 string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3646 string prefix3 = "Source_vertex_";
3647 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3648 theSourceVerticesEntries->length(theLength);
3649 GEOM::GEOM_Object_ptr theVtx_i;
3651 for (size_t ind = 0; ind < theLength; ind++) {
3652 theVtx_i = theSourceVertices[ind];
3653 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3654 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3657 string prefix4 = "Target_vertex_";
3658 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3659 theTargetVerticesEntries->length(theLength);
3660 for (size_t ind = 0; ind < theLength; ind++) {
3661 theVtx_i = theTargetVertices[ind];
3662 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3663 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3666 string theFace2Name = theFace2->GetName();
3668 AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3669 theSourceVerticesEntries, theTargetVerticesEntries);
3670 } catch (SALOME_Exception& ex) {
3671 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3676 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3677 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3678 throw (SALOME::SALOME_Exception)
3683 // Convert BLSURFPlugin::TEntryList to vector<string>
3684 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3685 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3686 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3687 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3690 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3693 this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3694 theSourceVerticesEntries, theTargetVerticesEntries);
3696 SMESH::TPythonDump pd;
3697 if (!theSourceVerticesEntries.empty())
3699 pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3700 pd << listEntriesTxt.c_str();
3704 pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3707 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3708 throw (SALOME::SALOME_Exception)
3711 const GEOM::ListOfGO theSourceVertices;
3712 const GEOM::ListOfGO theTargetVertices;
3713 AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3716 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3717 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3718 throw (SALOME::SALOME_Exception)
3722 size_t theLength = theSourceVertices.length();
3723 if (theLength != theTargetVertices.length())
3724 THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3726 std::vector<GEOM::shape_type> allowedShapeTypes;
3727 allowedShapeTypes.push_back(GEOM::EDGE);
3728 allowedShapeTypes.push_back(GEOM::COMPOUND);
3730 string prefix1 = "Source_edge_";
3731 CheckShapeTypes(theEdge1, allowedShapeTypes);
3732 string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3734 string prefix2 = "Target_edge_";
3735 CheckShapeTypes(theEdge2, allowedShapeTypes);
3736 string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3738 string prefix3 = "Source_vertex_";
3739 BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3740 theSourceVerticesEntries->length(theLength);
3741 GEOM::GEOM_Object_ptr theVtx_i;
3743 for (size_t ind = 0; ind < theLength; ind++) {
3744 theVtx_i = theSourceVertices[ind];
3745 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3746 theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3749 string prefix4 = "Target_vertex_";
3750 BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3751 theTargetVerticesEntries->length(theLength);
3752 for (size_t ind = 0; ind < theLength; ind++) {
3753 theVtx_i = theTargetVertices[ind];
3754 theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3755 theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3758 string theEdge2Name = theEdge2->GetName();
3760 AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3761 theSourceVerticesEntries, theTargetVerticesEntries);
3762 } catch (SALOME_Exception& ex) {
3763 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3768 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3769 const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3770 throw (SALOME::SALOME_Exception)
3775 // Convert BLSURFPlugin::TEntryList to vector<string>
3776 vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3777 for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3778 theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3779 theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3782 string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3784 this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3785 theSourceVerticesEntries, theTargetVerticesEntries);
3787 SMESH::TPythonDump pd;
3788 if (!theSourceVerticesEntries.empty())
3790 pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3791 pd << listEntriesTxt.c_str();
3795 pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3800 //================================================================================
3802 * \brief Sets the file for export resulting mesh in GMF format
3803 * \param theFileName - full name of the file (.mesh, .meshb)
3805 * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3807 //================================================================================
3808 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3809 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3811 bool valueChanged/*, modeChanged*/ = false;
3813 valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3814 // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3815 if (valueChanged)// or (!valueChanged && modeChanged))
3816 this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3817 } catch (const std::exception& ex) {
3818 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3820 if (valueChanged)// or (!valueChanged && modeChanged))
3821 SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3824 //================================================================================
3826 * \brief Gets the file name for export resulting mesh in GMF format
3827 * \retval char* - The file name
3829 * Returns the GMF file name
3831 //================================================================================
3832 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3834 return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3837 // //================================================================================
3839 // * \brief Gets the file mode for export resulting mesh in GMF format
3840 // * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3842 // * Returns the GMF file mode
3844 // //================================================================================
3845 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3846 // ASSERT(myBaseImpl);
3847 // return this->GetImpl()->GetGMFFileMode();
3850 //=============================================================================
3852 * BLSURFPlugin_Hypothesis_i::GetImpl
3854 * Get implementation
3856 //=============================================================================
3857 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3858 return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3861 //================================================================================
3863 * \brief Verify whether hypothesis supports given entity type
3864 * \param type - dimension (see SMESH::Dimension enumeration)
3865 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3867 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3869 //================================================================================
3870 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3871 return type == SMESH::DIM_2D;
3875 // Obsolete methods - To be removed in V7
3878 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3879 this->SetMinSize(theMinSize);
3881 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3882 return this->GetMinSize();
3884 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3885 this->SetMaxSize(theMaxSize);
3887 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3888 return this->GetMaxSize();
3890 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3891 this->SetMinSize(theMinSize);
3893 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3894 return this->GetMinSize();
3896 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3897 this->SetMaxSize(theMaxSize);
3899 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3900 return this->GetMaxSize();
3902 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3903 this->SetAngleMesh(theValue);
3905 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3906 return this->GetAngleMesh();
3908 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3909 this->SetAngleMesh(theValue);
3911 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3912 return this->GetAngleMesh();
3914 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3915 std::string theValueStr = theValue ? "1" : "0";
3916 this->SetOptionValue("respect_geometry",theValueStr.c_str());
3918 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3919 std::string theValueStr = this->GetOptionValue("respect_geometry");
3920 if (theValueStr.empty() || theValueStr == "respect")
3924 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3925 std::string theValueStr = theValue ? "1" : "0";
3926 this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
3928 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3929 std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
3930 if (theValueStr == "1")
3934 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3935 std::ostringstream theValueStr;
3936 theValueStr << theValue;
3937 this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
3939 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3940 std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
3942 theValueStr >> result;