mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 23:00:33 +05:00
Dump Python extension
This commit is contained in:
parent
246b043ec9
commit
f7a07e2eda
@ -478,6 +478,9 @@ 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()) {
|
||||||
@ -559,16 +562,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);
|
|
||||||
if (bOk)
|
|
||||||
anAngles[ j++ ] = angle*PI/180;
|
anAngles[ j++ ] = angle*PI/180;
|
||||||
|
aParameters << AnglesList->item(i)->text();
|
||||||
}
|
}
|
||||||
anAngles->length(j);
|
anAngles->length(j);
|
||||||
}
|
}
|
||||||
@ -581,6 +585,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();
|
||||||
@ -600,6 +608,9 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
|
|||||||
AnglesGrp->isChecked(), anAngles,
|
AnglesGrp->isChecked(), anAngles,
|
||||||
BasePointGrp->isChecked(), aBasePoint);
|
BasePointGrp->isChecked(), aBasePoint);
|
||||||
|
|
||||||
|
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK )
|
||||||
|
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||||
|
|
||||||
//wc.stop();
|
//wc.stop();
|
||||||
wc.suspend();
|
wc.suspend();
|
||||||
switch (retVal) {
|
switch (retVal) {
|
||||||
@ -1140,7 +1151,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -1151,7 +1173,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -1199,3 +1226,45 @@ void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e )
|
|||||||
ClickOnHelp();
|
ClickOnHelp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// 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 );
|
||||||
|
}
|
||||||
|
@ -78,6 +78,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 */
|
||||||
@ -94,6 +98,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;
|
||||||
|
@ -49,6 +49,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>
|
||||||
@ -70,7 +71,6 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
// IDL includes
|
// IDL includes
|
||||||
@ -208,7 +208,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);
|
||||||
@ -337,6 +337,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();
|
||||||
}
|
}
|
||||||
@ -444,10 +446,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);
|
||||||
@ -474,6 +479,17 @@ 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();
|
||||||
@ -484,6 +500,8 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
anAngle, aNbSteps, aTolerance);
|
anAngle, aNbSteps, aTolerance);
|
||||||
else
|
else
|
||||||
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
|
aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance);
|
||||||
|
|
||||||
|
myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) );
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,6 +512,8 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
ConstructorsClicked(GetConstructorId());
|
ConstructorsClicked(GetConstructorId());
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -502,7 +522,7 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_RevolutionDlg::ClickOnOk()
|
void SMESHGUI_RevolutionDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
ClickOnApply();
|
if( ClickOnApply() )
|
||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,6 +566,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 :
|
||||||
@ -1051,3 +1084,32 @@ void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
|
|||||||
mySimulation->SetVisibility(false);
|
mySimulation->SetVisibility(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
@ -43,7 +43,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;
|
||||||
@ -75,6 +75,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 */
|
||||||
@ -132,7 +134,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;
|
||||||
|
|
||||||
@ -142,13 +144,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();
|
||||||
|
@ -439,13 +439,14 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
|
|||||||
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
aParameters << SpinBox1_1->text();
|
aParameters << SpinBox1_1->text();
|
||||||
aParameters << SpinBox1_2->text();
|
if (GetConstructorId() == 0)
|
||||||
aParameters << SpinBox1_3->text();
|
|
||||||
if (GetConstructorId() == 0) {
|
|
||||||
aParameters << SpinBox2_1->text();
|
aParameters << SpinBox2_1->text();
|
||||||
|
aParameters << SpinBox1_2->text();
|
||||||
|
if (GetConstructorId() == 0)
|
||||||
aParameters << SpinBox2_2->text();
|
aParameters << SpinBox2_2->text();
|
||||||
|
aParameters << SpinBox1_3->text();
|
||||||
|
if (GetConstructorId() == 0)
|
||||||
aParameters << SpinBox2_3->text();
|
aParameters << SpinBox2_3->text();
|
||||||
}
|
|
||||||
|
|
||||||
int actionButton = ActionGroup->checkedId();
|
int actionButton = ActionGroup->checkedId();
|
||||||
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
|
||||||
|
@ -899,8 +899,8 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
|
|||||||
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
|
"BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
|
||||||
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
|
"ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
|
||||||
"RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
|
"RotationSweep","RotationSweepObject","ExtrusionSweep","AdvancedExtrusion",
|
||||||
"ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","Mirror",
|
"ExtrusionSweepObject","ExtrusionSweepObject1D","ExtrusionSweepObject2D","ExtrusionAlongPath",
|
||||||
"MirrorObject","Translate","TranslateObject","Rotate","RotateObject",
|
"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",
|
||||||
|
@ -1401,10 +1401,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 << " )";
|
||||||
@ -1436,12 +1435,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 << " )";
|
||||||
@ -1912,24 +1910,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,
|
||||||
@ -2023,16 +2015,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 +2031,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;
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
static int MYDEBUG = 1;
|
static int MYDEBUG = 0;
|
||||||
#else
|
#else
|
||||||
static int MYDEBUG = 1;
|
static int MYDEBUG = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -242,7 +242,7 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(it != _objectMap.end() && !aMethod.IsEmpty()) {
|
if(it != _objectMap.end()) {
|
||||||
ObjectStates *aStates = (*it).second;
|
ObjectStates *aStates = (*it).second;
|
||||||
// Case for LocalLength hypothesis
|
// Case for LocalLength hypothesis
|
||||||
if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
|
if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) {
|
||||||
@ -355,11 +355,36 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
|
else if(aCurrentStateSize == 6) { // translation by x1, x2, y1, y2, z1, z2
|
||||||
// TODO
|
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) {
|
if(isVariableFound) {
|
||||||
aCmd->SetArg(anArgIndex - 1, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".PointStructStr");
|
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");
|
aCmd->SetArg(anArgIndex - 2, TCollection_AsciiString(SMESH_2smeshpy::SmeshpyName())+".DirStructStr");
|
||||||
}
|
}
|
||||||
aStates->IncrementState();
|
aStates->IncrementState();
|
||||||
@ -367,9 +392,10 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
else if(aMethod.IsEqual("Rotate") ||
|
else if(aMethod.IsEqual("Rotate") ||
|
||||||
aMethod.IsEqual("RotateMakeGroups") ||
|
aMethod.IsEqual("RotateMakeGroups") ||
|
||||||
aMethod.IsEqual("RotateMakeMesh") ||
|
aMethod.IsEqual("RotateMakeMesh") ||
|
||||||
|
aMethod.IsEqual("RotationSweep") ||
|
||||||
|
aMethod.IsEqual("RotationSweepMakeGroups") ||
|
||||||
aMethod.IsEqual("Mirror") ||
|
aMethod.IsEqual("Mirror") ||
|
||||||
aMethod.IsEqual("MirrorMakeGroups") ||
|
aMethod.IsEqual("MirrorMakeGroups")) {
|
||||||
aMethod.IsEqual("MirrorMakeMesh")) {
|
|
||||||
bool isSubstitute = false;
|
bool isSubstitute = false;
|
||||||
int anArgIndex = 0;
|
int anArgIndex = 0;
|
||||||
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
for(int i = 1, n = aCmd->GetNbArgs(); i <= n; i++) {
|
||||||
@ -381,7 +407,7 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
if(anArgIndex > 0) {
|
if(anArgIndex > 0) {
|
||||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||||
if(!aCurrentState.at(j).IsEmpty()) {
|
if(!aCurrentState.at(j).IsEmpty()) {
|
||||||
if(j < 6) // from 0 to 5 - axis struct, 6 - angle
|
if(j < 6) // 0-5 - axis struct, 6 - angle (rotation & sweep), 7-8 - nbSteps and tolerance (sweep)
|
||||||
isSubstitute = true;
|
isSubstitute = true;
|
||||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||||
}
|
}
|
||||||
@ -419,7 +445,7 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
if(anArgIndex > 0) {
|
if(anArgIndex > 0) {
|
||||||
for(int j = 0; j < aCurrentStateSize; j++) {
|
for(int j = 0; j < aCurrentStateSize; j++) {
|
||||||
if(!aCurrentState.at(j).IsEmpty()) {
|
if(!aCurrentState.at(j).IsEmpty()) {
|
||||||
if(j < 3) // from 0 to 2 - dir struct, 3 - number of steps
|
if(j < 3) // 0-2 - dir struct, 3 - number of steps
|
||||||
isSubstitute = true;
|
isSubstitute = true;
|
||||||
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
aCmd->SetArg(anArgIndex+j, aCurrentState.at(j));
|
||||||
}
|
}
|
||||||
@ -431,6 +457,38 @@ void SMESH_NoteBook::ReplaceVariables()
|
|||||||
}
|
}
|
||||||
aStates->IncrementState();
|
aStates->IncrementState();
|
||||||
}
|
}
|
||||||
|
else if(aMethod.IsEqual("ExtrusionAlongPath") ||
|
||||||
|
aMethod.IsEqual("ExtrusionAlongPathMakeGroups") ||
|
||||||
|
/* workaround for a bug in the command parsing algorithm */
|
||||||
|
aCmd->GetString().Search("ExtrusionAlongPathMakeGroups") != -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") ||
|
else if(aMethod.IsEqual("TriToQuad") ||
|
||||||
aMethod.IsEqual("Concatenate") ||
|
aMethod.IsEqual("Concatenate") ||
|
||||||
aMethod.IsEqual("ConcatenateWithGroups")) {
|
aMethod.IsEqual("ConcatenateWithGroups")) {
|
||||||
@ -606,3 +664,35 @@ TCollection_AsciiString SMESH_NoteBook::GetResultScript() const
|
|||||||
aResult+=_commands[i]->GetString()+"\n";
|
aResult+=_commands[i]->GetString()+"\n";
|
||||||
return aResult;
|
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;
|
||||||
|
}
|
||||||
|
@ -94,6 +94,8 @@ private:
|
|||||||
void InitObjectMap();
|
void InitObjectMap();
|
||||||
void ProcessLayerDistribution();
|
void ProcessLayerDistribution();
|
||||||
|
|
||||||
|
bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
TVariablesMap _objectMap;
|
TVariablesMap _objectMap;
|
||||||
|
@ -155,6 +155,11 @@ DefaultSize, DefaultGeom, Custom = 0,0,1
|
|||||||
|
|
||||||
PrecisionConfusion = 1e-07
|
PrecisionConfusion = 1e-07
|
||||||
|
|
||||||
|
## Converts an angle from degrees to radians
|
||||||
|
def DegreesToRadians(AngleInDegrees):
|
||||||
|
from math import pi
|
||||||
|
return AngleInDegrees * pi / 180.0
|
||||||
|
|
||||||
# Salome notebook variable separator
|
# Salome notebook variable separator
|
||||||
variable_separator = ":"
|
variable_separator = ":"
|
||||||
|
|
||||||
@ -185,6 +190,54 @@ class PointStructStr:
|
|||||||
else:
|
else:
|
||||||
self.z = zStr
|
self.z = zStr
|
||||||
|
|
||||||
|
# Parametrized substitute for PointStruct (with 6 parameters)
|
||||||
|
class PointStructStr6:
|
||||||
|
|
||||||
|
x1 = 0
|
||||||
|
y1 = 0
|
||||||
|
z1 = 0
|
||||||
|
x2 = 0
|
||||||
|
y2 = 0
|
||||||
|
z2 = 0
|
||||||
|
xStr1 = ""
|
||||||
|
yStr1 = ""
|
||||||
|
zStr1 = ""
|
||||||
|
xStr2 = ""
|
||||||
|
yStr2 = ""
|
||||||
|
zStr2 = ""
|
||||||
|
|
||||||
|
def __init__(self, x1Str, x2Str, y1Str, y2Str, z1Str, z2Str):
|
||||||
|
self.x1Str = x1Str
|
||||||
|
self.x2Str = x2Str
|
||||||
|
self.y1Str = y1Str
|
||||||
|
self.y2Str = y2Str
|
||||||
|
self.z1Str = z1Str
|
||||||
|
self.z2Str = z2Str
|
||||||
|
if isinstance(x1Str, str) and notebook.isVariable(x1Str):
|
||||||
|
self.x1 = notebook.get(x1Str)
|
||||||
|
else:
|
||||||
|
self.x1 = x1Str
|
||||||
|
if isinstance(x2Str, str) and notebook.isVariable(x2Str):
|
||||||
|
self.x2 = notebook.get(x2Str)
|
||||||
|
else:
|
||||||
|
self.x2 = x2Str
|
||||||
|
if isinstance(y1Str, str) and notebook.isVariable(y1Str):
|
||||||
|
self.y1 = notebook.get(y1Str)
|
||||||
|
else:
|
||||||
|
self.y1 = y1Str
|
||||||
|
if isinstance(y2Str, str) and notebook.isVariable(y2Str):
|
||||||
|
self.y2 = notebook.get(y2Str)
|
||||||
|
else:
|
||||||
|
self.y2 = y2Str
|
||||||
|
if isinstance(z1Str, str) and notebook.isVariable(z1Str):
|
||||||
|
self.z1 = notebook.get(z1Str)
|
||||||
|
else:
|
||||||
|
self.z1 = z1Str
|
||||||
|
if isinstance(z2Str, str) and notebook.isVariable(z2Str):
|
||||||
|
self.z2 = notebook.get(z2Str)
|
||||||
|
else:
|
||||||
|
self.z2 = z2Str
|
||||||
|
|
||||||
# Parametrized substitute for AxisStruct
|
# Parametrized substitute for AxisStruct
|
||||||
class AxisStructStr:
|
class AxisStructStr:
|
||||||
|
|
||||||
@ -252,6 +305,12 @@ def ParseDirStruct(Dir):
|
|||||||
Parameters = "::"
|
Parameters = "::"
|
||||||
if isinstance(Dir, DirStructStr):
|
if isinstance(Dir, DirStructStr):
|
||||||
pntStr = Dir.pointStruct
|
pntStr = Dir.pointStruct
|
||||||
|
if isinstance(pntStr, PointStructStr6):
|
||||||
|
Parameters = str(pntStr.x1Str) + ":" + str(pntStr.x2Str) + ":"
|
||||||
|
Parameters += str(pntStr.y1Str) + ":" + str(pntStr.y2Str) + ":"
|
||||||
|
Parameters += str(pntStr.z1Str) + ":" + str(pntStr.z2Str)
|
||||||
|
Point = PointStruct(pntStr.x2 - pntStr.x1, pntStr.y2 - pntStr.y1, pntStr.z2 - pntStr.z1)
|
||||||
|
else:
|
||||||
Parameters = str(pntStr.xStr) + ":" + str(pntStr.yStr) + ":" + str(pntStr.zStr)
|
Parameters = str(pntStr.xStr) + ":" + str(pntStr.yStr) + ":" + str(pntStr.zStr)
|
||||||
Point = PointStruct(pntStr.x, pntStr.y, pntStr.z)
|
Point = PointStruct(pntStr.x, pntStr.y, pntStr.z)
|
||||||
Dir = DirStruct(Point)
|
Dir = DirStruct(Point)
|
||||||
@ -266,6 +325,24 @@ def ParseAxisStruct(Axis):
|
|||||||
Axis = AxisStruct(Axis.x, Axis.y, Axis.z, Axis.dx, Axis.dy, Axis.dz)
|
Axis = AxisStruct(Axis.x, Axis.y, Axis.z, Axis.dx, Axis.dy, Axis.dz)
|
||||||
return Axis, Parameters
|
return Axis, Parameters
|
||||||
|
|
||||||
|
## Return list of variable values from salome notebook
|
||||||
|
def ParseAngles(list):
|
||||||
|
Result = []
|
||||||
|
Parameters = ""
|
||||||
|
for parameter in list:
|
||||||
|
if isinstance(parameter,str) and notebook.isVariable(parameter):
|
||||||
|
Result.append(DegreesToRadians(notebook.get(parameter)))
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
Result.append(parameter)
|
||||||
|
pass
|
||||||
|
|
||||||
|
Parameters = Parameters + str(parameter)
|
||||||
|
Parameters = Parameters + ":"
|
||||||
|
pass
|
||||||
|
Parameters = Parameters[:len(Parameters)-1]
|
||||||
|
return Result, Parameters
|
||||||
|
|
||||||
def IsEqual(val1, val2, tol=PrecisionConfusion):
|
def IsEqual(val1, val2, tol=PrecisionConfusion):
|
||||||
if abs(val1 - val2) < tol:
|
if abs(val1 - val2) < tol:
|
||||||
return True
|
return True
|
||||||
@ -330,11 +407,6 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
|
|||||||
print hypName, "was not assigned to",geomName,":", reason
|
print hypName, "was not assigned to",geomName,":", reason
|
||||||
pass
|
pass
|
||||||
|
|
||||||
## Converts an angle from degrees to radians
|
|
||||||
def DegreesToRadians(AngleInDegrees):
|
|
||||||
from math import pi
|
|
||||||
return AngleInDegrees * pi / 180.0
|
|
||||||
|
|
||||||
# end of l1_auxiliary
|
# end of l1_auxiliary
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
@ -2335,7 +2407,7 @@ class Mesh:
|
|||||||
## Generates new elements by rotation of the elements around the axis
|
## Generates new elements by rotation of the elements around the axis
|
||||||
# @param IDsOfElements the list of ids of elements to sweep
|
# @param IDsOfElements the list of ids of elements to sweep
|
||||||
# @param Axis the axis of rotation, AxisStruct or line(geom object)
|
# @param Axis the axis of rotation, AxisStruct or line(geom object)
|
||||||
# @param AngleInRadians the angle of Rotation
|
# @param AngleInRadians the angle of Rotation (in radians) or a name of variable which defines angle in degrees
|
||||||
# @param NbOfSteps the number of steps
|
# @param NbOfSteps the number of steps
|
||||||
# @param Tolerance tolerance
|
# @param Tolerance tolerance
|
||||||
# @param MakeGroups forces the generation of new groups from existing ones
|
# @param MakeGroups forces the generation of new groups from existing ones
|
||||||
@ -2345,12 +2417,22 @@ class Mesh:
|
|||||||
# @ingroup l2_modif_extrurev
|
# @ingroup l2_modif_extrurev
|
||||||
def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
|
def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
|
||||||
MakeGroups=False, TotalAngle=False):
|
MakeGroups=False, TotalAngle=False):
|
||||||
|
flag = False
|
||||||
|
if isinstance(AngleInRadians,str):
|
||||||
|
flag = True
|
||||||
|
AngleInRadians,AngleParameters = geompyDC.ParseParameters(AngleInRadians)
|
||||||
|
if flag:
|
||||||
|
AngleInRadians = DegreesToRadians(AngleInRadians)
|
||||||
if IDsOfElements == []:
|
if IDsOfElements == []:
|
||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
Axis = self.smeshpyD.GetAxisStruct(Axis)
|
||||||
|
Axis,AxisParameters = ParseAxisStruct(Axis)
|
||||||
if TotalAngle and NbOfSteps:
|
if TotalAngle and NbOfSteps:
|
||||||
AngleInRadians /= NbOfSteps
|
AngleInRadians /= NbOfSteps
|
||||||
|
NbOfSteps,Tolerance,Parameters = geompyDC.ParseParameters(NbOfSteps,Tolerance)
|
||||||
|
Parameters = AxisParameters + ":" + AngleParameters + ":" + Parameters
|
||||||
|
self.mesh.SetParameters(Parameters)
|
||||||
if MakeGroups:
|
if MakeGroups:
|
||||||
return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
|
return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
|
||||||
AngleInRadians, NbOfSteps, Tolerance)
|
AngleInRadians, NbOfSteps, Tolerance)
|
||||||
@ -2496,6 +2578,8 @@ class Mesh:
|
|||||||
def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
|
def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
|
||||||
HasAngles, Angles, HasRefPoint, RefPoint,
|
HasAngles, Angles, HasRefPoint, RefPoint,
|
||||||
MakeGroups=False, LinearVariation=False):
|
MakeGroups=False, LinearVariation=False):
|
||||||
|
Angles,AnglesParameters = ParseAngles(Angles)
|
||||||
|
RefPoint,RefPointParameters = ParsePointStruct(RefPoint)
|
||||||
if IDsOfElements == []:
|
if IDsOfElements == []:
|
||||||
IDsOfElements = self.GetElementsId()
|
IDsOfElements = self.GetElementsId()
|
||||||
if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
|
if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
|
||||||
@ -2506,6 +2590,8 @@ class Mesh:
|
|||||||
if HasAngles and Angles and LinearVariation:
|
if HasAngles and Angles and LinearVariation:
|
||||||
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
|
Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
|
||||||
pass
|
pass
|
||||||
|
Parameters = AnglesParameters + ":" + RefPointParameters
|
||||||
|
self.mesh.SetParameters(Parameters)
|
||||||
if MakeGroups:
|
if MakeGroups:
|
||||||
return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
|
return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
|
||||||
PathShape, NodeStart, HasAngles,
|
PathShape, NodeStart, HasAngles,
|
||||||
|
Loading…
Reference in New Issue
Block a user