mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 18:14:17 +05:00
Merge from BR_DumpPython_Extension branch (from tag mergeto_BR_V5_Dev_28Jan09)
This commit is contained in:
parent
3443420a18
commit
586cf75e22
BIN
doc/salome/gui/SMESH/images/addnode_notebook.png
Executable file
BIN
doc/salome/gui/SMESH/images/addnode_notebook.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -43,6 +43,11 @@ created:
|
||||
|
||||
\image html add_node.png
|
||||
|
||||
\note You can also use variables defined in the SALOME \b NoteBook
|
||||
to specify coordinates of the node:
|
||||
|
||||
\image html addnode_notebook.png
|
||||
|
||||
<br>
|
||||
\anchor adding_edges_anchor
|
||||
<h2>Adding edges</h2>
|
||||
|
@ -16,6 +16,7 @@ the VTK viewer;</li>
|
||||
allowing to highlight important elements:
|
||||
<li>\subpage modifying_meshes_page "modifying meshes" with a vast
|
||||
array of dedicated operations.</li>
|
||||
<li>\subpage using_notebook_mesh_page.</li>
|
||||
</ul>
|
||||
|
||||
Almost all mesh module functionalities are accessible via
|
||||
|
33
doc/salome/gui/SMESH/input/using_notebook_smesh_page.doc
Normal file
33
doc/salome/gui/SMESH/input/using_notebook_smesh_page.doc
Normal file
@ -0,0 +1,33 @@
|
||||
/*!
|
||||
|
||||
\page using_notebook_mesh_page Using SALOME NoteBook
|
||||
|
||||
It is possible to use variables defined through <b>SALOME NoteBook</b> for
|
||||
creation and modification of objects in the MESH module with the following
|
||||
limitations:
|
||||
|
||||
<ul>
|
||||
<li> \ref radial_prism_algo_page "Distribution of Layers" hypothesis -
|
||||
parametrical values are correctly applied, but they are not restored
|
||||
after "Update study" operation.
|
||||
<li> \ref a1d_meshing_hypo_page "Number of Segments" hypothesis, Distribution
|
||||
with Table Density and Distribution with Analytic Density - parametrical
|
||||
values are not applicable.
|
||||
<li> \ref translation_page "Translation" dialog box, default mode
|
||||
(translation by two points) - parametrical values are correctly applied,
|
||||
but they are not restored after "Update study" operation.
|
||||
<li> \ref merging_nodes_page "Merging nodes" dialog box - parametrical value
|
||||
(tolerance of coincident nodes detection) is correctly applied,
|
||||
but it is not restored after "Update study" operation.
|
||||
<li> \ref revolution_page "Revolution" dialog box - it is impossible to
|
||||
use the angle of revolution as "total angle" if it is defined as variable.
|
||||
<li> \ref extrusion_along_path_page "Extrusion along a path" dialog box - it is
|
||||
impossible to use "Linear variation of the angles" mode if at least one of
|
||||
those angles is defined as variable.
|
||||
<li> \ref pattern_mapping_page "Pattern mapping" dialog box - parametrical
|
||||
values (indices of nodes) are correctly applied, but they are not restored
|
||||
after "Update study" operation.
|
||||
<li> \ref clipping_page "Clipping" dialog box.
|
||||
<li> <b>Colors / Size</b> dialog box.
|
||||
</ul>
|
||||
*/
|
@ -39,8 +39,11 @@ module SMESH
|
||||
DIM_3D
|
||||
};
|
||||
|
||||
typedef sequence<string> ListOfParameters;
|
||||
|
||||
interface SMESH_Hypothesis : SALOME::GenericObj
|
||||
{
|
||||
|
||||
/*!
|
||||
* Get the Hypothesis typeName
|
||||
*/
|
||||
@ -55,7 +58,36 @@ module SMESH
|
||||
* Get the internal Id
|
||||
*/
|
||||
long GetId();
|
||||
|
||||
/*!
|
||||
* Set list of parameters
|
||||
* \param theParameters is a string containing the notebook variables separated by ":" symbol,
|
||||
* used for Hypothesis creation
|
||||
*/
|
||||
void SetParameters (in string theParameters);
|
||||
|
||||
/*!
|
||||
* Return list of notebook variables used for Hypothesis creation separated by ":" symbol
|
||||
*/
|
||||
string GetParameters();
|
||||
|
||||
/*!
|
||||
* Return list of last notebook variables used for Hypothesis creation.
|
||||
*/
|
||||
ListOfParameters GetLastParameters();
|
||||
|
||||
/*!
|
||||
* Set list of parameters
|
||||
* \param theParameters is a string containing the last notebook variables separated by ":" symbol,
|
||||
* used for Hypothesis creation
|
||||
*/
|
||||
void SetLastParameters(in string theParameters);
|
||||
|
||||
/*!
|
||||
* Clear parameters list
|
||||
*/
|
||||
void ClearParameters();
|
||||
|
||||
/*!
|
||||
* Verify whether hypothesis supports given entity type
|
||||
*/
|
||||
|
@ -718,6 +718,22 @@ module SMESH
|
||||
|
||||
/*! Gets information about imported MED file */
|
||||
SALOME_MED::MedFileInfo GetMEDFileInfo();
|
||||
|
||||
/*!
|
||||
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
* \param theParameters is a string containing the notebook variables
|
||||
*/
|
||||
void SetParameters (in string theParameters);
|
||||
|
||||
/*!
|
||||
* Returns list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
string GetParameters();
|
||||
|
||||
/*!
|
||||
* Returns list of notebook variables used for last Mesh operation
|
||||
*/
|
||||
string_array GetLastParameters();
|
||||
};
|
||||
|
||||
interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
|
||||
|
@ -281,6 +281,48 @@ module SMESH
|
||||
in double AngleInRadians,
|
||||
in long NbOfSteps,
|
||||
in double Tolerance);
|
||||
/*!
|
||||
* \brief Genarate dim+1 elements by rotation of the object around axis
|
||||
* \param theObject - object containing elements to ratate
|
||||
* \param Axix - rotation axis
|
||||
* \param AngleInRadians - rotation angle
|
||||
* \param NbOfSteps - number of elements to generate from one element
|
||||
*/
|
||||
void RotationSweepObject1D(in SMESH_IDSource theObject,
|
||||
in AxisStruct Axix,
|
||||
in double AngleInRadians,
|
||||
in long NbOfSteps,
|
||||
in double Tolerance);
|
||||
/*!
|
||||
* \brief Same as previous but additionally create groups of elements
|
||||
* generated from elements belonging to preexisting groups
|
||||
*/
|
||||
ListOfGroups RotationSweepObject1DMakeGroups(in SMESH_IDSource theObject,
|
||||
in AxisStruct Axix,
|
||||
in double AngleInRadians,
|
||||
in long NbOfSteps,
|
||||
in double Tolerance);
|
||||
/*!
|
||||
* \brief Genarate dim+1 elements by rotation of the object around axis
|
||||
* \param theObject - object containing elements to ratate
|
||||
* \param Axix - rotation axis
|
||||
* \param AngleInRadians - rotation angle
|
||||
* \param NbOfSteps - number of elements to generate from one element
|
||||
*/
|
||||
void RotationSweepObject2D(in SMESH_IDSource theObject,
|
||||
in AxisStruct Axix,
|
||||
in double AngleInRadians,
|
||||
in long NbOfSteps,
|
||||
in double Tolerance);
|
||||
/*!
|
||||
* \brief Same as previous but additionally create groups of elements
|
||||
* generated from elements belonging to preexisting groups
|
||||
*/
|
||||
ListOfGroups RotationSweepObject2DMakeGroups(in SMESH_IDSource theObject,
|
||||
in AxisStruct Axix,
|
||||
in double AngleInRadians,
|
||||
in long NbOfSteps,
|
||||
in double Tolerance);
|
||||
/*!
|
||||
* \brief Genarate dim+1 elements by extrusion of elements along vector
|
||||
* \param IDsOfElements - elements to sweep
|
||||
@ -386,6 +428,42 @@ module SMESH
|
||||
in PointStruct RefPoint,
|
||||
out Extrusion_Error Error);
|
||||
|
||||
Extrusion_Error ExtrusionAlongPathObject1D(in SMESH_IDSource theObject,
|
||||
in SMESH_Mesh PathMesh,
|
||||
in GEOM::GEOM_Object PathShape,
|
||||
in long NodeStart,
|
||||
in boolean HasAngles,
|
||||
in double_array Angles,
|
||||
in boolean HasRefPoint,
|
||||
in PointStruct RefPoint);
|
||||
ListOfGroups ExtrusionAlongPathObject1DMakeGroups(in SMESH_IDSource theObject,
|
||||
in SMESH_Mesh PathMesh,
|
||||
in GEOM::GEOM_Object PathShape,
|
||||
in long NodeStart,
|
||||
in boolean HasAngles,
|
||||
in double_array Angles,
|
||||
in boolean HasRefPoint,
|
||||
in PointStruct RefPoint,
|
||||
out Extrusion_Error Error);
|
||||
|
||||
Extrusion_Error ExtrusionAlongPathObject2D(in SMESH_IDSource theObject,
|
||||
in SMESH_Mesh PathMesh,
|
||||
in GEOM::GEOM_Object PathShape,
|
||||
in long NodeStart,
|
||||
in boolean HasAngles,
|
||||
in double_array Angles,
|
||||
in boolean HasRefPoint,
|
||||
in PointStruct RefPoint);
|
||||
ListOfGroups ExtrusionAlongPathObject2DMakeGroups(in SMESH_IDSource theObject,
|
||||
in SMESH_Mesh PathMesh,
|
||||
in GEOM::GEOM_Object PathShape,
|
||||
in long NodeStart,
|
||||
in boolean HasAngles,
|
||||
in double_array Angles,
|
||||
in boolean HasRefPoint,
|
||||
in PointStruct RefPoint,
|
||||
out Extrusion_Error Error);
|
||||
|
||||
/*!
|
||||
* Compute rotation angles for ExtrusionAlongPath as linear variation
|
||||
* of given angles along path steps
|
||||
|
@ -50,6 +50,7 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
|
||||
_type = PARAM_ALGO;
|
||||
_shapeType = 0; // to be set by algo with TopAbs_Enum
|
||||
_param_algo_dim = -1; // to be set by algo parameter
|
||||
_parameters = string();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -149,3 +150,59 @@ void SMESH_Hypothesis::SetLibName(const char* theLibName)
|
||||
{
|
||||
_libName = string(theLibName);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis::SetParameters(const char *theParameters)
|
||||
{
|
||||
string aNewParameters(theParameters);
|
||||
if(aNewParameters.size()==0 && _parameters.size()==0)
|
||||
aNewParameters = " ";
|
||||
if(_parameters.size()>0)
|
||||
_parameters +="|";
|
||||
_parameters +=aNewParameters;
|
||||
SetLastParameters(theParameters);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis::ClearParameters()
|
||||
{
|
||||
_parameters = string();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
char* SMESH_Hypothesis::GetParameters() const
|
||||
{
|
||||
return (char*)_parameters.c_str();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
char* SMESH_Hypothesis::GetLastParameters() const
|
||||
{
|
||||
return (char*)_lastParameters.c_str();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis::SetLastParameters(const char* theParameters)
|
||||
{
|
||||
_lastParameters = string(theParameters);
|
||||
}
|
||||
|
@ -77,6 +77,13 @@ public:
|
||||
virtual const char* GetLibName() const;
|
||||
void SetLibName(const char* theLibName);
|
||||
|
||||
void SetParameters(const char *theParameters);
|
||||
char* GetParameters() const;
|
||||
|
||||
void SetLastParameters(const char* theParameters);
|
||||
char* GetLastParameters() const;
|
||||
void ClearParameters();
|
||||
|
||||
/*!
|
||||
* \brief Initialize my parameter values by the mesh built on the geometry
|
||||
* \param theMesh - the built mesh
|
||||
@ -115,6 +122,8 @@ protected:
|
||||
|
||||
private:
|
||||
std::string _libName;
|
||||
std::string _parameters;
|
||||
std::string _lastParameters;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1270,6 +1270,16 @@ SalomeApp_Study* SMESHGUI::activeStudy()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
char* SMESHGUI::JoinObjectParameters(const QStringList& theParametersList)
|
||||
{
|
||||
return theParametersList.join(":").toLatin1().data();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
|
@ -70,6 +70,8 @@ public :
|
||||
static SUIT_ResourceMgr* resourceMgr();
|
||||
static SUIT_Desktop* desktop();
|
||||
static SalomeApp_Study* activeStudy();
|
||||
static char* JoinObjectParameters(const QStringList& theParametersList);
|
||||
|
||||
bool isActiveStudyLocked();
|
||||
|
||||
static bool automaticUpdate();
|
||||
|
@ -285,7 +285,13 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (!myMesh->_is_nil()) {
|
||||
QStringList aParameters;
|
||||
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
|
||||
try {
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
|
||||
@ -303,6 +309,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
||||
CheckBoxMerge->isChecked(),
|
||||
SpinBoxTol->GetValue());
|
||||
|
||||
aCompoundMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
|
||||
mySMESHGUI->updateObjBrowser();
|
||||
} catch(...) {
|
||||
@ -483,6 +491,30 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e )
|
||||
//=================================================================================
|
||||
void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
|
||||
{
|
||||
|
||||
TextLabelTol->setEnabled(toMerge);
|
||||
SpinBoxTol->setEnabled(toMerge);
|
||||
if(!toMerge)
|
||||
SpinBoxTol->SetValue(1e-05);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_BuildCompoundDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok=true;
|
||||
if(CheckBoxMerge->isChecked())
|
||||
ok = SpinBoxTol->isValid( msg, true );
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -72,6 +72,8 @@ private:
|
||||
void hideEvent( QHideEvent* ); /* ESC key */
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
|
||||
bool isValid();
|
||||
|
||||
private:
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
|
@ -487,47 +487,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
!myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
|
||||
return false;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||
|
||||
if (MeshCheck->isChecked()) {
|
||||
// If "Select whole mesh, submesh or group" check box is on ->
|
||||
// get all elements of the required type from the object selected
|
||||
|
||||
// if MESH object is selected
|
||||
if (!CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(myIDSource))) {
|
||||
// get mesh
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(myIDSource);
|
||||
// get IDs from mesh...
|
||||
if (Elements1dRB->isChecked())
|
||||
// 1d elements
|
||||
anElementsId = aMesh->GetElementsByType(SMESH::EDGE);
|
||||
else if (Elements2dRB->isChecked()) {
|
||||
anElementsId = aMesh->GetElementsByType(SMESH::FACE);
|
||||
}
|
||||
}
|
||||
// SUBMESH is selected
|
||||
if (!CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(myIDSource))) {
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(myIDSource);
|
||||
// get IDs from submesh
|
||||
if (Elements1dRB->isChecked())
|
||||
// 1d elements
|
||||
anElementsId = aSubMesh->GetElementsByType(SMESH::EDGE);
|
||||
else if (Elements2dRB->isChecked())
|
||||
// 2d elements
|
||||
anElementsId = aSubMesh->GetElementsByType(SMESH::FACE);
|
||||
}
|
||||
// GROUP is selected
|
||||
if (!CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(myIDSource))) {
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(myIDSource);
|
||||
// get IDs from group
|
||||
// 1d elements or 2d elements
|
||||
if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE ||
|
||||
Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE)
|
||||
anElementsId = aGroup->GetListOfID();
|
||||
}
|
||||
} else {
|
||||
if (!MeshCheck->isChecked()) {
|
||||
// If "Select whole mesh, submesh or group" check box is off ->
|
||||
// use only elements of given type selected by user
|
||||
|
||||
@ -552,10 +517,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
}
|
||||
anElementsId->length(j);
|
||||
}
|
||||
}
|
||||
|
||||
if (anElementsId->length() <= 0) {
|
||||
return false;
|
||||
if (anElementsId->length() <= 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
||||
@ -568,16 +533,17 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList aParameters;
|
||||
|
||||
// get angles
|
||||
SMESH::double_array_var anAngles = new SMESH::double_array;
|
||||
if (AnglesGrp->isChecked()) {
|
||||
anAngles->length(AnglesList->count());
|
||||
anAngles->length(myAnglesList.count());
|
||||
int j = 0;
|
||||
bool bOk;
|
||||
for (int i = 0; i < AnglesList->count(); i++) {
|
||||
double angle = AnglesList->item(i)->text().toDouble(&bOk);
|
||||
if (bOk)
|
||||
anAngles[ j++ ] = angle*PI/180;
|
||||
for (int i = 0; i < myAnglesList.count(); i++) {
|
||||
double angle = myAnglesList[i];
|
||||
anAngles[ j++ ] = angle*PI/180;
|
||||
aParameters << AnglesList->item(i)->text();
|
||||
}
|
||||
anAngles->length(j);
|
||||
}
|
||||
@ -590,6 +556,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
aBasePoint.z = ZSpin->GetValue();
|
||||
}
|
||||
|
||||
aParameters << XSpin->text();
|
||||
aParameters << YSpin->text();
|
||||
aParameters << ZSpin->text();
|
||||
|
||||
try {
|
||||
SUIT_OverrideCursor wc;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
@ -597,17 +567,50 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
||||
anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
|
||||
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint, retVal);
|
||||
else
|
||||
retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint);
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||
if( MeshCheck->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint, retVal);
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionAlongPathObject2DMakeGroups(myIDSource, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint, retVal);
|
||||
}
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint, retVal);
|
||||
}
|
||||
else {
|
||||
if( MeshCheck->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
retVal = aMeshEditor->ExtrusionAlongPathObject1D(myIDSource, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint);
|
||||
else
|
||||
retVal = aMeshEditor->ExtrusionAlongPathObject2D(myIDSource, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint);
|
||||
}
|
||||
else
|
||||
retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
|
||||
myPathShape, aNodeStart,
|
||||
AnglesGrp->isChecked(), anAngles,
|
||||
BasePointGrp->isChecked(), aBasePoint);
|
||||
}
|
||||
|
||||
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
//wc.stop();
|
||||
wc.suspend();
|
||||
@ -1152,7 +1155,18 @@ int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
|
||||
//=======================================================================
|
||||
void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
|
||||
{
|
||||
AnglesList->addItem(QString::number(AngleSpin->GetValue()));
|
||||
QString msg;
|
||||
if( !AngleSpin->isValid( msg, true ) ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return;
|
||||
}
|
||||
AnglesList->addItem(AngleSpin->text());
|
||||
myAnglesList.append(AngleSpin->GetValue());
|
||||
|
||||
updateLinearAngles();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1163,7 +1177,12 @@ void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved()
|
||||
{
|
||||
QList<QListWidgetItem*> aList = AnglesList->selectedItems();
|
||||
QListWidgetItem* anItem;
|
||||
foreach(anItem, aList) delete anItem;
|
||||
foreach(anItem, aList) {
|
||||
myAnglesList.removeAt(AnglesList->row(anItem));
|
||||
delete anItem;
|
||||
}
|
||||
|
||||
updateLinearAngles();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -1233,3 +1252,45 @@ void SMESHGUI_ExtrusionAlongPathDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_ExtrusionAlongPathDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = XSpin->isValid( msg, true ) && ok;
|
||||
ok = YSpin->isValid( msg, true ) && ok;
|
||||
ok = ZSpin->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateLinearAngles
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_ExtrusionAlongPathDlg::updateLinearAngles()
|
||||
{
|
||||
bool enableLinear = true;
|
||||
for( int row = 0, nbRows = AnglesList->count(); row < nbRows; row++ ) {
|
||||
if( QListWidgetItem* anItem = AnglesList->item( row ) ) {
|
||||
enableLinear = false;
|
||||
anItem->text().toDouble(&enableLinear);
|
||||
if( !enableLinear )
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !enableLinear )
|
||||
LinearAnglesCheck->setChecked( false );
|
||||
LinearAnglesCheck->setEnabled( enableLinear );
|
||||
}
|
||||
|
@ -79,6 +79,10 @@ private:
|
||||
int GetConstructorId();
|
||||
void SetEditCurrentArgument( QToolButton* );
|
||||
|
||||
bool isValid();
|
||||
|
||||
void updateLinearAngles();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -95,6 +99,7 @@ private:
|
||||
SUIT_SelectionFilter* myElementsFilter;
|
||||
SUIT_SelectionFilter* myPathMeshFilter;
|
||||
int myType;
|
||||
QList<double> myAnglesList;
|
||||
|
||||
// widgets
|
||||
QGroupBox* ConstructorsBox;
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include <SVTK_ViewModel.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
|
||||
// OCCT includes
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
@ -67,7 +69,6 @@
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
@ -89,7 +90,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg( 0 )
|
||||
myFilterDlg( 0 ),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
|
||||
@ -197,7 +199,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
||||
|
||||
// Controls for nb. steps defining
|
||||
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
|
||||
SpinBox_NbSteps = new QSpinBox(GroupArguments);
|
||||
SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupArguments);
|
||||
|
||||
// CheckBox for groups generation
|
||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||
@ -404,6 +406,9 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (myNbOkElements) {
|
||||
|
||||
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
|
||||
@ -419,15 +424,41 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
||||
|
||||
long aNbSteps = (long)SpinBox_NbSteps->value();
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_Dx->text();
|
||||
aParameters << SpinBox_Dy->text();
|
||||
aParameters << SpinBox_Dz->text();
|
||||
aParameters << SpinBox_NbSteps->text();
|
||||
|
||||
try {
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
|
||||
else
|
||||
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||
if( CheckBoxMesh->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionSweepObject1DMakeGroups(mySelectedObject, aVector, aNbSteps);
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionSweepObject2DMakeGroups(mySelectedObject, aVector, aNbSteps);
|
||||
}
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
|
||||
}
|
||||
else {
|
||||
if( CheckBoxMesh->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps);
|
||||
else
|
||||
aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps);
|
||||
}
|
||||
else
|
||||
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
|
||||
}
|
||||
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
} catch (...) {
|
||||
}
|
||||
@ -437,6 +468,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||
Init(false);
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
return true;
|
||||
@ -603,41 +635,21 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
||||
}
|
||||
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
|
||||
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
|
||||
if (!mesh->_is_nil()) { //MESH
|
||||
// get elements from mesh
|
||||
myElementsId = mesh->GetElementsByType(neededType);
|
||||
aNbElements = myElementsId->length();
|
||||
} else {
|
||||
SMESH::SMESH_subMesh_var aSubMesh =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
if (!aSubMesh->_is_nil()) { //SUBMESH
|
||||
// get IDs from submesh
|
||||
myElementsId = aSubMesh->GetElementsByType(neededType);
|
||||
aNbElements = myElementsId->length();
|
||||
} else {
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
|
||||
if (!aGroup->_is_nil() && aGroup->GetType() == neededType) { // GROUP
|
||||
// get IDs from smesh group
|
||||
myElementsId = aGroup->GetListOfID();
|
||||
aNbElements = myElementsId->length();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
else
|
||||
return;
|
||||
} else {
|
||||
// get indices of selcted elements
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
mySelector->GetIndex(IO,aMapIndex);
|
||||
aNbElements = aMapIndex.Extent();
|
||||
|
||||
if (aNbElements < 1)
|
||||
return;
|
||||
|
||||
myElementsId = new SMESH::long_array;
|
||||
myElementsId->length( aNbElements );
|
||||
aString = "";
|
||||
@ -645,9 +657,6 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
||||
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
|
||||
}
|
||||
|
||||
if (aNbElements < 1)
|
||||
return;
|
||||
|
||||
myNbOkElements = true;
|
||||
|
||||
myBusy = true;
|
||||
@ -856,3 +865,26 @@ void SMESHGUI_ExtrusionDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_ExtrusionDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = SpinBox_Dx->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Dy->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Dz->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QPushButton;
|
||||
|
||||
class SMESHGUI;
|
||||
@ -56,6 +55,7 @@ class SMESHGUI_FilterDlg;
|
||||
class SVTK_Selector;
|
||||
class LightApp_SelectionMgr;
|
||||
class SUIT_SelectionFilter;
|
||||
class SalomeApp_IntSpinBox;
|
||||
|
||||
//=================================================================================
|
||||
// class : SMESHGUI_ExtrusionDlg
|
||||
@ -75,6 +75,8 @@ private:
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
int GetConstructorId();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -82,6 +84,8 @@ private:
|
||||
int myNbOkElements; /* to check when elements are defined */
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH::long_array_var myElementsId;
|
||||
@ -116,7 +120,7 @@ private:
|
||||
QLabel* TextLabelVz;
|
||||
SMESHGUI_SpinBox* SpinBox_Vz;
|
||||
QLabel* TextLabelNbSteps;
|
||||
QSpinBox* SpinBox_NbSteps;
|
||||
SalomeApp_IntSpinBox* SpinBox_NbSteps;
|
||||
QCheckBox* MakeGroupsCheck;
|
||||
|
||||
QGroupBox* GroupButtons;
|
||||
|
@ -36,11 +36,11 @@
|
||||
#include <utilities.h>
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <QtxIntSpinBox.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <LightApp_Application.h>
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
|
||||
// Qt includes
|
||||
#include <QFrame>
|
||||
@ -211,7 +211,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
{
|
||||
case QVariant::Int:
|
||||
{
|
||||
QtxIntSpinBox* sb = new QtxIntSpinBox( GroupC1 );
|
||||
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
|
||||
sb->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setValue( (*anIt).myValue.toInt() );
|
||||
@ -221,7 +221,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
break;
|
||||
case QVariant::Double:
|
||||
{
|
||||
QtxDoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
|
||||
SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
|
||||
sb->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setValue( (*anIt).myValue.toDouble() );
|
||||
@ -231,12 +231,34 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
||||
break;
|
||||
case QVariant::String:
|
||||
{
|
||||
QLineEdit* le = new QLineEdit( GroupC1 );
|
||||
le->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( le, i );
|
||||
le->setText( (*anIt).myValue.toString() );
|
||||
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
w = le;
|
||||
if((*anIt).isVariable) {
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
QString aVar = (*anIt).myValue.toString();
|
||||
if(aStudy->IsInteger(aVar.toLatin1().constData())){
|
||||
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
|
||||
sb->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setText( aVar );
|
||||
connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) );
|
||||
w = sb;
|
||||
}
|
||||
else if(aStudy->IsReal(aVar.toLatin1().constData())){
|
||||
SalomeApp_DoubleSpinBox* sb = new SalomeApp_DoubleSpinBox( GroupC1 );
|
||||
sb->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( sb, i );
|
||||
sb->setText( aVar );
|
||||
connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) );
|
||||
w = sb;
|
||||
}
|
||||
}
|
||||
else {
|
||||
QLineEdit* le = new QLineEdit( GroupC1 );
|
||||
le->setObjectName( (*anIt).myName );
|
||||
attuneStdWidget( le, i );
|
||||
le->setText( (*anIt).myValue.toString() );
|
||||
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
||||
w = le;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -279,16 +301,16 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
item.myName = (*anIt)->objectName();
|
||||
if( (*anIt)->inherits( "QtxIntSpinBox" ) )
|
||||
if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
|
||||
{
|
||||
QtxIntSpinBox* sb = ( QtxIntSpinBox* )( *anIt );
|
||||
SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
|
||||
item.myValue = sb->value();
|
||||
params.append( item );
|
||||
}
|
||||
|
||||
else if( (*anIt)->inherits( "QtxDoubleSpinBox" ) )
|
||||
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
|
||||
{
|
||||
QtxDoubleSpinBox* sb = ( QtxDoubleSpinBox* )( *anIt );
|
||||
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
|
||||
item.myValue = sb->value();
|
||||
params.append( item );
|
||||
}
|
||||
@ -311,6 +333,24 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const
|
||||
{
|
||||
QStringList aResult;
|
||||
ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
|
||||
for( ; anIt!=aLast; anIt++ ) {
|
||||
if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) ) {
|
||||
SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
|
||||
aResult.append(sb->text());
|
||||
}
|
||||
else if( (*anIt)->inherits( "QtxDoubleSpinBox" ) ) {
|
||||
QtxDoubleSpinBox* sb = ( QtxDoubleSpinBox* )( *anIt );
|
||||
aResult.append(sb->text());
|
||||
}
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
|
||||
{
|
||||
QString valueStr = "";
|
||||
@ -428,6 +468,26 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SMESHGUI_GenericHypothesisCreator::checkParams( QString& msg ) const
|
||||
{
|
||||
bool ok = true;
|
||||
ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end();
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
if( (*anIt)->inherits( "SalomeApp_IntSpinBox" ) )
|
||||
{
|
||||
SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt );
|
||||
ok = sb->isValid( msg, true ) && ok;
|
||||
}
|
||||
else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) )
|
||||
{
|
||||
SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt );
|
||||
ok = sb->isValid( msg, true ) && ok;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::onReject()
|
||||
{
|
||||
}
|
||||
@ -520,8 +580,15 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
||||
|
||||
void SMESHGUI_HypothesisDlg::accept()
|
||||
{
|
||||
if ( myCreator && !myCreator->checkParams() )
|
||||
QString msg;
|
||||
if ( myCreator && !myCreator->checkParams( msg ) )
|
||||
{
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return;
|
||||
}
|
||||
QtxDialog::accept();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public:
|
||||
const QString&, QWidget* );
|
||||
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
|
||||
|
||||
virtual bool checkParams() const = 0;
|
||||
virtual bool checkParams( QString& ) const;
|
||||
virtual void onReject();
|
||||
virtual QString helpPage() const;
|
||||
|
||||
@ -66,12 +66,15 @@ public:
|
||||
bool isCreation() const;
|
||||
|
||||
protected:
|
||||
typedef struct
|
||||
struct StdParam
|
||||
{
|
||||
QString myName;
|
||||
QVariant myValue;
|
||||
|
||||
} StdParam;
|
||||
bool isVariable;
|
||||
StdParam(){
|
||||
isVariable = false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef QList<StdParam> ListOfStdParams;
|
||||
typedef QList<QWidget*> ListOfWidgets;
|
||||
@ -89,6 +92,7 @@ protected:
|
||||
virtual QString storeParams() const = 0;
|
||||
virtual bool stdParams( ListOfStdParams& ) const;
|
||||
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
||||
virtual QStringList getVariablesFromDlg() const;
|
||||
static QString stdParamValues( const ListOfStdParams& );
|
||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||
virtual QWidget* getCustomWidget( const StdParam&,
|
||||
|
@ -372,9 +372,11 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !isValid() ) { // node id is invalid
|
||||
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
|
||||
tr("INVALID_ID") );
|
||||
QString msg;
|
||||
if ( !isValid( msg ) ) { // node id is invalid
|
||||
if( !msg.isEmpty() )
|
||||
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
|
||||
tr("INVALID_ID") );
|
||||
dlg()->show();
|
||||
return false;
|
||||
}
|
||||
@ -408,6 +410,12 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
||||
}
|
||||
if (aResult)
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << myDlg->myX->text();
|
||||
aParameters << myDlg->myY->text();
|
||||
aParameters << myDlg->myZ->text();
|
||||
aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
myDlg->myId->setText("");
|
||||
|
||||
SALOME_ListIO aList;
|
||||
@ -432,10 +440,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool SMESHGUI_MakeNodeAtPointOp::isValid()
|
||||
bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
if ( myMeshActor &&
|
||||
myDlg->myMoveRBtn->isDown() &&
|
||||
!myDlg->myAutoSearchChkBox->isChecked() )
|
||||
@ -445,7 +452,14 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid()
|
||||
if ( id > 0 )
|
||||
if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
|
||||
ok = aMesh->FindNode( id );
|
||||
if( !ok )
|
||||
msg += tr("INVALID_ID") + "\n";
|
||||
}
|
||||
|
||||
ok = myDlg->myX->isValid( msg, !myNoPreview ) && ok;
|
||||
ok = myDlg->myY->isValid( msg, !myNoPreview ) && ok;
|
||||
ok = myDlg->myZ->isValid( msg, !myNoPreview ) && ok;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -538,7 +552,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
|
||||
const bool preview = myDlg->myPreviewChkBox->isChecked();
|
||||
if ( autoSearch )
|
||||
myDlg->myId->setText("");
|
||||
if ( preview && ( autoSearch || isValid() ))
|
||||
QString msg;
|
||||
if ( preview && ( autoSearch || isValid( msg ) ))
|
||||
{
|
||||
try {
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
|
||||
|
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
virtual void activateSelection();
|
||||
|
||||
bool isValid();
|
||||
bool isValid( QString& );
|
||||
|
||||
protected slots:
|
||||
virtual bool onApply();
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SalomeApp_Tools.h>
|
||||
#include <LightApp_Application.h>
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
|
||||
#include <SALOME_ListIO.hxx>
|
||||
|
||||
@ -76,7 +77,6 @@
|
||||
#include <QRadioButton>
|
||||
#include <QCheckBox>
|
||||
#include <QButtonGroup>
|
||||
#include <QSpinBox>
|
||||
#include <QList>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
@ -246,9 +246,9 @@ QWidget* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
|
||||
mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
|
||||
|
||||
QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp );
|
||||
myNode1 = new QSpinBox( myRefineGrp );
|
||||
myNode1 = new SalomeApp_IntSpinBox( myRefineGrp );
|
||||
myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp );
|
||||
myNode2 = new QSpinBox( myRefineGrp );
|
||||
myNode2 = new SalomeApp_IntSpinBox( myRefineGrp );
|
||||
|
||||
myRefineGrpLayout->addWidget( mySelLbl[ Ids ], 0, 0 );
|
||||
myRefineGrpLayout->addWidget( mySelBtn[ Ids ], 0, 1 );
|
||||
@ -411,6 +411,24 @@ void SMESHGUI_MeshPatternDlg::Init()
|
||||
//=======================================================================
|
||||
bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
|
||||
{
|
||||
if (isRefine())
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = myNode1->isValid( msg, theMess ) && ok;
|
||||
if (myType == Type_3d)
|
||||
ok = myNode2->isValid( msg, theMess ) && ok;
|
||||
if( !ok ) {
|
||||
if( theMess ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QList<int> ids;
|
||||
if ((isRefine() &&
|
||||
(myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 ||
|
||||
@ -460,6 +478,12 @@ bool SMESHGUI_MeshPatternDlg::onApply()
|
||||
? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
|
||||
: myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << myNode1->text();
|
||||
if(myType == Type_3d )
|
||||
aParameters << myNode2->text();
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
} else { // Applying a pattern to geometrical object
|
||||
if (myType == Type_2d)
|
||||
myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked());
|
||||
@ -1375,8 +1399,8 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText)
|
||||
void SMESHGUI_MeshPatternDlg::onNodeChanged (int value)
|
||||
{
|
||||
if (myType == Type_3d) {
|
||||
QSpinBox* first = (QSpinBox*)sender();
|
||||
QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
|
||||
SalomeApp_IntSpinBox* first = (SalomeApp_IntSpinBox*)sender();
|
||||
SalomeApp_IntSpinBox* second = first == myNode1 ? myNode2 : myNode1;
|
||||
int secondVal = second->value();
|
||||
if (secondVal == value) {
|
||||
secondVal = value == second->maximum() ? second->minimum() : value + 1;
|
||||
|
@ -44,7 +44,7 @@ class QRadioButton;
|
||||
class QCheckBox;
|
||||
class QButtonGroup;
|
||||
class QLabel;
|
||||
class QSpinBox;
|
||||
class SalomeApp_IntSpinBox;
|
||||
class vtkUnstructuredGrid;
|
||||
class SALOME_Actor;
|
||||
class SVTK_Selector;
|
||||
@ -130,8 +130,8 @@ private:
|
||||
QCheckBox* myRefine;
|
||||
|
||||
QFrame* myRefineGrp;
|
||||
QSpinBox* myNode1;
|
||||
QSpinBox* myNode2;
|
||||
SalomeApp_IntSpinBox* myNode1;
|
||||
SalomeApp_IntSpinBox* myNode2;
|
||||
QLabel* myNode2Lbl;
|
||||
|
||||
QFrame* myGeomGrp;
|
||||
|
@ -281,6 +281,22 @@ bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
|
||||
tr("NODE_ID_IS_NOT_DEFINED"));
|
||||
return false;
|
||||
}
|
||||
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = myX->isValid( msg, theMess ) && ok;
|
||||
ok = myY->isValid( msg, theMess ) && ok;
|
||||
ok = myZ->isValid( msg, theMess ) && ok;
|
||||
if( !ok ) {
|
||||
if( theMess ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -325,6 +341,12 @@ bool SMESHGUI_MoveNodesDlg::onApply()
|
||||
bool aResult = false;
|
||||
try {
|
||||
aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << myX->text();
|
||||
aParameters << myY->text();
|
||||
aParameters << myZ->text();
|
||||
aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ QWidget* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent)
|
||||
// name : SMESHGUI_MultiEditDlg::isValid
|
||||
// Purpose : Verify validity of input data
|
||||
//=======================================================================
|
||||
bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/) const
|
||||
bool SMESHGUI_MultiEditDlg::isValid (const bool /*theMess*/)
|
||||
{
|
||||
return (!myMesh->_is_nil() &&
|
||||
(myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
|
||||
@ -1168,12 +1168,39 @@ SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
|
||||
{
|
||||
}
|
||||
|
||||
bool SMESHGUI_UnionOfTrianglesDlg::isValid (const bool theMess)
|
||||
{
|
||||
bool ok = SMESHGUI_MultiEditDlg::isValid( theMess );
|
||||
if( !ok )
|
||||
return false;
|
||||
|
||||
QString msg;
|
||||
ok = myMaxAngleSpin->isValid( msg, theMess );
|
||||
if( !ok ) {
|
||||
if( theMess ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
|
||||
const SMESH::long_array& theIds)
|
||||
{
|
||||
SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
|
||||
double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
|
||||
return theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
|
||||
bool ok = theEditor->TriToQuad(theIds, aCriterion, aMaxAngle);
|
||||
if( ok ) {
|
||||
QStringList aParameters;
|
||||
aParameters << myMaxAngleSpin->text();
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ protected:
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
QWidget* createButtonFrame( QWidget* );
|
||||
QWidget* createMainFrame( QWidget*, const bool );
|
||||
bool isValid( const bool ) const;
|
||||
virtual bool isValid( const bool );
|
||||
SMESH::long_array_var getIds();
|
||||
void updateButtons();
|
||||
void setSelectionMode();
|
||||
@ -190,6 +190,7 @@ public:
|
||||
virtual ~SMESHGUI_UnionOfTrianglesDlg();
|
||||
|
||||
protected:
|
||||
virtual bool isValid( const bool );
|
||||
virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
|
||||
|
||||
private:
|
||||
|
@ -87,13 +87,14 @@
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z )
|
||||
void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z, const QStringList& theParameters )
|
||||
{
|
||||
SUIT_OverrideCursor wc;
|
||||
try {
|
||||
_PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
|
||||
aMeshEditor->AddNode( x, y, z );
|
||||
theMesh->SetParameters( SMESHGUI::JoinObjectParameters(theParameters) );
|
||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||
CORBA::Long anId = aStudy->StudyId();
|
||||
if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
|
||||
@ -400,12 +401,21 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
/* Recup args and call method */
|
||||
double x = SpinBox_X->GetValue();
|
||||
double y = SpinBox_Y->GetValue();
|
||||
double z = SpinBox_Z->GetValue();
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_X->text();
|
||||
aParameters << SpinBox_Y->text();
|
||||
aParameters << SpinBox_Z->text();
|
||||
|
||||
mySimulation->SetVisibility( false );
|
||||
SMESH::AddNode( myMesh, x, y, z );
|
||||
SMESH::AddNode( myMesh, x, y, z, aParameters );
|
||||
SMESH::SetPointRepresentation( true );
|
||||
|
||||
// select myMesh
|
||||
@ -591,3 +601,25 @@ void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
|
||||
ClickOnHelp();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_NodesDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = SpinBox_X->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Y->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Z->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ private:
|
||||
void hideEvent ( QHideEvent* );
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
|
||||
bool isValid();
|
||||
|
||||
QGroupBox* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupCoordinates;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <LightApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SVTK_Selector.h>
|
||||
@ -71,7 +72,6 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QSpinBox>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
|
||||
@ -92,7 +92,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myVectorDefinition(NONE_SELECT),
|
||||
myFilterDlg( 0 )
|
||||
myFilterDlg( 0 ),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
||||
|
||||
@ -214,7 +215,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox);
|
||||
|
||||
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupAngleBox);
|
||||
SpinBox_NbSteps = new QSpinBox(GroupAngleBox);
|
||||
SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupAngleBox);
|
||||
|
||||
GroupAngleLayout->addWidget(RadioButton3, 0, 0);
|
||||
GroupAngleLayout->addWidget(RadioButton4, 0, 1);
|
||||
@ -350,6 +351,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
||||
connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||
connect(CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
|
||||
|
||||
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
@ -462,10 +465,13 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||
bool SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (myNbOkElements && IsAxisOk()) {
|
||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||
@ -492,16 +498,49 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||
if ( GroupAngle->checkedId() == 1 )
|
||||
anAngle = anAngle/aNbSteps;
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_X->text();
|
||||
aParameters << SpinBox_Y->text();
|
||||
aParameters << SpinBox_Z->text();
|
||||
aParameters << SpinBox_DX->text();
|
||||
aParameters << SpinBox_DY->text();
|
||||
aParameters << SpinBox_DZ->text();
|
||||
aParameters << SpinBox_Angle->text();
|
||||
aParameters << SpinBox_NbSteps->text();
|
||||
aParameters << SpinBox_Tolerance->text();
|
||||
|
||||
try {
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
else
|
||||
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||
if( CheckBoxMesh->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->RotationSweepObject2DMakeGroups(mySelectedObject, anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
}
|
||||
else
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
}
|
||||
else {
|
||||
if( CheckBoxMesh->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
|
||||
else
|
||||
aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis, anAngle, aNbSteps, aTolerance);
|
||||
}
|
||||
else
|
||||
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
|
||||
}
|
||||
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
@ -510,8 +549,11 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||
Init(false);
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -520,8 +562,8 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_RevolutionDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
if( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -567,6 +609,19 @@ void SMESHGUI_RevolutionDlg::ClickOnHelp()
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : onAngleTextChange()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_RevolutionDlg::onAngleTextChange (const QString& theNewText)
|
||||
{
|
||||
bool isNumber;
|
||||
SpinBox_Angle->text().toDouble( &isNumber );
|
||||
if( !isNumber )
|
||||
RadioButton3->setChecked( true );
|
||||
RadioButton4->setEnabled( isNumber );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : onTextChange()
|
||||
// purpose :
|
||||
@ -677,77 +732,18 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
|
||||
}
|
||||
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
int aConstructorId = GetConstructorId();
|
||||
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
// get IDs from mesh
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
|
||||
if (aConstructorId == 0) {
|
||||
SMDS_EdgeIteratorPtr anIter = aSMDSMesh->edgesIterator();
|
||||
|
||||
while (anIter->more()) {
|
||||
const SMDS_MeshEdge * edge = anIter->next();
|
||||
if (edge) {
|
||||
myElementsId += QString(" %1").arg(edge->GetID());
|
||||
aNbUnits++;
|
||||
}
|
||||
}
|
||||
} else if (aConstructorId == 1) {
|
||||
SMDS_FaceIteratorPtr anIter = aSMDSMesh->facesIterator();
|
||||
while (anIter->more()) {
|
||||
const SMDS_MeshFace * face = anIter->next();
|
||||
if (face) {
|
||||
myElementsId += QString(" %1").arg(face->GetID());
|
||||
aNbUnits++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
// get IDs from submesh
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
if (aConstructorId == 0)
|
||||
anElementsIds = aSubMesh->GetElementsByType(SMESH::EDGE);
|
||||
else if (aConstructorId == 1)
|
||||
anElementsIds = aSubMesh->GetElementsByType(SMESH::FACE);
|
||||
|
||||
for (int i = 0; i < anElementsIds->length(); i++)
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
aNbUnits = anElementsIds->length();
|
||||
} else { // GROUP
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
if (aGroup->_is_nil())
|
||||
return;
|
||||
|
||||
if ((aConstructorId == 0 && aGroup->GetType()!= SMESH::EDGE) ||
|
||||
(aConstructorId == 1 && aGroup->GetType()!= SMESH::FACE))
|
||||
return;
|
||||
|
||||
// get IDs from smesh group
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aGroup->GetListOfID();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
}
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
else
|
||||
return;
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||
myElementsId = aString;
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
|
||||
myNbOkElements = true;
|
||||
} else {
|
||||
|
||||
@ -1073,11 +1069,20 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
||||
try {
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||
aMeshEditor->RotationSweep(anElementsId.inout(),
|
||||
anAxis,
|
||||
anAngle,
|
||||
aNbSteps,
|
||||
aTolerance);
|
||||
if( CheckBoxMesh->isChecked() ) {
|
||||
if( GetConstructorId() == 0 )
|
||||
aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
else
|
||||
aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
|
||||
anAngle, aNbSteps, aTolerance);
|
||||
}
|
||||
else
|
||||
aMeshEditor->RotationSweep(anElementsId.inout(),
|
||||
anAxis,
|
||||
anAngle,
|
||||
aNbSteps,
|
||||
aTolerance);
|
||||
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||
} catch (...) {}
|
||||
@ -1154,3 +1159,31 @@ void SMESHGUI_RevolutionDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_RevolutionDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = SpinBox_X->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Y->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Z->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DX->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DY->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DZ->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Angle->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_NbSteps->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Tolerance->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class SalomeApp_IntSpinBox;
|
||||
class SMESHGUI_IdValidator;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SMESHGUI;
|
||||
@ -81,6 +81,8 @@ private:
|
||||
int GetConstructorId();
|
||||
bool IsAxisOk();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -89,6 +91,8 @@ private:
|
||||
QWidget* myEditCurrentArgument; /* Current argument */
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
@ -138,7 +142,7 @@ private:
|
||||
QLabel* TextLabelAngle;
|
||||
SMESHGUI_SpinBox* SpinBox_Angle;
|
||||
QLabel* TextLabelNbSteps;
|
||||
QSpinBox* SpinBox_NbSteps;
|
||||
SalomeApp_IntSpinBox* SpinBox_NbSteps;
|
||||
QLabel* TextLabelTolerance;
|
||||
SMESHGUI_SpinBox* SpinBox_Tolerance;
|
||||
|
||||
@ -155,13 +159,14 @@ private slots:
|
||||
void ConstructorsClicked( int );
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onTextChange( const QString& );
|
||||
void onAngleTextChange( const QString& );
|
||||
void onSelectMesh( bool );
|
||||
void onVectorChanged();
|
||||
void toDisplaySimulation();
|
||||
|
@ -91,7 +91,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0)
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
@ -365,10 +366,13 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_RotationDlg::ClickOnApply()
|
||||
bool SMESHGUI_RotationDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
if (myNbOkElements && IsAxisOk()) {
|
||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||
@ -389,6 +393,16 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
||||
anAxis.vz = SpinBox_DZ->GetValue();
|
||||
|
||||
double anAngle = (SpinBox_Angle->GetValue())*PI/180;
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_X->text();
|
||||
aParameters << SpinBox_Y->text();
|
||||
aParameters << SpinBox_Z->text();
|
||||
aParameters << SpinBox_DX->text();
|
||||
aParameters << SpinBox_DY->text();
|
||||
aParameters << SpinBox_DZ->text();
|
||||
aParameters << SpinBox_Angle->text();
|
||||
|
||||
int actionButton = ActionGroup->checkedId();
|
||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||
try {
|
||||
@ -396,19 +410,40 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
switch ( actionButton ) {
|
||||
case MOVE_ELEMS_BUTTON:
|
||||
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, false);
|
||||
else
|
||||
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
case COPY_ELEMS_BUTTON:
|
||||
if ( makeGroups )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
|
||||
else
|
||||
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
|
||||
if ( makeGroups ) {
|
||||
SMESH::ListOfGroups_var groups;
|
||||
if(CheckBoxMesh->isChecked())
|
||||
groups = aMeshEditor->RotateObjectMakeGroups(mySelectedObject, anAxis, anAngle);
|
||||
else
|
||||
groups = aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
|
||||
}
|
||||
else {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, true);
|
||||
else
|
||||
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
|
||||
}
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
case MAKE_MESH_BUTTON:
|
||||
SMESH::SMESH_Mesh_var mesh =
|
||||
aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
if(CheckBoxMesh->isChecked())
|
||||
mesh = aMeshEditor->RotateObjectMakeMesh(mySelectedObject, anAxis, anAngle, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
else
|
||||
mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( !mesh->_is_nil())
|
||||
mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
@ -418,8 +453,11 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
||||
actionButton == MAKE_MESH_BUTTON )
|
||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||
Init(false);
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -428,8 +466,8 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_RotationDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
if( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -586,13 +624,18 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
}
|
||||
else
|
||||
return;
|
||||
// get IDs from mesh
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
/*
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
|
||||
for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
|
||||
for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
|
||||
const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
|
||||
if (e) {
|
||||
myElementsId += QString(" %1").arg(i);
|
||||
@ -600,40 +643,41 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
||||
// get submesh
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
|
||||
// get IDs from submesh
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aSubMesh->GetElementsId();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
} else { // GROUP
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
if (aGroup->_is_nil())
|
||||
return;
|
||||
return;
|
||||
|
||||
// get IDs from smesh group
|
||||
// get IDs from smesh group
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aGroup->GetListOfID();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||
myElementsId = aString;
|
||||
}
|
||||
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
myNbOkElements = true;
|
||||
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||
if (aNbUnits != 1)
|
||||
@ -719,6 +763,7 @@ void SMESHGUI_RotationDlg::SetEditCurrentArgument()
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
myEditCurrentArgument->setFocus();
|
||||
@ -938,3 +983,30 @@ void SMESHGUI_RotationDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_RotationDlg::isValid()
|
||||
{
|
||||
bool ok = true;
|
||||
QString msg;
|
||||
|
||||
ok = SpinBox_X->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Y->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Z->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DX->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DY->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DZ->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Angle->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ private:
|
||||
bool IsAxisOk();
|
||||
void setNewMeshName();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -86,6 +88,7 @@ private:
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
QGroupBox* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
@ -133,7 +136,7 @@ private:
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
|
@ -50,6 +50,8 @@
|
||||
#include <LightApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
|
||||
#include <SVTK_ViewModel.h>
|
||||
#include <SVTK_Selector.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
@ -68,7 +70,6 @@
|
||||
#include <QRadioButton>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
#include <QGridLayout>
|
||||
@ -91,7 +92,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0)
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
@ -160,7 +162,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
|
||||
// Controls for iteration limit defining
|
||||
TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments);
|
||||
|
||||
SpinBox_IterationLimit = new QSpinBox(GroupArguments);
|
||||
SpinBox_IterationLimit = new SalomeApp_IntSpinBox(GroupArguments);
|
||||
|
||||
// Controls for max. aspect ratio defining
|
||||
TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments);
|
||||
@ -318,10 +320,13 @@ void SMESHGUI_SmoothingDlg::Init()
|
||||
// function : ClickOnApply()
|
||||
// purpose : Called when user presses <Apply> button
|
||||
//=================================================================================
|
||||
void SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
bool SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (!isValid())
|
||||
return false;
|
||||
|
||||
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
|
||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||
@ -345,6 +350,10 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
long anIterationLimit = (long)SpinBox_IterationLimit->value();
|
||||
double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_IterationLimit->text();
|
||||
aParameters << SpinBox_AspectRatio->text();
|
||||
|
||||
SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
|
||||
if (ComboBoxMethod->currentIndex() > 0)
|
||||
aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
|
||||
@ -354,12 +363,25 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
|
||||
if ( CheckBoxParametric->isChecked() )
|
||||
aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
else
|
||||
aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
if ( CheckBoxParametric->isChecked() ) {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
else
|
||||
aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
}
|
||||
else {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aResult = aMeshEditor->SmoothObject(mySelectedObject, aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
else
|
||||
aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
|
||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||
}
|
||||
|
||||
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
@ -371,8 +393,12 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
mySelectionMgr->setSelectedObjects(aList, false);
|
||||
SMESH::UpdateView();
|
||||
Init();
|
||||
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -381,8 +407,8 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_SmoothingDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
if( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -549,48 +575,15 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
// get IDs from mesh
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
|
||||
for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++ ) {
|
||||
const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
|
||||
if (e) {
|
||||
myElementsId += QString(" %1").arg(i);
|
||||
aNbUnits++;
|
||||
}
|
||||
}
|
||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
// get IDs from submesh
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aSubMesh->GetElementsId();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
} else { // GROUP
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||
if (aGroup->_is_nil())
|
||||
return;
|
||||
|
||||
// get IDs from smesh group
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aGroup->GetListOfID();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
}
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
else
|
||||
return;
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||
myElementsId = aString;
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
}
|
||||
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
|
||||
myNbOkNodes = 0;
|
||||
@ -598,9 +591,6 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
|
||||
} else {
|
||||
}
|
||||
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
|
||||
myBusy = true;
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myEditCurrentArgument->repaint();
|
||||
@ -822,3 +812,24 @@ void SMESHGUI_SmoothingDlg::setNodeFilters()
|
||||
{
|
||||
setFilters( false );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_SmoothingDlg::isValid()
|
||||
{
|
||||
QString msg;
|
||||
bool ok = true;
|
||||
ok = SpinBox_IterationLimit->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_AspectRatio->isValid( msg, true ) && ok;
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ class QPushButton;
|
||||
class QRadioButton;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class SMESHGUI;
|
||||
class SalomeApp_IntSpinBox;
|
||||
class SMESHGUI_IdValidator;
|
||||
class SMESHGUI_SpinBox;
|
||||
class SMESHGUI_FilterDlg;
|
||||
@ -73,6 +73,8 @@ private:
|
||||
void keyPressEvent( QKeyEvent* );
|
||||
void setFilters( const bool theIsElem );
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -83,6 +85,8 @@ private:
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
SVTK_Selector* mySelector;
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
@ -106,7 +110,7 @@ private:
|
||||
QLabel* TextLabelMethod;
|
||||
QComboBox* ComboBoxMethod;
|
||||
QLabel* TextLabelLimit;
|
||||
QSpinBox* SpinBox_IterationLimit;
|
||||
SalomeApp_IntSpinBox* SpinBox_IterationLimit;
|
||||
QLabel* TextLabelAspectRatio;
|
||||
SMESHGUI_SpinBox* SpinBox_AspectRatio;
|
||||
QCheckBox* CheckBoxParametric;
|
||||
@ -118,7 +122,7 @@ private:
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
|
@ -35,7 +35,7 @@
|
||||
// purpose : constructor of specific widget accepting floats in double precision.
|
||||
//=================================================================================
|
||||
SMESHGUI_SpinBox::SMESHGUI_SpinBox( QWidget* parent )
|
||||
: QtxDoubleSpinBox( parent )
|
||||
: SalomeApp_DoubleSpinBox( parent )
|
||||
{
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ QString SMESHGUI_SpinBox::GetString() const
|
||||
//=================================================================================
|
||||
QLineEdit* SMESHGUI_SpinBox::editor() const
|
||||
{
|
||||
return QtxDoubleSpinBox::lineEdit();
|
||||
return SalomeApp_DoubleSpinBox::lineEdit();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -116,4 +116,5 @@ void SMESHGUI_SpinBox::RangeStepAndValidator( double min,
|
||||
setDecimals(32);
|
||||
setRange(min, max);
|
||||
setSingleStep( step );
|
||||
setDefaultValue( min );
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "SMESH_SMESHGUI.hxx"
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <QtxDoubleSpinBox.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
|
||||
#define COORD_MIN -1e+15
|
||||
#define COORD_MAX +1e+15
|
||||
@ -43,7 +43,7 @@ class QDoubleValidator;
|
||||
// class : SMESHGUI_SpinBox
|
||||
// purpose : Derivated from QtxDoubleSpinBox class
|
||||
//=================================================================================
|
||||
class SMESHGUI_EXPORT SMESHGUI_SpinBox : public QtxDoubleSpinBox
|
||||
class SMESHGUI_EXPORT SMESHGUI_SpinBox : public SalomeApp_DoubleSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -92,7 +92,8 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0)
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
|
||||
@ -437,10 +438,13 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
if (myNbOkElements && IsMirrorOk()) {
|
||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||
@ -464,6 +468,13 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
aMirror.vz = SpinBox_DZ->GetValue();
|
||||
}
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox_X->text();
|
||||
aParameters << SpinBox_Y->text();
|
||||
aParameters << SpinBox_Z->text();
|
||||
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DX->text() );
|
||||
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DY->text() );
|
||||
aParameters << ( GetConstructorId() == 0 ? QString::number(0) : SpinBox_DZ->text() );
|
||||
|
||||
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
||||
|
||||
@ -482,32 +493,60 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
|
||||
switch ( actionButton ) {
|
||||
case MOVE_ELEMS_BUTTON:
|
||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
|
||||
break;
|
||||
case COPY_ELEMS_BUTTON:
|
||||
if ( makeGroups )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
|
||||
case MOVE_ELEMS_BUTTON: {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, false );
|
||||
else
|
||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
|
||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
|
||||
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
case MAKE_MESH_BUTTON:
|
||||
SMESH::SMESH_Mesh_var mesh =
|
||||
aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
}
|
||||
case COPY_ELEMS_BUTTON: {
|
||||
SMESH::ListOfGroups_var groups;
|
||||
if ( makeGroups ) {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
groups = aMeshEditor->MirrorObjectMakeGroups(mySelectedObject, aMirror, aMirrorType);
|
||||
else
|
||||
groups = aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
|
||||
}
|
||||
else {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, true);
|
||||
else
|
||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
|
||||
}
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
}
|
||||
case MAKE_MESH_BUTTON: {
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
if(CheckBoxMesh->isChecked())
|
||||
mesh = aMeshEditor->MirrorObjectMakeMesh(mySelectedObject, aMirror, aMirrorType, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
else
|
||||
mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( !mesh->_is_nil())
|
||||
mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
|
||||
SMESH::UpdateView();
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
||||
actionButton == MAKE_MESH_BUTTON )
|
||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||
Init(false);
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -516,8 +555,8 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_SymmetryDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
if( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -675,8 +714,13 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
// get IDs from mesh
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
}
|
||||
else
|
||||
return;
|
||||
// get IDs from mesh
|
||||
/*
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
@ -688,17 +732,20 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
||||
aNbUnits++;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
||||
// get submesh
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
|
||||
// get IDs from submesh
|
||||
/*
|
||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||
anElementsIds = aSubMesh->GetElementsId();
|
||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
|
||||
} else { // GROUP
|
||||
// get smesh group
|
||||
SMESH::SMESH_GroupBase_var aGroup =
|
||||
@ -714,14 +761,14 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, IO, aString);
|
||||
myElementsId = aString;
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
|
||||
|
||||
myNbOkElements = true;
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||
@ -1035,3 +1082,31 @@ void SMESHGUI_SymmetryDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_SymmetryDlg::isValid()
|
||||
{
|
||||
bool ok = true;
|
||||
QString msg;
|
||||
|
||||
ok = SpinBox_X->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Y->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_Z->isValid( msg, true ) && ok;
|
||||
if (GetConstructorId() != 0) {
|
||||
ok = SpinBox_DX->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DY->isValid( msg, true ) && ok;
|
||||
ok = SpinBox_DZ->isValid( msg, true ) && ok;
|
||||
}
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ private:
|
||||
bool IsMirrorOk();
|
||||
void setNewMeshName();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -83,6 +85,8 @@ private:
|
||||
|
||||
QWidget* myEditCurrentArgument; /* Current LineEdit */
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
bool myBusy;
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH_Actor* myActor;
|
||||
@ -135,7 +139,7 @@ private slots:
|
||||
void ConstructorsClicked( int );
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
|
@ -109,7 +109,8 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||
myFilterDlg(0)
|
||||
myFilterDlg(0),
|
||||
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
|
||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
|
||||
@ -436,10 +437,13 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
bool SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return;
|
||||
return false;
|
||||
|
||||
if( !isValid() )
|
||||
return false;
|
||||
|
||||
if (myNbOkElements) {
|
||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||
@ -461,6 +465,17 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
aVector.PS.z = SpinBox1_3->GetValue();
|
||||
}
|
||||
|
||||
QStringList aParameters;
|
||||
aParameters << SpinBox1_1->text();
|
||||
if (GetConstructorId() == 0)
|
||||
aParameters << SpinBox2_1->text();
|
||||
aParameters << SpinBox1_2->text();
|
||||
if (GetConstructorId() == 0)
|
||||
aParameters << SpinBox2_2->text();
|
||||
aParameters << SpinBox1_3->text();
|
||||
if (GetConstructorId() == 0)
|
||||
aParameters << SpinBox2_3->text();
|
||||
|
||||
int actionButton = ActionGroup->checkedId();
|
||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||
try {
|
||||
@ -468,31 +483,55 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||
switch ( actionButton ) {
|
||||
case MOVE_ELEMS_BUTTON:
|
||||
aMeshEditor->Translate(anElementsId, aVector, false);
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->TranslateObject(mySelectedObject, aVector, false);
|
||||
else
|
||||
aMeshEditor->Translate(anElementsId, aVector, false);
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
case COPY_ELEMS_BUTTON:
|
||||
if ( makeGroups )
|
||||
SMESH::ListOfGroups_var groups =
|
||||
aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
|
||||
else
|
||||
aMeshEditor->Translate(anElementsId, aVector, true);
|
||||
if ( makeGroups ) {
|
||||
SMESH::ListOfGroups_var groups;
|
||||
if(CheckBoxMesh->isChecked())
|
||||
groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
|
||||
else
|
||||
groups = aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
|
||||
}
|
||||
else {
|
||||
if(CheckBoxMesh->isChecked())
|
||||
aMeshEditor->TranslateObject(mySelectedObject, aVector, true);
|
||||
else
|
||||
aMeshEditor->Translate(anElementsId, aVector, true);
|
||||
}
|
||||
if( !myMesh->_is_nil())
|
||||
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
break;
|
||||
case MAKE_MESH_BUTTON:
|
||||
SMESH::SMESH_Mesh_var mesh =
|
||||
aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
if(CheckBoxMesh->isChecked())
|
||||
mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
else
|
||||
mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( !mesh->_is_nil())
|
||||
mesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
|
||||
SMESH::UpdateView();
|
||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
||||
actionButton == MAKE_MESH_BUTTON )
|
||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||
Init(false);
|
||||
ConstructorsClicked(GetConstructorId());
|
||||
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -501,8 +540,8 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void SMESHGUI_TranslationDlg::ClickOnOk()
|
||||
{
|
||||
ClickOnApply();
|
||||
ClickOnCancel();
|
||||
if( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -657,8 +696,13 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
||||
if (CheckBoxMesh->isChecked()) {
|
||||
SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
|
||||
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH, SUBMESH, OR GROUP
|
||||
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||
}
|
||||
else
|
||||
return;
|
||||
// get IDs from mesh
|
||||
/*
|
||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||
if (!aSMDSMesh)
|
||||
return;
|
||||
@ -696,14 +740,14 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
||||
}
|
||||
aNbUnits = anElementsIds->length();
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||
myElementsId = aString;
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aNbUnits < 1)
|
||||
return;
|
||||
|
||||
myNbOkElements = true;
|
||||
} else {
|
||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||
@ -986,3 +1030,31 @@ void SMESHGUI_TranslationDlg::setFilters()
|
||||
|
||||
myFilterDlg->show();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_TranslationDlg::isValid()
|
||||
{
|
||||
bool ok = true;
|
||||
QString msg;
|
||||
|
||||
ok = SpinBox1_1->isValid( msg, true ) && ok;
|
||||
ok = SpinBox1_2->isValid( msg, true ) && ok;
|
||||
ok = SpinBox1_3->isValid( msg, true ) && ok;
|
||||
if (GetConstructorId() == 0) {
|
||||
ok = SpinBox2_1->isValid( msg, true ) && ok;
|
||||
ok = SpinBox2_2->isValid( msg, true ) && ok;
|
||||
ok = SpinBox2_3->isValid( msg, true ) && ok;
|
||||
}
|
||||
|
||||
if( !ok ) {
|
||||
QString str( tr( "SMESH_INCORRECT_INPUT" ) );
|
||||
if ( !msg.isEmpty() )
|
||||
str += "\n" + msg;
|
||||
SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ private:
|
||||
int GetConstructorId();
|
||||
void setNewMeshName();
|
||||
|
||||
bool isValid();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
SMESHGUI_IdValidator* myIdValidator;
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -88,6 +90,8 @@ private:
|
||||
SMESH_Actor* myActor;
|
||||
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
||||
|
||||
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||
|
||||
QGroupBox* ConstructorsBox;
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* RadioButton1;
|
||||
@ -132,7 +136,7 @@ private slots:
|
||||
void ConstructorsClicked( int );
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
bool ClickOnApply();
|
||||
void ClickOnHelp();
|
||||
void SetEditCurrentArgument();
|
||||
void SelectionIntoArgument();
|
||||
|
@ -1280,6 +1280,10 @@ Are you sure want to export to MED 2.1 ?</translation>
|
||||
<source>SMESH_ID_NODES</source>
|
||||
<translation>Id Nodes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_INCORRECT_INPUT</source>
|
||||
<translation>Incorrect input data!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_INFORMATION</source>
|
||||
<translation>Information</translation>
|
||||
|
@ -47,6 +47,7 @@ salomeinclude_HEADERS = \
|
||||
SMESH_MEDSupport_i.hxx \
|
||||
SMESH_Pattern_i.hxx \
|
||||
SMESH_2smeshpy.hxx \
|
||||
SMESH_NoteBook.hxx \
|
||||
SMESH.hxx
|
||||
|
||||
# Scripts to be installed.
|
||||
@ -76,7 +77,8 @@ dist_libSMESHEngine_la_SOURCES = \
|
||||
SMESH_Filter_i.cxx \
|
||||
SMESH_Group_i.cxx \
|
||||
SMESH_Pattern_i.cxx \
|
||||
SMESH_2smeshpy.cxx
|
||||
SMESH_2smeshpy.cxx \
|
||||
SMESH_NoteBook.cxx
|
||||
|
||||
# Executables targets
|
||||
bin_PROGRAMS = SMESHEngine
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#include "utilities.h"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
#include "SMESH_NoteBook.hxx"
|
||||
#include "Resource_DataMapOfAsciiStringAsciiString.hxx"
|
||||
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
@ -125,12 +126,31 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
||||
theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames );
|
||||
|
||||
// split theScript into separate commands
|
||||
|
||||
SMESH_NoteBook * aNoteBook = new SMESH_NoteBook();
|
||||
|
||||
int from = 1, end = theScript.Length(), to;
|
||||
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
||||
{
|
||||
if ( to != from )
|
||||
// cut out and store a command
|
||||
aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
|
||||
from = to + 1;
|
||||
}
|
||||
|
||||
aNoteBook->ReplaceVariables();
|
||||
|
||||
TCollection_AsciiString aNoteScript = aNoteBook->GetResultScript();
|
||||
delete aNoteBook;
|
||||
aNoteBook = 0;
|
||||
|
||||
// split theScript into separate commands
|
||||
from = 1, end = aNoteScript.Length();
|
||||
while ( from < end && ( to = aNoteScript.Location( "\n", from, end )))
|
||||
{
|
||||
if ( to != from )
|
||||
// cut out and store a command
|
||||
theGen->AddCommand( theScript.SubString( from, to - 1 ));
|
||||
theGen->AddCommand( aNoteScript.SubString( from, to - 1 ));
|
||||
from = to + 1;
|
||||
}
|
||||
|
||||
@ -1057,13 +1077,14 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
|
||||
if ( sameMethods.empty() ) {
|
||||
const char * names[] = {
|
||||
"RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
|
||||
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode",
|
||||
"InverseDiag","DeleteDiag","Reorient","ReorientObject","SplitQuad","SplitQuadObject",
|
||||
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
|
||||
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
|
||||
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
|
||||
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
|
||||
"RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
|
||||
"ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","Mirror",
|
||||
"MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
|
||||
"RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
|
||||
"ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
|
||||
"ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
|
||||
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
|
||||
"FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
|
||||
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
|
||||
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
|
||||
@ -1983,14 +2004,21 @@ const TCollection_AsciiString & _pyCommand::GetArg( int index )
|
||||
if ( begPos < 1 )
|
||||
begPos = myString.Location( "(", 1, Length() ) + 1;
|
||||
|
||||
int i = 0, prevLen = 0;
|
||||
int i = 0, prevLen = 0, nbNestings = 0;
|
||||
while ( begPos != EMPTY ) {
|
||||
begPos += prevLen;
|
||||
if( myString.Value( begPos ) == '(' )
|
||||
nbNestings++;
|
||||
// check if we are looking at the closing parenthesis
|
||||
while ( begPos <= Length() && isspace( myString.Value( begPos )))
|
||||
++begPos;
|
||||
if ( begPos > Length() || myString.Value( begPos ) == ')' )
|
||||
if ( begPos > Length() )
|
||||
break;
|
||||
if ( myString.Value( begPos ) == ')' ) {
|
||||
nbNestings--;
|
||||
if( nbNestings == 0 )
|
||||
break;
|
||||
}
|
||||
myArgs.Append( GetWord( myString, begPos, true, true ));
|
||||
SetBegPos( ARG1_IND + i, begPos );
|
||||
prevLen = myArgs.Last().Length();
|
||||
@ -2144,7 +2172,8 @@ void _pyCommand::SetArg( int index, const TCollection_AsciiString& theArg)
|
||||
if ( pos < 1 ) // no index-th arg exist, append inexistent args
|
||||
{
|
||||
// find a closing parenthesis
|
||||
if ( int lastArgInd = GetNbArgs() ) {
|
||||
if ( GetNbArgs() != 0 && index <= GetNbArgs() ) {
|
||||
int lastArgInd = GetNbArgs();
|
||||
pos = GetBegPos( ARG1_IND + lastArgInd - 1 ) + GetArg( lastArgInd ).Length();
|
||||
while ( pos > 0 && pos <= Length() && myString.Value( pos ) != ')' )
|
||||
++pos;
|
||||
|
@ -493,6 +493,11 @@ public:
|
||||
* \brief Find SObject for an algo
|
||||
*/
|
||||
SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* algo);
|
||||
|
||||
void UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters);
|
||||
char* GetParameters(CORBA::Object_ptr theObject);
|
||||
char* ParseParameters(const char* theParameters);
|
||||
|
||||
|
||||
private:
|
||||
// Create hypothesis of given type
|
||||
|
@ -43,8 +43,10 @@
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
static int VARIABLE_DEBUG = 0;
|
||||
#else
|
||||
static int MYDEBUG = 0;
|
||||
static int VARIABLE_DEBUG = 0;
|
||||
#endif
|
||||
|
||||
//=============================================================================
|
||||
@ -863,3 +865,100 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : UpdateParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters)
|
||||
{
|
||||
|
||||
if(VARIABLE_DEBUG)
|
||||
cout<<"UpdateParameters : "<<theParameters<<endl;
|
||||
SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
|
||||
if(aStudy->_is_nil() || CORBA::is_nil(theObject))
|
||||
return;
|
||||
|
||||
SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
|
||||
if(aSObj->_is_nil())
|
||||
return;
|
||||
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
|
||||
SALOMEDS::GenericAttribute_var aFindAttr;
|
||||
bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString");
|
||||
if(VARIABLE_DEBUG)
|
||||
cout<<"Find Attribute "<<hasAttr<<endl;
|
||||
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute( aSObj, "AttributeString");
|
||||
SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr);
|
||||
|
||||
TCollection_AsciiString aNewParams;
|
||||
TCollection_AsciiString aOldParameters(aStringAttr->Value());
|
||||
TCollection_AsciiString anInputParams(ParseParameters(theParameters));
|
||||
|
||||
if(!hasAttr)
|
||||
aNewParams = anInputParams;
|
||||
else
|
||||
aNewParams = aOldParameters+"|"+anInputParams;
|
||||
|
||||
if(VARIABLE_DEBUG)
|
||||
{
|
||||
cout<<"Input Parameters : "<<anInputParams<<endl;
|
||||
cout<<"Old Parameters : "<<aOldParameters<<endl;
|
||||
cout<<"New Parameters : "<<aNewParams<<endl;
|
||||
}
|
||||
|
||||
|
||||
aStringAttr->SetValue( aNewParams.ToCString() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ParseParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
char* SMESH_Gen_i::ParseParameters(const char* theParameters)
|
||||
{
|
||||
const char* aParameters = CORBA::string_dup(theParameters);
|
||||
TCollection_AsciiString anInputParams;
|
||||
SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
|
||||
if( !aStudy->_is_nil() ) {
|
||||
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
|
||||
for(int j=0;j<aSections->length();j++) {
|
||||
SALOMEDS::ListOfStrings aVars= aSections[j];
|
||||
for(int i=0;i<aVars.length();i++ ) {
|
||||
anInputParams += aStudy->IsVariable(aVars[i].in()) ?
|
||||
TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString("");
|
||||
if(i != aVars.length()-1)
|
||||
anInputParams+=":";
|
||||
}
|
||||
if(j!=aSections->length()-1)
|
||||
anInputParams+="|";
|
||||
}
|
||||
}
|
||||
return CORBA::string_dup(anInputParams.ToCString());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetParameters
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
|
||||
{
|
||||
TCollection_AsciiString aResult;
|
||||
|
||||
SALOMEDS::Study_ptr aStudy = GetCurrentStudy();
|
||||
SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject);
|
||||
|
||||
if(!aStudy->_is_nil() &&
|
||||
!CORBA::is_nil(theObject) &&
|
||||
!aSObj->_is_nil()){
|
||||
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
if ( aSObj->FindAttribute(anAttr, "AttributeString")) {
|
||||
aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value());
|
||||
}
|
||||
}
|
||||
|
||||
return CORBA::string_dup( aResult.ToCString() );
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
@ -120,6 +121,120 @@ CORBA::Long SMESH_Hypothesis_i::GetId()
|
||||
return myBaseImpl->GetID();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::IsPublished()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
bool SMESH_Hypothesis_i::IsPublished(){
|
||||
bool res = false;
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
if(gen){
|
||||
SALOMEDS::SObject_var SO =
|
||||
SMESH_Gen_i::ObjectToSObject(gen->GetCurrentStudy() , SMESH::SMESH_Hypothesis::_narrow(_this()));
|
||||
res = !SO->_is_nil();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::SetParameters()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis_i::SetParameters(const char* theParameters)
|
||||
{
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
char * aParameters = CORBA::string_dup(theParameters);
|
||||
if(gen){
|
||||
if(IsPublished()) {
|
||||
SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Hypothesis::_narrow(_this()),aParameters);
|
||||
}
|
||||
else {
|
||||
myBaseImpl->SetParameters(gen->ParseParameters(aParameters));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::GetParameters()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
char* SMESH_Hypothesis_i::GetParameters()
|
||||
{
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
char* aResult;
|
||||
if(IsPublished()) {
|
||||
MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get Parameters from SObject");
|
||||
aResult = gen->GetParameters(SMESH::SMESH_Hypothesis::_narrow(_this()));
|
||||
}
|
||||
else {
|
||||
MESSAGE("SMESH_Hypothesis_i::GetParameters() : Get local parameters");
|
||||
aResult = myBaseImpl->GetParameters();
|
||||
}
|
||||
return CORBA::string_dup(aResult);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::GetLastParameters()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
SMESH::ListOfParameters* SMESH_Hypothesis_i::GetLastParameters()
|
||||
{
|
||||
SMESH::ListOfParameters_var aResult = new SMESH::ListOfParameters();
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
if(gen) {
|
||||
char *aParameters;
|
||||
if(IsPublished())
|
||||
aParameters = GetParameters();
|
||||
else
|
||||
aParameters = myBaseImpl->GetLastParameters();
|
||||
|
||||
SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
|
||||
if(!aStudy->_is_nil()) {
|
||||
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
|
||||
if(aSections->length() > 0) {
|
||||
SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
|
||||
aResult->length(aVars.length());
|
||||
for(int i = 0;i < aVars.length();i++)
|
||||
aResult[i] = CORBA::string_dup( aVars[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::SetLastParameters()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis_i::SetLastParameters(const char* theParameters)
|
||||
{
|
||||
if(!IsPublished()) {
|
||||
myBaseImpl->SetLastParameters(theParameters);
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::ClearParameters()
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Hypothesis_i::ClearParameters()
|
||||
{
|
||||
if(!IsPublished()) {
|
||||
myBaseImpl->ClearParameters();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Hypothesis_i::GetImpl
|
||||
|
@ -64,6 +64,25 @@ public:
|
||||
|
||||
// Get unique id of hypothesis
|
||||
CORBA::Long GetId();
|
||||
|
||||
// Set list of parameters separated by ":" symbol, used for Hypothesis creation
|
||||
void SetParameters (const char* theParameters);
|
||||
|
||||
// Return list of notebook variables used for Hypothesis creation separated by ":" symbol
|
||||
char* GetParameters();
|
||||
|
||||
//Return list of last notebook variables used for Hypothesis creation.
|
||||
SMESH::ListOfParameters* GetLastParameters();
|
||||
|
||||
//Set last parameters for not published hypothesis
|
||||
|
||||
void SetLastParameters(const char* theParameters);
|
||||
|
||||
// Clear parameters list
|
||||
void ClearParameters();
|
||||
|
||||
//Return true if hypothesis was published in study
|
||||
bool IsPublished();
|
||||
|
||||
// Get implementation
|
||||
::SMESH_Hypothesis* GetImpl();
|
||||
|
@ -1351,12 +1351,13 @@ SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
|
||||
CORBA::Double theAngleInRadians,
|
||||
CORBA::Long theNbOfSteps,
|
||||
CORBA::Double theTolerance,
|
||||
const bool theMakeGroups)
|
||||
const bool theMakeGroups,
|
||||
const SMDSAbs_ElementType theElementType)
|
||||
{
|
||||
initData();
|
||||
|
||||
TIDSortedElemSet inElements, copyElements;
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), inElements);
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), inElements, theElementType);
|
||||
|
||||
TIDSortedElemSet* workElements = & inElements;
|
||||
TPreviewMesh tmpMesh( SMDSAbs_Face );
|
||||
@ -1399,10 +1400,9 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump() << this << ".RotationSweep( "
|
||||
<< theIDsOfElements
|
||||
<< ", axis, "
|
||||
<< theIDsOfElements << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
@ -1434,12 +1434,11 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
|
||||
theTolerance,
|
||||
true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump()<< "axis = " << theAxis;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump<< this << ".RotationSweepMakeGroups( "
|
||||
<< theIDsOfElements
|
||||
<< ", axis, "
|
||||
<< theIDsOfElements << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
@ -1459,10 +1458,9 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump() << this << ".RotationSweepObject( "
|
||||
<< theObject
|
||||
<< ", axis, "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
@ -1476,6 +1474,64 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
|
||||
false);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RotationSweepObject1D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESH_MeshEditor_i::RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct & theAxis,
|
||||
CORBA::Double theAngleInRadians,
|
||||
CORBA::Long theNbOfSteps,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << this << ".RotationSweepObject1D( "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
}
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
rotationSweep(anElementsId,
|
||||
theAxis,
|
||||
theAngleInRadians,
|
||||
theNbOfSteps,
|
||||
theTolerance,
|
||||
false,
|
||||
SMDSAbs_Edge);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RotationSweepObject2D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESH_MeshEditor_i::RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct & theAxis,
|
||||
CORBA::Double theAngleInRadians,
|
||||
CORBA::Long theNbOfSteps,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << this << ".RotationSweepObject2D( "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
}
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
rotationSweep(anElementsId,
|
||||
theAxis,
|
||||
theAngleInRadians,
|
||||
theNbOfSteps,
|
||||
theTolerance,
|
||||
false,
|
||||
SMDSAbs_Face);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RotationSweepObjectMakeGroups
|
||||
//purpose :
|
||||
@ -1496,12 +1552,77 @@ SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theO
|
||||
theTolerance,
|
||||
true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
|
||||
<< theObject
|
||||
<< ", axis, "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RotationSweepObject1DMakeGroups
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups*
|
||||
SMESH_MeshEditor_i::RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct& theAxis,
|
||||
CORBA::Double theAngleInRadians,
|
||||
CORBA::Long theNbOfSteps,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
|
||||
theAxis,
|
||||
theAngleInRadians,
|
||||
theNbOfSteps,
|
||||
theTolerance,
|
||||
true,
|
||||
SMDSAbs_Edge);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump<< this << ".RotationSweepObject1DMakeGroups( "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RotationSweepObject2DMakeGroups
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups*
|
||||
SMESH_MeshEditor_i::RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct& theAxis,
|
||||
CORBA::Double theAngleInRadians,
|
||||
CORBA::Long theNbOfSteps,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups *aGroups = rotationSweep(anElementsId,
|
||||
theAxis,
|
||||
theAngleInRadians,
|
||||
theNbOfSteps,
|
||||
theTolerance,
|
||||
true,
|
||||
SMDSAbs_Face);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump<< this << ".RotationSweepObject2DMakeGroups( "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngleInRadians << ", "
|
||||
<< theNbOfSteps << ", "
|
||||
<< theTolerance << " )";
|
||||
@ -1561,9 +1682,8 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
|
||||
{
|
||||
extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump() << this << ".ExtrusionSweep( "
|
||||
<< theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1580,9 +1700,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject(SMESH::SMESH_IDSource_ptr theObjec
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump() << this << ".ExtrusionSweepObject( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1598,9 +1717,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump() << this << ".ExtrusionSweepObject1D( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1616,9 +1734,8 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump() << this << ".ExtrusionSweepObject2D( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1635,11 +1752,10 @@ SMESH_MeshEditor_i::ExtrusionSweepMakeGroups(const SMESH::long_array& theIDsOfEl
|
||||
SMESH::ListOfGroups* aGroups = extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".ExtrusionSweepMakeGroups( "
|
||||
<< theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -1657,11 +1773,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
|
||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -1679,11 +1794,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -1701,11 +1815,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "stepVector = " << theStepVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
|
||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
||||
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -1842,7 +1955,8 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
||||
CORBA::Boolean theHasRefPoint,
|
||||
const SMESH::PointStruct & theRefPoint,
|
||||
const bool theMakeGroups,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
|
||||
const SMDSAbs_ElementType theElementType)
|
||||
{
|
||||
initData();
|
||||
|
||||
@ -1867,7 +1981,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
||||
}
|
||||
|
||||
TIDSortedElemSet elements;
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements);
|
||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
|
||||
|
||||
list<double> angles;
|
||||
for (int i = 0; i < theAngles.length(); i++) {
|
||||
@ -1912,24 +2026,18 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||
const SMESH::PointStruct & theRefPoint)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "rotAngles = " << theAngles;
|
||||
|
||||
if ( theHasRefPoint )
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( "
|
||||
<< theRefPoint.x << ", "
|
||||
<< theRefPoint.y << ", "
|
||||
<< theRefPoint.z << " )";
|
||||
else
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
|
||||
|
||||
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
|
||||
<< theIDsOfElements << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< "rotAngles" << ", "
|
||||
<< theHasRefPoint << ", refPoint )";
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||
extrusionAlongPath( theIDsOfElements,
|
||||
@ -1961,24 +2069,18 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObje
|
||||
const SMESH::PointStruct & theRefPoint)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "rotAngles = " << theAngles;
|
||||
|
||||
if ( theHasRefPoint )
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( "
|
||||
<< theRefPoint.x << ", "
|
||||
<< theRefPoint.y << ", "
|
||||
<< theRefPoint.z << " )";
|
||||
else
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
|
||||
|
||||
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
|
||||
<< theObject << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< "rotAngles" << ", "
|
||||
<< theHasRefPoint << ", refPoint )";
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
@ -1995,6 +2097,96 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObje
|
||||
return anError;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtrusionAlongPathObject1D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||
SMESH_MeshEditor_i::ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||
GEOM::GEOM_Object_ptr thePathShape,
|
||||
CORBA::Long theNodeStart,
|
||||
CORBA::Boolean theHasAngles,
|
||||
const SMESH::double_array & theAngles,
|
||||
CORBA::Boolean theHasRefPoint,
|
||||
const SMESH::PointStruct & theRefPoint)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject1D( "
|
||||
<< theObject << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
extrusionAlongPath( anElementsId,
|
||||
thePathMesh,
|
||||
thePathShape,
|
||||
theNodeStart,
|
||||
theHasAngles,
|
||||
theAngles,
|
||||
theHasRefPoint,
|
||||
theRefPoint,
|
||||
false,
|
||||
anError,
|
||||
SMDSAbs_Edge);
|
||||
return anError;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtrusionAlongPathObject2D
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||
SMESH_MeshEditor_i::ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||
GEOM::GEOM_Object_ptr thePathShape,
|
||||
CORBA::Long theNodeStart,
|
||||
CORBA::Boolean theHasAngles,
|
||||
const SMESH::double_array & theAngles,
|
||||
CORBA::Boolean theHasRefPoint,
|
||||
const SMESH::PointStruct & theRefPoint)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject2D( "
|
||||
<< theObject << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
extrusionAlongPath( anElementsId,
|
||||
thePathMesh,
|
||||
thePathShape,
|
||||
theNodeStart,
|
||||
theHasAngles,
|
||||
theAngles,
|
||||
theHasRefPoint,
|
||||
theRefPoint,
|
||||
false,
|
||||
anError,
|
||||
SMDSAbs_Face);
|
||||
return anError;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtrusionAlongPathMakeGroups
|
||||
@ -2023,16 +2215,6 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theI
|
||||
true,
|
||||
Error);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "rotAngles = " << theAngles;
|
||||
|
||||
if ( theHasRefPoint )
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( "
|
||||
<< theRefPoint.x << ", "
|
||||
<< theRefPoint.y << ", "
|
||||
<< theRefPoint.z << " )";
|
||||
else
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
|
||||
|
||||
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||
TPythonDump aPythonDump;
|
||||
if(isDumpGroups) {
|
||||
@ -2049,8 +2231,12 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theI
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< "rotAngles" << ", "
|
||||
<< theHasRefPoint << ", refPoint )";
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -2084,16 +2270,6 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
Error);
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "rotAngles = " << theAngles;
|
||||
|
||||
if ( theHasRefPoint )
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( "
|
||||
<< theRefPoint.x << ", "
|
||||
<< theRefPoint.y << ", "
|
||||
<< theRefPoint.z << " )";
|
||||
else
|
||||
TPythonDump() << "refPoint = SMESH.PointStruct( 0,0,0 )";
|
||||
|
||||
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||
TPythonDump aPythonDump;
|
||||
if(isDumpGroups) {
|
||||
@ -2110,8 +2286,124 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< "rotAngles" << ", "
|
||||
<< theHasRefPoint << ", refPoint )";
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtrusionAlongPathObject1DMakeGroups
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups* SMESH_MeshEditor_i::
|
||||
ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||
GEOM::GEOM_Object_ptr thePathShape,
|
||||
CORBA::Long theNodeStart,
|
||||
CORBA::Boolean theHasAngles,
|
||||
const SMESH::double_array& theAngles,
|
||||
CORBA::Boolean theHasRefPoint,
|
||||
const SMESH::PointStruct& theRefPoint,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
|
||||
{
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
|
||||
thePathMesh,
|
||||
thePathShape,
|
||||
theNodeStart,
|
||||
theHasAngles,
|
||||
theAngles,
|
||||
theHasRefPoint,
|
||||
theRefPoint,
|
||||
true,
|
||||
Error,
|
||||
SMDSAbs_Edge);
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||
TPythonDump aPythonDump;
|
||||
if(isDumpGroups) {
|
||||
aPythonDump << "("<<aGroups;
|
||||
}
|
||||
if(isDumpGroups)
|
||||
aPythonDump << ", error)";
|
||||
else
|
||||
aPythonDump <<"error";
|
||||
|
||||
aPythonDump << " = " << this << ".ExtrusionAlongPathObject1DMakeGroups( "
|
||||
<< theObject << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ExtrusionAlongPathObject2DMakeGroups
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH::ListOfGroups* SMESH_MeshEditor_i::
|
||||
ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr thePathMesh,
|
||||
GEOM::GEOM_Object_ptr thePathShape,
|
||||
CORBA::Long theNodeStart,
|
||||
CORBA::Boolean theHasAngles,
|
||||
const SMESH::double_array& theAngles,
|
||||
CORBA::Boolean theHasRefPoint,
|
||||
const SMESH::PointStruct& theRefPoint,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error)
|
||||
{
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups = extrusionAlongPath( anElementsId,
|
||||
thePathMesh,
|
||||
thePathShape,
|
||||
theNodeStart,
|
||||
theHasAngles,
|
||||
theAngles,
|
||||
theHasRefPoint,
|
||||
theRefPoint,
|
||||
true,
|
||||
Error,
|
||||
SMDSAbs_Face);
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||
TPythonDump aPythonDump;
|
||||
if(isDumpGroups) {
|
||||
aPythonDump << "("<<aGroups;
|
||||
}
|
||||
if(isDumpGroups)
|
||||
aPythonDump << ", error)";
|
||||
else
|
||||
aPythonDump <<"error";
|
||||
|
||||
aPythonDump << " = " << this << ".ExtrusionAlongPathObject2DMakeGroups( "
|
||||
<< theObject << ", "
|
||||
<< thePathMesh << ", "
|
||||
<< thePathShape << ", "
|
||||
<< theNodeStart << ", "
|
||||
<< theHasAngles << ", "
|
||||
<< theAngles << ", "
|
||||
<< theHasRefPoint << ", "
|
||||
<< "SMESH.PointStruct( "
|
||||
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -2285,12 +2577,11 @@ SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array& theIDsO
|
||||
{
|
||||
SMESH::ListOfGroups * aGroups = mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump()<<"axis = "<<theMirror;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".MirrorMakeGroups( "
|
||||
<< theIDsOfElements << ", "
|
||||
<< "axis, "
|
||||
<< theMirror << ", "
|
||||
<< mirrorTypeName(theMirrorType) << " )";
|
||||
}
|
||||
return aGroups;
|
||||
@ -2309,12 +2600,11 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr t
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
SMESH::ListOfGroups * aGroups = mirror(anElementsId, theMirror, theMirrorType, true, true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump()<<"axis = "<<theMirror;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".MirrorObjectMakeGroups( "
|
||||
<< theObject << ", "
|
||||
<< "axis, "
|
||||
<< theMirror << ", "
|
||||
<< mirrorTypeName(theMirrorType) << " )";
|
||||
}
|
||||
return aGroups;
|
||||
@ -2450,10 +2740,9 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
|
||||
CORBA::Boolean theCopy)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "vector = " << theVector;
|
||||
TPythonDump() << this << ".Translate( "
|
||||
<< theIDsOfElements
|
||||
<< ", vector, "
|
||||
<< theIDsOfElements << ", "
|
||||
<< theVector << ", "
|
||||
<< theCopy << " )";
|
||||
}
|
||||
translate(theIDsOfElements,
|
||||
@ -2473,8 +2762,8 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << this << ".TranslateObject( "
|
||||
<< theObject
|
||||
<< ", vector, "
|
||||
<< theObject << ", "
|
||||
<< theVector << ", "
|
||||
<< theCopy << " )";
|
||||
}
|
||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||
@ -2495,12 +2784,11 @@ SMESH_MeshEditor_i::TranslateMakeGroups(const SMESH::long_array& theIDsOfElement
|
||||
{
|
||||
SMESH::ListOfGroups * aGroups = translate(theIDsOfElements,theVector,true,true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "vector = " << theVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".TranslateMakeGroups( "
|
||||
<< theIDsOfElements
|
||||
<< ", vector )";
|
||||
<< theIDsOfElements << ", "
|
||||
<< theVector << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -2519,12 +2807,11 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
|
||||
TPythonDump() << "vector = " << theVector;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".TranslateObjectMakeGroups( "
|
||||
<< theObject
|
||||
<< ", vector )";
|
||||
<< theObject << ", "
|
||||
<< theVector << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
@ -2660,10 +2947,9 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
|
||||
CORBA::Boolean theCopy)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump() << this << ".Rotate( "
|
||||
<< theIDsOfElements
|
||||
<< ", axis, "
|
||||
<< theIDsOfElements << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngle << ", "
|
||||
<< theCopy << " )";
|
||||
}
|
||||
@ -2685,10 +2971,9 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
|
||||
CORBA::Boolean theCopy)
|
||||
{
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump() << this << ".RotateObject( "
|
||||
<< theObject
|
||||
<< ", axis, "
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngle << ", "
|
||||
<< theCopy << " )";
|
||||
}
|
||||
@ -2712,12 +2997,11 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
|
||||
{
|
||||
SMESH::ListOfGroups * aGroups = rotate(theIDsOfElements,theAxis,theAngle,true,true);
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".RotateMakeGroups( "
|
||||
<< theIDsOfElements
|
||||
<< ", axis, "
|
||||
<< theIDsOfElements << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngle << " )";
|
||||
}
|
||||
return aGroups;
|
||||
@ -2737,13 +3021,12 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::ListOfGroups * aGroups = rotate(anElementsId,theAxis,theAngle,true,true);
|
||||
|
||||
if ( !myPreviewMode ) {
|
||||
TPythonDump() << "axis = " << theAxis;
|
||||
TPythonDump aPythonDump;
|
||||
DumpGroupsList(aPythonDump,aGroups);
|
||||
aPythonDump << this << ".RotateObjectMakeGroups( "
|
||||
<< theObject
|
||||
<< ", axis, "
|
||||
<< theAngle << " )";
|
||||
<< theObject << ", "
|
||||
<< theAxis << ", "
|
||||
<< theAngle << " )";
|
||||
}
|
||||
return aGroups;
|
||||
}
|
||||
|
@ -181,6 +181,16 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
void RotationSweepObject1D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct & Axis,
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
void RotationSweepObject2D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
const SMESH::AxisStruct & Axis,
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
|
||||
void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
|
||||
const SMESH::DirStruct & StepVector,
|
||||
@ -219,6 +229,24 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
||||
const SMESH::double_array & Angles,
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct & RefPoint);
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||
ExtrusionAlongPathObject1D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||
GEOM::GEOM_Object_ptr PathShape,
|
||||
CORBA::Long NodeStart,
|
||||
CORBA::Boolean HasAngles,
|
||||
const SMESH::double_array & Angles,
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct & RefPoint);
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error
|
||||
ExtrusionAlongPathObject2D(SMESH::SMESH_IDSource_ptr theObject,
|
||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||
GEOM::GEOM_Object_ptr PathShape,
|
||||
CORBA::Long NodeStart,
|
||||
CORBA::Boolean HasAngles,
|
||||
const SMESH::double_array & Angles,
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct & RefPoint);
|
||||
|
||||
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
|
||||
GEOM::GEOM_Object_ptr PathShape,
|
||||
@ -257,6 +285,16 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
SMESH::ListOfGroups* RotationSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
|
||||
const SMESH::AxisStruct& Axix,
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
SMESH::ListOfGroups* RotationSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
|
||||
const SMESH::AxisStruct& Axix,
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance);
|
||||
SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
|
||||
const SMESH::DirStruct& StepVector,
|
||||
CORBA::Long NbOfSteps);
|
||||
@ -292,6 +330,24 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct& RefPoint,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
|
||||
SMESH::ListOfGroups* ExtrusionAlongPathObject1DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
|
||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||
GEOM::GEOM_Object_ptr PathShape,
|
||||
CORBA::Long NodeStart,
|
||||
CORBA::Boolean HasAngles,
|
||||
const SMESH::double_array& Angles,
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct& RefPoint,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
|
||||
SMESH::ListOfGroups* ExtrusionAlongPathObject2DMakeGroups(SMESH::SMESH_IDSource_ptr Object,
|
||||
SMESH::SMESH_Mesh_ptr PathMesh,
|
||||
GEOM::GEOM_Object_ptr PathShape,
|
||||
CORBA::Long NodeStart,
|
||||
CORBA::Boolean HasAngles,
|
||||
const SMESH::double_array& Angles,
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct& RefPoint,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
|
||||
SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
|
||||
const SMESH::AxisStruct& Mirror,
|
||||
SMESH::SMESH_MeshEditor::MirrorType MirrorType);
|
||||
@ -454,7 +510,8 @@ private: //!< private methods
|
||||
CORBA::Double AngleInRadians,
|
||||
CORBA::Long NbOfSteps,
|
||||
CORBA::Double Tolerance,
|
||||
const bool MakeGroups);
|
||||
const bool MakeGroups,
|
||||
const SMDSAbs_ElementType ElementType=SMDSAbs_All);
|
||||
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
|
||||
const SMESH::DirStruct & StepVector,
|
||||
CORBA::Long NbOfSteps,
|
||||
@ -475,7 +532,8 @@ private: //!< private methods
|
||||
CORBA::Boolean HasRefPoint,
|
||||
const SMESH::PointStruct & RefPoint,
|
||||
const bool MakeGroups,
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error & Error);
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error & Error,
|
||||
const SMDSAbs_ElementType ElementType=SMDSAbs_All);
|
||||
SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
|
||||
const SMESH::AxisStruct & Axis,
|
||||
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
|
||||
|
@ -3112,3 +3112,50 @@ void SMESH_Mesh_i::checkGroupNames()
|
||||
aGrp->SetName( guiName );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* \brief Sets list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
//=============================================================================
|
||||
void SMESH_Mesh_i::SetParameters(const char* theParameters)
|
||||
{
|
||||
SMESH_Gen_i::GetSMESHGen()->UpdateParameters(SMESH::SMESH_Mesh::_narrow(_this()),
|
||||
CORBA::string_dup(theParameters));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* \brief Returns list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
//=============================================================================
|
||||
char* SMESH_Mesh_i::GetParameters()
|
||||
{
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
return CORBA::string_dup(gen->GetParameters(SMESH::SMESH_Mesh::_narrow(_this())));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* \brief Returns list of notebook variables used for last Mesh operation
|
||||
*/
|
||||
//=============================================================================
|
||||
SMESH::string_array* SMESH_Mesh_i::GetLastParameters()
|
||||
{
|
||||
SMESH::string_array_var aResult = new SMESH::string_array();
|
||||
SMESH_Gen_i *gen = SMESH_Gen_i::GetSMESHGen();
|
||||
if(gen) {
|
||||
char *aParameters = GetParameters();
|
||||
SALOMEDS::Study_ptr aStudy = gen->GetCurrentStudy();
|
||||
if(!aStudy->_is_nil()) {
|
||||
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
|
||||
if(aSections->length() > 0) {
|
||||
SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
|
||||
aResult->length(aVars.length());
|
||||
for(int i = 0;i < aVars.length();i++)
|
||||
aResult[i] = CORBA::string_dup( aVars[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return aResult._retn();
|
||||
}
|
||||
|
@ -468,6 +468,21 @@ public:
|
||||
*/
|
||||
virtual SALOME_MED::MedFileInfo* GetMEDFileInfo();
|
||||
|
||||
/*!
|
||||
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
void SetParameters (const char* theParameters);
|
||||
|
||||
/*!
|
||||
* Returns list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
char* GetParameters();
|
||||
|
||||
/*!
|
||||
* Returns list of notebook variables used for last Mesh operation
|
||||
*/
|
||||
SMESH::string_array* GetLastParameters();
|
||||
|
||||
std::map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
|
||||
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
|
||||
|
||||
|
861
src/SMESH_I/SMESH_NoteBook.cxx
Normal file
861
src/SMESH_I/SMESH_NoteBook.cxx
Normal file
@ -0,0 +1,861 @@
|
||||
// Copyright (C) 2008 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : SMESH_NoteBook.cxx
|
||||
// Author : Roman NIKOLAEV
|
||||
|
||||
#include "SMESH_2smeshpy.hxx"
|
||||
#include "SMESH_NoteBook.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
|
||||
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
#else
|
||||
static int MYDEBUG = 0;
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
void SetVariable(Handle(_pyCommand) theCommand,const ObjectStates* theStates, int position, int theArgNb);
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
ObjectStates::ObjectStates(TCollection_AsciiString theType)
|
||||
{
|
||||
_type = theType;
|
||||
_dumpstate = 0;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
//================================================================================
|
||||
ObjectStates::~ObjectStates()
|
||||
{
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Add new object state
|
||||
* \param theState - Object state (vector of notebook variable)
|
||||
*/
|
||||
//================================================================================
|
||||
void ObjectStates::AddState(const TState &theState)
|
||||
{
|
||||
_states.push_back(theState);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return current object state
|
||||
* \\retval state - Object state (vector of notebook variable)
|
||||
*/
|
||||
//================================================================================
|
||||
TState ObjectStates::GetCurrectState() const
|
||||
{
|
||||
if(_states.size() > _dumpstate)
|
||||
return _states[_dumpstate];
|
||||
TState empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
TAllStates ObjectStates::GetAllStates() const
|
||||
{
|
||||
return _states;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
void ObjectStates::IncrementState()
|
||||
{
|
||||
_dumpstate++;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
TCollection_AsciiString ObjectStates::GetObjectType() const{
|
||||
return _type;
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
LayerDistributionStates::LayerDistributionStates():
|
||||
ObjectStates("LayerDistribution")
|
||||
{
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
//================================================================================
|
||||
LayerDistributionStates::~LayerDistributionStates()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief AddDistribution
|
||||
*/
|
||||
//================================================================================
|
||||
void LayerDistributionStates::AddDistribution(const TCollection_AsciiString& theDistribution)
|
||||
{
|
||||
_distributions.insert(pair<TCollection_AsciiString,TCollection_AsciiString>(theDistribution,""));
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief HasDistribution
|
||||
*/
|
||||
//================================================================================
|
||||
bool LayerDistributionStates::HasDistribution(const TCollection_AsciiString& theDistribution) const
|
||||
{
|
||||
return _distributions.find(theDistribution) != _distributions.end();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief SetDistributionType
|
||||
*/
|
||||
//================================================================================
|
||||
bool LayerDistributionStates::SetDistributionType(const TCollection_AsciiString& theDistribution,
|
||||
const TCollection_AsciiString& theType)
|
||||
{
|
||||
TDistributionMap::iterator it = _distributions.find(theDistribution);
|
||||
if(it == _distributions.end())
|
||||
return false;
|
||||
(*it).second = theType;
|
||||
return true;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief GetDistributionType
|
||||
*/
|
||||
//================================================================================
|
||||
TCollection_AsciiString LayerDistributionStates::
|
||||
GetDistributionType(const TCollection_AsciiString& theDistribution) const
|
||||
{
|
||||
TDistributionMap::const_iterator it = _distributions.find(theDistribution);
|
||||
return (it == _distributions.end()) ? TCollection_AsciiString() : (*it).second;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
SMESH_NoteBook::SMESH_NoteBook()
|
||||
{
|
||||
InitObjectMap();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Destructor
|
||||
*/
|
||||
//================================================================================
|
||||
SMESH_NoteBook::~SMESH_NoteBook()
|
||||
{
|
||||
TVariablesMap::const_iterator it = _objectMap.begin();
|
||||
for(;it!=_objectMap.end();it++) {
|
||||
if((*it).second)
|
||||
delete (*it).second;
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Replace parameters of the functions on the Salome NoteBook Variables
|
||||
* \param theString - Input string
|
||||
* \retval TCollection_AsciiString - Convertion result
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESH_NoteBook::ReplaceVariables()
|
||||
{
|
||||
for(int i=0;i<_commands.size();i++) {
|
||||
Handle(_pyCommand) aCmd = _commands[i];
|
||||
TCollection_AsciiString aMethod = aCmd->GetMethod();
|
||||
TCollection_AsciiString aObject = aCmd->GetObject();
|
||||
TCollection_AsciiString aResultValue = aCmd->GetResultValue();
|
||||
if(MYDEBUG) {
|
||||
cout<<"Command before : "<< aCmd->GetString()<<endl;
|
||||
cout<<"Method : "<< aMethod<<endl;
|
||||
cout<<"Object : "<< aObject<<endl;
|
||||
cout<<"Result : "<< aResultValue<<endl;
|
||||
}
|
||||
|
||||
// check if method modifies the object itself
|
||||
TVariablesMap::const_iterator it = _objectMap.find(aObject);
|
||||
if(it == _objectMap.end()) // check if method returns a new object
|
||||
it = _objectMap.find(aResultValue);
|
||||
|
||||
if(it == _objectMap.end()) { // check if method modifies a mesh using mesh editor
|
||||
TMeshEditorMap::const_iterator meIt = myMeshEditors.find(aObject);
|
||||
if(meIt != myMeshEditors.end()) {
|
||||
TCollection_AsciiString aMesh = (*meIt).second;
|
||||
it = _objectMap.find(aMesh);
|
||||
}
|
||||
}
|
||||
|
||||
if(it == _objectMap.end()) { // additional check for pattern mapping
|
||||
if(aMethod.IsEqual("ApplyToMeshFaces") ||
|
||||
aMethod.IsEqual("ApplyToHexahedrons"))
|
||||
it = _objectMap.find(aCmd->GetArg(1));
|
||||
}
|
||||
|
||||
if(it != _objectMap.end()) {
|
||||
if(MYDEBUG)
|
||||
cout << "Found object : " << (*it).first << endl;
|
||||
ObjectStates *aStates = (*it).second;
|
||||
// Case for LocalLength hypothesis
|
||||
if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
|
||||
if(aMethod.IsEqual("SetLength")) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("SetPrecision")) {
|
||||
if(!aStates->GetCurrectState().at(1).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for SegmentLengthAroundVertex hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("SegmentLengthAroundVertex")
|
||||
&& aStates->GetCurrectState().size() >= 1) {
|
||||
if(aMethod == "SetLength") {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for Arithmetic1D and StartEndLength hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("Arithmetic1D") ||
|
||||
aStates->GetObjectType().IsEqual("StartEndLength")) {
|
||||
if(aMethod == "SetLength" &&
|
||||
aStates->GetCurrectState().size() >= 2) {
|
||||
if(aCmd->GetArg(2) == "1" && !aStates->GetCurrectState().at(0).IsEmpty())
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
else if(!aStates->GetCurrectState().at(1).IsEmpty())
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
//Case for Deflection1D hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("Deflection1D")){
|
||||
if(aMethod == "SetDeflection" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for LayerDistribution hypothesis (not finished yet)
|
||||
else if(aStates->GetObjectType() == "LayerDistribution") {
|
||||
if(aMethod == "SetLayerDistribution"){
|
||||
LayerDistributionStates* aLDStates = (LayerDistributionStates*)(aStates);
|
||||
aLDStates->AddDistribution(aCmd->GetArg(1));
|
||||
if(MYDEBUG)
|
||||
cout<<"Add Distribution :"<<aCmd->GetArg(1)<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Case for MaxElementArea hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("MaxElementArea")){
|
||||
if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for MaxElementVolume hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("MaxElementVolume")){
|
||||
if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NETGEN_Parameters_2D or NETGEN_Parameters_2D hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NETGEN_Parameters_2D") ||
|
||||
aStates->GetObjectType().IsEqual("NETGEN_Parameters")){
|
||||
if(aMethod == "SetMaxSize" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetGrowthRate" && aStates->GetCurrectState().size() >= 2) {
|
||||
if(!aStates->GetCurrectState().at(1).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetNbSegPerEdge" && aStates->GetCurrectState().size() >= 3) {
|
||||
if(!aStates->GetCurrectState().at(2).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(2));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetNbSegPerRadius" && aStates->GetCurrectState().size() >= 4) {
|
||||
if(!aStates->GetCurrectState().at(3).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(3));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NETGEN_SimpleParameters_3D or NETGEN_SimpleParameters_2D hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NETGEN_SimpleParameters_3D") ||
|
||||
aStates->GetObjectType().IsEqual("NETGEN_SimpleParameters_2D")){
|
||||
|
||||
if((aMethod == "SetNumberOfSegments" || aMethod == "SetLocalLength") &&
|
||||
aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetMaxElementArea" && aStates->GetCurrectState().size() >= 2) {
|
||||
if(!aStates->GetCurrectState().at(1).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetMaxElementVolume" && aStates->GetCurrectState().size() >= 3) {
|
||||
if(!aStates->GetCurrectState().at(2).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(2));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod == "LengthFromEdges" || aMethod == "LengthFromFaces"){
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NumberOfLayers hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NumberOfLayers")){
|
||||
if(aMethod == "SetNumberOfLayers" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NumberOfSegments hypothesis
|
||||
else if(aStates->GetObjectType().IsEqual("NumberOfSegments")){
|
||||
if(aMethod == "SetNumberOfSegments" && aStates->GetCurrectState().size() >= 1) {
|
||||
if(!aStates->GetCurrectState().at(0).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(0));
|
||||
if(aStates->GetCurrectState().size()==1)
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if (aMethod == "SetScaleFactor" && aStates->GetCurrectState().size() >= 2) {
|
||||
if(!aStates->GetCurrectState().at(1).IsEmpty() )
|
||||
aCmd->SetArg(1,aStates->GetCurrectState().at(1));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
else if(aStates->GetObjectType().IsEqual("Mesh")) {
|
||||
TState aCurrentState = aStates->GetCurrectState();
|
||||
int aCurrentStateSize = aCurrentState.size();
|
||||
if(aMethod.IsEqual("Translate") ||
|
||||
aMethod.IsEqual("TranslateMakeGroups") ||
|
||||
aMethod.IsEqual("TranslateMakeMesh") ||
|
||||
aMethod.IsEqual("TranslateObject") ||
|
||||
aMethod.IsEqual("TranslateObjectMakeGroups") ||
|
||||
aMethod.IsEqual("TranslateObjectMakeMesh")) {
|
||||
bool isVariableFound = false;
|
||||
int anArgIndex = 0;
|
||||
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
||||
if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
|
||||
anArgIndex = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(anArgIndex > 0) {
|
||||
if(aCurrentStateSize == 3) { // translation by dx, dy, dz
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty()) {
|
||||
isVariableFound = true;
|
||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
|
||||
// TODO: limitation until operations on the variables will be introduced
|
||||
/*
|
||||
isVariableFound = true;
|
||||
for(int j = 0; j < 3; j++) {
|
||||
TCollection_AsciiString anArg = aCmd->GetArg(anArgIndex+j);
|
||||
TCollection_AsciiString aValue1 = aCurrentState.at(2*j), aValue2 = aCurrentState.at(2*j+1);
|
||||
bool aV1 = !aValue1.IsEmpty();
|
||||
bool aV2 = !aValue2.IsEmpty();
|
||||
double aValue, aCurrentValue = anArg.IsRealValue() ? anArg.RealValue() : 0;
|
||||
if(aV1 && !aV2) {
|
||||
if(!GetReal(aValue1, aValue))
|
||||
aValue = 0;
|
||||
aValue2 = TCollection_AsciiString( aValue + aCurrentValue );
|
||||
}
|
||||
else if(!aV1 && aV2) {
|
||||
if(!GetReal(aValue2, aValue))
|
||||
aValue = 0;
|
||||
aValue1 = TCollection_AsciiString( aValue - aCurrentValue );
|
||||
}
|
||||
else if(!aV1 && !aV2) {
|
||||
aValue1 = TCollection_AsciiString( 0 );
|
||||
aValue2 = TCollection_AsciiString( aCurrentValue );
|
||||
}
|
||||
aCmd->SetArg(anArgIndex+j, aValue1 + ", " + aValue2 );
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
if(isVariableFound) {
|
||||
TCollection_AsciiString aDim;
|
||||
if(aCurrentStateSize == 6)
|
||||
aDim = "6";
|
||||
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr"+aDim);
|
||||
aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
|
||||
}
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("Rotate") ||
|
||||
aMethod.IsEqual("RotateMakeGroups") ||
|
||||
aMethod.IsEqual("RotateMakeMesh") ||
|
||||
aMethod.IsEqual("RotateObject") ||
|
||||
aMethod.IsEqual("RotateObjectMakeGroups") ||
|
||||
aMethod.IsEqual("RotateObjectMakeMesh") ||
|
||||
aMethod.IsEqual("RotationSweep") ||
|
||||
aMethod.IsEqual("RotationSweepObject") ||
|
||||
aMethod.IsEqual("RotationSweepObject1D") ||
|
||||
aMethod.IsEqual("RotationSweepObject2D") ||
|
||||
aMethod.IsEqual("RotationSweepMakeGroups") ||
|
||||
aMethod.IsEqual("RotationSweepObjectMakeGroups") ||
|
||||
aMethod.IsEqual("RotationSweepObject1DMakeGroups") ||
|
||||
aMethod.IsEqual("RotationSweepObject2DMakeGroups") ||
|
||||
aMethod.IsEqual("Mirror") ||
|
||||
aMethod.IsEqual("MirrorMakeMesh") ||
|
||||
aMethod.IsEqual("MirrorMakeGroups") ||
|
||||
aMethod.IsEqual("MirrorObject") ||
|
||||
aMethod.IsEqual("MirrorObjectMakeMesh") ||
|
||||
aMethod.IsEqual("MirrorObjectMakeGroups")) {
|
||||
bool isSubstitute = false;
|
||||
int anArgIndex = 0;
|
||||
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
||||
if(aCmd->GetArg(i).IsEqual("SMESH.AxisStruct")) {
|
||||
anArgIndex = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(anArgIndex > 0) {
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty()) {
|
||||
if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep)
|
||||
isSubstitute = true;
|
||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSubstitute)
|
||||
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".AxisStructStr");
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("AddNode") ||
|
||||
aMethod.IsEqual("MoveClosestNodeToPoint")) {
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty())
|
||||
aCmd->SetArg(j+1, aCurrentState.at(j));
|
||||
}
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("MoveNode")) {
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty())
|
||||
aCmd->SetArg(j+2, aCurrentState.at(j));
|
||||
}
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("ExtrusionSweep") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObject") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObject1D") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObject2D") ||
|
||||
aMethod.IsEqual("ExtrusionSweepMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObjectMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObject1DMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionSweepObject2DMakeGroups")) {
|
||||
bool isSubstitute = false;
|
||||
int anArgIndex = 0;
|
||||
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
||||
if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
|
||||
anArgIndex = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(anArgIndex > 0) {
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty()) {
|
||||
if(j < 3) // 0-2 - dir struct, 3 - number of steps
|
||||
isSubstitute = true;
|
||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSubstitute) {
|
||||
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
|
||||
aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
|
||||
}
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("ExtrusionAlongPath") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObject") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObject1D") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObject2D") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObjectMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObject1DMakeGroups") ||
|
||||
aMethod.IsEqual("ExtrusionAlongPathObject2DMakeGroups") ||
|
||||
/* workaround for a bug in the command parsing algorithm */
|
||||
aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -1 ||
|
||||
aCmd->GetString().Search("ExtrusionAlongPathObjectMakeGroups") != -1 ||
|
||||
aCmd->GetString().Search("ExtrusionAlongPathObject1DMakeGroups") != -1 ||
|
||||
aCmd->GetString().Search("ExtrusionAlongPathObject2DMakeGroups") != -1 ) {
|
||||
int aNbAngles = aCurrentStateSize-3; // State looks like "Angle1:...:AngleN:X:Y:Z"
|
||||
bool isSubstitute = false;
|
||||
int anArgIndex = 0;
|
||||
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
||||
if(aCmd->GetArg(i).IsEqual("SMESH.PointStruct")) {
|
||||
anArgIndex = i-1-aNbAngles;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(anArgIndex > 0) {
|
||||
int j = 0;
|
||||
for(; j < aNbAngles; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty()) {
|
||||
aCmd->SetArg(anArgIndex+j-1, aCurrentState.at(j));
|
||||
}
|
||||
}
|
||||
for(; j < aNbAngles+3; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty()) {
|
||||
isSubstitute = true;
|
||||
aCmd->SetArg(anArgIndex+j+2, aCurrentState.at(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSubstitute)
|
||||
aCmd->SetArg(anArgIndex + aNbAngles + 1,
|
||||
TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("TriToQuad") ||
|
||||
aMethod.IsEqual("Concatenate") ||
|
||||
aMethod.IsEqual("ConcatenateWithGroups")) {
|
||||
if(aCurrentStateSize && !aCurrentState.at(0).IsEmpty())
|
||||
aCmd->SetArg(aCmd->GetNbArgs(), aCurrentState.at(0));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("Smooth") ||
|
||||
aMethod.IsEqual("SmoothObject") ||
|
||||
aMethod.IsEqual("SmoothParametric") ||
|
||||
aMethod.IsEqual("SmoothParametricObject")) {
|
||||
int anArgIndex = aCmd->GetNbArgs() - 2;
|
||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||
if(!aCurrentState.at(j).IsEmpty())
|
||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||
}
|
||||
aStates->IncrementState();
|
||||
}
|
||||
else if(aMethod.IsEqual("ApplyToMeshFaces") ||
|
||||
aMethod.IsEqual("ApplyToHexahedrons")) {
|
||||
int anArgIndex = aCmd->GetNbArgs()-1;
|
||||
for(int j = 0; j < aCurrentStateSize; j++)
|
||||
if(!aCurrentState.at(j).IsEmpty())
|
||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||
aStates->IncrementState();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(MYDEBUG)
|
||||
cout << "Object not found" << endl;
|
||||
}
|
||||
if(MYDEBUG) {
|
||||
cout<<"Command after: "<< aCmd->GetString()<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessLayerDistribution();
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Private method
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESH_NoteBook::InitObjectMap()
|
||||
{
|
||||
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
|
||||
if(!aGen)
|
||||
return;
|
||||
|
||||
SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
|
||||
if(aStudy->_is_nil())
|
||||
return;
|
||||
|
||||
SALOMEDS::SObject_var aSO = aStudy->FindComponent(aGen->ComponentDataType());
|
||||
if(CORBA::is_nil(aSO))
|
||||
return;
|
||||
|
||||
SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
|
||||
char* aParameters;
|
||||
for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
|
||||
SALOMEDS::SObject_var aSObject = Itr->Value();
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
if ( aSObject->FindAttribute(anAttr, "AttributeString")) {
|
||||
aParameters = SALOMEDS::AttributeString::_narrow(anAttr)->Value();
|
||||
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
|
||||
if(MYDEBUG) {
|
||||
cout<<"Entry : "<< aSObject->GetID()<<endl;
|
||||
cout<<"aParameters : "<<aParameters<<endl;
|
||||
}
|
||||
TCollection_AsciiString anObjType;
|
||||
CORBA::Object_var anObject = SMESH_Gen_i::SObjectToObject(aSObject);
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(anObject);
|
||||
if(!aHyp->_is_nil()) {
|
||||
anObjType = TCollection_AsciiString(aHyp->GetName());
|
||||
}
|
||||
else if(SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject)) {
|
||||
anObjType = TCollection_AsciiString("Mesh");
|
||||
}
|
||||
if(MYDEBUG)
|
||||
cout<<"The object Type : "<<anObjType<<endl;
|
||||
ObjectStates *aState = NULL;
|
||||
if(anObjType == "LayerDistribution") {
|
||||
aState = new LayerDistributionStates();
|
||||
}
|
||||
else
|
||||
aState = new ObjectStates(anObjType);
|
||||
|
||||
for(int i = 0; i < aSections->length(); i++) {
|
||||
TState aVars;
|
||||
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
|
||||
for(int j = 0;j<aListOfVars.length();j++) {
|
||||
TCollection_AsciiString aVar(aListOfVars[j].in());
|
||||
if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
|
||||
aVar.InsertBefore(1,"\"");
|
||||
aVar.InsertAfter(aVar.Length(),"\"");
|
||||
}
|
||||
aVars.push_back(aVar);
|
||||
if(MYDEBUG) {
|
||||
cout<<"Variable: '"<<aVar<<"'"<<endl;
|
||||
}
|
||||
}
|
||||
aState->AddState(aVars);
|
||||
}
|
||||
_objectMap.insert(pair<TCollection_AsciiString,ObjectStates*>(TCollection_AsciiString(aSObject->GetID()),aState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESH_NoteBook::AddCommand(const TCollection_AsciiString& theString)
|
||||
{
|
||||
if(MYDEBUG)
|
||||
cout<<theString<<endl;
|
||||
Handle(_pyCommand) aCommand = new _pyCommand( theString, -1);
|
||||
_commands.push_back(aCommand);
|
||||
|
||||
if ( aCommand->GetMethod() == "GetMeshEditor" ) { // MeshEditor creation
|
||||
myMeshEditors.insert( make_pair( aCommand->GetResultValue(),
|
||||
aCommand->GetObject() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESH_NoteBook::ProcessLayerDistribution()
|
||||
{
|
||||
// 1) Find all LayerDistribution states
|
||||
vector<LayerDistributionStates*> aLDS;
|
||||
TVariablesMap::const_iterator it = _objectMap.begin();
|
||||
for(;it != _objectMap.end();it++) {
|
||||
LayerDistributionStates* aLDStates = dynamic_cast<LayerDistributionStates*>(((*it).second));
|
||||
if(aLDStates!=NULL) {
|
||||
aLDS.push_back(aLDStates);
|
||||
}
|
||||
}
|
||||
|
||||
if(!aLDS.size())
|
||||
return;
|
||||
|
||||
// 2) Initialize all type of 1D Distribution hypothesis
|
||||
for(int i=0;i<_commands.size();i++){
|
||||
for(int j =0;j < aLDS.size();j++){
|
||||
TCollection_AsciiString aResultValue = _commands[i]->GetResultValue();
|
||||
if(_commands[i]->GetMethod() == "CreateHypothesis" &&
|
||||
aLDS[j]->HasDistribution(aResultValue)){
|
||||
TCollection_AsciiString aType = _commands[i]->GetArg(1);
|
||||
aType.RemoveAll('\'');
|
||||
aLDS[j]->SetDistributionType(aResultValue,aType);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 3) ... and replase variables ...
|
||||
|
||||
for(int i=0;i<_commands.size();i++){
|
||||
for(int j =0;j < aLDS.size();j++){
|
||||
TCollection_AsciiString anObject = _commands[i]->GetObject();
|
||||
|
||||
if(aLDS[j]->HasDistribution(anObject)) {
|
||||
TCollection_AsciiString aType = aLDS[j]->GetDistributionType(anObject);
|
||||
TCollection_AsciiString aMethod = _commands[i]->GetMethod();
|
||||
if(aType == "LocalLength") {
|
||||
if(aMethod == "SetLength") {
|
||||
SetVariable(_commands[i], aLDS[j],0,1);
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
else if(aMethod == "SetPrecision") {
|
||||
SetVariable(_commands[i], aLDS[j],1,1);
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
// Case for NumberOfSegments hypothesis
|
||||
else if(aType == "NumberOfSegments"){
|
||||
if(aMethod == "SetNumberOfSegments") {
|
||||
SetVariable(_commands[i], aLDS[j],0,1);
|
||||
if(aLDS[j]->GetCurrectState().size()==1)
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
else if (aMethod == "SetScaleFactor") {
|
||||
SetVariable(_commands[i], aLDS[j],1,1);
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
}
|
||||
|
||||
else if( aType == "Deflection1D" ){
|
||||
if(aMethod == "SetDeflection"){
|
||||
SetVariable(_commands[i], aLDS[j],0,1);
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
}
|
||||
// Case for Arithmetic1D and StartEndLength hypothesis
|
||||
else if(aType == "Arithmetic1D" || aType == "StartEndLength") {
|
||||
if(aMethod == "SetLength") {
|
||||
int anArgNb = (_commands[i]->GetArg(2) == "1") ? 0 : 1;
|
||||
SetVariable(_commands[i], aLDS[j],anArgNb,1);
|
||||
aLDS[j]->IncrementState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return result script
|
||||
*/
|
||||
//================================================================================
|
||||
TCollection_AsciiString SMESH_NoteBook::GetResultScript() const
|
||||
{
|
||||
TCollection_AsciiString aResult;
|
||||
for(int i=0;i<_commands.size();i++)
|
||||
aResult+=_commands[i]->GetString()+"\n";
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return value of the variable
|
||||
*/
|
||||
//================================================================================
|
||||
bool SMESH_NoteBook::GetReal(const TCollection_AsciiString& theVarName, double& theValue)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
SMESH_Gen_i *aGen = SMESH_Gen_i::GetSMESHGen();
|
||||
if(!aGen)
|
||||
return ok;
|
||||
|
||||
SALOMEDS::Study_ptr aStudy = aGen->GetCurrentStudy();
|
||||
if(aStudy->_is_nil())
|
||||
return ok;
|
||||
|
||||
TCollection_AsciiString aVarName = theVarName;
|
||||
aVarName.RemoveAll('\"');
|
||||
|
||||
if(aVarName.IsEmpty())
|
||||
return ok;
|
||||
|
||||
const char* aName = aVarName.ToCString();
|
||||
if(aStudy->IsVariable(aName) && (aStudy->IsReal(aName) || aStudy->IsInteger(aName))) {
|
||||
theValue = aStudy->GetReal(aVarName.ToCString());
|
||||
ok = true;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Set variable of the ObjectStates from position to the _pyCommand
|
||||
* method as nbArg argument
|
||||
*/
|
||||
void SetVariable(Handle(_pyCommand) theCommand, const ObjectStates* theStates, int position, int theArgNb)
|
||||
{
|
||||
if(theStates->GetCurrectState().size() > position)
|
||||
if(!theStates->GetCurrectState().at(position).IsEmpty())
|
||||
theCommand->SetArg(theArgNb,theStates->GetCurrectState().at(position));
|
||||
}
|
106
src/SMESH_I/SMESH_NoteBook.hxx
Normal file
106
src/SMESH_I/SMESH_NoteBook.hxx
Normal file
@ -0,0 +1,106 @@
|
||||
// Copyright (C) 2008 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.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : SMESH_NoteBook.hxx
|
||||
// Author : Roman NIKOLAEV ()
|
||||
|
||||
|
||||
#ifndef SMESH_NoteBook_HeaderFile
|
||||
#define SMESH_NoteBook_HeaderFile
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
|
||||
|
||||
class _pyCommand;
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
typedef std::vector<TCollection_AsciiString> TState;
|
||||
typedef std::vector<TState> TAllStates;
|
||||
typedef TCollection_AsciiString _pyID;
|
||||
|
||||
class ObjectStates{
|
||||
|
||||
public:
|
||||
|
||||
ObjectStates(TCollection_AsciiString theType);
|
||||
virtual ~ObjectStates();
|
||||
|
||||
void AddState(const TState &theState);
|
||||
|
||||
TState GetCurrectState() const;
|
||||
TAllStates GetAllStates() const;
|
||||
void IncrementState();
|
||||
TCollection_AsciiString GetObjectType() const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
TCollection_AsciiString _type;
|
||||
TAllStates _states;
|
||||
int _dumpstate;
|
||||
};
|
||||
|
||||
class LayerDistributionStates : public ObjectStates
|
||||
{
|
||||
public:
|
||||
typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
|
||||
LayerDistributionStates();
|
||||
virtual ~LayerDistributionStates();
|
||||
|
||||
void AddDistribution(const TCollection_AsciiString& theDistribution);
|
||||
bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
|
||||
|
||||
bool SetDistributionType(const TCollection_AsciiString& theDistribution,
|
||||
const TCollection_AsciiString& theType);
|
||||
TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
|
||||
|
||||
private:
|
||||
|
||||
TDistributionMap _distributions;
|
||||
};
|
||||
|
||||
|
||||
class SMESH_NoteBook
|
||||
{
|
||||
public:
|
||||
typedef std::map<TCollection_AsciiString,ObjectStates*> TVariablesMap;
|
||||
typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
|
||||
SMESH_NoteBook();
|
||||
~SMESH_NoteBook();
|
||||
void ReplaceVariables();
|
||||
|
||||
void AddCommand(const TCollection_AsciiString& theString);
|
||||
TCollection_AsciiString GetResultScript() const;
|
||||
|
||||
private:
|
||||
void InitObjectMap();
|
||||
void ProcessLayerDistribution();
|
||||
|
||||
bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
|
||||
|
||||
private:
|
||||
|
||||
TVariablesMap _objectMap;
|
||||
std::vector<Handle(_pyCommand)> _commands;
|
||||
TMeshEditorMap myMeshEditors;
|
||||
};
|
||||
|
||||
#endif //SMESH_NoteBook_HeaderFile
|
File diff suppressed because it is too large
Load Diff
@ -27,6 +27,7 @@
|
||||
#include "StdMeshersGUI_DistrTable.h"
|
||||
#include "StdMeshersGUI_DistrPreview.h"
|
||||
|
||||
#include <SMESHGUI.h>
|
||||
#include <SMESHGUI_Utils.h>
|
||||
#include <SMESHGUI_HypothesesUtils.h>
|
||||
#include <SMESHGUI_SpinBox.h>
|
||||
@ -36,7 +37,7 @@
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SalomeApp_Tools.h>
|
||||
#include <QtxIntSpinBox.h>
|
||||
#include <SalomeApp_IntSpinBox.h>
|
||||
#include <QtxComboBox.h>
|
||||
|
||||
// Qt includes
|
||||
@ -78,13 +79,17 @@ StdMeshersGUI_NbSegmentsCreator::~StdMeshersGUI_NbSegmentsCreator()
|
||||
{
|
||||
}
|
||||
|
||||
bool StdMeshersGUI_NbSegmentsCreator::checkParams() const
|
||||
bool StdMeshersGUI_NbSegmentsCreator::checkParams( QString& msg ) const
|
||||
{
|
||||
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
|
||||
return false;
|
||||
NbSegmentsHypothesisData data_old, data_new;
|
||||
readParamsFromHypo( data_old );
|
||||
readParamsFromWidgets( data_new );
|
||||
bool res = storeParamsToHypo( data_new );
|
||||
storeParamsToHypo( data_old );
|
||||
res = myNbSeg->isValid( msg, true ) && res;
|
||||
res = myScale->isValid( msg, true ) && res;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -122,7 +127,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
||||
|
||||
// 1) number of segments
|
||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 );
|
||||
myNbSeg = new QtxIntSpinBox( GroupC1 );
|
||||
myNbSeg = new SalomeApp_IntSpinBox( GroupC1 );
|
||||
myNbSeg->setMinimum( 1 );
|
||||
myNbSeg->setMaximum( 9999 );
|
||||
myGroupLayout->addWidget( myNbSeg, row, 1 );
|
||||
@ -206,9 +211,16 @@ void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const
|
||||
|
||||
if( myName )
|
||||
myName->setText( data.myName );
|
||||
myNbSeg->setValue( data.myNbSeg );
|
||||
if(data.myNbSegVarName.isEmpty())
|
||||
myNbSeg->setValue( data.myNbSeg );
|
||||
else
|
||||
myNbSeg->setText( data.myNbSegVarName );
|
||||
|
||||
myDistr->setCurrentIndex( data.myDistrType );
|
||||
myScale->setValue( data.myScale );
|
||||
if(data.myScaleVarName.isEmpty())
|
||||
myScale->setValue( data.myScale );
|
||||
else
|
||||
myScale->setText( data.myScaleVarName );
|
||||
myConv->button( data.myConv )->setChecked( true );
|
||||
myTable->setFuncMinValue(myConv->checkedId()==0 ? -1E20 : 0);
|
||||
myTable->setData( data.myTable );
|
||||
@ -223,7 +235,7 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
||||
NbSegmentsHypothesisData data;
|
||||
readParamsFromWidgets( data );
|
||||
storeParamsToHypo( data );
|
||||
|
||||
|
||||
QString valStr = QString::number( data.myNbSeg ) += "; ";
|
||||
|
||||
enum DistrType
|
||||
@ -238,8 +250,8 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
||||
case Regular :
|
||||
valStr += tr("SMESH_DISTR_REGULAR");
|
||||
break;
|
||||
case Scale :
|
||||
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );
|
||||
case Scale :
|
||||
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
|
||||
break;
|
||||
case TabFunc : {
|
||||
//valStr += tr("SMESH_TAB_FUNC");
|
||||
@ -275,9 +287,21 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo( NbSegmentsHypothesisDa
|
||||
h_data.myName = hypName();
|
||||
|
||||
h_data.myNbSeg = (int) h->GetNumberOfSegments();
|
||||
|
||||
SMESH::ListOfParameters_var aParameters = h->GetLastParameters();
|
||||
|
||||
h_data.myNbSegVarName = (aParameters->length() > 0) ? QString(aParameters[0].in()) : QString("");
|
||||
|
||||
int distr = (int) h->GetDistrType();
|
||||
h_data.myDistrType = distr;
|
||||
h_data.myScale = distr==1 ? h->GetScaleFactor() : 1.0;
|
||||
|
||||
if(distr==1){
|
||||
h_data.myScaleVarName = (aParameters->length() > 1) ? QString(aParameters[1].in()) : QString("");
|
||||
}
|
||||
else
|
||||
h_data.myScaleVarName = QString("");
|
||||
|
||||
if( distr==2 )
|
||||
{
|
||||
SMESH::double_array* a = h->GetTableFunction();
|
||||
@ -310,13 +334,17 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
||||
if( isCreation() )
|
||||
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
|
||||
|
||||
QStringList aVariablesList;
|
||||
aVariablesList.append(h_data.myNbSegVarName);
|
||||
|
||||
h->SetNumberOfSegments( h_data.myNbSeg );
|
||||
int distr = h_data.myDistrType;
|
||||
h->SetDistrType( distr );
|
||||
|
||||
if( distr==1 )
|
||||
|
||||
if( distr==1 ) {
|
||||
h->SetScaleFactor( h_data.myScale );
|
||||
|
||||
aVariablesList.append(h_data.myScaleVarName);
|
||||
}
|
||||
if( distr==2 || distr==3 )
|
||||
h->SetConversionMode( h_data.myConv );
|
||||
|
||||
@ -328,6 +356,8 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
||||
//setting of function must follow after setConversionMode, because otherwise
|
||||
//the function will be checked with old conversion mode, so that it may occurs
|
||||
//unexpected errors for user
|
||||
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& ex)
|
||||
{
|
||||
@ -341,6 +371,8 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesi
|
||||
{
|
||||
h_data.myName = myName ? myName->text() : "";
|
||||
h_data.myNbSeg = myNbSeg->value();
|
||||
h_data.myNbSegVarName = myNbSeg->text();
|
||||
h_data.myScaleVarName = myScale->text();
|
||||
h_data.myDistrType = myDistr->currentIndex();
|
||||
h_data.myConv = myConv->checkedId();
|
||||
h_data.myScale = myScale->value();
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
|
||||
class QtxIntSpinBox;
|
||||
class SalomeApp_IntSpinBox;
|
||||
class QtxComboBox;
|
||||
class SMESHGUI_SpinBox;
|
||||
class StdMeshersGUI_DistrTableFrame;
|
||||
@ -51,6 +51,7 @@ typedef struct
|
||||
double myScale;
|
||||
SMESH::double_array myTable;
|
||||
QString myName, myExpr;
|
||||
QString myNbSegVarName, myScaleVarName;
|
||||
|
||||
} NbSegmentsHypothesisData;
|
||||
|
||||
@ -62,7 +63,7 @@ public:
|
||||
StdMeshersGUI_NbSegmentsCreator();
|
||||
virtual ~StdMeshersGUI_NbSegmentsCreator();
|
||||
|
||||
virtual bool checkParams() const;
|
||||
virtual bool checkParams( QString& ) const;
|
||||
|
||||
protected:
|
||||
virtual QFrame* buildFrame();
|
||||
@ -78,7 +79,7 @@ private:
|
||||
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
|
||||
|
||||
private:
|
||||
QtxIntSpinBox* myNbSeg;
|
||||
SalomeApp_IntSpinBox* myNbSeg;
|
||||
QtxComboBox* myDistr;
|
||||
SMESHGUI_SpinBox* myScale;
|
||||
StdMeshersGUI_DistrTableFrame* myTable;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <SMESH_NumberFilter.hxx>
|
||||
#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
|
||||
#include <StdMeshersGUI_LayerDistributionParamWdg.h>
|
||||
#include <SALOMEDSClient_Study.hxx>
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
@ -340,8 +341,11 @@ namespace {
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshersGUI_StdHypothesisCreator::checkParams() const
|
||||
bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
|
||||
{
|
||||
if( !SMESHGUI_GenericHypothesisCreator::checkParams( msg ) )
|
||||
return false;
|
||||
|
||||
// check if object reference parameter is set, as it has no default value
|
||||
bool ok = true;
|
||||
if ( hypType().startsWith("ProjectionSource" ))
|
||||
@ -399,6 +403,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
}
|
||||
|
||||
QString valueStr = stdParamValues( params );
|
||||
QStringList aVariablesList = getVariablesFromDlg();
|
||||
|
||||
if( res && !params.isEmpty() )
|
||||
{
|
||||
@ -408,7 +413,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetPrecision( params[1].myValue.toDouble() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="MaxLength" )
|
||||
{
|
||||
@ -429,6 +436,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" )
|
||||
{
|
||||
@ -436,13 +444,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
{
|
||||
StdMeshers::StdMeshers_MaxElementArea_var h =
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
||||
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetMaxElementArea( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
@ -451,6 +461,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
|
||||
|
||||
h->SetMaxElementVolume( params[0].myValue.toDouble() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="StartEndLength" )
|
||||
{
|
||||
@ -458,13 +469,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
||||
|
||||
h->SetLength( params[0].myValue.toDouble(), true );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetLength( params[1].myValue.toDouble(), false );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
|
||||
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
h->SetDeflection( params[0].myValue.toDouble() );
|
||||
}
|
||||
else if( hypType()=="AutomaticLength" )
|
||||
@ -480,6 +493,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
|
||||
|
||||
h->SetNumberOfLayers( params[0].myValue.toInt() );
|
||||
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||
}
|
||||
else if( hypType()=="LayerDistribution" )
|
||||
{
|
||||
@ -487,8 +501,10 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
|
||||
StdMeshersGUI_LayerDistributionParamWdg* w =
|
||||
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
|
||||
|
||||
|
||||
h->SetLayerDistribution( w->GetHypothesis() );
|
||||
h->SetParameters(w->GetHypothesis()->GetParameters());
|
||||
w->GetHypothesis()->ClearParameters();
|
||||
}
|
||||
else if( hypType()=="ProjectionSource1D" )
|
||||
{
|
||||
@ -558,20 +574,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
p.append( item );
|
||||
customWidgets()->append(0);
|
||||
}
|
||||
|
||||
|
||||
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
|
||||
SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
|
||||
|
||||
if( hypType()=="LocalLength" )
|
||||
{
|
||||
StdMeshers::StdMeshers_LocalLength_var h =
|
||||
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
|
||||
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||
item.myValue = h->GetLength();
|
||||
p.append( item );
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength();
|
||||
p.append( item );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
|
||||
item.myValue = h->GetPrecision();
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetPrecision();
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
else if( hypType()=="MaxLength" )
|
||||
{
|
||||
@ -612,7 +633,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
|
||||
|
||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||
item.myValue = h->GetLength();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength();
|
||||
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="Arithmetic1D" )
|
||||
@ -621,10 +644,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
item.myValue = h->GetLength( true );
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
item.myValue = h->GetLength( false );
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="MaxElementArea" )
|
||||
@ -633,8 +659,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
|
||||
item.myValue = h->GetMaxElementArea();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetMaxElementArea();
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
else if( hypType()=="MaxElementVolume" )
|
||||
{
|
||||
@ -642,7 +670,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
|
||||
item.myValue = h->GetMaxElementVolume();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetMaxElementVolume();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="StartEndLength" )
|
||||
@ -651,19 +680,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
item.myValue = h->GetLength( true );
|
||||
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetLength( true );
|
||||
p.append( item );
|
||||
|
||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
||||
item.myValue = h->GetLength( false );
|
||||
if(!initVariableName(aParameters,item,1))
|
||||
item.myValue = h->GetLength( false );
|
||||
p.append( item );
|
||||
|
||||
}
|
||||
else if( hypType()=="Deflection1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
|
||||
|
||||
|
||||
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
|
||||
item.myValue = h->GetDeflection();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = h->GetDeflection();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="AutomaticLength" )
|
||||
@ -683,15 +718,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
|
||||
item.myValue = (int) h->GetNumberOfLayers();
|
||||
if(!initVariableName(aParameters,item,0))
|
||||
item.myValue = (int) h->GetNumberOfLayers();
|
||||
p.append( item );
|
||||
}
|
||||
else if( hypType()=="LayerDistribution" )
|
||||
{
|
||||
StdMeshers::StdMeshers_LayerDistribution_var h =
|
||||
{
|
||||
StdMeshers::StdMeshers_LayerDistribution_var h =
|
||||
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
|
||||
|
||||
//Set into not published hypo last variables
|
||||
QStringList aLastVarsList;
|
||||
for(int i = 0;i<aParameters->length();i++)
|
||||
aLastVarsList.append(QString(aParameters[i].in()));
|
||||
|
||||
if(!aLastVarsList.isEmpty())
|
||||
h->GetLayerDistribution()->SetLastParameters(SMESHGUI::JoinObjectParameters(aLastVarsList));
|
||||
|
||||
customWidgets()->append
|
||||
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
|
||||
}
|
||||
@ -988,3 +1033,21 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshersGUI_StdHypothesisCreator::initVariableName(SMESH::ListOfParameters_var theParameters,
|
||||
StdParam &theParams,
|
||||
int order) const
|
||||
{
|
||||
QString aVaribaleName = (theParameters->length() > order) ? QString(theParameters[order].in()) : QString("");
|
||||
theParams.isVariable = !aVaribaleName.isEmpty();
|
||||
if(theParams.isVariable)
|
||||
theParams.myValue = aVaribaleName;
|
||||
|
||||
return theParams.isVariable;
|
||||
}
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
// SMESH includes
|
||||
#include "SMESH_StdMeshersGUI.hxx"
|
||||
|
||||
#include <SMESHGUI_Hypotheses.h>
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Class for creation of standard hypotheses
|
||||
*/
|
||||
@ -41,7 +41,7 @@ public:
|
||||
StdMeshersGUI_StdHypothesisCreator( const QString& );
|
||||
virtual ~StdMeshersGUI_StdHypothesisCreator();
|
||||
|
||||
virtual bool checkParams() const;
|
||||
virtual bool checkParams( QString& ) const;
|
||||
|
||||
protected:
|
||||
virtual QFrame* buildFrame ();
|
||||
@ -59,6 +59,7 @@ protected:
|
||||
virtual QWidget* getWidgetForParam( int paramIndex ) const;
|
||||
virtual ListOfWidgets* customWidgets() const;
|
||||
virtual void onReject();
|
||||
virtual bool initVariableName(SMESH::ListOfParameters_var theParameters, StdParam& theParams, int order) const;
|
||||
|
||||
virtual void valueChanged( QWidget* );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user