mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 21:04:18 +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
|
\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>
|
<br>
|
||||||
\anchor adding_edges_anchor
|
\anchor adding_edges_anchor
|
||||||
<h2>Adding edges</h2>
|
<h2>Adding edges</h2>
|
||||||
|
@ -16,6 +16,7 @@ the VTK viewer;</li>
|
|||||||
allowing to highlight important elements:
|
allowing to highlight important elements:
|
||||||
<li>\subpage modifying_meshes_page "modifying meshes" with a vast
|
<li>\subpage modifying_meshes_page "modifying meshes" with a vast
|
||||||
array of dedicated operations.</li>
|
array of dedicated operations.</li>
|
||||||
|
<li>\subpage using_notebook_mesh_page.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
Almost all mesh module functionalities are accessible via
|
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
|
DIM_3D
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef sequence<string> ListOfParameters;
|
||||||
|
|
||||||
interface SMESH_Hypothesis : SALOME::GenericObj
|
interface SMESH_Hypothesis : SALOME::GenericObj
|
||||||
{
|
{
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the Hypothesis typeName
|
* Get the Hypothesis typeName
|
||||||
*/
|
*/
|
||||||
@ -55,7 +58,36 @@ module SMESH
|
|||||||
* Get the internal Id
|
* Get the internal Id
|
||||||
*/
|
*/
|
||||||
long GetId();
|
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
|
* Verify whether hypothesis supports given entity type
|
||||||
*/
|
*/
|
||||||
|
@ -718,6 +718,22 @@ module SMESH
|
|||||||
|
|
||||||
/*! Gets information about imported MED file */
|
/*! Gets information about imported MED file */
|
||||||
SALOME_MED::MedFileInfo GetMEDFileInfo();
|
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
|
interface SMESH_subMesh : SALOME::GenericObj, SMESH_IDSource
|
||||||
|
@ -281,6 +281,48 @@ module SMESH
|
|||||||
in double AngleInRadians,
|
in double AngleInRadians,
|
||||||
in long NbOfSteps,
|
in long NbOfSteps,
|
||||||
in double Tolerance);
|
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
|
* \brief Genarate dim+1 elements by extrusion of elements along vector
|
||||||
* \param IDsOfElements - elements to sweep
|
* \param IDsOfElements - elements to sweep
|
||||||
@ -386,6 +428,42 @@ module SMESH
|
|||||||
in PointStruct RefPoint,
|
in PointStruct RefPoint,
|
||||||
out Extrusion_Error Error);
|
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
|
* Compute rotation angles for ExtrusionAlongPath as linear variation
|
||||||
* of given angles along path steps
|
* of given angles along path steps
|
||||||
|
@ -50,6 +50,7 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
|
|||||||
_type = PARAM_ALGO;
|
_type = PARAM_ALGO;
|
||||||
_shapeType = 0; // to be set by algo with TopAbs_Enum
|
_shapeType = 0; // to be set by algo with TopAbs_Enum
|
||||||
_param_algo_dim = -1; // to be set by algo parameter
|
_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);
|
_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;
|
virtual const char* GetLibName() const;
|
||||||
void SetLibName(const char* theLibName);
|
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
|
* \brief Initialize my parameter values by the mesh built on the geometry
|
||||||
* \param theMesh - the built mesh
|
* \param theMesh - the built mesh
|
||||||
@ -115,6 +122,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _libName;
|
std::string _libName;
|
||||||
|
std::string _parameters;
|
||||||
|
std::string _lastParameters;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1270,6 +1270,16 @@ SalomeApp_Study* SMESHGUI::activeStudy()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
char* SMESHGUI::JoinObjectParameters(const QStringList& theParametersList)
|
||||||
|
{
|
||||||
|
return theParametersList.join(":").toLatin1().data();
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
|
@ -70,6 +70,8 @@ public :
|
|||||||
static SUIT_ResourceMgr* resourceMgr();
|
static SUIT_ResourceMgr* resourceMgr();
|
||||||
static SUIT_Desktop* desktop();
|
static SUIT_Desktop* desktop();
|
||||||
static SalomeApp_Study* activeStudy();
|
static SalomeApp_Study* activeStudy();
|
||||||
|
static char* JoinObjectParameters(const QStringList& theParametersList);
|
||||||
|
|
||||||
bool isActiveStudyLocked();
|
bool isActiveStudyLocked();
|
||||||
|
|
||||||
static bool automaticUpdate();
|
static bool automaticUpdate();
|
||||||
|
@ -285,7 +285,13 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
|||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!myMesh->_is_nil()) {
|
if (!myMesh->_is_nil()) {
|
||||||
|
QStringList aParameters;
|
||||||
|
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
|
||||||
try {
|
try {
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
|
|
||||||
@ -303,6 +309,8 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
|||||||
CheckBoxMerge->isChecked(),
|
CheckBoxMerge->isChecked(),
|
||||||
SpinBoxTol->GetValue());
|
SpinBoxTol->GetValue());
|
||||||
|
|
||||||
|
aCompoundMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||||
|
|
||||||
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
|
SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
|
||||||
mySMESHGUI->updateObjBrowser();
|
mySMESHGUI->updateObjBrowser();
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
@ -483,6 +491,30 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
|
void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge)
|
||||||
{
|
{
|
||||||
|
|
||||||
TextLabelTol->setEnabled(toMerge);
|
TextLabelTol->setEnabled(toMerge);
|
||||||
SpinBoxTol->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 hideEvent( QHideEvent* ); /* ESC key */
|
||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
|
@ -487,47 +487,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
!myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
|
!myMeshActor || myPathMesh->_is_nil() || myPathShape->_is_nil())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
SMESH::long_array_var anElementsId = new SMESH::long_array;
|
||||||
|
|
||||||
if (MeshCheck->isChecked()) {
|
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 "Select whole mesh, submesh or group" check box is off ->
|
// If "Select whole mesh, submesh or group" check box is off ->
|
||||||
// use only elements of given type selected by user
|
// use only elements of given type selected by user
|
||||||
|
|
||||||
@ -552,10 +517,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
}
|
}
|
||||||
anElementsId->length(j);
|
anElementsId->length(j);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (anElementsId->length() <= 0) {
|
if (anElementsId->length() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
if (StartPointLineEdit->text().trimmed().isEmpty()) {
|
||||||
@ -568,16 +533,17 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList aParameters;
|
||||||
|
|
||||||
// get angles
|
// get angles
|
||||||
SMESH::double_array_var anAngles = new SMESH::double_array;
|
SMESH::double_array_var anAngles = new SMESH::double_array;
|
||||||
if (AnglesGrp->isChecked()) {
|
if (AnglesGrp->isChecked()) {
|
||||||
anAngles->length(AnglesList->count());
|
anAngles->length(myAnglesList.count());
|
||||||
int j = 0;
|
int j = 0;
|
||||||
bool bOk;
|
for (int i = 0; i < myAnglesList.count(); i++) {
|
||||||
for (int i = 0; i < AnglesList->count(); i++) {
|
double angle = myAnglesList[i];
|
||||||
double angle = AnglesList->item(i)->text().toDouble(&bOk);
|
anAngles[ j++ ] = angle*PI/180;
|
||||||
if (bOk)
|
aParameters << AnglesList->item(i)->text();
|
||||||
anAngles[ j++ ] = angle*PI/180;
|
|
||||||
}
|
}
|
||||||
anAngles->length(j);
|
anAngles->length(j);
|
||||||
}
|
}
|
||||||
@ -590,6 +556,10 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
aBasePoint.z = ZSpin->GetValue();
|
aBasePoint.z = ZSpin->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aParameters << XSpin->text();
|
||||||
|
aParameters << YSpin->text();
|
||||||
|
aParameters << ZSpin->text();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SUIT_OverrideCursor wc;
|
SUIT_OverrideCursor wc;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
@ -597,17 +567,50 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
|
anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
|
||||||
|
|
||||||
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
|
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
|
||||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||||
SMESH::ListOfGroups_var groups =
|
if( MeshCheck->isChecked() ) {
|
||||||
aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
|
if( GetConstructorId() == 0 )
|
||||||
myPathShape, aNodeStart,
|
SMESH::ListOfGroups_var groups =
|
||||||
AnglesGrp->isChecked(), anAngles,
|
aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh,
|
||||||
BasePointGrp->isChecked(), aBasePoint, retVal);
|
myPathShape, aNodeStart,
|
||||||
else
|
AnglesGrp->isChecked(), anAngles,
|
||||||
retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
|
BasePointGrp->isChecked(), aBasePoint, retVal);
|
||||||
myPathShape, aNodeStart,
|
else
|
||||||
AnglesGrp->isChecked(), anAngles,
|
SMESH::ListOfGroups_var groups =
|
||||||
BasePointGrp->isChecked(), aBasePoint);
|
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.stop();
|
||||||
wc.suspend();
|
wc.suspend();
|
||||||
@ -1152,7 +1155,18 @@ int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded()
|
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();
|
QList<QListWidgetItem*> aList = AnglesList->selectedItems();
|
||||||
QListWidgetItem* anItem;
|
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();
|
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();
|
int GetConstructorId();
|
||||||
void SetEditCurrentArgument( QToolButton* );
|
void SetEditCurrentArgument( QToolButton* );
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
|
void updateLinearAngles();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -95,6 +99,7 @@ private:
|
|||||||
SUIT_SelectionFilter* myElementsFilter;
|
SUIT_SelectionFilter* myElementsFilter;
|
||||||
SUIT_SelectionFilter* myPathMeshFilter;
|
SUIT_SelectionFilter* myPathMeshFilter;
|
||||||
int myType;
|
int myType;
|
||||||
|
QList<double> myAnglesList;
|
||||||
|
|
||||||
// widgets
|
// widgets
|
||||||
QGroupBox* ConstructorsBox;
|
QGroupBox* ConstructorsBox;
|
||||||
|
@ -53,6 +53,8 @@
|
|||||||
#include <SVTK_ViewModel.h>
|
#include <SVTK_ViewModel.h>
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
|
|
||||||
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
|
|
||||||
// OCCT includes
|
// OCCT includes
|
||||||
#include <TColStd_MapOfInteger.hxx>
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||||
@ -67,7 +69,6 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -89,7 +90,8 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
|
|||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( 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 image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
|
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
|
// Controls for nb. steps defining
|
||||||
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
|
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments);
|
||||||
SpinBox_NbSteps = new QSpinBox(GroupArguments);
|
SpinBox_NbSteps = new SalomeApp_IntSpinBox(GroupArguments);
|
||||||
|
|
||||||
// CheckBox for groups generation
|
// CheckBox for groups generation
|
||||||
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
|
||||||
@ -404,6 +406,9 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
|||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements) {
|
if (myNbOkElements) {
|
||||||
|
|
||||||
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
|
gp_XYZ aNormale(SpinBox_Vx->GetValue(),
|
||||||
@ -419,15 +424,41 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
|||||||
|
|
||||||
long aNbSteps = (long)SpinBox_NbSteps->value();
|
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 {
|
try {
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
|
||||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||||
SMESH::ListOfGroups_var groups =
|
if( CheckBoxMesh->isChecked() ) {
|
||||||
aMeshEditor->ExtrusionSweepMakeGroups(myElementsId.inout(), aVector, aNbSteps);
|
if( GetConstructorId() == 0 )
|
||||||
else
|
SMESH::ListOfGroups_var groups =
|
||||||
aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps);
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
@ -437,6 +468,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply()
|
|||||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||||
Init(false);
|
Init(false);
|
||||||
ConstructorsClicked(GetConstructorId());
|
ConstructorsClicked(GetConstructorId());
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -603,41 +635,21 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
SMESH::ElementType neededType = GetConstructorId() ? SMESH::FACE : SMESH::EDGE;
|
|
||||||
|
|
||||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||||
|
|
||||||
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||||
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||||
if (!mesh->_is_nil()) { //MESH
|
else
|
||||||
// get elements from mesh
|
return;
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// get indices of selcted elements
|
// get indices of selcted elements
|
||||||
TColStd_IndexedMapOfInteger aMapIndex;
|
TColStd_IndexedMapOfInteger aMapIndex;
|
||||||
mySelector->GetIndex(IO,aMapIndex);
|
mySelector->GetIndex(IO,aMapIndex);
|
||||||
aNbElements = aMapIndex.Extent();
|
aNbElements = aMapIndex.Extent();
|
||||||
|
|
||||||
|
if (aNbElements < 1)
|
||||||
|
return;
|
||||||
|
|
||||||
myElementsId = new SMESH::long_array;
|
myElementsId = new SMESH::long_array;
|
||||||
myElementsId->length( aNbElements );
|
myElementsId->length( aNbElements );
|
||||||
aString = "";
|
aString = "";
|
||||||
@ -645,9 +657,6 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
|
|||||||
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
|
aString += QString(" %1").arg( myElementsId[ i ] = aMapIndex( i+1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbElements < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
myNbOkElements = true;
|
myNbOkElements = true;
|
||||||
|
|
||||||
myBusy = true;
|
myBusy = true;
|
||||||
@ -856,3 +865,26 @@ void SMESHGUI_ExtrusionDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
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 QLabel;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QSpinBox;
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
|
||||||
class SMESHGUI;
|
class SMESHGUI;
|
||||||
@ -56,6 +55,7 @@ class SMESHGUI_FilterDlg;
|
|||||||
class SVTK_Selector;
|
class SVTK_Selector;
|
||||||
class LightApp_SelectionMgr;
|
class LightApp_SelectionMgr;
|
||||||
class SUIT_SelectionFilter;
|
class SUIT_SelectionFilter;
|
||||||
|
class SalomeApp_IntSpinBox;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : SMESHGUI_ExtrusionDlg
|
// class : SMESHGUI_ExtrusionDlg
|
||||||
@ -75,6 +75,8 @@ private:
|
|||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
int GetConstructorId();
|
int GetConstructorId();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -82,6 +84,8 @@ private:
|
|||||||
int myNbOkElements; /* to check when elements are defined */
|
int myNbOkElements; /* to check when elements are defined */
|
||||||
SVTK_Selector* mySelector;
|
SVTK_Selector* mySelector;
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
bool myBusy;
|
bool myBusy;
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH::long_array_var myElementsId;
|
SMESH::long_array_var myElementsId;
|
||||||
@ -116,7 +120,7 @@ private:
|
|||||||
QLabel* TextLabelVz;
|
QLabel* TextLabelVz;
|
||||||
SMESHGUI_SpinBox* SpinBox_Vz;
|
SMESHGUI_SpinBox* SpinBox_Vz;
|
||||||
QLabel* TextLabelNbSteps;
|
QLabel* TextLabelNbSteps;
|
||||||
QSpinBox* SpinBox_NbSteps;
|
SalomeApp_IntSpinBox* SpinBox_NbSteps;
|
||||||
QCheckBox* MakeGroupsCheck;
|
QCheckBox* MakeGroupsCheck;
|
||||||
|
|
||||||
QGroupBox* GroupButtons;
|
QGroupBox* GroupButtons;
|
||||||
|
@ -36,11 +36,11 @@
|
|||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <QtxIntSpinBox.h>
|
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
#include <SUIT_ResourceMgr.h>
|
#include <SUIT_ResourceMgr.h>
|
||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
@ -211,7 +211,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
|||||||
{
|
{
|
||||||
case QVariant::Int:
|
case QVariant::Int:
|
||||||
{
|
{
|
||||||
QtxIntSpinBox* sb = new QtxIntSpinBox( GroupC1 );
|
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
|
||||||
sb->setObjectName( (*anIt).myName );
|
sb->setObjectName( (*anIt).myName );
|
||||||
attuneStdWidget( sb, i );
|
attuneStdWidget( sb, i );
|
||||||
sb->setValue( (*anIt).myValue.toInt() );
|
sb->setValue( (*anIt).myValue.toInt() );
|
||||||
@ -221,7 +221,7 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
|||||||
break;
|
break;
|
||||||
case QVariant::Double:
|
case QVariant::Double:
|
||||||
{
|
{
|
||||||
QtxDoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
|
SalomeApp_DoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 );
|
||||||
sb->setObjectName( (*anIt).myName );
|
sb->setObjectName( (*anIt).myName );
|
||||||
attuneStdWidget( sb, i );
|
attuneStdWidget( sb, i );
|
||||||
sb->setValue( (*anIt).myValue.toDouble() );
|
sb->setValue( (*anIt).myValue.toDouble() );
|
||||||
@ -231,12 +231,34 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
|
|||||||
break;
|
break;
|
||||||
case QVariant::String:
|
case QVariant::String:
|
||||||
{
|
{
|
||||||
QLineEdit* le = new QLineEdit( GroupC1 );
|
if((*anIt).isVariable) {
|
||||||
le->setObjectName( (*anIt).myName );
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
attuneStdWidget( le, i );
|
QString aVar = (*anIt).myValue.toString();
|
||||||
le->setText( (*anIt).myValue.toString() );
|
if(aStudy->IsInteger(aVar.toLatin1().constData())){
|
||||||
connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) );
|
SalomeApp_IntSpinBox* sb = new SalomeApp_IntSpinBox( GroupC1 );
|
||||||
w = le;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
@ -279,16 +301,16 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
|
|||||||
for( ; anIt!=aLast; anIt++ )
|
for( ; anIt!=aLast; anIt++ )
|
||||||
{
|
{
|
||||||
item.myName = (*anIt)->objectName();
|
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();
|
item.myValue = sb->value();
|
||||||
params.append( item );
|
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();
|
item.myValue = sb->value();
|
||||||
params.append( item );
|
params.append( item );
|
||||||
}
|
}
|
||||||
@ -311,6 +333,24 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par
|
|||||||
return res;
|
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 SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams& params)
|
||||||
{
|
{
|
||||||
QString valueStr = "";
|
QString valueStr = "";
|
||||||
@ -428,6 +468,26 @@ bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWi
|
|||||||
return false;
|
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()
|
void SMESHGUI_GenericHypothesisCreator::onReject()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -520,8 +580,15 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f )
|
|||||||
|
|
||||||
void SMESHGUI_HypothesisDlg::accept()
|
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;
|
return;
|
||||||
|
}
|
||||||
QtxDialog::accept();
|
QtxDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
const QString&, QWidget* );
|
const QString&, QWidget* );
|
||||||
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
|
void setInitParamsHypothesis(SMESH::SMESH_Hypothesis_ptr);
|
||||||
|
|
||||||
virtual bool checkParams() const = 0;
|
virtual bool checkParams( QString& ) const;
|
||||||
virtual void onReject();
|
virtual void onReject();
|
||||||
virtual QString helpPage() const;
|
virtual QString helpPage() const;
|
||||||
|
|
||||||
@ -66,12 +66,15 @@ public:
|
|||||||
bool isCreation() const;
|
bool isCreation() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef struct
|
struct StdParam
|
||||||
{
|
{
|
||||||
QString myName;
|
QString myName;
|
||||||
QVariant myValue;
|
QVariant myValue;
|
||||||
|
bool isVariable;
|
||||||
} StdParam;
|
StdParam(){
|
||||||
|
isVariable = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef QList<StdParam> ListOfStdParams;
|
typedef QList<StdParam> ListOfStdParams;
|
||||||
typedef QList<QWidget*> ListOfWidgets;
|
typedef QList<QWidget*> ListOfWidgets;
|
||||||
@ -89,6 +92,7 @@ protected:
|
|||||||
virtual QString storeParams() const = 0;
|
virtual QString storeParams() const = 0;
|
||||||
virtual bool stdParams( ListOfStdParams& ) const;
|
virtual bool stdParams( ListOfStdParams& ) const;
|
||||||
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
bool getStdParamFromDlg( ListOfStdParams& ) const;
|
||||||
|
virtual QStringList getVariablesFromDlg() const;
|
||||||
static QString stdParamValues( const ListOfStdParams& );
|
static QString stdParamValues( const ListOfStdParams& );
|
||||||
virtual void attuneStdWidget( QWidget*, const int ) const;
|
virtual void attuneStdWidget( QWidget*, const int ) const;
|
||||||
virtual QWidget* getCustomWidget( const StdParam&,
|
virtual QWidget* getCustomWidget( const StdParam&,
|
||||||
|
@ -372,9 +372,11 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isValid() ) { // node id is invalid
|
QString msg;
|
||||||
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
|
if ( !isValid( msg ) ) { // node id is invalid
|
||||||
tr("INVALID_ID") );
|
if( !msg.isEmpty() )
|
||||||
|
SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ),
|
||||||
|
tr("INVALID_ID") );
|
||||||
dlg()->show();
|
dlg()->show();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -408,6 +410,12 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
|||||||
}
|
}
|
||||||
if (aResult)
|
if (aResult)
|
||||||
{
|
{
|
||||||
|
QStringList aParameters;
|
||||||
|
aParameters << myDlg->myX->text();
|
||||||
|
aParameters << myDlg->myY->text();
|
||||||
|
aParameters << myDlg->myZ->text();
|
||||||
|
aMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||||
|
|
||||||
myDlg->myId->setText("");
|
myDlg->myId->setText("");
|
||||||
|
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
@ -432,10 +440,9 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply()
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
bool SMESHGUI_MakeNodeAtPointOp::isValid()
|
bool SMESHGUI_MakeNodeAtPointOp::isValid( QString& msg )
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
if ( myMeshActor &&
|
if ( myMeshActor &&
|
||||||
myDlg->myMoveRBtn->isDown() &&
|
myDlg->myMoveRBtn->isDown() &&
|
||||||
!myDlg->myAutoSearchChkBox->isChecked() )
|
!myDlg->myAutoSearchChkBox->isChecked() )
|
||||||
@ -445,7 +452,14 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid()
|
|||||||
if ( id > 0 )
|
if ( id > 0 )
|
||||||
if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
|
if (SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh())
|
||||||
ok = aMesh->FindNode( id );
|
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;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,7 +552,8 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
|
|||||||
const bool preview = myDlg->myPreviewChkBox->isChecked();
|
const bool preview = myDlg->myPreviewChkBox->isChecked();
|
||||||
if ( autoSearch )
|
if ( autoSearch )
|
||||||
myDlg->myId->setText("");
|
myDlg->myId->setText("");
|
||||||
if ( preview && ( autoSearch || isValid() ))
|
QString msg;
|
||||||
|
if ( preview && ( autoSearch || isValid( msg ) ))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
|
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO());
|
||||||
|
@ -60,7 +60,7 @@ protected:
|
|||||||
|
|
||||||
virtual void activateSelection();
|
virtual void activateSelection();
|
||||||
|
|
||||||
bool isValid();
|
bool isValid( QString& );
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual bool onApply();
|
virtual bool onApply();
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <SalomeApp_Tools.h>
|
#include <SalomeApp_Tools.h>
|
||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
|
|
||||||
#include <SALOME_ListIO.hxx>
|
#include <SALOME_ListIO.hxx>
|
||||||
|
|
||||||
@ -76,7 +77,6 @@
|
|||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -246,9 +246,9 @@ QWidget* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
|
|||||||
mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
|
mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
|
||||||
|
|
||||||
QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), 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 );
|
myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp );
|
||||||
myNode2 = new QSpinBox( myRefineGrp );
|
myNode2 = new SalomeApp_IntSpinBox( myRefineGrp );
|
||||||
|
|
||||||
myRefineGrpLayout->addWidget( mySelLbl[ Ids ], 0, 0 );
|
myRefineGrpLayout->addWidget( mySelLbl[ Ids ], 0, 0 );
|
||||||
myRefineGrpLayout->addWidget( mySelBtn[ Ids ], 0, 1 );
|
myRefineGrpLayout->addWidget( mySelBtn[ Ids ], 0, 1 );
|
||||||
@ -411,6 +411,24 @@ void SMESHGUI_MeshPatternDlg::Init()
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess)
|
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;
|
QList<int> ids;
|
||||||
if ((isRefine() &&
|
if ((isRefine() &&
|
||||||
(myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 ||
|
(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->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked())
|
||||||
: myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true));
|
: 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
|
} else { // Applying a pattern to geometrical object
|
||||||
if (myType == Type_2d)
|
if (myType == Type_2d)
|
||||||
myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked());
|
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)
|
void SMESHGUI_MeshPatternDlg::onNodeChanged (int value)
|
||||||
{
|
{
|
||||||
if (myType == Type_3d) {
|
if (myType == Type_3d) {
|
||||||
QSpinBox* first = (QSpinBox*)sender();
|
SalomeApp_IntSpinBox* first = (SalomeApp_IntSpinBox*)sender();
|
||||||
QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
|
SalomeApp_IntSpinBox* second = first == myNode1 ? myNode2 : myNode1;
|
||||||
int secondVal = second->value();
|
int secondVal = second->value();
|
||||||
if (secondVal == value) {
|
if (secondVal == value) {
|
||||||
secondVal = value == second->maximum() ? second->minimum() : value + 1;
|
secondVal = value == second->maximum() ? second->minimum() : value + 1;
|
||||||
|
@ -44,7 +44,7 @@ class QRadioButton;
|
|||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QButtonGroup;
|
class QButtonGroup;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QSpinBox;
|
class SalomeApp_IntSpinBox;
|
||||||
class vtkUnstructuredGrid;
|
class vtkUnstructuredGrid;
|
||||||
class SALOME_Actor;
|
class SALOME_Actor;
|
||||||
class SVTK_Selector;
|
class SVTK_Selector;
|
||||||
@ -130,8 +130,8 @@ private:
|
|||||||
QCheckBox* myRefine;
|
QCheckBox* myRefine;
|
||||||
|
|
||||||
QFrame* myRefineGrp;
|
QFrame* myRefineGrp;
|
||||||
QSpinBox* myNode1;
|
SalomeApp_IntSpinBox* myNode1;
|
||||||
QSpinBox* myNode2;
|
SalomeApp_IntSpinBox* myNode2;
|
||||||
QLabel* myNode2Lbl;
|
QLabel* myNode2Lbl;
|
||||||
|
|
||||||
QFrame* myGeomGrp;
|
QFrame* myGeomGrp;
|
||||||
|
@ -281,6 +281,22 @@ bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess)
|
|||||||
tr("NODE_ID_IS_NOT_DEFINED"));
|
tr("NODE_ID_IS_NOT_DEFINED"));
|
||||||
return false;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +341,12 @@ bool SMESHGUI_MoveNodesDlg::onApply()
|
|||||||
bool aResult = false;
|
bool aResult = false;
|
||||||
try {
|
try {
|
||||||
aResult = aMeshEditor->MoveNode(anId, myX->GetValue(), myY->GetValue(), myZ->GetValue());
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ QWidget* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent)
|
|||||||
// name : SMESHGUI_MultiEditDlg::isValid
|
// name : SMESHGUI_MultiEditDlg::isValid
|
||||||
// Purpose : Verify validity of input data
|
// 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() &&
|
return (!myMesh->_is_nil() &&
|
||||||
(myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
|
(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,
|
bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
|
||||||
const SMESH::long_array& theIds)
|
const SMESH::long_array& theIds)
|
||||||
{
|
{
|
||||||
SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
|
SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
|
||||||
double aMaxAngle = myMaxAngleSpin->GetValue() * PI / 180.0;
|
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* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
QWidget* createButtonFrame( QWidget* );
|
QWidget* createButtonFrame( QWidget* );
|
||||||
QWidget* createMainFrame( QWidget*, const bool );
|
QWidget* createMainFrame( QWidget*, const bool );
|
||||||
bool isValid( const bool ) const;
|
virtual bool isValid( const bool );
|
||||||
SMESH::long_array_var getIds();
|
SMESH::long_array_var getIds();
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void setSelectionMode();
|
void setSelectionMode();
|
||||||
@ -190,6 +190,7 @@ public:
|
|||||||
virtual ~SMESHGUI_UnionOfTrianglesDlg();
|
virtual ~SMESHGUI_UnionOfTrianglesDlg();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual bool isValid( const bool );
|
||||||
virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
|
virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -87,13 +87,14 @@
|
|||||||
|
|
||||||
namespace SMESH
|
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;
|
SUIT_OverrideCursor wc;
|
||||||
try {
|
try {
|
||||||
_PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
|
_PTR(SObject) aSobj = SMESH::FindSObject( theMesh );
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor();
|
||||||
aMeshEditor->AddNode( x, y, z );
|
aMeshEditor->AddNode( x, y, z );
|
||||||
|
theMesh->SetParameters( SMESHGUI::JoinObjectParameters(theParameters) );
|
||||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||||
CORBA::Long anId = aStudy->StudyId();
|
CORBA::Long anId = aStudy->StudyId();
|
||||||
if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
|
if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) {
|
||||||
@ -400,12 +401,21 @@ bool SMESHGUI_NodesDlg::ClickOnApply()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Recup args and call method */
|
/* Recup args and call method */
|
||||||
double x = SpinBox_X->GetValue();
|
double x = SpinBox_X->GetValue();
|
||||||
double y = SpinBox_Y->GetValue();
|
double y = SpinBox_Y->GetValue();
|
||||||
double z = SpinBox_Z->GetValue();
|
double z = SpinBox_Z->GetValue();
|
||||||
|
|
||||||
|
QStringList aParameters;
|
||||||
|
aParameters << SpinBox_X->text();
|
||||||
|
aParameters << SpinBox_Y->text();
|
||||||
|
aParameters << SpinBox_Z->text();
|
||||||
|
|
||||||
mySimulation->SetVisibility( false );
|
mySimulation->SetVisibility( false );
|
||||||
SMESH::AddNode( myMesh, x, y, z );
|
SMESH::AddNode( myMesh, x, y, z, aParameters );
|
||||||
SMESH::SetPointRepresentation( true );
|
SMESH::SetPointRepresentation( true );
|
||||||
|
|
||||||
// select myMesh
|
// select myMesh
|
||||||
@ -591,3 +601,25 @@ void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e )
|
|||||||
ClickOnHelp();
|
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 hideEvent ( QHideEvent* );
|
||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
QGroupBox* GroupConstructors;
|
QGroupBox* GroupConstructors;
|
||||||
QRadioButton* Constructor1;
|
QRadioButton* Constructor1;
|
||||||
QGroupBox* GroupCoordinates;
|
QGroupBox* GroupCoordinates;
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
|
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
#include <SVTK_Selector.h>
|
#include <SVTK_Selector.h>
|
||||||
@ -71,7 +72,6 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
@ -92,7 +92,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
|||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
|
||||||
myVectorDefinition(NONE_SELECT),
|
myVectorDefinition(NONE_SELECT),
|
||||||
myFilterDlg( 0 )
|
myFilterDlg( 0 ),
|
||||||
|
mySelectedObject(SMESH::SMESH_IDSource::_nil())
|
||||||
{
|
{
|
||||||
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
|
||||||
|
|
||||||
@ -214,7 +215,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
|
|||||||
SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox);
|
SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngleBox);
|
||||||
|
|
||||||
TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), 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(RadioButton3, 0, 0);
|
||||||
GroupAngleLayout->addWidget(RadioButton4, 0, 1);
|
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(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
|
||||||
connect(CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
|
connect(CheckBoxPreview, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
|
||||||
|
|
||||||
|
connect(SpinBox_Angle, SIGNAL(textChanged(const QString&)), this, SLOT(onAngleTextChange(const QString&)));
|
||||||
|
|
||||||
ConstructorsClicked(0);
|
ConstructorsClicked(0);
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
@ -462,10 +465,13 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
|
|||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RevolutionDlg::ClickOnApply()
|
bool SMESHGUI_RevolutionDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements && IsAxisOk()) {
|
if (myNbOkElements && IsAxisOk()) {
|
||||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
@ -492,16 +498,49 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
if ( GroupAngle->checkedId() == 1 )
|
if ( GroupAngle->checkedId() == 1 )
|
||||||
anAngle = anAngle/aNbSteps;
|
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 {
|
try {
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
|
||||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) {
|
||||||
SMESH::ListOfGroups_var groups =
|
if( CheckBoxMesh->isChecked() ) {
|
||||||
aMeshEditor->RotationSweepMakeGroups(anElementsId.inout(), anAxis,
|
if( GetConstructorId() == 0 )
|
||||||
anAngle, aNbSteps, aTolerance);
|
SMESH::ListOfGroups_var groups =
|
||||||
else
|
aMeshEditor->RotationSweepObject1DMakeGroups(mySelectedObject, anAxis,
|
||||||
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,8 +549,11 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||||
Init(false);
|
Init(false);
|
||||||
ConstructorsClicked(GetConstructorId());
|
ConstructorsClicked(GetConstructorId());
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -520,8 +562,8 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RevolutionDlg::ClickOnOk()
|
void SMESHGUI_RevolutionDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
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()
|
// function : onTextChange()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -677,77 +732,18 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
int aConstructorId = GetConstructorId();
|
|
||||||
|
|
||||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||||
|
|
||||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||||
// get IDs from mesh
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
else
|
||||||
if (!aSMDSMesh)
|
return;
|
||||||
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();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||||
myElementsId = aString;
|
myElementsId = aString;
|
||||||
|
if (aNbUnits < 1)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbUnits < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
myNbOkElements = true;
|
myNbOkElements = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -1073,11 +1069,20 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
|||||||
try {
|
try {
|
||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||||
aMeshEditor->RotationSweep(anElementsId.inout(),
|
if( CheckBoxMesh->isChecked() ) {
|
||||||
anAxis,
|
if( GetConstructorId() == 0 )
|
||||||
anAngle,
|
aMeshEditor->RotationSweepObject1D(mySelectedObject, anAxis,
|
||||||
aNbSteps,
|
anAngle, aNbSteps, aTolerance);
|
||||||
aTolerance);
|
else
|
||||||
|
aMeshEditor->RotationSweepObject2D(mySelectedObject, anAxis,
|
||||||
|
anAngle, aNbSteps, aTolerance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aMeshEditor->RotationSweep(anElementsId.inout(),
|
||||||
|
anAxis,
|
||||||
|
anAngle,
|
||||||
|
aNbSteps,
|
||||||
|
aTolerance);
|
||||||
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||||
mySimulation->SetData(aMeshPreviewStruct._retn());
|
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
@ -1154,3 +1159,31 @@ void SMESHGUI_RevolutionDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
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 QPushButton;
|
||||||
class QRadioButton;
|
class QRadioButton;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QSpinBox;
|
class SalomeApp_IntSpinBox;
|
||||||
class SMESHGUI_IdValidator;
|
class SMESHGUI_IdValidator;
|
||||||
class SMESHGUI_SpinBox;
|
class SMESHGUI_SpinBox;
|
||||||
class SMESHGUI;
|
class SMESHGUI;
|
||||||
@ -81,6 +81,8 @@ private:
|
|||||||
int GetConstructorId();
|
int GetConstructorId();
|
||||||
bool IsAxisOk();
|
bool IsAxisOk();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -89,6 +91,8 @@ private:
|
|||||||
QWidget* myEditCurrentArgument; /* Current argument */
|
QWidget* myEditCurrentArgument; /* Current argument */
|
||||||
SVTK_Selector* mySelector;
|
SVTK_Selector* mySelector;
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
bool myBusy;
|
bool myBusy;
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
@ -138,7 +142,7 @@ private:
|
|||||||
QLabel* TextLabelAngle;
|
QLabel* TextLabelAngle;
|
||||||
SMESHGUI_SpinBox* SpinBox_Angle;
|
SMESHGUI_SpinBox* SpinBox_Angle;
|
||||||
QLabel* TextLabelNbSteps;
|
QLabel* TextLabelNbSteps;
|
||||||
QSpinBox* SpinBox_NbSteps;
|
SalomeApp_IntSpinBox* SpinBox_NbSteps;
|
||||||
QLabel* TextLabelTolerance;
|
QLabel* TextLabelTolerance;
|
||||||
SMESHGUI_SpinBox* SpinBox_Tolerance;
|
SMESHGUI_SpinBox* SpinBox_Tolerance;
|
||||||
|
|
||||||
@ -155,13 +159,14 @@ private slots:
|
|||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
void ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ClickOnHelp();
|
void ClickOnHelp();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog();
|
void DeactivateActiveDialog();
|
||||||
void ActivateThisDialog();
|
void ActivateThisDialog();
|
||||||
void onTextChange( const QString& );
|
void onTextChange( const QString& );
|
||||||
|
void onAngleTextChange( const QString& );
|
||||||
void onSelectMesh( bool );
|
void onSelectMesh( bool );
|
||||||
void onVectorChanged();
|
void onVectorChanged();
|
||||||
void toDisplaySimulation();
|
void toDisplaySimulation();
|
||||||
|
@ -91,7 +91,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule )
|
|||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( 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 image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION")));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||||
@ -365,10 +366,13 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
|
|||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RotationDlg::ClickOnApply()
|
bool SMESHGUI_RotationDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements && IsAxisOk()) {
|
if (myNbOkElements && IsAxisOk()) {
|
||||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
@ -389,6 +393,16 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
|||||||
anAxis.vz = SpinBox_DZ->GetValue();
|
anAxis.vz = SpinBox_DZ->GetValue();
|
||||||
|
|
||||||
double anAngle = (SpinBox_Angle->GetValue())*PI/180;
|
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();
|
int actionButton = ActionGroup->checkedId();
|
||||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||||
try {
|
try {
|
||||||
@ -396,19 +410,40 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
|||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
switch ( actionButton ) {
|
switch ( actionButton ) {
|
||||||
case MOVE_ELEMS_BUTTON:
|
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;
|
break;
|
||||||
case COPY_ELEMS_BUTTON:
|
case COPY_ELEMS_BUTTON:
|
||||||
if ( makeGroups )
|
if ( makeGroups ) {
|
||||||
SMESH::ListOfGroups_var groups =
|
SMESH::ListOfGroups_var groups;
|
||||||
aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
|
if(CheckBoxMesh->isChecked())
|
||||||
else
|
groups = aMeshEditor->RotateObjectMakeGroups(mySelectedObject, anAxis, anAngle);
|
||||||
aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
|
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;
|
break;
|
||||||
case MAKE_MESH_BUTTON:
|
case MAKE_MESH_BUTTON:
|
||||||
SMESH::SMESH_Mesh_var mesh =
|
SMESH::SMESH_Mesh_var mesh;
|
||||||
aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
|
if(CheckBoxMesh->isChecked())
|
||||||
LineEditNewMesh->text().toLatin1().data());
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
@ -418,8 +453,11 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
|||||||
actionButton == MAKE_MESH_BUTTON )
|
actionButton == MAKE_MESH_BUTTON )
|
||||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||||
Init(false);
|
Init(false);
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -428,8 +466,8 @@ void SMESHGUI_RotationDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RotationDlg::ClickOnOk()
|
void SMESHGUI_RotationDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -586,13 +624,18 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
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
|
// get IDs from mesh
|
||||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
/*
|
||||||
if (!aSMDSMesh)
|
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||||
|
if (!aSMDSMesh)
|
||||||
return;
|
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);
|
const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
|
||||||
if (e) {
|
if (e) {
|
||||||
myElementsId += QString(" %1").arg(i);
|
myElementsId += QString(" %1").arg(i);
|
||||||
@ -600,40 +643,41 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
} 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);
|
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||||
|
|
||||||
// get IDs from submesh
|
// get IDs from submesh
|
||||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||||
anElementsIds = aSubMesh->GetElementsId();
|
anElementsIds = aSubMesh->GetElementsId();
|
||||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||||
}
|
}
|
||||||
aNbUnits = anElementsIds->length();
|
aNbUnits = anElementsIds->length();
|
||||||
} else { // GROUP
|
} else { // GROUP
|
||||||
// get smesh group
|
// get smesh group
|
||||||
SMESH::SMESH_GroupBase_var aGroup =
|
SMESH::SMESH_GroupBase_var aGroup =
|
||||||
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||||
if (aGroup->_is_nil())
|
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;
|
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||||
anElementsIds = aGroup->GetListOfID();
|
anElementsIds = aGroup->GetListOfID();
|
||||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||||
}
|
}
|
||||||
aNbUnits = anElementsIds->length();
|
aNbUnits = anElementsIds->length();
|
||||||
}
|
}
|
||||||
} else {
|
*/
|
||||||
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||||
myElementsId = aString;
|
myElementsId = aString;
|
||||||
}
|
if (aNbUnits < 1)
|
||||||
|
return;
|
||||||
if (aNbUnits < 1)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
myNbOkElements = true;
|
myNbOkElements = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||||
if (aNbUnits != 1)
|
if (aNbUnits != 1)
|
||||||
@ -719,6 +763,7 @@ void SMESHGUI_RotationDlg::SetEditCurrentArgument()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
@ -938,3 +983,30 @@ void SMESHGUI_RotationDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
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();
|
bool IsAxisOk();
|
||||||
void setNewMeshName();
|
void setNewMeshName();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -86,6 +88,7 @@ private:
|
|||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
QGroupBox* GroupConstructors;
|
QGroupBox* GroupConstructors;
|
||||||
QRadioButton* RadioButton1;
|
QRadioButton* RadioButton1;
|
||||||
@ -133,7 +136,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
void ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ClickOnHelp();
|
void ClickOnHelp();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
#include <LightApp_Application.h>
|
#include <LightApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
#include <LightApp_SelectionMgr.h>
|
||||||
|
|
||||||
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
|
|
||||||
#include <SVTK_ViewModel.h>
|
#include <SVTK_ViewModel.h>
|
||||||
#include <SVTK_Selector.h>
|
#include <SVTK_Selector.h>
|
||||||
#include <SVTK_ViewWindow.h>
|
#include <SVTK_ViewWindow.h>
|
||||||
@ -68,7 +70,6 @@
|
|||||||
#include <QRadioButton>
|
#include <QRadioButton>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@ -91,7 +92,8 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule )
|
|||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( 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 image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
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
|
// Controls for iteration limit defining
|
||||||
TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments);
|
TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments);
|
||||||
|
|
||||||
SpinBox_IterationLimit = new QSpinBox(GroupArguments);
|
SpinBox_IterationLimit = new SalomeApp_IntSpinBox(GroupArguments);
|
||||||
|
|
||||||
// Controls for max. aspect ratio defining
|
// Controls for max. aspect ratio defining
|
||||||
TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments);
|
TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments);
|
||||||
@ -318,10 +320,13 @@ void SMESHGUI_SmoothingDlg::Init()
|
|||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose : Called when user presses <Apply> button
|
// purpose : Called when user presses <Apply> button
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_SmoothingDlg::ClickOnApply()
|
bool SMESHGUI_SmoothingDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if (!isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
|
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
|
||||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
@ -345,6 +350,10 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
|||||||
long anIterationLimit = (long)SpinBox_IterationLimit->value();
|
long anIterationLimit = (long)SpinBox_IterationLimit->value();
|
||||||
double aMaxAspectRatio = SpinBox_AspectRatio->GetValue();
|
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;
|
SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH;
|
||||||
if (ComboBoxMethod->currentIndex() > 0)
|
if (ComboBoxMethod->currentIndex() > 0)
|
||||||
aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
|
aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH;
|
||||||
@ -354,12 +363,25 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
|||||||
SUIT_OverrideCursor aWaitCursor;
|
SUIT_OverrideCursor aWaitCursor;
|
||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
|
||||||
if ( CheckBoxParametric->isChecked() )
|
if ( CheckBoxParametric->isChecked() ) {
|
||||||
aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(),
|
if(CheckBoxMesh->isChecked())
|
||||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(),
|
||||||
else
|
anIterationLimit, aMaxAspectRatio, aMethod);
|
||||||
aResult = aMeshEditor->Smooth(anElementsId.inout(), aNodesId.inout(),
|
else
|
||||||
anIterationLimit, aMaxAspectRatio, aMethod);
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,8 +393,12 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
|||||||
mySelectionMgr->setSelectedObjects(aList, false);
|
mySelectionMgr->setSelectedObjects(aList, false);
|
||||||
SMESH::UpdateView();
|
SMESH::UpdateView();
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -381,8 +407,8 @@ void SMESHGUI_SmoothingDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_SmoothingDlg::ClickOnOk()
|
void SMESHGUI_SmoothingDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -549,48 +575,15 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
|
|||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||||
|
|
||||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil())
|
||||||
// get IDs from mesh
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
else
|
||||||
if (!aSMDSMesh)
|
return;
|
||||||
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();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||||
myElementsId = aString;
|
myElementsId = aString;
|
||||||
|
if (aNbUnits < 1)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
|
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myActor) {
|
||||||
myNbOkNodes = 0;
|
myNbOkNodes = 0;
|
||||||
@ -598,9 +591,6 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbUnits < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
myBusy = true;
|
myBusy = true;
|
||||||
myEditCurrentArgument->setText(aString);
|
myEditCurrentArgument->setText(aString);
|
||||||
myEditCurrentArgument->repaint();
|
myEditCurrentArgument->repaint();
|
||||||
@ -822,3 +812,24 @@ void SMESHGUI_SmoothingDlg::setNodeFilters()
|
|||||||
{
|
{
|
||||||
setFilters( false );
|
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 QRadioButton;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QSpinBox;
|
|
||||||
class SMESHGUI;
|
class SMESHGUI;
|
||||||
|
class SalomeApp_IntSpinBox;
|
||||||
class SMESHGUI_IdValidator;
|
class SMESHGUI_IdValidator;
|
||||||
class SMESHGUI_SpinBox;
|
class SMESHGUI_SpinBox;
|
||||||
class SMESHGUI_FilterDlg;
|
class SMESHGUI_FilterDlg;
|
||||||
@ -73,6 +73,8 @@ private:
|
|||||||
void keyPressEvent( QKeyEvent* );
|
void keyPressEvent( QKeyEvent* );
|
||||||
void setFilters( const bool theIsElem );
|
void setFilters( const bool theIsElem );
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -83,6 +85,8 @@ private:
|
|||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||||
SVTK_Selector* mySelector;
|
SVTK_Selector* mySelector;
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
bool myBusy;
|
bool myBusy;
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
@ -106,7 +110,7 @@ private:
|
|||||||
QLabel* TextLabelMethod;
|
QLabel* TextLabelMethod;
|
||||||
QComboBox* ComboBoxMethod;
|
QComboBox* ComboBoxMethod;
|
||||||
QLabel* TextLabelLimit;
|
QLabel* TextLabelLimit;
|
||||||
QSpinBox* SpinBox_IterationLimit;
|
SalomeApp_IntSpinBox* SpinBox_IterationLimit;
|
||||||
QLabel* TextLabelAspectRatio;
|
QLabel* TextLabelAspectRatio;
|
||||||
SMESHGUI_SpinBox* SpinBox_AspectRatio;
|
SMESHGUI_SpinBox* SpinBox_AspectRatio;
|
||||||
QCheckBox* CheckBoxParametric;
|
QCheckBox* CheckBoxParametric;
|
||||||
@ -118,7 +122,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
void ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ClickOnHelp();
|
void ClickOnHelp();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
// purpose : constructor of specific widget accepting floats in double precision.
|
// purpose : constructor of specific widget accepting floats in double precision.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_SpinBox::SMESHGUI_SpinBox( QWidget* parent )
|
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
|
QLineEdit* SMESHGUI_SpinBox::editor() const
|
||||||
{
|
{
|
||||||
return QtxDoubleSpinBox::lineEdit();
|
return SalomeApp_DoubleSpinBox::lineEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -116,4 +116,5 @@ void SMESHGUI_SpinBox::RangeStepAndValidator( double min,
|
|||||||
setDecimals(32);
|
setDecimals(32);
|
||||||
setRange(min, max);
|
setRange(min, max);
|
||||||
setSingleStep( step );
|
setSingleStep( step );
|
||||||
|
setDefaultValue( min );
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "SMESH_SMESHGUI.hxx"
|
#include "SMESH_SMESHGUI.hxx"
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <QtxDoubleSpinBox.h>
|
#include <SalomeApp_DoubleSpinBox.h>
|
||||||
|
|
||||||
#define COORD_MIN -1e+15
|
#define COORD_MIN -1e+15
|
||||||
#define COORD_MAX +1e+15
|
#define COORD_MAX +1e+15
|
||||||
@ -43,7 +43,7 @@ class QDoubleValidator;
|
|||||||
// class : SMESHGUI_SpinBox
|
// class : SMESHGUI_SpinBox
|
||||||
// purpose : Derivated from QtxDoubleSpinBox class
|
// purpose : Derivated from QtxDoubleSpinBox class
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class SMESHGUI_EXPORT SMESHGUI_SpinBox : public QtxDoubleSpinBox
|
class SMESHGUI_EXPORT SMESHGUI_SpinBox : public SalomeApp_DoubleSpinBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -92,7 +92,8 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule )
|
|||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( 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 image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
|
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
|
||||||
@ -437,10 +438,13 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId)
|
|||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_SymmetryDlg::ClickOnApply()
|
bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements && IsMirrorOk()) {
|
if (myNbOkElements && IsMirrorOk()) {
|
||||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
@ -464,6 +468,13 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
|||||||
aMirror.vz = SpinBox_DZ->GetValue();
|
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;
|
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
|
||||||
|
|
||||||
@ -482,32 +493,60 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
|||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
|
|
||||||
switch ( actionButton ) {
|
switch ( actionButton ) {
|
||||||
case MOVE_ELEMS_BUTTON:
|
case MOVE_ELEMS_BUTTON: {
|
||||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
|
if(CheckBoxMesh->isChecked())
|
||||||
break;
|
aMeshEditor->MirrorObject(mySelectedObject, aMirror, aMirrorType, false );
|
||||||
case COPY_ELEMS_BUTTON:
|
|
||||||
if ( makeGroups )
|
|
||||||
SMESH::ListOfGroups_var groups =
|
|
||||||
aMeshEditor->MirrorMakeGroups(anElementsId, aMirror, aMirrorType);
|
|
||||||
else
|
else
|
||||||
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true);
|
aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false );
|
||||||
|
|
||||||
|
if( !myMesh->_is_nil())
|
||||||
|
myMesh->SetParameters(SMESHGUI::JoinObjectParameters(aParameters));
|
||||||
break;
|
break;
|
||||||
case MAKE_MESH_BUTTON:
|
}
|
||||||
SMESH::SMESH_Mesh_var mesh =
|
case COPY_ELEMS_BUTTON: {
|
||||||
aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups,
|
SMESH::ListOfGroups_var groups;
|
||||||
LineEditNewMesh->text().toLatin1().data());
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESH::UpdateView();
|
SMESH::UpdateView();
|
||||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
||||||
actionButton == MAKE_MESH_BUTTON )
|
actionButton == MAKE_MESH_BUTTON )
|
||||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||||
Init(false);
|
Init(false);
|
||||||
ConstructorsClicked(GetConstructorId());
|
ConstructorsClicked(GetConstructorId());
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -516,8 +555,8 @@ void SMESHGUI_SymmetryDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_SymmetryDlg::ClickOnOk()
|
void SMESHGUI_SymmetryDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -675,8 +714,13 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
|||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||||
|
|
||||||
if (!SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO)->_is_nil()) { //MESH
|
if (!SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO)->_is_nil()) { //MESH
|
||||||
// get IDs from mesh
|
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(IO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
// get IDs from mesh
|
||||||
|
/*
|
||||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||||
if (!aSMDSMesh)
|
if (!aSMDSMesh)
|
||||||
return;
|
return;
|
||||||
@ -688,17 +732,20 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
|||||||
aNbUnits++;
|
aNbUnits++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
|
} 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);
|
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||||
|
|
||||||
// get IDs from submesh
|
// get IDs from submesh
|
||||||
|
/*
|
||||||
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
SMESH::long_array_var anElementsIds = new SMESH::long_array;
|
||||||
anElementsIds = aSubMesh->GetElementsId();
|
anElementsIds = aSubMesh->GetElementsId();
|
||||||
for (int i = 0; i < anElementsIds->length(); i++) {
|
for (int i = 0; i < anElementsIds->length(); i++) {
|
||||||
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
myElementsId += QString(" %1").arg(anElementsIds[i]);
|
||||||
}
|
}
|
||||||
aNbUnits = anElementsIds->length();
|
aNbUnits = anElementsIds->length();
|
||||||
|
|
||||||
} else { // GROUP
|
} else { // GROUP
|
||||||
// get smesh group
|
// get smesh group
|
||||||
SMESH::SMESH_GroupBase_var aGroup =
|
SMESH::SMESH_GroupBase_var aGroup =
|
||||||
@ -714,14 +761,14 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
aNbUnits = anElementsIds->length();
|
aNbUnits = anElementsIds->length();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, IO, aString);
|
||||||
myElementsId = aString;
|
myElementsId = aString;
|
||||||
|
if (aNbUnits < 1)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbUnits < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
myNbOkElements = true;
|
myNbOkElements = true;
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||||
@ -1035,3 +1082,31 @@ void SMESHGUI_SymmetryDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
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();
|
bool IsMirrorOk();
|
||||||
void setNewMeshName();
|
void setNewMeshName();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -83,6 +85,8 @@ private:
|
|||||||
|
|
||||||
QWidget* myEditCurrentArgument; /* Current LineEdit */
|
QWidget* myEditCurrentArgument; /* Current LineEdit */
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
bool myBusy;
|
bool myBusy;
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
@ -135,7 +139,7 @@ private slots:
|
|||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
void ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ClickOnHelp();
|
void ClickOnHelp();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
|
@ -109,7 +109,8 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule )
|
|||||||
: QDialog( SMESH::GetDesktop( theModule ) ),
|
: QDialog( SMESH::GetDesktop( theModule ) ),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
mySelectionMgr( SMESH::GetSelectionMgr( 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 image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
|
||||||
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
|
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
|
||||||
@ -436,10 +437,13 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId)
|
|||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_TranslationDlg::ClickOnApply()
|
bool SMESHGUI_TranslationDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
if (mySMESHGUI->isActiveStudyLocked())
|
if (mySMESHGUI->isActiveStudyLocked())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
|
if( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
if (myNbOkElements) {
|
if (myNbOkElements) {
|
||||||
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
|
||||||
@ -461,6 +465,17 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
|||||||
aVector.PS.z = SpinBox1_3->GetValue();
|
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();
|
int actionButton = ActionGroup->checkedId();
|
||||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||||
try {
|
try {
|
||||||
@ -468,31 +483,55 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
|||||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
|
||||||
switch ( actionButton ) {
|
switch ( actionButton ) {
|
||||||
case MOVE_ELEMS_BUTTON:
|
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;
|
break;
|
||||||
case COPY_ELEMS_BUTTON:
|
case COPY_ELEMS_BUTTON:
|
||||||
if ( makeGroups )
|
if ( makeGroups ) {
|
||||||
SMESH::ListOfGroups_var groups =
|
SMESH::ListOfGroups_var groups;
|
||||||
aMeshEditor->TranslateMakeGroups(anElementsId, aVector);
|
if(CheckBoxMesh->isChecked())
|
||||||
else
|
groups = aMeshEditor->TranslateObjectMakeGroups(mySelectedObject,aVector);
|
||||||
aMeshEditor->Translate(anElementsId, aVector, true);
|
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;
|
break;
|
||||||
case MAKE_MESH_BUTTON:
|
case MAKE_MESH_BUTTON:
|
||||||
SMESH::SMESH_Mesh_var mesh =
|
SMESH::SMESH_Mesh_var mesh;
|
||||||
aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups,
|
if(CheckBoxMesh->isChecked())
|
||||||
LineEditNewMesh->text().toLatin1().data());
|
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 (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESH::UpdateView();
|
SMESH::UpdateView();
|
||||||
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
|
||||||
actionButton == MAKE_MESH_BUTTON )
|
actionButton == MAKE_MESH_BUTTON )
|
||||||
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
mySMESHGUI->updateObjBrowser(true); // new groups may appear
|
||||||
Init(false);
|
Init(false);
|
||||||
ConstructorsClicked(GetConstructorId());
|
ConstructorsClicked(GetConstructorId());
|
||||||
|
mySelectedObject = SMESH::SMESH_IDSource::_nil();
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -501,8 +540,8 @@ void SMESHGUI_TranslationDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_TranslationDlg::ClickOnOk()
|
void SMESHGUI_TranslationDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -657,8 +696,13 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
|||||||
if (CheckBoxMesh->isChecked()) {
|
if (CheckBoxMesh->isChecked()) {
|
||||||
SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
|
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
|
// get IDs from mesh
|
||||||
|
/*
|
||||||
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
|
||||||
if (!aSMDSMesh)
|
if (!aSMDSMesh)
|
||||||
return;
|
return;
|
||||||
@ -696,14 +740,14 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
aNbUnits = anElementsIds->length();
|
aNbUnits = anElementsIds->length();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, IO, aString);
|
||||||
myElementsId = aString;
|
myElementsId = aString;
|
||||||
|
if (aNbUnits < 1)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aNbUnits < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
myNbOkElements = true;
|
myNbOkElements = true;
|
||||||
} else {
|
} else {
|
||||||
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
|
||||||
@ -986,3 +1030,31 @@ void SMESHGUI_TranslationDlg::setFilters()
|
|||||||
|
|
||||||
myFilterDlg->show();
|
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();
|
int GetConstructorId();
|
||||||
void setNewMeshName();
|
void setNewMeshName();
|
||||||
|
|
||||||
|
bool isValid();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
SMESHGUI_IdValidator* myIdValidator;
|
SMESHGUI_IdValidator* myIdValidator;
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
@ -88,6 +90,8 @@ private:
|
|||||||
SMESH_Actor* myActor;
|
SMESH_Actor* myActor;
|
||||||
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter;
|
||||||
|
|
||||||
|
SMESH::SMESH_IDSource_var mySelectedObject;
|
||||||
|
|
||||||
QGroupBox* ConstructorsBox;
|
QGroupBox* ConstructorsBox;
|
||||||
QButtonGroup* GroupConstructors;
|
QButtonGroup* GroupConstructors;
|
||||||
QRadioButton* RadioButton1;
|
QRadioButton* RadioButton1;
|
||||||
@ -132,7 +136,7 @@ private slots:
|
|||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
void ClickOnCancel();
|
||||||
void ClickOnApply();
|
bool ClickOnApply();
|
||||||
void ClickOnHelp();
|
void ClickOnHelp();
|
||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void SelectionIntoArgument();
|
void SelectionIntoArgument();
|
||||||
|
@ -1280,6 +1280,10 @@ Are you sure want to export to MED 2.1 ?</translation>
|
|||||||
<source>SMESH_ID_NODES</source>
|
<source>SMESH_ID_NODES</source>
|
||||||
<translation>Id Nodes</translation>
|
<translation>Id Nodes</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SMESH_INCORRECT_INPUT</source>
|
||||||
|
<translation>Incorrect input data!</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SMESH_INFORMATION</source>
|
<source>SMESH_INFORMATION</source>
|
||||||
<translation>Information</translation>
|
<translation>Information</translation>
|
||||||
|
@ -47,6 +47,7 @@ salomeinclude_HEADERS = \
|
|||||||
SMESH_MEDSupport_i.hxx \
|
SMESH_MEDSupport_i.hxx \
|
||||||
SMESH_Pattern_i.hxx \
|
SMESH_Pattern_i.hxx \
|
||||||
SMESH_2smeshpy.hxx \
|
SMESH_2smeshpy.hxx \
|
||||||
|
SMESH_NoteBook.hxx \
|
||||||
SMESH.hxx
|
SMESH.hxx
|
||||||
|
|
||||||
# Scripts to be installed.
|
# Scripts to be installed.
|
||||||
@ -76,7 +77,8 @@ dist_libSMESHEngine_la_SOURCES = \
|
|||||||
SMESH_Filter_i.cxx \
|
SMESH_Filter_i.cxx \
|
||||||
SMESH_Group_i.cxx \
|
SMESH_Group_i.cxx \
|
||||||
SMESH_Pattern_i.cxx \
|
SMESH_Pattern_i.cxx \
|
||||||
SMESH_2smeshpy.cxx
|
SMESH_2smeshpy.cxx \
|
||||||
|
SMESH_NoteBook.cxx
|
||||||
|
|
||||||
# Executables targets
|
# Executables targets
|
||||||
bin_PROGRAMS = SMESHEngine
|
bin_PROGRAMS = SMESHEngine
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
#include "SMESH_PythonDump.hxx"
|
#include "SMESH_PythonDump.hxx"
|
||||||
|
#include "SMESH_NoteBook.hxx"
|
||||||
#include "Resource_DataMapOfAsciiStringAsciiString.hxx"
|
#include "Resource_DataMapOfAsciiStringAsciiString.hxx"
|
||||||
|
|
||||||
#include "SMESH_Gen_i.hxx"
|
#include "SMESH_Gen_i.hxx"
|
||||||
@ -125,12 +126,31 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
|||||||
theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames );
|
theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames );
|
||||||
|
|
||||||
// split theScript into separate commands
|
// split theScript into separate commands
|
||||||
|
|
||||||
|
SMESH_NoteBook * aNoteBook = new SMESH_NoteBook();
|
||||||
|
|
||||||
int from = 1, end = theScript.Length(), to;
|
int from = 1, end = theScript.Length(), to;
|
||||||
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
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 )
|
if ( to != from )
|
||||||
// cut out and store a command
|
// cut out and store a command
|
||||||
theGen->AddCommand( theScript.SubString( from, to - 1 ));
|
theGen->AddCommand( aNoteScript.SubString( from, to - 1 ));
|
||||||
from = to + 1;
|
from = to + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,13 +1077,14 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
if ( sameMethods.empty() ) {
|
if ( sameMethods.empty() ) {
|
||||||
const char * names[] = {
|
const char * names[] = {
|
||||||
"RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
|
"RemoveElements","RemoveNodes","AddNode","AddEdge","AddFace","AddPolygonalFace",
|
||||||
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode",
|
"AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","MoveNode", "MoveClosestNodeToPoint",
|
||||||
"InverseDiag","DeleteDiag","Reorient","ReorientObject","SplitQuad","SplitQuadObject",
|
"InverseDiag","DeleteDiag","Reorient","ReorientObject","TriToQuad","SplitQuad","SplitQuadObject",
|
||||||
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
|
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
|
||||||
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
|
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
|
||||||
"RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
|
"RotationSweep","RotationSweepObject","RotationSweepObject1D","RotationSweepObject2D",
|
||||||
"ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","Mirror",
|
"ExtrusionSweep","AdvancedExtrusion","ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
|
||||||
"MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
|
"ExtrusionAlongPath","ExtrusionAlongPathObject","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
|
||||||
|
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
|
||||||
"FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
|
"FindCoincidentNodes","FindCoincidentNodesOnPart","MergeNodes","FindEqualElements",
|
||||||
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
|
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
|
||||||
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
|
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
|
||||||
@ -1983,14 +2004,21 @@ const TCollection_AsciiString & _pyCommand::GetArg( int index )
|
|||||||
if ( begPos < 1 )
|
if ( begPos < 1 )
|
||||||
begPos = myString.Location( "(", 1, Length() ) + 1;
|
begPos = myString.Location( "(", 1, Length() ) + 1;
|
||||||
|
|
||||||
int i = 0, prevLen = 0;
|
int i = 0, prevLen = 0, nbNestings = 0;
|
||||||
while ( begPos != EMPTY ) {
|
while ( begPos != EMPTY ) {
|
||||||
begPos += prevLen;
|
begPos += prevLen;
|
||||||
|
if( myString.Value( begPos ) == '(' )
|
||||||
|
nbNestings++;
|
||||||
// check if we are looking at the closing parenthesis
|
// check if we are looking at the closing parenthesis
|
||||||
while ( begPos <= Length() && isspace( myString.Value( begPos )))
|
while ( begPos <= Length() && isspace( myString.Value( begPos )))
|
||||||
++begPos;
|
++begPos;
|
||||||
if ( begPos > Length() || myString.Value( begPos ) == ')' )
|
if ( begPos > Length() )
|
||||||
break;
|
break;
|
||||||
|
if ( myString.Value( begPos ) == ')' ) {
|
||||||
|
nbNestings--;
|
||||||
|
if( nbNestings == 0 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
myArgs.Append( GetWord( myString, begPos, true, true ));
|
myArgs.Append( GetWord( myString, begPos, true, true ));
|
||||||
SetBegPos( ARG1_IND + i, begPos );
|
SetBegPos( ARG1_IND + i, begPos );
|
||||||
prevLen = myArgs.Last().Length();
|
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
|
if ( pos < 1 ) // no index-th arg exist, append inexistent args
|
||||||
{
|
{
|
||||||
// find a closing parenthesis
|
// 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();
|
pos = GetBegPos( ARG1_IND + lastArgInd - 1 ) + GetArg( lastArgInd ).Length();
|
||||||
while ( pos > 0 && pos <= Length() && myString.Value( pos ) != ')' )
|
while ( pos > 0 && pos <= Length() && myString.Value( pos ) != ')' )
|
||||||
++pos;
|
++pos;
|
||||||
|
@ -493,6 +493,11 @@ public:
|
|||||||
* \brief Find SObject for an algo
|
* \brief Find SObject for an algo
|
||||||
*/
|
*/
|
||||||
SALOMEDS::SObject_ptr GetAlgoSO(const ::SMESH_Algo* 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:
|
private:
|
||||||
// Create hypothesis of given type
|
// Create hypothesis of given type
|
||||||
|
@ -43,8 +43,10 @@
|
|||||||
|
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
static int MYDEBUG = 0;
|
static int MYDEBUG = 0;
|
||||||
|
static int VARIABLE_DEBUG = 0;
|
||||||
#else
|
#else
|
||||||
static int MYDEBUG = 0;
|
static int MYDEBUG = 0;
|
||||||
|
static int VARIABLE_DEBUG = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -863,3 +865,100 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy
|
|||||||
return true;
|
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 <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "SMESH_Hypothesis_i.hxx"
|
#include "SMESH_Hypothesis_i.hxx"
|
||||||
|
#include "SMESH_Gen_i.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -120,6 +121,120 @@ CORBA::Long SMESH_Hypothesis_i::GetId()
|
|||||||
return myBaseImpl->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
|
* SMESH_Hypothesis_i::GetImpl
|
||||||
|
@ -64,6 +64,25 @@ public:
|
|||||||
|
|
||||||
// Get unique id of hypothesis
|
// Get unique id of hypothesis
|
||||||
CORBA::Long GetId();
|
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
|
// Get implementation
|
||||||
::SMESH_Hypothesis* GetImpl();
|
::SMESH_Hypothesis* GetImpl();
|
||||||
|
@ -1351,12 +1351,13 @@ SMESH_MeshEditor_i::rotationSweep(const SMESH::long_array & theIDsOfElements,
|
|||||||
CORBA::Double theAngleInRadians,
|
CORBA::Double theAngleInRadians,
|
||||||
CORBA::Long theNbOfSteps,
|
CORBA::Long theNbOfSteps,
|
||||||
CORBA::Double theTolerance,
|
CORBA::Double theTolerance,
|
||||||
const bool theMakeGroups)
|
const bool theMakeGroups,
|
||||||
|
const SMDSAbs_ElementType theElementType)
|
||||||
{
|
{
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
TIDSortedElemSet inElements, copyElements;
|
TIDSortedElemSet inElements, copyElements;
|
||||||
arrayToSet(theIDsOfElements, GetMeshDS(), inElements);
|
arrayToSet(theIDsOfElements, GetMeshDS(), inElements, theElementType);
|
||||||
|
|
||||||
TIDSortedElemSet* workElements = & inElements;
|
TIDSortedElemSet* workElements = & inElements;
|
||||||
TPreviewMesh tmpMesh( SMDSAbs_Face );
|
TPreviewMesh tmpMesh( SMDSAbs_Face );
|
||||||
@ -1399,10 +1400,9 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
|
|||||||
CORBA::Double theTolerance)
|
CORBA::Double theTolerance)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump() << this << ".RotationSweep( "
|
TPythonDump() << this << ".RotationSweep( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngleInRadians << ", "
|
<< theAngleInRadians << ", "
|
||||||
<< theNbOfSteps << ", "
|
<< theNbOfSteps << ", "
|
||||||
<< theTolerance << " )";
|
<< theTolerance << " )";
|
||||||
@ -1434,12 +1434,11 @@ SMESH_MeshEditor_i::RotationSweepMakeGroups(const SMESH::long_array& theIDsOfEle
|
|||||||
theTolerance,
|
theTolerance,
|
||||||
true);
|
true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump()<< "axis = " << theAxis;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump<< this << ".RotationSweepMakeGroups( "
|
aPythonDump<< this << ".RotationSweepMakeGroups( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngleInRadians << ", "
|
<< theAngleInRadians << ", "
|
||||||
<< theNbOfSteps << ", "
|
<< theNbOfSteps << ", "
|
||||||
<< theTolerance << " )";
|
<< theTolerance << " )";
|
||||||
@ -1459,10 +1458,9 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
|
|||||||
CORBA::Double theTolerance)
|
CORBA::Double theTolerance)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump() << this << ".RotationSweepObject( "
|
TPythonDump() << this << ".RotationSweepObject( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngleInRadians << ", "
|
<< theAngleInRadians << ", "
|
||||||
<< theNbOfSteps << ", "
|
<< theNbOfSteps << ", "
|
||||||
<< theTolerance << " )";
|
<< theTolerance << " )";
|
||||||
@ -1476,6 +1474,64 @@ void SMESH_MeshEditor_i::RotationSweepObject(SMESH::SMESH_IDSource_ptr theObject
|
|||||||
false);
|
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
|
//function : RotationSweepObjectMakeGroups
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -1496,12 +1552,77 @@ SMESH_MeshEditor_i::RotationSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr theO
|
|||||||
theTolerance,
|
theTolerance,
|
||||||
true);
|
true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
|
aPythonDump<< this << ".RotationSweepObjectMakeGroups( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", axis, "
|
<< 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 << ", "
|
<< theAngleInRadians << ", "
|
||||||
<< theNbOfSteps << ", "
|
<< theNbOfSteps << ", "
|
||||||
<< theTolerance << " )";
|
<< theTolerance << " )";
|
||||||
@ -1561,9 +1682,8 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen
|
|||||||
{
|
{
|
||||||
extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
|
extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, false );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump() << this << ".ExtrusionSweep( "
|
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();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
|
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump() << this << ".ExtrusionSweepObject( "
|
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();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
|
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Edge );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump() << this << ".ExtrusionSweepObject1D( "
|
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();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
|
extrusionSweep (anElementsId, theStepVector, theNbOfSteps, false, SMDSAbs_Face );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump() << this << ".ExtrusionSweepObject2D( "
|
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 );
|
SMESH::ListOfGroups* aGroups = extrusionSweep (theIDsOfElements, theStepVector, theNbOfSteps, true );
|
||||||
|
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".ExtrusionSweepMakeGroups( "
|
aPythonDump << this << ".ExtrusionSweepMakeGroups( "
|
||||||
<< theIDsOfElements << ", stepVector, " << theNbOfSteps << " )";
|
<< theIDsOfElements << ", " << theStepVector <<", " << theNbOfSteps << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -1657,11 +1773,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObjectMakeGroups(SMESH::SMESH_IDSource_ptr the
|
|||||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
|
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true );
|
||||||
|
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
|
aPythonDump<< this << ".ExtrusionSweepObjectMakeGroups( "
|
||||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -1679,11 +1794,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject1DMakeGroups(SMESH::SMESH_IDSource_ptr t
|
|||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
|
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Edge );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
|
aPythonDump << this << ".ExtrusionSweepObject1DMakeGroups( "
|
||||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -1701,11 +1815,10 @@ SMESH_MeshEditor_i::ExtrusionSweepObject2DMakeGroups(SMESH::SMESH_IDSource_ptr t
|
|||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
|
SMESH::ListOfGroups * aGroups = extrusionSweep (anElementsId, theStepVector, theNbOfSteps, true, SMDSAbs_Face );
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "stepVector = " << theStepVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
|
aPythonDump << this << ".ExtrusionSweepObject2DMakeGroups( "
|
||||||
<< theObject << ", stepVector, " << theNbOfSteps << " )";
|
<< theObject << ", " << theStepVector << ", " << theNbOfSteps << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -1842,7 +1955,8 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
|||||||
CORBA::Boolean theHasRefPoint,
|
CORBA::Boolean theHasRefPoint,
|
||||||
const SMESH::PointStruct & theRefPoint,
|
const SMESH::PointStruct & theRefPoint,
|
||||||
const bool theMakeGroups,
|
const bool theMakeGroups,
|
||||||
SMESH::SMESH_MeshEditor::Extrusion_Error & theError)
|
SMESH::SMESH_MeshEditor::Extrusion_Error & theError,
|
||||||
|
const SMDSAbs_ElementType theElementType)
|
||||||
{
|
{
|
||||||
initData();
|
initData();
|
||||||
|
|
||||||
@ -1867,7 +1981,7 @@ SMESH_MeshEditor_i::extrusionAlongPath(const SMESH::long_array & theIDsOfEleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
TIDSortedElemSet elements;
|
TIDSortedElemSet elements;
|
||||||
arrayToSet(theIDsOfElements, GetMeshDS(), elements);
|
arrayToSet(theIDsOfElements, GetMeshDS(), elements, theElementType);
|
||||||
|
|
||||||
list<double> angles;
|
list<double> angles;
|
||||||
for (int i = 0; i < theAngles.length(); i++) {
|
for (int i = 0; i < theAngles.length(); i++) {
|
||||||
@ -1912,24 +2026,18 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
|
|||||||
const SMESH::PointStruct & theRefPoint)
|
const SMESH::PointStruct & theRefPoint)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
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( "
|
TPythonDump() << "error = " << this << ".ExtrusionAlongPath( "
|
||||||
<< theIDsOfElements << ", "
|
<< theIDsOfElements << ", "
|
||||||
<< thePathMesh << ", "
|
<< thePathMesh << ", "
|
||||||
<< thePathShape << ", "
|
<< thePathShape << ", "
|
||||||
<< theNodeStart << ", "
|
<< theNodeStart << ", "
|
||||||
<< theHasAngles << ", "
|
<< theHasAngles << ", "
|
||||||
<< "rotAngles" << ", "
|
<< theAngles << ", "
|
||||||
<< theHasRefPoint << ", refPoint )";
|
<< theHasRefPoint << ", "
|
||||||
|
<< "SMESH.PointStruct( "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||||
}
|
}
|
||||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||||
extrusionAlongPath( theIDsOfElements,
|
extrusionAlongPath( theIDsOfElements,
|
||||||
@ -1961,24 +2069,18 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObje
|
|||||||
const SMESH::PointStruct & theRefPoint)
|
const SMESH::PointStruct & theRefPoint)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
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( "
|
TPythonDump() << "error = " << this << ".ExtrusionAlongPathObject( "
|
||||||
<< theObject << ", "
|
<< theObject << ", "
|
||||||
<< thePathMesh << ", "
|
<< thePathMesh << ", "
|
||||||
<< thePathShape << ", "
|
<< thePathShape << ", "
|
||||||
<< theNodeStart << ", "
|
<< theNodeStart << ", "
|
||||||
<< theHasAngles << ", "
|
<< theHasAngles << ", "
|
||||||
<< "rotAngles" << ", "
|
<< theAngles << ", "
|
||||||
<< theHasRefPoint << ", refPoint )";
|
<< theHasRefPoint << ", "
|
||||||
|
<< "SMESH.PointStruct( "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||||
}
|
}
|
||||||
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
SMESH::SMESH_MeshEditor::Extrusion_Error anError;
|
||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
@ -1995,6 +2097,96 @@ SMESH_MeshEditor_i::ExtrusionAlongPathObject(SMESH::SMESH_IDSource_ptr theObje
|
|||||||
return anError;
|
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
|
//function : ExtrusionAlongPathMakeGroups
|
||||||
@ -2023,16 +2215,6 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theI
|
|||||||
true,
|
true,
|
||||||
Error);
|
Error);
|
||||||
if ( !myPreviewMode ) {
|
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;
|
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
if(isDumpGroups) {
|
if(isDumpGroups) {
|
||||||
@ -2049,8 +2231,12 @@ SMESH_MeshEditor_i::ExtrusionAlongPathMakeGroups(const SMESH::long_array& theI
|
|||||||
<< thePathShape << ", "
|
<< thePathShape << ", "
|
||||||
<< theNodeStart << ", "
|
<< theNodeStart << ", "
|
||||||
<< theHasAngles << ", "
|
<< theHasAngles << ", "
|
||||||
<< "rotAngles" << ", "
|
<< theAngles << ", "
|
||||||
<< theHasRefPoint << ", refPoint )";
|
<< theHasRefPoint << ", "
|
||||||
|
<< "SMESH.PointStruct( "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.x : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.y : 0 ) << ", "
|
||||||
|
<< ( theHasRefPoint ? theRefPoint.z : 0 ) << " ) )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -2084,16 +2270,6 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
Error);
|
Error);
|
||||||
|
|
||||||
if ( !myPreviewMode ) {
|
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;
|
bool isDumpGroups = aGroups && aGroups->length() > 0;
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
if(isDumpGroups) {
|
if(isDumpGroups) {
|
||||||
@ -2110,8 +2286,124 @@ ExtrusionAlongPathObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
<< thePathShape << ", "
|
<< thePathShape << ", "
|
||||||
<< theNodeStart << ", "
|
<< theNodeStart << ", "
|
||||||
<< theHasAngles << ", "
|
<< theHasAngles << ", "
|
||||||
<< "rotAngles" << ", "
|
<< theAngles << ", "
|
||||||
<< theHasRefPoint << ", refPoint )";
|
<< 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;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -2285,12 +2577,11 @@ SMESH_MeshEditor_i::MirrorMakeGroups(const SMESH::long_array& theIDsO
|
|||||||
{
|
{
|
||||||
SMESH::ListOfGroups * aGroups = mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
|
SMESH::ListOfGroups * aGroups = mirror(theIDsOfElements, theMirror, theMirrorType, true, true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump()<<"axis = "<<theMirror;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".MirrorMakeGroups( "
|
aPythonDump << this << ".MirrorMakeGroups( "
|
||||||
<< theIDsOfElements << ", "
|
<< theIDsOfElements << ", "
|
||||||
<< "axis, "
|
<< theMirror << ", "
|
||||||
<< mirrorTypeName(theMirrorType) << " )";
|
<< mirrorTypeName(theMirrorType) << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
@ -2309,12 +2600,11 @@ SMESH_MeshEditor_i::MirrorObjectMakeGroups(SMESH::SMESH_IDSource_ptr t
|
|||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
||||||
SMESH::ListOfGroups * aGroups = mirror(anElementsId, theMirror, theMirrorType, true, true);
|
SMESH::ListOfGroups * aGroups = mirror(anElementsId, theMirror, theMirrorType, true, true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump()<<"axis = "<<theMirror;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".MirrorObjectMakeGroups( "
|
aPythonDump << this << ".MirrorObjectMakeGroups( "
|
||||||
<< theObject << ", "
|
<< theObject << ", "
|
||||||
<< "axis, "
|
<< theMirror << ", "
|
||||||
<< mirrorTypeName(theMirrorType) << " )";
|
<< mirrorTypeName(theMirrorType) << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
@ -2450,10 +2740,9 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements,
|
|||||||
CORBA::Boolean theCopy)
|
CORBA::Boolean theCopy)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "vector = " << theVector;
|
|
||||||
TPythonDump() << this << ".Translate( "
|
TPythonDump() << this << ".Translate( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", vector, "
|
<< theVector << ", "
|
||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
translate(theIDsOfElements,
|
translate(theIDsOfElements,
|
||||||
@ -2473,8 +2762,8 @@ void SMESH_MeshEditor_i::TranslateObject(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << this << ".TranslateObject( "
|
TPythonDump() << this << ".TranslateObject( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", vector, "
|
<< theVector << ", "
|
||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
SMESH::long_array_var anElementsId = theObject->GetIDs();
|
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);
|
SMESH::ListOfGroups * aGroups = translate(theIDsOfElements,theVector,true,true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "vector = " << theVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".TranslateMakeGroups( "
|
aPythonDump << this << ".TranslateMakeGroups( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", vector )";
|
<< theVector << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -2519,12 +2807,11 @@ SMESH_MeshEditor_i::TranslateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObjec
|
|||||||
|
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
|
|
||||||
TPythonDump() << "vector = " << theVector;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".TranslateObjectMakeGroups( "
|
aPythonDump << this << ".TranslateObjectMakeGroups( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", vector )";
|
<< theVector << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
@ -2660,10 +2947,9 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
|
|||||||
CORBA::Boolean theCopy)
|
CORBA::Boolean theCopy)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump() << this << ".Rotate( "
|
TPythonDump() << this << ".Rotate( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngle << ", "
|
<< theAngle << ", "
|
||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
@ -2685,10 +2971,9 @@ void SMESH_MeshEditor_i::RotateObject(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
CORBA::Boolean theCopy)
|
CORBA::Boolean theCopy)
|
||||||
{
|
{
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump() << this << ".RotateObject( "
|
TPythonDump() << this << ".RotateObject( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngle << ", "
|
<< theAngle << ", "
|
||||||
<< theCopy << " )";
|
<< theCopy << " )";
|
||||||
}
|
}
|
||||||
@ -2712,12 +2997,11 @@ SMESH_MeshEditor_i::RotateMakeGroups(const SMESH::long_array& theIDsOfElements,
|
|||||||
{
|
{
|
||||||
SMESH::ListOfGroups * aGroups = rotate(theIDsOfElements,theAxis,theAngle,true,true);
|
SMESH::ListOfGroups * aGroups = rotate(theIDsOfElements,theAxis,theAngle,true,true);
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".RotateMakeGroups( "
|
aPythonDump << this << ".RotateMakeGroups( "
|
||||||
<< theIDsOfElements
|
<< theIDsOfElements << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngle << " )";
|
<< theAngle << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
@ -2737,13 +3021,12 @@ SMESH_MeshEditor_i::RotateObjectMakeGroups(SMESH::SMESH_IDSource_ptr theObject,
|
|||||||
SMESH::ListOfGroups * aGroups = rotate(anElementsId,theAxis,theAngle,true,true);
|
SMESH::ListOfGroups * aGroups = rotate(anElementsId,theAxis,theAngle,true,true);
|
||||||
|
|
||||||
if ( !myPreviewMode ) {
|
if ( !myPreviewMode ) {
|
||||||
TPythonDump() << "axis = " << theAxis;
|
|
||||||
TPythonDump aPythonDump;
|
TPythonDump aPythonDump;
|
||||||
DumpGroupsList(aPythonDump,aGroups);
|
DumpGroupsList(aPythonDump,aGroups);
|
||||||
aPythonDump << this << ".RotateObjectMakeGroups( "
|
aPythonDump << this << ".RotateObjectMakeGroups( "
|
||||||
<< theObject
|
<< theObject << ", "
|
||||||
<< ", axis, "
|
<< theAxis << ", "
|
||||||
<< theAngle << " )";
|
<< theAngle << " )";
|
||||||
}
|
}
|
||||||
return aGroups;
|
return aGroups;
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,16 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
CORBA::Double AngleInRadians,
|
CORBA::Double AngleInRadians,
|
||||||
CORBA::Long NbOfSteps,
|
CORBA::Long NbOfSteps,
|
||||||
CORBA::Double Tolerance);
|
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,
|
void ExtrusionSweep(const SMESH::long_array & IDsOfElements,
|
||||||
const SMESH::DirStruct & StepVector,
|
const SMESH::DirStruct & StepVector,
|
||||||
@ -219,6 +229,24 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
const SMESH::double_array & Angles,
|
const SMESH::double_array & Angles,
|
||||||
CORBA::Boolean HasRefPoint,
|
CORBA::Boolean HasRefPoint,
|
||||||
const SMESH::PointStruct & RefPoint);
|
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,
|
SMESH::double_array* LinearAnglesVariation(SMESH::SMESH_Mesh_ptr PathMesh,
|
||||||
GEOM::GEOM_Object_ptr PathShape,
|
GEOM::GEOM_Object_ptr PathShape,
|
||||||
@ -257,6 +285,16 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
CORBA::Double AngleInRadians,
|
CORBA::Double AngleInRadians,
|
||||||
CORBA::Long NbOfSteps,
|
CORBA::Long NbOfSteps,
|
||||||
CORBA::Double Tolerance);
|
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,
|
SMESH::ListOfGroups* ExtrusionSweepMakeGroups(const SMESH::long_array& IDsOfElements,
|
||||||
const SMESH::DirStruct& StepVector,
|
const SMESH::DirStruct& StepVector,
|
||||||
CORBA::Long NbOfSteps);
|
CORBA::Long NbOfSteps);
|
||||||
@ -292,6 +330,24 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
CORBA::Boolean HasRefPoint,
|
CORBA::Boolean HasRefPoint,
|
||||||
const SMESH::PointStruct& RefPoint,
|
const SMESH::PointStruct& RefPoint,
|
||||||
SMESH::SMESH_MeshEditor::Extrusion_Error& Error);
|
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,
|
SMESH::ListOfGroups* MirrorMakeGroups(const SMESH::long_array& IDsOfElements,
|
||||||
const SMESH::AxisStruct& Mirror,
|
const SMESH::AxisStruct& Mirror,
|
||||||
SMESH::SMESH_MeshEditor::MirrorType MirrorType);
|
SMESH::SMESH_MeshEditor::MirrorType MirrorType);
|
||||||
@ -454,7 +510,8 @@ private: //!< private methods
|
|||||||
CORBA::Double AngleInRadians,
|
CORBA::Double AngleInRadians,
|
||||||
CORBA::Long NbOfSteps,
|
CORBA::Long NbOfSteps,
|
||||||
CORBA::Double Tolerance,
|
CORBA::Double Tolerance,
|
||||||
const bool MakeGroups);
|
const bool MakeGroups,
|
||||||
|
const SMDSAbs_ElementType ElementType=SMDSAbs_All);
|
||||||
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
|
SMESH::ListOfGroups* extrusionSweep(const SMESH::long_array & IDsOfElements,
|
||||||
const SMESH::DirStruct & StepVector,
|
const SMESH::DirStruct & StepVector,
|
||||||
CORBA::Long NbOfSteps,
|
CORBA::Long NbOfSteps,
|
||||||
@ -475,7 +532,8 @@ private: //!< private methods
|
|||||||
CORBA::Boolean HasRefPoint,
|
CORBA::Boolean HasRefPoint,
|
||||||
const SMESH::PointStruct & RefPoint,
|
const SMESH::PointStruct & RefPoint,
|
||||||
const bool MakeGroups,
|
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,
|
SMESH::ListOfGroups* mirror(const SMESH::long_array & IDsOfElements,
|
||||||
const SMESH::AxisStruct & Axis,
|
const SMESH::AxisStruct & Axis,
|
||||||
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
|
SMESH::SMESH_MeshEditor::MirrorType MirrorType,
|
||||||
|
@ -3112,3 +3112,50 @@ void SMESH_Mesh_i::checkGroupNames()
|
|||||||
aGrp->SetName( guiName );
|
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();
|
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_i*> _mapSubMesh_i; //NRI
|
||||||
std::map<int, ::SMESH_subMesh*> _mapSubMesh; //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_DistrTable.h"
|
||||||
#include "StdMeshersGUI_DistrPreview.h"
|
#include "StdMeshersGUI_DistrPreview.h"
|
||||||
|
|
||||||
|
#include <SMESHGUI.h>
|
||||||
#include <SMESHGUI_Utils.h>
|
#include <SMESHGUI_Utils.h>
|
||||||
#include <SMESHGUI_HypothesesUtils.h>
|
#include <SMESHGUI_HypothesesUtils.h>
|
||||||
#include <SMESHGUI_SpinBox.h>
|
#include <SMESHGUI_SpinBox.h>
|
||||||
@ -36,7 +37,7 @@
|
|||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SalomeApp_Tools.h>
|
#include <SalomeApp_Tools.h>
|
||||||
#include <QtxIntSpinBox.h>
|
#include <SalomeApp_IntSpinBox.h>
|
||||||
#include <QtxComboBox.h>
|
#include <QtxComboBox.h>
|
||||||
|
|
||||||
// Qt includes
|
// 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;
|
NbSegmentsHypothesisData data_old, data_new;
|
||||||
readParamsFromHypo( data_old );
|
readParamsFromHypo( data_old );
|
||||||
readParamsFromWidgets( data_new );
|
readParamsFromWidgets( data_new );
|
||||||
bool res = storeParamsToHypo( data_new );
|
bool res = storeParamsToHypo( data_new );
|
||||||
storeParamsToHypo( data_old );
|
storeParamsToHypo( data_old );
|
||||||
|
res = myNbSeg->isValid( msg, true ) && res;
|
||||||
|
res = myScale->isValid( msg, true ) && res;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +127,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame()
|
|||||||
|
|
||||||
// 1) number of segments
|
// 1) number of segments
|
||||||
myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 );
|
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->setMinimum( 1 );
|
||||||
myNbSeg->setMaximum( 9999 );
|
myNbSeg->setMaximum( 9999 );
|
||||||
myGroupLayout->addWidget( myNbSeg, row, 1 );
|
myGroupLayout->addWidget( myNbSeg, row, 1 );
|
||||||
@ -206,9 +211,16 @@ void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const
|
|||||||
|
|
||||||
if( myName )
|
if( myName )
|
||||||
myName->setText( data.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 );
|
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 );
|
myConv->button( data.myConv )->setChecked( true );
|
||||||
myTable->setFuncMinValue(myConv->checkedId()==0 ? -1E20 : 0);
|
myTable->setFuncMinValue(myConv->checkedId()==0 ? -1E20 : 0);
|
||||||
myTable->setData( data.myTable );
|
myTable->setData( data.myTable );
|
||||||
@ -223,7 +235,7 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
|||||||
NbSegmentsHypothesisData data;
|
NbSegmentsHypothesisData data;
|
||||||
readParamsFromWidgets( data );
|
readParamsFromWidgets( data );
|
||||||
storeParamsToHypo( data );
|
storeParamsToHypo( data );
|
||||||
|
|
||||||
QString valStr = QString::number( data.myNbSeg ) += "; ";
|
QString valStr = QString::number( data.myNbSeg ) += "; ";
|
||||||
|
|
||||||
enum DistrType
|
enum DistrType
|
||||||
@ -238,8 +250,8 @@ QString StdMeshersGUI_NbSegmentsCreator::storeParams() const
|
|||||||
case Regular :
|
case Regular :
|
||||||
valStr += tr("SMESH_DISTR_REGULAR");
|
valStr += tr("SMESH_DISTR_REGULAR");
|
||||||
break;
|
break;
|
||||||
case Scale :
|
case Scale :
|
||||||
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );
|
valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
|
||||||
break;
|
break;
|
||||||
case TabFunc : {
|
case TabFunc : {
|
||||||
//valStr += tr("SMESH_TAB_FUNC");
|
//valStr += tr("SMESH_TAB_FUNC");
|
||||||
@ -275,9 +287,21 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromHypo( NbSegmentsHypothesisDa
|
|||||||
h_data.myName = hypName();
|
h_data.myName = hypName();
|
||||||
|
|
||||||
h_data.myNbSeg = (int) h->GetNumberOfSegments();
|
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();
|
int distr = (int) h->GetDistrType();
|
||||||
h_data.myDistrType = distr;
|
h_data.myDistrType = distr;
|
||||||
h_data.myScale = distr==1 ? h->GetScaleFactor() : 1.0;
|
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 )
|
if( distr==2 )
|
||||||
{
|
{
|
||||||
SMESH::double_array* a = h->GetTableFunction();
|
SMESH::double_array* a = h->GetTableFunction();
|
||||||
@ -310,13 +334,17 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
|||||||
if( isCreation() )
|
if( isCreation() )
|
||||||
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
|
SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() );
|
||||||
|
|
||||||
|
QStringList aVariablesList;
|
||||||
|
aVariablesList.append(h_data.myNbSegVarName);
|
||||||
|
|
||||||
h->SetNumberOfSegments( h_data.myNbSeg );
|
h->SetNumberOfSegments( h_data.myNbSeg );
|
||||||
int distr = h_data.myDistrType;
|
int distr = h_data.myDistrType;
|
||||||
h->SetDistrType( distr );
|
h->SetDistrType( distr );
|
||||||
|
|
||||||
if( distr==1 )
|
if( distr==1 ) {
|
||||||
h->SetScaleFactor( h_data.myScale );
|
h->SetScaleFactor( h_data.myScale );
|
||||||
|
aVariablesList.append(h_data.myScaleVarName);
|
||||||
|
}
|
||||||
if( distr==2 || distr==3 )
|
if( distr==2 || distr==3 )
|
||||||
h->SetConversionMode( h_data.myConv );
|
h->SetConversionMode( h_data.myConv );
|
||||||
|
|
||||||
@ -328,6 +356,8 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe
|
|||||||
//setting of function must follow after setConversionMode, because otherwise
|
//setting of function must follow after setConversionMode, because otherwise
|
||||||
//the function will be checked with old conversion mode, so that it may occurs
|
//the function will be checked with old conversion mode, so that it may occurs
|
||||||
//unexpected errors for user
|
//unexpected errors for user
|
||||||
|
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
catch(const SALOME::SALOME_Exception& ex)
|
catch(const SALOME::SALOME_Exception& ex)
|
||||||
{
|
{
|
||||||
@ -341,6 +371,8 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesi
|
|||||||
{
|
{
|
||||||
h_data.myName = myName ? myName->text() : "";
|
h_data.myName = myName ? myName->text() : "";
|
||||||
h_data.myNbSeg = myNbSeg->value();
|
h_data.myNbSeg = myNbSeg->value();
|
||||||
|
h_data.myNbSegVarName = myNbSeg->text();
|
||||||
|
h_data.myScaleVarName = myScale->text();
|
||||||
h_data.myDistrType = myDistr->currentIndex();
|
h_data.myDistrType = myDistr->currentIndex();
|
||||||
h_data.myConv = myConv->checkedId();
|
h_data.myConv = myConv->checkedId();
|
||||||
h_data.myScale = myScale->value();
|
h_data.myScale = myScale->value();
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||||
|
|
||||||
class QtxIntSpinBox;
|
class SalomeApp_IntSpinBox;
|
||||||
class QtxComboBox;
|
class QtxComboBox;
|
||||||
class SMESHGUI_SpinBox;
|
class SMESHGUI_SpinBox;
|
||||||
class StdMeshersGUI_DistrTableFrame;
|
class StdMeshersGUI_DistrTableFrame;
|
||||||
@ -51,6 +51,7 @@ typedef struct
|
|||||||
double myScale;
|
double myScale;
|
||||||
SMESH::double_array myTable;
|
SMESH::double_array myTable;
|
||||||
QString myName, myExpr;
|
QString myName, myExpr;
|
||||||
|
QString myNbSegVarName, myScaleVarName;
|
||||||
|
|
||||||
} NbSegmentsHypothesisData;
|
} NbSegmentsHypothesisData;
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ public:
|
|||||||
StdMeshersGUI_NbSegmentsCreator();
|
StdMeshersGUI_NbSegmentsCreator();
|
||||||
virtual ~StdMeshersGUI_NbSegmentsCreator();
|
virtual ~StdMeshersGUI_NbSegmentsCreator();
|
||||||
|
|
||||||
virtual bool checkParams() const;
|
virtual bool checkParams( QString& ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QFrame* buildFrame();
|
virtual QFrame* buildFrame();
|
||||||
@ -78,7 +79,7 @@ private:
|
|||||||
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
|
bool storeParamsToHypo( const NbSegmentsHypothesisData& ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtxIntSpinBox* myNbSeg;
|
SalomeApp_IntSpinBox* myNbSeg;
|
||||||
QtxComboBox* myDistr;
|
QtxComboBox* myDistr;
|
||||||
SMESHGUI_SpinBox* myScale;
|
SMESHGUI_SpinBox* myScale;
|
||||||
StdMeshersGUI_DistrTableFrame* myTable;
|
StdMeshersGUI_DistrTableFrame* myTable;
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <SMESH_NumberFilter.hxx>
|
#include <SMESH_NumberFilter.hxx>
|
||||||
#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
|
#include <StdMeshersGUI_ObjectReferenceParamWdg.h>
|
||||||
#include <StdMeshersGUI_LayerDistributionParamWdg.h>
|
#include <StdMeshersGUI_LayerDistributionParamWdg.h>
|
||||||
|
#include <SALOMEDSClient_Study.hxx>
|
||||||
|
|
||||||
// SALOME GUI includes
|
// SALOME GUI includes
|
||||||
#include <SUIT_ResourceMgr.h>
|
#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
|
// check if object reference parameter is set, as it has no default value
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if ( hypType().startsWith("ProjectionSource" ))
|
if ( hypType().startsWith("ProjectionSource" ))
|
||||||
@ -399,6 +403,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString valueStr = stdParamValues( params );
|
QString valueStr = stdParamValues( params );
|
||||||
|
QStringList aVariablesList = getVariablesFromDlg();
|
||||||
|
|
||||||
if( res && !params.isEmpty() )
|
if( res && !params.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -408,7 +413,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_LocalLength::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetLength( params[0].myValue.toDouble() );
|
h->SetLength( params[0].myValue.toDouble() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
h->SetPrecision( params[1].myValue.toDouble() );
|
h->SetPrecision( params[1].myValue.toDouble() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxLength" )
|
else if( hypType()=="MaxLength" )
|
||||||
{
|
{
|
||||||
@ -429,6 +436,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetLength( params[0].myValue.toDouble() );
|
h->SetLength( params[0].myValue.toDouble() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="Arithmetic1D" )
|
else if( hypType()=="Arithmetic1D" )
|
||||||
{
|
{
|
||||||
@ -436,13 +444,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetLength( params[0].myValue.toDouble(), true );
|
h->SetLength( params[0].myValue.toDouble(), true );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
h->SetLength( params[1].myValue.toDouble(), false );
|
h->SetLength( params[1].myValue.toDouble(), false );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxElementArea" )
|
else if( hypType()=="MaxElementArea" )
|
||||||
{
|
{
|
||||||
StdMeshers::StdMeshers_MaxElementArea_var h =
|
StdMeshers::StdMeshers_MaxElementArea_var h =
|
||||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_MaxElementArea::_narrow( hypothesis() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
h->SetMaxElementArea( params[0].myValue.toDouble() );
|
h->SetMaxElementArea( params[0].myValue.toDouble() );
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxElementVolume" )
|
else if( hypType()=="MaxElementVolume" )
|
||||||
@ -451,6 +461,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetMaxElementVolume( params[0].myValue.toDouble() );
|
h->SetMaxElementVolume( params[0].myValue.toDouble() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="StartEndLength" )
|
else if( hypType()=="StartEndLength" )
|
||||||
{
|
{
|
||||||
@ -458,13 +469,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_StartEndLength::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetLength( params[0].myValue.toDouble(), true );
|
h->SetLength( params[0].myValue.toDouble(), true );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
h->SetLength( params[1].myValue.toDouble(), false );
|
h->SetLength( params[1].myValue.toDouble(), false );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="Deflection1D" )
|
else if( hypType()=="Deflection1D" )
|
||||||
{
|
{
|
||||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_Deflection1D::_narrow( hypothesis() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
h->SetDeflection( params[0].myValue.toDouble() );
|
h->SetDeflection( params[0].myValue.toDouble() );
|
||||||
}
|
}
|
||||||
else if( hypType()=="AutomaticLength" )
|
else if( hypType()=="AutomaticLength" )
|
||||||
@ -480,6 +493,7 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hypothesis() );
|
||||||
|
|
||||||
h->SetNumberOfLayers( params[0].myValue.toInt() );
|
h->SetNumberOfLayers( params[0].myValue.toInt() );
|
||||||
|
h->SetParameters(SMESHGUI::JoinObjectParameters(aVariablesList));
|
||||||
}
|
}
|
||||||
else if( hypType()=="LayerDistribution" )
|
else if( hypType()=="LayerDistribution" )
|
||||||
{
|
{
|
||||||
@ -487,8 +501,10 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
|||||||
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
|
StdMeshers::StdMeshers_LayerDistribution::_narrow( hypothesis() );
|
||||||
StdMeshersGUI_LayerDistributionParamWdg* w =
|
StdMeshersGUI_LayerDistributionParamWdg* w =
|
||||||
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
|
widget< StdMeshersGUI_LayerDistributionParamWdg >( 0 );
|
||||||
|
|
||||||
h->SetLayerDistribution( w->GetHypothesis() );
|
h->SetLayerDistribution( w->GetHypothesis() );
|
||||||
|
h->SetParameters(w->GetHypothesis()->GetParameters());
|
||||||
|
w->GetHypothesis()->ClearParameters();
|
||||||
}
|
}
|
||||||
else if( hypType()=="ProjectionSource1D" )
|
else if( hypType()=="ProjectionSource1D" )
|
||||||
{
|
{
|
||||||
@ -558,20 +574,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
p.append( item );
|
p.append( item );
|
||||||
customWidgets()->append(0);
|
customWidgets()->append(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
|
SMESH::SMESH_Hypothesis_var hyp = initParamsHypothesis();
|
||||||
|
SMESH::ListOfParameters_var aParameters = hyp->GetLastParameters();
|
||||||
|
|
||||||
if( hypType()=="LocalLength" )
|
if( hypType()=="LocalLength" )
|
||||||
{
|
{
|
||||||
StdMeshers::StdMeshers_LocalLength_var h =
|
StdMeshers::StdMeshers_LocalLength_var h =
|
||||||
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
|
StdMeshers::StdMeshers_LocalLength::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||||
item.myValue = h->GetLength();
|
if(!initVariableName(aParameters,item,0))
|
||||||
p.append( item );
|
item.myValue = h->GetLength();
|
||||||
|
p.append( item );
|
||||||
|
|
||||||
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
|
item.myName = tr("SMESH_LOCAL_LENGTH_PRECISION");
|
||||||
item.myValue = h->GetPrecision();
|
if(!initVariableName(aParameters,item,1))
|
||||||
|
item.myValue = h->GetPrecision();
|
||||||
p.append( item );
|
p.append( item );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxLength" )
|
else if( hypType()=="MaxLength" )
|
||||||
{
|
{
|
||||||
@ -612,7 +633,9 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
|
StdMeshers::StdMeshers_SegmentLengthAroundVertex::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
item.myName = tr("SMESH_LOCAL_LENGTH_PARAM");
|
||||||
item.myValue = h->GetLength();
|
if(!initVariableName(aParameters,item,0))
|
||||||
|
item.myValue = h->GetLength();
|
||||||
|
|
||||||
p.append( item );
|
p.append( item );
|
||||||
}
|
}
|
||||||
else if( hypType()=="Arithmetic1D" )
|
else if( hypType()=="Arithmetic1D" )
|
||||||
@ -621,10 +644,13 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
|
StdMeshers::StdMeshers_Arithmetic1D::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
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 );
|
p.append( item );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
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 );
|
p.append( item );
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxElementArea" )
|
else if( hypType()=="MaxElementArea" )
|
||||||
@ -633,8 +659,10 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
|
StdMeshers::StdMeshers_MaxElementArea::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
|
item.myName = tr( "SMESH_MAX_ELEMENT_AREA_PARAM" );
|
||||||
item.myValue = h->GetMaxElementArea();
|
if(!initVariableName(aParameters,item,0))
|
||||||
|
item.myValue = h->GetMaxElementArea();
|
||||||
p.append( item );
|
p.append( item );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( hypType()=="MaxElementVolume" )
|
else if( hypType()=="MaxElementVolume" )
|
||||||
{
|
{
|
||||||
@ -642,7 +670,8 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
|
StdMeshers::StdMeshers_MaxElementVolume::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
|
item.myName = tr( "SMESH_MAX_ELEMENT_VOLUME_PARAM" );
|
||||||
item.myValue = h->GetMaxElementVolume();
|
if(!initVariableName(aParameters,item,0))
|
||||||
|
item.myValue = h->GetMaxElementVolume();
|
||||||
p.append( item );
|
p.append( item );
|
||||||
}
|
}
|
||||||
else if( hypType()=="StartEndLength" )
|
else if( hypType()=="StartEndLength" )
|
||||||
@ -651,19 +680,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
|
StdMeshers::StdMeshers_StartEndLength::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
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 );
|
p.append( item );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_END_LENGTH_PARAM" );
|
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 );
|
p.append( item );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( hypType()=="Deflection1D" )
|
else if( hypType()=="Deflection1D" )
|
||||||
{
|
{
|
||||||
StdMeshers::StdMeshers_Deflection1D_var h =
|
StdMeshers::StdMeshers_Deflection1D_var h =
|
||||||
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
|
StdMeshers::StdMeshers_Deflection1D::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
|
item.myName = tr( "SMESH_DEFLECTION1D_PARAM" );
|
||||||
item.myValue = h->GetDeflection();
|
if(!initVariableName(aParameters,item,0))
|
||||||
|
item.myValue = h->GetDeflection();
|
||||||
p.append( item );
|
p.append( item );
|
||||||
}
|
}
|
||||||
else if( hypType()=="AutomaticLength" )
|
else if( hypType()=="AutomaticLength" )
|
||||||
@ -683,15 +718,25 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
|||||||
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
|
StdMeshers::StdMeshers_NumberOfLayers::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_NUMBER_OF_LAYERS" );
|
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 );
|
p.append( item );
|
||||||
}
|
}
|
||||||
else if( hypType()=="LayerDistribution" )
|
else if( hypType()=="LayerDistribution" )
|
||||||
{
|
{
|
||||||
StdMeshers::StdMeshers_LayerDistribution_var h =
|
StdMeshers::StdMeshers_LayerDistribution_var h =
|
||||||
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
|
StdMeshers::StdMeshers_LayerDistribution::_narrow( hyp );
|
||||||
|
|
||||||
item.myName = tr( "SMESH_LAYERS_DISTRIBUTION" ); p.append( item );
|
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
|
customWidgets()->append
|
||||||
( new StdMeshersGUI_LayerDistributionParamWdg( h->GetLayerDistribution(), hypName(), dlg()));
|
( 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
|
// SMESH includes
|
||||||
#include "SMESH_StdMeshersGUI.hxx"
|
#include "SMESH_StdMeshersGUI.hxx"
|
||||||
|
|
||||||
#include <SMESHGUI_Hypotheses.h>
|
#include <SMESHGUI_Hypotheses.h>
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Class for creation of standard hypotheses
|
* \brief Class for creation of standard hypotheses
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,7 @@ public:
|
|||||||
StdMeshersGUI_StdHypothesisCreator( const QString& );
|
StdMeshersGUI_StdHypothesisCreator( const QString& );
|
||||||
virtual ~StdMeshersGUI_StdHypothesisCreator();
|
virtual ~StdMeshersGUI_StdHypothesisCreator();
|
||||||
|
|
||||||
virtual bool checkParams() const;
|
virtual bool checkParams( QString& ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QFrame* buildFrame ();
|
virtual QFrame* buildFrame ();
|
||||||
@ -59,6 +59,7 @@ protected:
|
|||||||
virtual QWidget* getWidgetForParam( int paramIndex ) const;
|
virtual QWidget* getWidgetForParam( int paramIndex ) const;
|
||||||
virtual ListOfWidgets* customWidgets() const;
|
virtual ListOfWidgets* customWidgets() const;
|
||||||
virtual void onReject();
|
virtual void onReject();
|
||||||
|
virtual bool initVariableName(SMESH::ListOfParameters_var theParameters, StdParam& theParams, int order) const;
|
||||||
|
|
||||||
virtual void valueChanged( QWidget* );
|
virtual void valueChanged( QWidget* );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user