X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=097dd94b7f57fa21ebf7cfb523030d46964153b2;hp=b7b5b5f0fcd8e35589fb3017531b78b390a0c8ae;hb=ad4fc4d4c9f7b740fa6b7a7e1cacd173915c1bcb;hpb=99baeb95830d5fe79a2cadd291ef083496c34909 diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index b7b5b5f0f..097dd94b7 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -306,6 +306,8 @@ namespace { // - FT_EntityType = 36 // v 7.3.0: FT_Undefined == 46, new items: // - FT_ConnectedElements = 39 + // v 7.6.0: FT_Undefined == 47, new items: + // - FT_BelongToMeshGroup = 22 // // It's necessary to continue recording this history and to fill // undef2newItems (see below) accordingly. @@ -326,6 +328,7 @@ namespace { undef2newItems[ 44 ].push_back( 37 ); undef2newItems[ 45 ].push_back( 36 ); undef2newItems[ 46 ].push_back( 39 ); + undef2newItems[ 47 ].push_back( 22 ); ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined ); } @@ -384,6 +387,7 @@ namespace { "ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D", "ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups", "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", + "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects", "Translate","TranslateMakeGroups","TranslateMakeMesh", "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh", "ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms" @@ -431,7 +435,8 @@ namespace { "ExportCGNS","ExportGMF", "Create0DElementsOnAllNodes","Reorient2D","QuadTo4Tri", "ScaleMakeGroups","Scale","ScaleMakeMesh", - "FindCoincidentNodesOnPartBut","DoubleElements" + "FindCoincidentNodesOnPartBut","DoubleElements", + "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects" ,"" }; // <- mark of the end methodsAcceptingList.Insert( methodNames ); } @@ -888,18 +893,22 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand if ( Type == "SMESH.FT_ElemGeomType" ) { // set SMESH.GeometryType instead of a numerical Threshold - const int nbTypes = SMESH::Geom_BALL+1; + const int nbTypes = SMESH::Geom_LAST; const char* types[nbTypes] = { "Geom_POINT", "Geom_EDGE", "Geom_TRIANGLE", "Geom_QUADRANGLE", "Geom_POLYGON", "Geom_TETRA", "Geom_PYRAMID", "Geom_HEXA", "Geom_PENTA", "Geom_HEXAGONAL_PRISM", "Geom_POLYHEDRA", "Geom_BALL" }; if ( -1 < iGeom && iGeom < nbTypes ) Threshold = SMESH + types[ iGeom ]; +#ifdef _DEBUG_ + // is types complete? (compilation failure mains that enum GeometryType changed) + int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; +#endif } if (Type == "SMESH.FT_EntityType") { // set SMESH.EntityType instead of a numerical Threshold - const int nbTypes = SMESH::Entity_Ball+1; + const int nbTypes = SMESH::Entity_Last; const char* types[nbTypes] = { "Entity_Node", "Entity_0D", "Entity_Edge", "Entity_Quad_Edge", "Entity_Triangle", "Entity_Quad_Triangle", "Entity_BiQuad_Triangle", @@ -911,6 +920,10 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand "Entity_Polyhedra", "Entity_Quad_Polyhedra", "Entity_Ball" }; if ( -1 < iGeom && iGeom < nbTypes ) Threshold = SMESH + types[ iGeom ]; +#ifdef _DEBUG_ + // is types complete? (compilation failure mains that enum EntityType changed) + int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; +#endif } } if ( ThresholdID.Length() != 2 ) // neither '' nor "" @@ -1793,10 +1806,29 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) list< Handle(_pyHypothesis) >::iterator hyp; if ( !myLastComputeCmd.IsNull() ) { - for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) - (*hyp)->ComputeDiscarded( myLastComputeCmd ); + // check if the previously computed mesh has been edited, + // if so then we do not clear the previous Compute() + bool toClear = true; + if ( myLastComputeCmd->GetMethod() == "Compute" ) + { + list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin(); + for ( ; e != myEditors.end() && toClear; ++e ) + { + list< Handle(_pyCommand)>& cmds = (*e)->GetProcessedCmds(); + list< Handle(_pyCommand) >::reverse_iterator cmd = cmds.rbegin(); + if ( cmd != cmds.rend() && + (*cmd)->GetOrderNb() > myLastComputeCmd->GetOrderNb() ) + toClear = false; + } + } + if ( toClear ) + { + // clear hyp commands called before myLastComputeCmd + for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) + (*hyp)->ComputeDiscarded( myLastComputeCmd ); - myLastComputeCmd->Clear(); + myLastComputeCmd->Clear(); + } } myLastComputeCmd = theCommand; @@ -1961,7 +1993,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) // // remove "PartTo" from the method TCollection_AsciiString newMethod = method; - newMethod.Remove( 7, 6 ); + newMethod.Remove( /*where=*/7, /*howmany=*/6 ); theCommand->SetMethod( newMethod ); // make the 1st arg be the last one (or last but three for ExportMED()) _pyID partID = theCommand->GetArg( 1 ); @@ -2073,8 +2105,8 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) if ( sameMethods.empty() ) { const char * names[] = { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents", - "GetGroups","UnionGroups","IntersectGroups","CutGroups","GetLog","GetId","ClearLog", - "GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements", + "GetGroups","UnionGroups","IntersectGroups","CutGroups","CreateDimGroup","GetLog","GetId", + "ClearLog","GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements", "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles", "NbTrianglesOfOrder","NbQuadrangles","NbQuadranglesOfOrder","NbPolygons","NbVolumes", "NbVolumesOfOrder","NbTetras","NbTetrasOfOrder","NbHexas","NbHexasOfOrder", @@ -2369,14 +2401,15 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall", "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces", "MoveNode", "MoveClosestNodeToPoint", - "InverseDiag","DeleteDiag","Reorient","ReorientObject", + "InverseDiag","DeleteDiag","Reorient","ReorientObject","Reorient2DBy3D", "TriToQuad","TriToQuadObject", "QuadTo4Tri", "SplitQuad","SplitQuadObject", "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject", "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements", "RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D", "ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D", - "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject", + "ExtrusionByNormal", "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject", "ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D", + "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects", "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject", "FindCoincidentNodes","MergeNodes","FindEqualElements", "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders", @@ -2758,7 +2791,7 @@ void _pyHypothesis::Process( const Handle(_pyCommand)& theCommand) myArgCommands.push_back( theCommand ); usedCommand = true; while ( crMethod.myArgs.size() < i+1 ) - crMethod.myArgs.push_back( "[]" ); + crMethod.myArgs.push_back( "None" ); crMethod.myArgs[ i ] = theCommand->GetArg( crMethod.myArgNb[i] ); } } @@ -3163,23 +3196,28 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) void _pyComplexParamHypo::Flush() { + list < Handle(_pyCommand) >::iterator cmd; if ( IsWrapped() ) { - list < Handle(_pyCommand) >::iterator cmd = myUnusedCommands.begin(); - for ( ; cmd != myUnusedCommands.end(); ++cmd ) + for ( cmd = myUnusedCommands.begin(); cmd != myUnusedCommands.end(); ++cmd ) if ((*cmd)->GetMethod() == "SetObjectEntry" ) (*cmd)->Clear(); - - if ( GetAlgoType() == "Cartesian_3D" ) - { - _pyID algo = myCreationCmd->GetObject(); - for ( cmd = myProcessedCmds.begin(); cmd != myProcessedCmds.end(); ++cmd ) - { - StructToList( *cmd, /*checkMethod=*/false ); - (*cmd)->SetObject( algo ); - } - } } + + // if ( GetAlgoType() == "Cartesian_3D" ) + // { + // _pyID algo = myCreationCmd->GetObject(); + // for ( cmd = myProcessedCmds.begin(); cmd != myProcessedCmds.end(); ++cmd ) + // { + // if ( IsWrapped() ) + // { + // StructToList( *cmd, /*checkMethod=*/false ); + // const _AString & method = (*cmd)->GetMethod(); + // if ( method == "SetFixedPoint" ) + // (*cmd)->SetObject( algo ); + // } + // } + // } } //================================================================================