X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_2smeshpy.cxx;h=e12cd7f5a5b6b323af282eb2e8ebd4a6b0c8970f;hp=44cb333a54b7403ab4ef7c0652a3331984f94154;hb=b0a908c0d20341651771d0249fb10882f54b2aad;hpb=e33e8e2029a4e91779b9c1d5f480979fa7b51d0b diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 44cb333a5..e12cd7f5a 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2014 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 @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -201,6 +201,9 @@ namespace { _AString comment; _pyID obj = cmd->GetObject(); + if ( obj.Search( "print " ) == 1 ) + return; // print statement + if ( !obj.IsEmpty() && obj.Value( obj.Length() ) == ')' ) // remove an accessor method obj = _pyCommand( obj ).GetObject(); @@ -369,7 +372,7 @@ namespace { */ //================================================================================ - void StructToList( Handle( _pyCommand)& theCommand ) + void StructToList( Handle( _pyCommand)& theCommand, const bool checkMethod=true ) { static TStringSet methodsAcceptingList; if ( methodsAcceptingList.empty() ) { @@ -383,11 +386,11 @@ namespace { "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", "Translate","TranslateMakeGroups","TranslateMakeMesh", "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh", - "ExtrusionAlongPathX","ExtrusionAlongPathObjX" + "ExtrusionAlongPathX","ExtrusionAlongPathObjX","SplitHexahedraIntoPrisms" ,"" }; // <- mark of the end methodsAcceptingList.Insert( methodNames ); } - if ( methodsAcceptingList.Contains( theCommand->GetMethod() )) + if ( !checkMethod || methodsAcceptingList.Contains( theCommand->GetMethod() )) { for ( int i = theCommand->GetNbArgs(); i > 0; --i ) { @@ -2072,6 +2075,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand ) "GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ", "GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes", "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces", + "GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes", "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor", "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder" ,"" }; // <- mark of end @@ -2372,7 +2376,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand) "GetLastCreatedElems", "MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh","TranslateObjectMakeMesh", "Scale","ScaleMakeMesh","RotateMakeMesh","RotateObjectMakeMesh","MakeBoundaryMesh", - "MakeBoundaryElements", "SplitVolumesIntoTetra", + "MakeBoundaryElements", "SplitVolumesIntoTetra","SplitHexahedraIntoPrisms", "DoubleElements","DoubleNodes","DoubleNode","DoubleNodeGroup","DoubleNodeGroups", "DoubleNodeElem","DoubleNodeElemInRegion","DoubleNodeElemGroup", "DoubleNodeElemGroupInRegion","DoubleNodeElemGroups","DoubleNodeElemGroupsInRegion", @@ -2628,6 +2632,8 @@ Handle(_pyHypothesis) _pyHypothesis::NewHypothesis( const Handle(_pyCommand)& th hyp->SetConvMethodAndType( "SetGrid", "Cartesian_3D"); for ( int iArg = 0; iArg < 4; ++iArg ) hyp->setCreationArg( iArg+1, "[]"); + hyp->AddAccumulativeMethod( "SetGrid" ); + hyp->AddAccumulativeMethod( "SetGridSpacing" ); } else { @@ -3086,9 +3092,11 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) { // CartesianParameters3D hyp - if ( theCommand->GetMethod() == "SetSizeThreshold" ) + if ( theCommand->GetMethod() == "SetSizeThreshold" || + theCommand->GetMethod() == "SetToAddEdges" ) { - setCreationArg( 4, theCommand->GetArg( 1 )); + int iEdges = ( theCommand->GetMethod().Value( 4 ) == 'T' ); + setCreationArg( 4+iEdges, theCommand->GetArg( 1 )); myArgCommands.push_back( theCommand ); return; } @@ -3110,7 +3118,9 @@ void _pyComplexParamHypo::Process( const Handle(_pyCommand)& theCommand) myCurCrMethod->myArgs[ iArg ] += "]"; } myArgCommands.push_back( theCommand ); - rememberCmdOfParameter( theCommand ); + //rememberCmdOfParameter( theCommand ); -- these commands are marked as + // accumulative, else, if the creation + // is not converted, commands for axes 1 and 2 are lost return; } } @@ -3151,13 +3161,23 @@ void _pyComplexParamHypo::Flush() for ( ; 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 ); + } + } } } //================================================================================ /*! * \brief Convert methods of 1D hypotheses to my own methods - * \param theCommand - The called hypothesis method + * \param theCommand - The called hypothesis method */ //================================================================================ @@ -4246,10 +4266,13 @@ bool _pySelfEraser::CanClear() { int nbCalls = 0; std::list< Handle(_pyCommand) >& cmds = GetProcessedCmds(); - std::list< Handle(_pyCommand) >::const_iterator cmd = cmds.begin(); - for ( ; cmd != cmds.end(); ++cmd ) + std::list< Handle(_pyCommand) >::iterator cmd = cmds.begin(); + for ( ; cmd != cmds.end(); ) // check of cmd emptiness is not enough as object can change - nbCalls += ( ( *cmd )->GetString().Search( GetID() ) > 0 ); + if (( *cmd )->GetString().Search( GetID() ) > 0 ) + ++nbCalls, ++cmd; + else + cmd = cmds.erase( cmd ); // save the cmd from clearing toErase = ( nbCalls < 1 ); }