1 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : SMESH_MeshEditor_i.cxx
25 // Author : Nicolas REJNERI
29 #include "SMESH_MeshEditor_i.hxx"
31 #include "SMDS_MeshEdge.hxx"
32 #include "SMDS_MeshFace.hxx"
33 #include "SMDS_MeshVolume.hxx"
34 #include "SMDS_PolyhedralVolumeOfNodes.hxx"
36 #include "SMESH_MeshEditor.hxx"
38 #include "SMESH_Gen_i.hxx"
39 #include "SMESH_Filter_i.hxx"
40 #include "SMESH_PythonDump.hxx"
42 #include "utilities.h"
48 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
52 #include <Standard_Failure.hxx>
55 #include <Standard_ErrorHandler.hxx>
57 #include "CASCatch.hxx"
63 using SMESH::TPythonDump;
65 //=============================================================================
67 * \brief Mesh to apply modifications for preview purposes
69 //=============================================================================
71 struct TPreviewMesh: public SMESH_Mesh
73 SMDSAbs_ElementType myPreviewType; // type to show
75 TPreviewMesh(SMDSAbs_ElementType previewElements = SMDSAbs_All) {
76 _isShapeToMesh = _id =_studyId =_idDoc = 0;
77 _myMeshDS = new SMESHDS_Mesh( _id, true );
78 myPreviewType = previewElements;
80 virtual ~TPreviewMesh() { delete _myMeshDS; }
82 void Copy( const SMESH::long_array & theIDsOfElements,
84 TIDSortedElemSet& theElements,
85 SMDSAbs_ElementType theSelectType = SMDSAbs_All,
86 SMDSAbs_ElementType theAvoidType = SMDSAbs_All)
88 SMESHDS_Mesh* aMeshDS = _myMeshDS;
90 // loop on theIDsOfElements
91 for ( int i=0; i<theIDsOfElements.length(); ++i )
93 const SMDS_MeshElement* anElem =
94 theMesh.GetMeshDS()->FindElement(theIDsOfElements[i]);
95 if ( !anElem ) continue;
96 SMDSAbs_ElementType type = anElem->GetType();
97 if ( type == theAvoidType ||
98 ( theSelectType != SMDSAbs_All && type != theSelectType ))
101 // copy element nodes
102 int anElemNbNodes = anElem->NbNodes();
103 vector< int > anElemNodesID( anElemNbNodes ) ;
104 SMDS_ElemIteratorPtr itElemNodes = anElem->nodesIterator();
105 for ( int i = 0; itElemNodes->more(); i++)
107 const SMDS_MeshNode* anElemNode =
108 static_cast<const SMDS_MeshNode*>( itElemNodes->next() );
109 _myMeshDS->AddNodeWithID(anElemNode->X(), anElemNode->Y(), anElemNode->Z(),
110 anElemNode->GetID());
111 anElemNodesID[i] = anElemNode->GetID();
114 // creates a corresponding element on copied nodes
115 const SMDS_MeshElement* anElemCopy = 0;
116 if ( anElem->IsPoly() && type == SMDSAbs_Volume )
118 const SMDS_PolyhedralVolumeOfNodes* ph =
119 dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
121 anElemCopy = aMeshDS->AddPolyhedralVolumeWithID
122 (anElemNodesID, ph->GetQuanities(),anElem->GetID());
125 anElemCopy = ::SMESH_MeshEditor(this).AddElement( anElemNodesID,
130 theElements.insert( anElemCopy );
134 };// struct TPreviewMesh
136 //=============================================================================
140 //=============================================================================
142 SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh* theMesh, bool isPreview)
145 myPreviewMode = isPreview;
148 //================================================================================
152 //================================================================================
154 SMESH_MeshEditor_i::~SMESH_MeshEditor_i()
158 //================================================================================
160 * \brief Clear members
162 //================================================================================
164 void SMESH_MeshEditor_i::initData()
166 if ( myPreviewMode ) {
167 myPreviewData = new SMESH::MeshPreviewStruct();
170 myLastCreatedElems = new SMESH::long_array();
171 myLastCreatedNodes = new SMESH::long_array();
175 //=============================================================================
179 //=============================================================================
182 SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array & IDsOfElements)
186 ::SMESH_MeshEditor anEditor( _myMesh );
189 for (int i = 0; i < IDsOfElements.length(); i++)
190 IdList.push_back( IDsOfElements[i] );
192 // Update Python script
193 TPythonDump() << "isDone = " << this << ".RemoveElements( " << IDsOfElements << " )";
195 TPythonDump() << "print 'RemoveElements: ', isDone";
198 return anEditor.Remove( IdList, false );
201 //=============================================================================
205 //=============================================================================
207 CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array & IDsOfNodes)
211 ::SMESH_MeshEditor anEditor( _myMesh );
213 for (int i = 0; i < IDsOfNodes.length(); i++)
214 IdList.push_back( IDsOfNodes[i] );
216 // Update Python script
217 TPythonDump() << "isDone = " << this << ".RemoveNodes( " << IDsOfNodes << " )";
219 TPythonDump() << "print 'RemoveNodes: ', isDone";
222 return anEditor.Remove( IdList, true );
225 //=============================================================================
229 //=============================================================================
231 CORBA::Long SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes)
235 int NbNodes = IDsOfNodes.length();
236 SMDS_MeshElement* elem = 0;
239 CORBA::Long index1 = IDsOfNodes[0];
240 CORBA::Long index2 = IDsOfNodes[1];
241 elem = GetMeshDS()->AddEdge(GetMeshDS()->FindNode(index1), GetMeshDS()->FindNode(index2));
243 // Update Python script
244 TPythonDump() << "edge = " << this << ".AddEdge([ "
245 << index1 << ", " << index2 <<" ])";
248 CORBA::Long n1 = IDsOfNodes[0];
249 CORBA::Long n2 = IDsOfNodes[1];
250 CORBA::Long n12 = IDsOfNodes[2];
251 elem = GetMeshDS()->AddEdge(GetMeshDS()->FindNode(n1),
252 GetMeshDS()->FindNode(n2),
253 GetMeshDS()->FindNode(n12));
254 // Update Python script
255 TPythonDump() << "edgeID = " << this << ".AddEdge([ "
256 <<n1<<", "<<n2<<", "<<n12<<" ])";
260 return elem->GetID();
265 //=============================================================================
269 //=============================================================================
271 CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,
272 CORBA::Double y, CORBA::Double z)
276 const SMDS_MeshNode* N = GetMeshDS()->AddNode(x, y, z);
278 // Update Python script
279 TPythonDump() << "nodeID = " << this << ".AddNode( "
280 << x << ", " << y << ", " << z << " )";
285 //=============================================================================
289 //=============================================================================
291 CORBA::Long SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
295 int NbNodes = IDsOfNodes.length();
301 std::vector<const SMDS_MeshNode*> nodes (NbNodes);
302 for (int i = 0; i < NbNodes; i++)
303 nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
305 SMDS_MeshElement* elem = 0;
307 elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
309 else if (NbNodes == 4) {
310 elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
312 else if (NbNodes == 6) {
313 elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
316 else if (NbNodes == 8) {
317 elem = GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3],
318 nodes[4], nodes[5], nodes[6], nodes[7]);
321 // Update Python script
322 TPythonDump() << "faceID = " << this << ".AddFace( " << IDsOfNodes << " )";
325 return elem->GetID();
330 //=============================================================================
334 //=============================================================================
335 CORBA::Long SMESH_MeshEditor_i::AddPolygonalFace
336 (const SMESH::long_array & IDsOfNodes)
340 int NbNodes = IDsOfNodes.length();
341 std::vector<const SMDS_MeshNode*> nodes (NbNodes);
342 for (int i = 0; i < NbNodes; i++)
343 nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
345 const SMDS_MeshElement* elem = GetMeshDS()->AddPolygonalFace(nodes);
347 // Update Python script
348 TPythonDump() <<"faceID = "<<this<<".AddPolygonalFace( "<<IDsOfNodes<<" )";
350 TPythonDump() << "print 'AddPolygonalFace: ', faceID";
354 return elem->GetID();
359 //=============================================================================
363 //=============================================================================
365 CORBA::Long SMESH_MeshEditor_i::AddVolume(const SMESH::long_array & IDsOfNodes)
369 int NbNodes = IDsOfNodes.length();
370 vector< const SMDS_MeshNode*> n(NbNodes);
371 for(int i=0;i<NbNodes;i++)
372 n[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
374 SMDS_MeshElement* elem = 0;
377 case 4 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3]); break;
378 case 5 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4]); break;
379 case 6 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5]); break;
380 case 8 :elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]); break;
381 case 10:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],
382 n[6],n[7],n[8],n[9]);
384 case 13:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],
385 n[7],n[8],n[9],n[10],n[11],n[12]);
387 case 15:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],
388 n[9],n[10],n[11],n[12],n[13],n[14]);
390 case 20:elem = GetMeshDS()->AddVolume(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],
391 n[8],n[9],n[10],n[11],n[12],n[13],n[14],
392 n[15],n[16],n[17],n[18],n[19]);
396 // Update Python script
397 TPythonDump() << "volID = " << this << ".AddVolume( " << IDsOfNodes << " )";
399 TPythonDump() << "print 'AddVolume: ', volID";
403 return elem->GetID();
408 //=============================================================================
410 * AddPolyhedralVolume
412 //=============================================================================
413 CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolume
414 (const SMESH::long_array & IDsOfNodes,
415 const SMESH::long_array & Quantities)
419 int NbNodes = IDsOfNodes.length();
420 std::vector<const SMDS_MeshNode*> n (NbNodes);
421 for (int i = 0; i < NbNodes; i++)
422 n[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
424 int NbFaces = Quantities.length();
425 std::vector<int> q (NbFaces);
426 for (int j = 0; j < NbFaces; j++)
427 q[j] = Quantities[j];
429 const SMDS_MeshElement* elem = GetMeshDS()->AddPolyhedralVolume(n, q);
431 // Update Python script
432 TPythonDump() << "volID = " << this << ".AddPolyhedralVolume( "
433 << IDsOfNodes << ", " << Quantities << " )";
435 TPythonDump() << "print 'AddPolyhedralVolume: ', volID";
439 return elem->GetID();
444 //=============================================================================
446 * AddPolyhedralVolumeByFaces
448 //=============================================================================
449 CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
450 (const SMESH::long_array & IdsOfFaces)
454 int NbFaces = IdsOfFaces.length();
455 std::vector<const SMDS_MeshNode*> poly_nodes;
456 std::vector<int> quantities (NbFaces);
458 for (int i = 0; i < NbFaces; i++) {
459 const SMDS_MeshElement* aFace = GetMeshDS()->FindElement(IdsOfFaces[i]);
460 quantities[i] = aFace->NbNodes();
462 SMDS_ElemIteratorPtr It = aFace->nodesIterator();
464 poly_nodes.push_back(static_cast<const SMDS_MeshNode *>(It->next()));
468 const SMDS_MeshElement* elem = GetMeshDS()->AddPolyhedralVolume(poly_nodes, quantities);
470 // Update Python script
471 TPythonDump() << "volID = " << this << ".AddPolyhedralVolumeByFaces( "
472 << IdsOfFaces << " )";
474 TPythonDump() << "print 'AddPolyhedralVolume: ', volID";
478 return elem->GetID();
483 //=============================================================================
487 //=============================================================================
489 CORBA::Boolean SMESH_MeshEditor_i::MoveNode(CORBA::Long NodeID,
496 const SMDS_MeshNode * node = GetMeshDS()->FindNode( NodeID );
500 GetMeshDS()->MoveNode(node, x, y, z);
502 // Update Python script
503 TPythonDump() << "isDone = " << this << ".MoveNode( "
504 << NodeID << ", " << x << ", " << y << ", " << z << " )";
509 //=============================================================================
513 //=============================================================================
515 CORBA::Boolean SMESH_MeshEditor_i::InverseDiag(CORBA::Long NodeID1,
520 const SMDS_MeshNode * n1 = GetMeshDS()->FindNode( NodeID1 );
521 const SMDS_MeshNode * n2 = GetMeshDS()->FindNode( NodeID2 );
525 // Update Python script
526 TPythonDump() << "isDone = " << this << ".InverseDiag( "
527 << NodeID1 << ", " << NodeID2 << " )";
529 ::SMESH_MeshEditor aMeshEditor( _myMesh );
530 return aMeshEditor.InverseDiag ( n1, n2 );
533 //=============================================================================
537 //=============================================================================
539 CORBA::Boolean SMESH_MeshEditor_i::DeleteDiag(CORBA::Long NodeID1,
544 const SMDS_MeshNode * n1 = GetMeshDS()->FindNode( NodeID1 );
545 const SMDS_MeshNode * n2 = GetMeshDS()->FindNode( NodeID2 );
549 // Update Python script
550 TPythonDump() << "isDone = " << this << ".DeleteDiag( "
551 << NodeID1 << ", " << NodeID2 << " )";
553 ::SMESH_MeshEditor aMeshEditor( _myMesh );
555 bool stat = aMeshEditor.DeleteDiag ( n1, n2 );
557 StoreResult(aMeshEditor);
562 //=============================================================================
566 //=============================================================================
568 CORBA::Boolean SMESH_MeshEditor_i::Reorient(const SMESH::long_array & IDsOfElements)
572 ::SMESH_MeshEditor anEditor( _myMesh );
573 for (int i = 0; i < IDsOfElements.length(); i++)
575 CORBA::Long index = IDsOfElements[i];
576 const SMDS_MeshElement * elem = GetMeshDS()->FindElement(index);
578 anEditor.Reorient( elem );
580 // Update Python script
581 TPythonDump() << "isDone = " << this << ".Reorient( " << IDsOfElements << " )";
587 //=============================================================================
591 //=============================================================================
593 CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theObject)
597 SMESH::long_array_var anElementsId = theObject->GetIDs();
598 CORBA::Boolean isDone = Reorient(anElementsId);
600 // Clear python line, created by Reorient()
601 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
602 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
604 // Update Python script
605 TPythonDump() << "isDone = " << this << ".ReorientObject( " << theObject << " )";
612 //================================================================================
614 * \brief function for conversion long_array to TIDSortedElemSet
615 * \param IDs - array of IDs
616 * \param aMesh - mesh
617 * \param aMap - collection to fill
618 * \param aType - element type
620 //================================================================================
622 void ToMap(const SMESH::long_array & IDs,
623 const SMESHDS_Mesh* aMesh,
624 TIDSortedElemSet& aMap,
625 const SMDSAbs_ElementType aType = SMDSAbs_All )
627 for (int i=0; i<IDs.length(); i++) {
628 CORBA::Long ind = IDs[i];
629 const SMDS_MeshElement * elem = aMesh->FindElement(ind);
630 if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
636 //=============================================================================
640 //=============================================================================
641 CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfElements,
642 SMESH::NumericalFunctor_ptr Criterion,
643 CORBA::Double MaxAngle)
647 SMESHDS_Mesh* aMesh = GetMeshDS();
648 TIDSortedElemSet faces;
649 ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
651 SMESH::NumericalFunctor_i* aNumericalFunctor =
652 dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
653 SMESH::Controls::NumericalFunctorPtr aCrit;
654 if ( !aNumericalFunctor )
655 aCrit.reset( new SMESH::Controls::AspectRatio() );
657 aCrit = aNumericalFunctor->GetNumericalFunctor();
659 // Update Python script
660 TPythonDump() << "isDone = " << this << ".TriToQuad( "
661 << IDsOfElements << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
663 TPythonDump() << "print 'TriToQuad: ', isDone";
666 ::SMESH_MeshEditor anEditor( _myMesh );
668 bool stat = anEditor.TriToQuad( faces, aCrit, MaxAngle );
670 StoreResult(anEditor);
676 //=============================================================================
680 //=============================================================================
681 CORBA::Boolean SMESH_MeshEditor_i::TriToQuadObject (SMESH::SMESH_IDSource_ptr theObject,
682 SMESH::NumericalFunctor_ptr Criterion,
683 CORBA::Double MaxAngle)
687 SMESH::long_array_var anElementsId = theObject->GetIDs();
688 CORBA::Boolean isDone = TriToQuad(anElementsId, Criterion, MaxAngle);
690 // Clear python line(s), created by TriToQuad()
691 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
692 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
694 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
697 SMESH::NumericalFunctor_i* aNumericalFunctor =
698 SMESH::DownCast<SMESH::NumericalFunctor_i*>( Criterion );
700 // Update Python script
701 TPythonDump() << "isDone = " << this << ".TriToQuadObject("
702 << theObject << ", " << aNumericalFunctor << ", " << MaxAngle << " )";
704 TPythonDump() << "print 'TriToQuadObject: ', isDone";
711 //=============================================================================
715 //=============================================================================
716 CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array & IDsOfElements,
717 SMESH::NumericalFunctor_ptr Criterion)
721 SMESHDS_Mesh* aMesh = GetMeshDS();
722 TIDSortedElemSet faces;
723 ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
725 SMESH::NumericalFunctor_i* aNumericalFunctor =
726 dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
727 SMESH::Controls::NumericalFunctorPtr aCrit;
728 if ( !aNumericalFunctor )
729 aCrit.reset( new SMESH::Controls::AspectRatio() );
731 aCrit = aNumericalFunctor->GetNumericalFunctor();
734 // Update Python script
735 TPythonDump() << "isDone = " << this << ".QuadToTri( " << IDsOfElements << ", " << aNumericalFunctor << " )";
737 TPythonDump() << "print 'QuadToTri: ', isDone";
740 ::SMESH_MeshEditor anEditor( _myMesh );
741 CORBA::Boolean stat = anEditor.QuadToTri( faces, aCrit );
743 StoreResult(anEditor);
749 //=============================================================================
753 //=============================================================================
754 CORBA::Boolean SMESH_MeshEditor_i::QuadToTriObject (SMESH::SMESH_IDSource_ptr theObject,
755 SMESH::NumericalFunctor_ptr Criterion)
759 SMESH::long_array_var anElementsId = theObject->GetIDs();
760 CORBA::Boolean isDone = QuadToTri(anElementsId, Criterion);
762 // Clear python line(s), created by QuadToTri()
763 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
764 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
766 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
769 SMESH::NumericalFunctor_i* aNumericalFunctor =
770 SMESH::DownCast<SMESH::NumericalFunctor_i*>( Criterion );
772 // Update Python script
773 TPythonDump() << "isDone = " << this << ".QuadToTriObject( " << theObject << ", " << aNumericalFunctor << " )";
775 TPythonDump() << "print 'QuadToTriObject: ', isDone";
782 //=============================================================================
786 //=============================================================================
787 CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfElements,
788 CORBA::Boolean Diag13)
792 SMESHDS_Mesh* aMesh = GetMeshDS();
793 TIDSortedElemSet faces;
794 ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
796 // Update Python script
797 TPythonDump() << "isDone = " << this << ".SplitQuad( "
798 << IDsOfElements << ", " << Diag13 << " )";
800 TPythonDump() << "print 'SplitQuad: ', isDone";
803 ::SMESH_MeshEditor anEditor( _myMesh );
804 CORBA::Boolean stat = anEditor.QuadToTri( faces, Diag13 );
806 StoreResult(anEditor);
812 //=============================================================================
816 //=============================================================================
817 CORBA::Boolean SMESH_MeshEditor_i::SplitQuadObject (SMESH::SMESH_IDSource_ptr theObject,
818 CORBA::Boolean Diag13)
822 SMESH::long_array_var anElementsId = theObject->GetIDs();
823 CORBA::Boolean isDone = SplitQuad(anElementsId, Diag13);
825 // Clear python line(s), created by SplitQuad()
826 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
827 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
829 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
832 // Update Python script
833 TPythonDump() << "isDone = " << this << ".SplitQuadObject( "
834 << theObject << ", " << Diag13 << " )";
836 TPythonDump() << "print 'SplitQuadObject: ', isDone";
843 //=============================================================================
847 //=============================================================================
848 CORBA::Long SMESH_MeshEditor_i::BestSplit (CORBA::Long IDOfQuad,
849 SMESH::NumericalFunctor_ptr Criterion)
851 const SMDS_MeshElement* quad = GetMeshDS()->FindElement(IDOfQuad);
852 if (quad && quad->GetType() == SMDSAbs_Face && quad->NbNodes() == 4)
854 SMESH::NumericalFunctor_i* aNumericalFunctor =
855 dynamic_cast<SMESH::NumericalFunctor_i*>(SMESH_Gen_i::GetServant(Criterion).in());
856 SMESH::Controls::NumericalFunctorPtr aCrit;
857 if (aNumericalFunctor)
858 aCrit = aNumericalFunctor->GetNumericalFunctor();
860 aCrit.reset(new SMESH::Controls::AspectRatio());
862 ::SMESH_MeshEditor anEditor (_myMesh);
863 return anEditor.BestSplit(quad, aCrit);
869 //=======================================================================
872 //=======================================================================
875 SMESH_MeshEditor_i::Smooth(const SMESH::long_array & IDsOfElements,
876 const SMESH::long_array & IDsOfFixedNodes,
877 CORBA::Long MaxNbOfIterations,
878 CORBA::Double MaxAspectRatio,
879 SMESH::SMESH_MeshEditor::Smooth_Method Method)
881 return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
882 MaxAspectRatio, Method, false );
886 //=======================================================================
887 //function : SmoothParametric
889 //=======================================================================
892 SMESH_MeshEditor_i::SmoothParametric(const SMESH::long_array & IDsOfElements,
893 const SMESH::long_array & IDsOfFixedNodes,
894 CORBA::Long MaxNbOfIterations,
895 CORBA::Double MaxAspectRatio,
896 SMESH::SMESH_MeshEditor::Smooth_Method Method)
898 return smooth( IDsOfElements, IDsOfFixedNodes, MaxNbOfIterations,
899 MaxAspectRatio, Method, true );
903 //=======================================================================
904 //function : SmoothObject
906 //=======================================================================
909 SMESH_MeshEditor_i::SmoothObject(SMESH::SMESH_IDSource_ptr theObject,
910 const SMESH::long_array & IDsOfFixedNodes,
911 CORBA::Long MaxNbOfIterations,
912 CORBA::Double MaxAspectRatio,
913 SMESH::SMESH_MeshEditor::Smooth_Method Method)
915 return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
916 MaxAspectRatio, Method, false);
920 //=======================================================================
921 //function : SmoothParametricObject
923 //=======================================================================
926 SMESH_MeshEditor_i::SmoothParametricObject(SMESH::SMESH_IDSource_ptr theObject,
927 const SMESH::long_array & IDsOfFixedNodes,
928 CORBA::Long MaxNbOfIterations,
929 CORBA::Double MaxAspectRatio,
930 SMESH::SMESH_MeshEditor::Smooth_Method Method)
932 return smoothObject (theObject, IDsOfFixedNodes, MaxNbOfIterations,
933 MaxAspectRatio, Method, true);
937 //=============================================================================
941 //=============================================================================
944 SMESH_MeshEditor_i::smooth(const SMESH::long_array & IDsOfElements,
945 const SMESH::long_array & IDsOfFixedNodes,
946 CORBA::Long MaxNbOfIterations,
947 CORBA::Double MaxAspectRatio,
948 SMESH::SMESH_MeshEditor::Smooth_Method Method,
953 SMESHDS_Mesh* aMesh = GetMeshDS();
955 TIDSortedElemSet elements;
956 ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
958 set<const SMDS_MeshNode*> fixedNodes;
959 for (int i = 0; i < IDsOfFixedNodes.length(); i++) {
960 CORBA::Long index = IDsOfFixedNodes[i];
961 const SMDS_MeshNode * node = aMesh->FindNode(index);
963 fixedNodes.insert( node );
965 ::SMESH_MeshEditor::SmoothMethod method = ::SMESH_MeshEditor::LAPLACIAN;
966 if ( Method != SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH )
967 method = ::SMESH_MeshEditor::CENTROIDAL;
969 ::SMESH_MeshEditor anEditor( _myMesh );
970 anEditor.Smooth(elements, fixedNodes, method,
971 MaxNbOfIterations, MaxAspectRatio, IsParametric );
973 StoreResult(anEditor);
975 // Update Python script
976 TPythonDump() << "isDone = " << this << "."
977 << (IsParametric ? "SmoothParametric( " : "Smooth( ")
978 << IDsOfElements << ", " << IDsOfFixedNodes << ", "
979 << MaxNbOfIterations << ", " << MaxAspectRatio << ", "
980 << "SMESH.SMESH_MeshEditor."
981 << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
982 "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
984 TPythonDump() << "print 'Smooth: ', isDone";
991 //=============================================================================
995 //=============================================================================
998 SMESH_MeshEditor_i::smoothObject(SMESH::SMESH_IDSource_ptr theObject,
999 const SMESH::long_array & IDsOfFixedNodes,
1000 CORBA::Long MaxNbOfIterations,
1001 CORBA::Double MaxAspectRatio,
1002 SMESH::SMESH_MeshEditor::Smooth_Method Method,
1007 SMESH::long_array_var anElementsId = theObject->GetIDs();
1008 CORBA::Boolean isDone = smooth (anElementsId, IDsOfFixedNodes, MaxNbOfIterations,
1009 MaxAspectRatio, Method, IsParametric);
1011 // Clear python line(s), created by Smooth()
1012 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1013 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1015 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1018 // Update Python script
1019 TPythonDump() << "isDone = " << this << "."
1020 << (IsParametric ? "SmoothParametricObject( " : "SmoothObject( ")
1021 << theObject << ", " << IDsOfFixedNodes << ", "
1022 << MaxNbOfIterations << ", " << MaxAspectRatio << ", "
1023 << "SMESH.SMESH_MeshEditor."
1024 << ( Method == SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH ?
1025 "CENTROIDAL_SMOOTH )" : "LAPLACIAN_SMOOTH )");
1027 TPythonDump() << "print 'SmoothObject: ', isDone";
1034 //=============================================================================
1038 //=============================================================================
1040 void SMESH_MeshEditor_i::RenumberNodes()
1042 // Update Python script
1043 TPythonDump() << this << ".RenumberNodes()";
1045 GetMeshDS()->Renumber( true );
1049 //=============================================================================
1053 //=============================================================================
1055 void SMESH_MeshEditor_i::RenumberElements()
1057 // Update Python script
1058 TPythonDump() << this << ".RenumberElements()";
1060 GetMeshDS()->Renumber( false );
1064 //=======================================================================
1065 //function : RotationSweep
1067 //=======================================================================
1069 void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElements,
1070 const SMESH::AxisStruct & theAxis,
1071 CORBA::Double theAngleInRadians,
1072 CORBA::Long theNbOfSteps,
1073 CORBA::Double theTolerance)
1077 TIDSortedElemSet elements;
1078 TPreviewMesh tmpMesh( SMDSAbs_Face );
1079 SMESH_Mesh* mesh = 0;
1080 bool makeWalls=true;
1081 if ( myPreviewMode )
1083 SMDSAbs_ElementType select = SMDSAbs_All, avoid = SMDSAbs_Volume;
1084 tmpMesh.Copy( theIDsOfElements, *_myMesh, elements, select, avoid );
1086 //makeWalls = false;
1090 ToMap(theIDsOfElements, GetMeshDS(), elements);
1094 gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ),
1095 gp_Vec( theAxis.vx, theAxis.vy, theAxis.vz ));
1097 ::SMESH_MeshEditor anEditor( mesh );
1098 anEditor.RotationSweep (elements, Ax1, theAngleInRadians,
1099 theNbOfSteps, theTolerance, makeWalls);
1101 StoreResult(anEditor);
1103 if ( !myPreviewMode ) {
1104 // Update Python script
1105 TPythonDump() << "axis = " << theAxis;
1106 TPythonDump() << this << ".RotationSweep( "
1109 << theAngleInRadians << ", "
1110 << theNbOfSteps << ", "
1111 << theTolerance << " )";
1115 //=======================================================================
1116 //function : RotationSweepObject
1118 //=======================================================================
1120 void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject,
1121 const SMESH::AxisStruct & theAxis,
1122 CORBA::Double theAngleInRadians,
1123 CORBA::Long theNbOfSteps,
1124 CORBA::Double theTolerance)
1128 SMESH::long_array_var anElementsId = theObject->GetIDs();
1129 RotationSweep(anElementsId, theAxis, theAngleInRadians, theNbOfSteps, theTolerance);
1131 // Clear python line, created by RotationSweep()
1132 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1133 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1135 // Update Python script
1136 TPythonDump() << this << ".RotationSweepObject( "
1139 << theAngleInRadians << ", "
1140 << theNbOfSteps << ", "
1141 << theTolerance << " )";
1144 //=======================================================================
1145 //function : ExtrusionSweep
1147 //=======================================================================
1149 void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElements,
1150 const SMESH::DirStruct & theStepVector,
1151 CORBA::Long theNbOfSteps)
1161 SMESHDS_Mesh* aMesh = GetMeshDS();
1163 TIDSortedElemSet elements;
1164 ToMap(theIDsOfElements, aMesh, elements);
1166 const SMESH::PointStruct * P = &theStepVector.PS;
1167 gp_Vec stepVec( P->x, P->y, P->z );
1169 TElemOfElemListMap aHystory;
1170 ::SMESH_MeshEditor anEditor( _myMesh );
1171 anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
1173 StoreResult(anEditor);
1175 // Update Python script
1176 TPythonDump() << "stepVector = " << theStepVector;
1177 TPythonDump() << this << ".ExtrusionSweep( "
1178 << theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
1181 } catch(Standard_Failure) {
1183 } CASCatch_CATCH(Standard_Failure) {
1185 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
1186 INFOS( "SMESH_MeshEditor_i::ExtrusionSweep fails - "<< aFail->GetMessageString() );
1191 //=======================================================================
1192 //function : ExtrusionSweepObject
1194 //=======================================================================
1196 void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObject,
1197 const SMESH::DirStruct & theStepVector,
1198 CORBA::Long theNbOfSteps)
1202 SMESH::long_array_var anElementsId = theObject->GetIDs();
1203 ExtrusionSweep(anElementsId, theStepVector, theNbOfSteps);
1205 // Clear python line, created by ExtrusionSweep()
1206 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1207 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1209 // Update Python script
1210 TPythonDump() << this << ".ExtrusionSweepObject( "
1211 << theObject << ", stepVector, " << theNbOfSteps << " )";
1214 //=======================================================================
1215 //function : ExtrusionSweepObject1D
1217 //=======================================================================
1219 void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
1220 const SMESH::DirStruct & theStepVector,
1221 CORBA::Long theNbOfSteps)
1225 SMESHDS_Mesh* aMesh = GetMeshDS();
1227 SMESH::long_array_var allElementsId = theObject->GetIDs();
1229 TIDSortedElemSet elements;
1230 ToMap(allElementsId, aMesh, elements);
1232 const SMESH::PointStruct * P = &theStepVector.PS;
1233 gp_Vec stepVec( P->x, P->y, P->z );
1235 ::SMESH_MeshEditor anEditor( _myMesh );
1236 //anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
1237 TElemOfElemListMap aHystory;
1238 anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
1240 StoreResult(anEditor);
1242 // Update Python script
1243 TPythonDump() << "stepVector = " << theStepVector;
1244 TPythonDump() << this << ".ExtrusionSweepObject1D( "
1245 << theObject << ", stepVector, " << theNbOfSteps << " )";
1248 //=======================================================================
1249 //function : ExtrusionSweepObject2D
1251 //=======================================================================
1253 void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
1254 const SMESH::DirStruct & theStepVector,
1255 CORBA::Long theNbOfSteps)
1259 SMESHDS_Mesh* aMesh = GetMeshDS();
1261 SMESH::long_array_var allElementsId = theObject->GetIDs();
1263 TIDSortedElemSet elements;
1264 ToMap(allElementsId, aMesh, elements);
1266 const SMESH::PointStruct * P = &theStepVector.PS;
1267 gp_Vec stepVec( P->x, P->y, P->z );
1269 ::SMESH_MeshEditor anEditor( _myMesh );
1270 //anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps);
1271 TElemOfElemListMap aHystory;
1272 anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory);
1274 StoreResult(anEditor);
1276 // Update Python script
1277 TPythonDump() << "stepVector = " << theStepVector;
1278 TPythonDump() << this << ".ExtrusionSweepObject2D( "
1279 << theObject << ", stepVector, " << theNbOfSteps << " )";
1283 //=======================================================================
1284 //function : AdvancedExtrusion
1286 //=======================================================================
1288 void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfElements,
1289 const SMESH::DirStruct & theStepVector,
1290 CORBA::Long theNbOfSteps,
1291 CORBA::Long theExtrFlags,
1292 CORBA::Double theSewTolerance)
1296 SMESHDS_Mesh* aMesh = GetMeshDS();
1298 TIDSortedElemSet elements;
1299 ToMap(theIDsOfElements, aMesh, elements);
1301 const SMESH::PointStruct * P = &theStepVector.PS;
1302 gp_Vec stepVec( P->x, P->y, P->z );
1304 ::SMESH_MeshEditor anEditor( _myMesh );
1305 TElemOfElemListMap aHystory;
1306 anEditor.ExtrusionSweep (elements, stepVec, theNbOfSteps, aHystory,
1307 theExtrFlags, theSewTolerance);
1309 StoreResult(anEditor);
1311 // Update Python script
1312 TPythonDump() << "stepVector = " << theStepVector;
1313 TPythonDump() << this << ".AdvancedExtrusion("
1316 << theNbOfSteps << ","
1317 << theExtrFlags << ", "
1318 << theSewTolerance << " )";
1322 #define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
1324 static SMESH::SMESH_MeshEditor::Extrusion_Error convExtrError( const::SMESH_MeshEditor::Extrusion_Error e )
1328 RETCASE( EXTR_NO_ELEMENTS );
1329 RETCASE( EXTR_PATH_NOT_EDGE );
1330 RETCASE( EXTR_BAD_PATH_SHAPE );
1331 RETCASE( EXTR_BAD_STARTING_NODE );
1332 RETCASE( EXTR_BAD_ANGLES_NUMBER );
1333 RETCASE( EXTR_CANT_GET_TANGENT );
1335 return SMESH::SMESH_MeshEditor::EXTR_OK;
1338 //=======================================================================
1339 //function : ExtrusionAlongPath
1341 //=======================================================================
1343 SMESH::SMESH_MeshEditor::Extrusion_Error
1344 SMESH_MeshEditor_i::ExtrusionAlongPath(const SMESH::long_array & theIDsOfElements,
1345 SMESH::SMESH_Mesh_ptr thePathMesh,
1346 GEOM::GEOM_Object_ptr thePathShape,
1347 CORBA::Long theNodeStart,
1348 CORBA::Boolean theHasAngles,
1349 const SMESH::double_array & theAngles,
1350 CORBA::Boolean theHasRefPoint,
1351 const SMESH::PointStruct & theRefPoint)
1355 SMESHDS_Mesh* aMesh = GetMeshDS();
1357 if ( thePathMesh->_is_nil() || thePathShape->_is_nil() )
1358 return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
1360 SMESH_Mesh_i* aMeshImp = dynamic_cast<SMESH_Mesh_i*>( SMESH_Gen_i::GetServant( thePathMesh ).in() );
1361 TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
1362 SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
1364 if ( !aSubMesh || !aSubMesh->GetSubMeshDS())
1365 return SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE;
1367 SMDS_MeshNode* nodeStart = (SMDS_MeshNode*)aMeshImp->GetImpl().GetMeshDS()->FindNode(theNodeStart);
1369 return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
1371 TIDSortedElemSet elements;
1372 ToMap(theIDsOfElements, aMesh, elements);
1374 list<double> angles;
1375 for (int i = 0; i < theAngles.length(); i++) {
1376 angles.push_back( theAngles[i] );
1379 gp_Pnt refPnt( theRefPoint.x, theRefPoint.y, theRefPoint.z );
1381 // Update Python script
1382 TPythonDump() << "rotAngles = " << theAngles;
1384 if ( theHasRefPoint )
1385 TPythonDump() << "refPoint = SMESH.PointStruct( "
1386 << refPnt.X() << ", "
1387 << refPnt.Y() << ", "
1388 << refPnt.Z() << " )";
1390 TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
1392 TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
1393 << theIDsOfElements << ", "
1394 << thePathMesh << ", "
1395 << thePathShape << ", "
1396 << theNodeStart << ", "
1397 << theHasAngles << ", "
1398 << "rotAngles" << ", "
1399 << theHasRefPoint << ", refPoint )";
1401 ::SMESH_MeshEditor anEditor( _myMesh );
1402 SMESH::SMESH_MeshEditor::Extrusion_Error error =
1403 convExtrError( anEditor.ExtrusionAlongTrack( elements, aSubMesh, nodeStart,
1404 theHasAngles, angles,
1405 theHasRefPoint, refPnt ) );
1407 StoreResult(anEditor);
1412 //=======================================================================
1413 //function : ExtrusionAlongPathObject
1415 //=======================================================================
1417 SMESH::SMESH_MeshEditor::Extrusion_Error
1418 SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObject,
1419 SMESH::SMESH_Mesh_ptr thePathMesh,
1420 GEOM::GEOM_Object_ptr thePathShape,
1421 CORBA::Long theNodeStart,
1422 CORBA::Boolean theHasAngles,
1423 const SMESH::double_array & theAngles,
1424 CORBA::Boolean theHasRefPoint,
1425 const SMESH::PointStruct & theRefPoint)
1429 SMESH::long_array_var anElementsId = theObject->GetIDs();
1430 SMESH::SMESH_MeshEditor::Extrusion_Error error = ExtrusionAlongPath
1431 (anElementsId, thePathMesh, thePathShape, theNodeStart,
1432 theHasAngles, theAngles, theHasRefPoint, theRefPoint);
1434 // Clear python line, created by ExtrusionAlongPath()
1435 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1436 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1438 // Update Python script
1439 TPythonDump() << "rotAngles = " << theAngles;
1440 TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
1441 << theObject << ", "
1442 << thePathMesh << ", "
1443 << thePathShape << ", "
1444 << theNodeStart << ", "
1445 << theHasAngles << ", "
1446 << "rotAngles" << ", "
1447 << theHasRefPoint<<", refPoint )";
1452 //================================================================================
1454 * \brief Compute rotation angles for ExtrusionAlongPath as linear variation
1455 * of given angles along path steps
1456 * \param PathMesh mesh containing a 1D sub-mesh on the edge, along
1457 * which proceeds the extrusion
1458 * \param PathShape is shape(edge); as the mesh can be complex, the edge
1459 * is used to define the sub-mesh for the path
1461 //================================================================================
1463 SMESH::double_array*
1464 SMESH_MeshEditor_i::LinearAnglesVariation(SMESH::SMESH_Mesh_ptr thePathMesh,
1465 GEOM::GEOM_Object_ptr thePathShape,
1466 const SMESH::double_array & theAngles)
1468 SMESH::double_array_var aResult = new SMESH::double_array();
1469 return aResult._retn();
1472 //=======================================================================
1475 //=======================================================================
1477 void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElements,
1478 const SMESH::AxisStruct & theAxis,
1479 SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
1480 CORBA::Boolean theCopy)
1484 SMESHDS_Mesh* aMesh = GetMeshDS();
1486 TIDSortedElemSet elements;
1487 ToMap(theIDsOfElements, aMesh, elements);
1489 gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
1490 gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
1493 TCollection_AsciiString typeStr;
1494 switch ( theMirrorType ) {
1495 case SMESH::SMESH_MeshEditor::POINT:
1496 aTrsf.SetMirror( P );
1497 typeStr = "SMESH.SMESH_MeshEditor.POINT";
1499 case SMESH::SMESH_MeshEditor::AXIS:
1500 aTrsf.SetMirror( gp_Ax1( P, V ));
1501 typeStr = "SMESH.SMESH_MeshEditor.AXIS";
1504 aTrsf.SetMirror( gp_Ax2( P, V ));
1505 typeStr = "SMESH.SMESH_MeshEditor.PLANE";
1508 // Update Python script
1509 TPythonDump() << this << ".Mirror( "
1510 << theIDsOfElements << ", "
1515 ::SMESH_MeshEditor anEditor( _myMesh );
1516 anEditor.Transform (elements, aTrsf, theCopy);
1519 StoreResult(anEditor);
1524 //=======================================================================
1525 //function : MirrorObject
1527 //=======================================================================
1529 void SMESH_MeshEditor_i::MirrorObject(SMESH::SMESH_IDSource_ptr theObject,
1530 const SMESH::AxisStruct & theAxis,
1531 SMESH::SMESH_MeshEditor::MirrorType theMirrorType,
1532 CORBA::Boolean theCopy)
1536 SMESH::long_array_var anElementsId = theObject->GetIDs();
1537 Mirror(anElementsId, theAxis, theMirrorType, theCopy);
1539 // Clear python line, created by Mirror()
1540 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1541 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1543 // Update Python script
1544 TCollection_AsciiString typeStr;
1545 switch ( theMirrorType ) {
1546 case SMESH::SMESH_MeshEditor::POINT:
1547 typeStr = "SMESH.SMESH_MeshEditor.POINT";
1549 case SMESH::SMESH_MeshEditor::AXIS:
1550 typeStr = "SMESH.SMESH_MeshEditor.AXIS";
1553 typeStr = "SMESH.SMESH_MeshEditor.PLANE";
1555 TPythonDump() << "axis = " << theAxis;
1556 TPythonDump() << this << ".MirrorObject( "
1557 << theObject << ", "
1563 //=======================================================================
1564 //function : Translate
1566 //=======================================================================
1568 void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
1569 const SMESH::DirStruct & theVector,
1570 CORBA::Boolean theCopy)
1574 SMESHDS_Mesh* aMesh = GetMeshDS();
1576 TIDSortedElemSet elements;
1577 ToMap(theIDsOfElements, aMesh, elements);
1580 const SMESH::PointStruct * P = &theVector.PS;
1581 aTrsf.SetTranslation( gp_Vec( P->x, P->y, P->z ));
1583 ::SMESH_MeshEditor anEditor( _myMesh );
1584 anEditor.Transform (elements, aTrsf, theCopy);
1587 StoreResult(anEditor);
1590 // Update Python script
1591 TPythonDump() << "vector = " << theVector;
1592 TPythonDump() << this << ".Translate( "
1598 //=======================================================================
1599 //function : TranslateObject
1601 //=======================================================================
1603 void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
1604 const SMESH::DirStruct & theVector,
1605 CORBA::Boolean theCopy)
1609 SMESH::long_array_var anElementsId = theObject->GetIDs();
1610 Translate(anElementsId, theVector, theCopy);
1612 // Clear python line, created by Translate()
1613 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1614 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1616 // Update Python script
1617 TPythonDump() << this << ".TranslateObject( "
1623 //=======================================================================
1626 //=======================================================================
1628 void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
1629 const SMESH::AxisStruct & theAxis,
1630 CORBA::Double theAngle,
1631 CORBA::Boolean theCopy)
1635 SMESHDS_Mesh* aMesh = GetMeshDS();
1637 TIDSortedElemSet elements;
1638 ToMap(theIDsOfElements, aMesh, elements);
1640 gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
1641 gp_Vec V ( theAxis.vx, theAxis.vy, theAxis.vz );
1644 aTrsf.SetRotation( gp_Ax1( P, V ), theAngle);
1646 ::SMESH_MeshEditor anEditor( _myMesh );
1647 anEditor.Transform (elements, aTrsf, theCopy);
1650 StoreResult(anEditor);
1653 // Update Python script
1654 TPythonDump() << "axis = " << theAxis;
1655 TPythonDump() << this << ".Rotate( "
1662 //=======================================================================
1663 //function : RotateObject
1665 //=======================================================================
1667 void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
1668 const SMESH::AxisStruct & theAxis,
1669 CORBA::Double theAngle,
1670 CORBA::Boolean theCopy)
1674 SMESH::long_array_var anElementsId = theObject->GetIDs();
1675 Rotate(anElementsId, theAxis, theAngle, theCopy);
1677 // Clear python line, created by Rotate()
1678 SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
1679 aSMESHGen->RemoveLastFromPythonScript(aSMESHGen->GetCurrentStudyID());
1681 // Update Python script
1682 TPythonDump() << this << ".RotateObject( "
1689 //=======================================================================
1690 //function : FindCoincidentNodes
1692 //=======================================================================
1694 void SMESH_MeshEditor_i::FindCoincidentNodes (CORBA::Double Tolerance,
1695 SMESH::array_of_long_array_out GroupsOfNodes)
1699 ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
1700 ::SMESH_MeshEditor anEditor( _myMesh );
1701 set<const SMDS_MeshNode*> nodes; // no input nodes
1702 anEditor.FindCoincidentNodes( nodes, Tolerance, aListOfListOfNodes );
1704 GroupsOfNodes = new SMESH::array_of_long_array;
1705 GroupsOfNodes->length( aListOfListOfNodes.size() );
1706 ::SMESH_MeshEditor::TListOfListOfNodes::iterator llIt = aListOfListOfNodes.begin();
1707 for ( CORBA::Long i = 0; llIt != aListOfListOfNodes.end(); llIt++, i++ ) {
1708 list< const SMDS_MeshNode* >& aListOfNodes = *llIt;
1709 list< const SMDS_MeshNode* >::iterator lIt = aListOfNodes.begin();;
1710 SMESH::long_array& aGroup = GroupsOfNodes[ i ];
1711 aGroup.length( aListOfNodes.size() );
1712 for ( int j = 0; lIt != aListOfNodes.end(); lIt++, j++ )
1713 aGroup[ j ] = (*lIt)->GetID();
1715 // Update Python script
1716 TPythonDump() << "coincident_nodes = " << this << ".FindCoincidentNodes( "
1717 << Tolerance << " )";
1720 //=======================================================================
1721 //function : MergeNodes
1723 //=======================================================================
1725 void SMESH_MeshEditor_i::MergeNodes (const SMESH::array_of_long_array& GroupsOfNodes)
1729 SMESHDS_Mesh* aMesh = GetMeshDS();
1731 TPythonDump aTPythonDump;
1732 aTPythonDump << this << ".MergeNodes([";
1733 ::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
1734 for (int i = 0; i < GroupsOfNodes.length(); i++)
1736 const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
1737 aListOfListOfNodes.push_back( list< const SMDS_MeshNode* >() );
1738 list< const SMDS_MeshNode* >& aListOfNodes = aListOfListOfNodes.back();
1739 for ( int j = 0; j < aNodeGroup.length(); j++ )
1741 CORBA::Long index = aNodeGroup[ j ];
1742 const SMDS_MeshNode * node = aMesh->FindNode(index);
1744 aListOfNodes.push_back( node );
1746 if ( aListOfNodes.size() < 2 )
1747 aListOfListOfNodes.pop_back();
1749 if ( i > 0 ) aTPythonDump << ", ";
1750 aTPythonDump << aNodeGroup;
1752 ::SMESH_MeshEditor anEditor( _myMesh );
1753 anEditor.MergeNodes( aListOfListOfNodes );
1755 // Update Python script
1756 aTPythonDump << "])";
1759 //=======================================================================
1760 //function : MergeEqualElements
1762 //=======================================================================
1764 void SMESH_MeshEditor_i::MergeEqualElements()
1768 ::SMESH_MeshEditor anEditor( _myMesh );
1769 anEditor.MergeEqualElements();
1771 // Update Python script
1772 TPythonDump() << this << ".MergeEqualElements()";
1775 //=======================================================================
1776 //function : operator
1778 //=======================================================================
1780 #define RETCASE(enm) case ::SMESH_MeshEditor::enm: return SMESH::SMESH_MeshEditor::enm;
1782 static SMESH::SMESH_MeshEditor::Sew_Error convError( const::SMESH_MeshEditor::Sew_Error e )
1786 RETCASE( SEW_BORDER1_NOT_FOUND );
1787 RETCASE( SEW_BORDER2_NOT_FOUND );
1788 RETCASE( SEW_BOTH_BORDERS_NOT_FOUND );
1789 RETCASE( SEW_BAD_SIDE_NODES );
1790 RETCASE( SEW_VOLUMES_TO_SPLIT );
1791 RETCASE( SEW_DIFF_NB_OF_ELEMENTS );
1792 RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
1793 RETCASE( SEW_BAD_SIDE1_NODES );
1794 RETCASE( SEW_BAD_SIDE2_NODES );
1796 return SMESH::SMESH_MeshEditor::SEW_OK;
1799 //=======================================================================
1800 //function : SewFreeBorders
1802 //=======================================================================
1804 SMESH::SMESH_MeshEditor::Sew_Error
1805 SMESH_MeshEditor_i::SewFreeBorders(CORBA::Long FirstNodeID1,
1806 CORBA::Long SecondNodeID1,
1807 CORBA::Long LastNodeID1,
1808 CORBA::Long FirstNodeID2,
1809 CORBA::Long SecondNodeID2,
1810 CORBA::Long LastNodeID2,
1811 CORBA::Boolean CreatePolygons,
1812 CORBA::Boolean CreatePolyedrs)
1816 SMESHDS_Mesh* aMesh = GetMeshDS();
1818 const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
1819 const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
1820 const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
1821 const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
1822 const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
1823 const SMDS_MeshNode* aSide2ThirdNode = aMesh->FindNode( LastNodeID2 );
1825 if (!aBorderFirstNode ||
1826 !aBorderSecondNode||
1828 return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
1829 if (!aSide2FirstNode ||
1830 !aSide2SecondNode ||
1832 return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
1834 // Update Python script
1835 TPythonDump() << "error = " << this << ".SewFreeBorders( "
1836 << FirstNodeID1 << ", "
1837 << SecondNodeID1 << ", "
1838 << LastNodeID1 << ", "
1839 << FirstNodeID2 << ", "
1840 << SecondNodeID2 << ", "
1841 << LastNodeID2 << ", "
1842 << CreatePolygons<< ", "
1843 << CreatePolyedrs<< " )";
1845 ::SMESH_MeshEditor anEditor( _myMesh );
1846 SMESH::SMESH_MeshEditor::Sew_Error error =
1847 convError( anEditor.SewFreeBorder (aBorderFirstNode,
1857 StoreResult(anEditor);
1863 //=======================================================================
1864 //function : SewConformFreeBorders
1866 //=======================================================================
1868 SMESH::SMESH_MeshEditor::Sew_Error
1869 SMESH_MeshEditor_i::SewConformFreeBorders(CORBA::Long FirstNodeID1,
1870 CORBA::Long SecondNodeID1,
1871 CORBA::Long LastNodeID1,
1872 CORBA::Long FirstNodeID2,
1873 CORBA::Long SecondNodeID2)
1877 SMESHDS_Mesh* aMesh = GetMeshDS();
1879 const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeID1 );
1880 const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeID1 );
1881 const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeID1 );
1882 const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeID2 );
1883 const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( SecondNodeID2 );
1884 const SMDS_MeshNode* aSide2ThirdNode = 0;
1886 if (!aBorderFirstNode ||
1887 !aBorderSecondNode||
1889 return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
1890 if (!aSide2FirstNode ||
1892 return SMESH::SMESH_MeshEditor::SEW_BORDER2_NOT_FOUND;
1894 // Update Python script
1895 TPythonDump() << "error = " << this << ".SewConformFreeBorders( "
1896 << FirstNodeID1 << ", "
1897 << SecondNodeID1 << ", "
1898 << LastNodeID1 << ", "
1899 << FirstNodeID2 << ", "
1900 << SecondNodeID2 << " )";
1902 ::SMESH_MeshEditor anEditor( _myMesh );
1903 SMESH::SMESH_MeshEditor::Sew_Error error =
1904 convError( anEditor.SewFreeBorder (aBorderFirstNode,
1913 StoreResult(anEditor);
1919 //=======================================================================
1920 //function : SewBorderToSide
1922 //=======================================================================
1924 SMESH::SMESH_MeshEditor::Sew_Error
1925 SMESH_MeshEditor_i::SewBorderToSide(CORBA::Long FirstNodeIDOnFreeBorder,
1926 CORBA::Long SecondNodeIDOnFreeBorder,
1927 CORBA::Long LastNodeIDOnFreeBorder,
1928 CORBA::Long FirstNodeIDOnSide,
1929 CORBA::Long LastNodeIDOnSide,
1930 CORBA::Boolean CreatePolygons,
1931 CORBA::Boolean CreatePolyedrs)
1935 SMESHDS_Mesh* aMesh = GetMeshDS();
1937 const SMDS_MeshNode* aBorderFirstNode = aMesh->FindNode( FirstNodeIDOnFreeBorder );
1938 const SMDS_MeshNode* aBorderSecondNode = aMesh->FindNode( SecondNodeIDOnFreeBorder );
1939 const SMDS_MeshNode* aBorderLastNode = aMesh->FindNode( LastNodeIDOnFreeBorder );
1940 const SMDS_MeshNode* aSide2FirstNode = aMesh->FindNode( FirstNodeIDOnSide );
1941 const SMDS_MeshNode* aSide2SecondNode = aMesh->FindNode( LastNodeIDOnSide );
1942 const SMDS_MeshNode* aSide2ThirdNode = 0;
1944 if (!aBorderFirstNode ||
1945 !aBorderSecondNode||
1947 return SMESH::SMESH_MeshEditor::SEW_BORDER1_NOT_FOUND;
1948 if (!aSide2FirstNode ||
1950 return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE_NODES;
1952 // Update Python script
1953 TPythonDump() << "error = " << this << ".SewBorderToSide( "
1954 << FirstNodeIDOnFreeBorder << ", "
1955 << SecondNodeIDOnFreeBorder << ", "
1956 << LastNodeIDOnFreeBorder << ", "
1957 << FirstNodeIDOnSide << ", "
1958 << LastNodeIDOnSide << ", "
1959 << CreatePolygons << ", "
1960 << CreatePolyedrs << ") ";
1962 ::SMESH_MeshEditor anEditor( _myMesh );
1963 SMESH::SMESH_MeshEditor::Sew_Error error =
1964 convError( anEditor.SewFreeBorder (aBorderFirstNode,
1974 StoreResult(anEditor);
1980 //=======================================================================
1981 //function : SewSideElements
1983 //=======================================================================
1985 SMESH::SMESH_MeshEditor::Sew_Error
1986 SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
1987 const SMESH::long_array& IDsOfSide2Elements,
1988 CORBA::Long NodeID1OfSide1ToMerge,
1989 CORBA::Long NodeID1OfSide2ToMerge,
1990 CORBA::Long NodeID2OfSide1ToMerge,
1991 CORBA::Long NodeID2OfSide2ToMerge)
1995 SMESHDS_Mesh* aMesh = GetMeshDS();
1997 const SMDS_MeshNode* aFirstNode1ToMerge = aMesh->FindNode( NodeID1OfSide1ToMerge );
1998 const SMDS_MeshNode* aFirstNode2ToMerge = aMesh->FindNode( NodeID1OfSide2ToMerge );
1999 const SMDS_MeshNode* aSecondNode1ToMerge = aMesh->FindNode( NodeID2OfSide1ToMerge );
2000 const SMDS_MeshNode* aSecondNode2ToMerge = aMesh->FindNode( NodeID2OfSide2ToMerge );
2002 if (!aFirstNode1ToMerge ||
2003 !aFirstNode2ToMerge )
2004 return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE1_NODES;
2005 if (!aSecondNode1ToMerge||
2006 !aSecondNode2ToMerge)
2007 return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE2_NODES;
2009 TIDSortedElemSet aSide1Elems, aSide2Elems;
2010 ToMap(IDsOfSide1Elements, aMesh, aSide1Elems);
2011 ToMap(IDsOfSide2Elements, aMesh, aSide2Elems);
2013 // Update Python script
2014 TPythonDump() << "error = " << this << ".SewSideElements( "
2015 << IDsOfSide1Elements << ", "
2016 << IDsOfSide2Elements << ", "
2017 << NodeID1OfSide1ToMerge << ", "
2018 << NodeID1OfSide2ToMerge << ", "
2019 << NodeID2OfSide1ToMerge << ", "
2020 << NodeID2OfSide2ToMerge << ")";
2022 ::SMESH_MeshEditor anEditor( _myMesh );
2023 SMESH::SMESH_MeshEditor::Sew_Error error =
2024 convError( anEditor.SewSideElements (aSide1Elems, aSide2Elems,
2027 aSecondNode1ToMerge,
2028 aSecondNode2ToMerge));
2030 StoreResult(anEditor);
2035 //================================================================================
2037 * \brief Set new nodes for given element
2038 * \param ide - element id
2039 * \param newIDs - new node ids
2040 * \retval CORBA::Boolean - true if result is OK
2042 //================================================================================
2044 CORBA::Boolean SMESH_MeshEditor_i::ChangeElemNodes(CORBA::Long ide,
2045 const SMESH::long_array& newIDs)
2049 const SMDS_MeshElement* elem = GetMeshDS()->FindElement(ide);
2050 if(!elem) return false;
2052 int nbn = newIDs.length();
2054 const SMDS_MeshNode* aNodes [nbn];
2057 const SMDS_MeshNode* aNode = GetMeshDS()->FindNode(newIDs[i]);
2060 aNodes[nbn1] = aNode;
2063 // Update Python script
2064 TPythonDump() << "isDone = " << this << ".ChangeElemNodes( "
2065 << ide << ", " << newIDs << " )";
2067 TPythonDump() << "print 'ChangeElemNodes: ', isDone";
2070 return GetMeshDS()->ChangeElementNodes( elem, aNodes, nbn1+1 );
2073 //================================================================================
2075 * \brief Update myLastCreated* or myPreviewData
2076 * \param anEditor - it contains last modification results
2078 //================================================================================
2080 void SMESH_MeshEditor_i::StoreResult(::SMESH_MeshEditor& anEditor)
2082 if ( myPreviewMode ) { // --- MeshPreviewStruct filling ---
2084 list<int> aNodesConnectivity;
2085 typedef map<int, int> TNodesMap;
2088 TPreviewMesh * aPreviewMesh = dynamic_cast< TPreviewMesh* >( anEditor.GetMesh() );
2089 SMDSAbs_ElementType previewType = aPreviewMesh->myPreviewType;
2091 SMESHDS_Mesh* aMeshDS = anEditor.GetMeshDS();
2092 int nbEdges = aMeshDS->NbEdges();
2093 int nbFaces = aMeshDS->NbFaces();
2094 int nbVolum = aMeshDS->NbVolumes();
2095 switch ( previewType ) {
2096 case SMDSAbs_Edge : nbFaces = nbVolum = 0; break;
2097 case SMDSAbs_Face : nbEdges = nbVolum = 0; break;
2098 case SMDSAbs_Volume: nbEdges = nbFaces = 0; break;
2101 myPreviewData->nodesXYZ.length(aMeshDS->NbNodes());
2102 myPreviewData->elementTypes.length(nbEdges + nbFaces + nbVolum);
2104 SMDS_ElemIteratorPtr itMeshElems = aMeshDS->elementsIterator();
2106 while ( itMeshElems->more() ) {
2107 const SMDS_MeshElement* aMeshElem = itMeshElems->next();
2108 if ( previewType != SMDSAbs_All && aMeshElem->GetType() != previewType )
2111 SMDS_ElemIteratorPtr itElemNodes = aMeshElem->nodesIterator();
2112 while ( itElemNodes->more() ) {
2113 const SMDS_MeshNode* aMeshNode =
2114 static_cast<const SMDS_MeshNode*>( itElemNodes->next() );
2115 int aNodeID = aMeshNode->GetID();
2116 TNodesMap::iterator anIter = nodesMap.find(aNodeID);
2117 if ( anIter == nodesMap.end() ) {
2118 // filling the nodes coordinates
2119 myPreviewData->nodesXYZ[j].x = aMeshNode->X();
2120 myPreviewData->nodesXYZ[j].y = aMeshNode->Y();
2121 myPreviewData->nodesXYZ[j].z = aMeshNode->Z();
2122 anIter = nodesMap.insert( make_pair(aNodeID, j) ).first;
2125 aNodesConnectivity.push_back(anIter->second);
2128 // filling the elements types
2129 SMDSAbs_ElementType aType;
2131 /*if (aMeshElem->GetType() == SMDSAbs_Volume) {
2132 aType = SMDSAbs_Node;
2136 aType = aMeshElem->GetType();
2137 isPoly = aMeshElem->IsPoly();
2140 myPreviewData->elementTypes[i].SMDS_ElementType = (SMESH::ElementType) aType;
2141 myPreviewData->elementTypes[i].isPoly = isPoly;
2142 myPreviewData->elementTypes[i].nbNodesInElement = aMeshElem->NbNodes();
2146 myPreviewData->nodesXYZ.length( j );
2148 // filling the elements connectivities
2149 list<int>::iterator aConnIter = aNodesConnectivity.begin();
2150 myPreviewData->elementConnectivities.length(aNodesConnectivity.size());
2151 for( int i = 0; aConnIter != aNodesConnectivity.end(); aConnIter++, i++ )
2152 myPreviewData->elementConnectivities[i] = *aConnIter;
2158 // add new nodes into myLastCreatedNodes
2159 const SMESH_SequenceOfElemPtr& aSeq = anEditor.GetLastCreatedNodes();
2160 myLastCreatedNodes->length(aSeq.Length());
2161 for(int i=0; i<aSeq.Length(); i++)
2162 myLastCreatedNodes[i] = aSeq.Value(i+1)->GetID();
2165 // add new elements into myLastCreatedElems
2166 const SMESH_SequenceOfElemPtr& aSeq = anEditor.GetLastCreatedElems();
2167 myLastCreatedElems->length(aSeq.Length());
2168 for(int i=0; i<aSeq.Length(); i++)
2169 myLastCreatedElems[i] = aSeq.Value(i+1)->GetID();
2173 //================================================================================
2175 * Return data of mesh edition preview
2177 //================================================================================
2179 SMESH::MeshPreviewStruct* SMESH_MeshEditor_i::GetPreviewData()
2181 return myPreviewData._retn();
2184 //================================================================================
2186 * \brief Returns list of it's IDs of created nodes
2187 * \retval SMESH::long_array* - list of node ID
2189 //================================================================================
2191 SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedNodes()
2193 return myLastCreatedNodes._retn();
2196 //================================================================================
2198 * \brief Returns list of it's IDs of created elements
2199 * \retval SMESH::long_array* - list of elements' ID
2201 //================================================================================
2203 SMESH::long_array* SMESH_MeshEditor_i::GetLastCreatedElems()
2205 return myLastCreatedElems._retn();
2208 //=======================================================================
2209 //function : ConvertToQuadratic
2211 //=======================================================================
2213 void SMESH_MeshEditor_i::ConvertToQuadratic(CORBA::Boolean theForce3d)
2215 ::SMESH_MeshEditor anEditor( _myMesh );
2216 anEditor.ConvertToQuadratic(theForce3d);
2217 // Update Python script
2218 TPythonDump() << this << ".ConvertToQuadratic( " << theForce3d << " )";
2221 //=======================================================================
2222 //function : ConvertFromQuadratic
2224 //=======================================================================
2226 CORBA::Boolean SMESH_MeshEditor_i::ConvertFromQuadratic()
2228 ::SMESH_MeshEditor anEditor( _myMesh );
2229 CORBA::Boolean isDone = anEditor.ConvertFromQuadratic();
2230 // Update Python script
2231 TPythonDump() << this << ".ConvertFromQuadratic()";