-// 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
// 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
*/
//================================================================================
- void StructToList( Handle( _pyCommand)& theCommand )
+ void StructToList( Handle( _pyCommand)& theCommand, const bool checkMethod=true )
{
static TStringSet methodsAcceptingList;
if ( methodsAcceptingList.empty() ) {
"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 )
{
TCollection_AsciiString newMethod = method;
newMethod.Remove( 7, 6 );
theCommand->SetMethod( newMethod );
- // make the 1st arg be the last one (or last but one for ExportMED())
+ // make the 1st arg be the last one (or last but three for ExportMED())
_pyID partID = theCommand->GetArg( 1 );
- int nbArgs = theCommand->GetNbArgs() - (newMethod == "ExportMED");
+ int nbArgs = theCommand->GetNbArgs() - 3 * (newMethod == "ExportMED");
for ( int i = 2; i <= nbArgs; ++i )
theCommand->SetArg( i-1, theCommand->GetArg( i ));
theCommand->SetArg( nbArgs, partID );
"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
"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",
hyp->SetConvMethodAndType( "SetGrid", "Cartesian_3D");
for ( int iArg = 0; iArg < 4; ++iArg )
hyp->setCreationArg( iArg+1, "[]");
+ hyp->AddAccumulativeMethod( "SetGrid" );
+ hyp->AddAccumulativeMethod( "SetGridSpacing" );
}
else
{
{
// 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;
}
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;
}
}
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
*/
//================================================================================
{
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 );
}