Salome HOME
Join delta from tag V4_1_1 till tag mergeto_V4_1_0_maintainance_07Mar2008.
authorjfa <jfa@opencascade.com>
Fri, 7 Mar 2008 11:05:56 +0000 (11:05 +0000)
committerjfa <jfa@opencascade.com>
Fri, 7 Mar 2008 11:05:56 +0000 (11:05 +0000)
13 files changed:
src/SMDS/SMDS_MeshNode.cxx
src/SMDS/SMDS_MeshNode.hxx
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_subMesh.cxx
src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.h
src/SMESHGUI/SMESH_msg_en.po
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_SWIG/smeshDC.py
src/StdMeshers/StdMeshers_FaceSide.cxx
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
src/StdMeshers/StdMeshers_MEFISTO_2D.hxx

index b7a1cb117ed5544bdc711316938ccecb25327bc5..587aee90a86284144296f898755b476f326607d5 100644 (file)
@@ -246,7 +246,7 @@ bool SMDS_MeshNode::emptyInverseElements()
  */
 //================================================================================
 
-int SMDS_MeshNode::NbInverseNodes(SMDSAbs_ElementType type) const
+int SMDS_MeshNode::NbInverseElements(SMDSAbs_ElementType type) const
 {
   if ( type == SMDSAbs_All )
     return myInverseElements.Extent();
index d195fbdfdef8b91326cda458ad31f764c8a9d508..585f59bf9a699a128bace23c425a26a72772a612 100644 (file)
@@ -47,7 +47,7 @@ class SMDS_EXPORT SMDS_MeshNode:public SMDS_MeshElement
        void ClearInverseElements();
        bool emptyInverseElements();
        SMDS_ElemIteratorPtr GetInverseElementIterator(SMDSAbs_ElementType type=SMDSAbs_All) const;
-        int NbInverseNodes(SMDSAbs_ElementType type=SMDSAbs_All) const;
+        int NbInverseElements(SMDSAbs_ElementType type=SMDSAbs_All) const;
        void SetPosition(const SMDS_PositionPtr& aPos);
        const SMDS_PositionPtr& GetPosition() const;
        SMDSAbs_ElementType GetType() const;
index b858c372f1249ad88d97ff39fb0c5659a2cc07d2..6b94beafec3f1c7521983523b0b8147c6593db9f 100644 (file)
@@ -6871,7 +6871,7 @@ int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh *    theSm,
       vector<const SMDS_MeshNode*>::iterator nIt = mediumNodes.begin();
       for ( ; nIt != mediumNodes.end(); ++nIt ) {
         const SMDS_MeshNode* n = *nIt;
-        if ( n->NbInverseNodes() == 0 ) {
+        if ( n->NbInverseElements() == 0 ) {
           if ( n->GetPosition()->GetShapeId() != theShapeID )
             meshDS->RemoveFreeNode( n, meshDS->MeshElements
                                     ( n->GetPosition()->GetShapeId() ));
index bbb5fa96a45e3c7f8c7e2da6dcaf1b826d6c1252..3a1c9fa0db92a3a399bc0a27412a672fec34f677 100644 (file)
@@ -1195,7 +1195,7 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
       while (itn->more()) {
         const SMDS_MeshNode * node = itn->next();
         //MESSAGE( " RM node: "<<node->GetID());
-        if ( node->NbInverseNodes() == 0 )
+        if ( node->NbInverseElements() == 0 )
           meshDS->RemoveFreeNode(node, subMeshDS);
         else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another
           meshDS->RemoveNode(node);
index bd1f3bb6cd7019a68a883a1d080e5d3852182521..3521af48dd745038d9cb13c0afc56e146a59e25c 100644 (file)
@@ -259,6 +259,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
 
   AngleSpin = new SMESHGUI_SpinBox(AnglesGrp);
 
+  LinearAnglesCheck = new QCheckBox(tr("LINEAR_ANGLES"), AnglesGrp);
+
   // layouting
   QVBoxLayout* bLayout = new QVBoxLayout();
   bLayout->addWidget(AddAngleButton);
@@ -268,6 +270,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
   AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0);
   AnglesGrpLayout->addMultiCellLayout(bLayout,    0, 1, 1, 1);
   AnglesGrpLayout->addWidget(         AngleSpin,  0,    2   );
+  AnglesGrpLayout->addWidget( LinearAnglesCheck,  2,    0   );
   AnglesGrpLayout->setRowStretch(1, 10);
 
   // CheckBox for groups generation
@@ -604,17 +607,20 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply()
   try {
     SUIT_OverrideCursor wc;
     SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+    if ( LinearAnglesCheck->isChecked() )
+      anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles );
+
     SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
       SMESH::ListOfGroups_var groups = 
-        aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId.inout(), myPathMesh,
+        aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh,
                                                   myPathShape, aNodeStart,
-                                                  AnglesCheck->isChecked(), anAngles.inout(),
+                                                  AnglesCheck->isChecked(), anAngles,
                                                   BasePointCheck->isChecked(), aBasePoint, retVal);
     else
-      retVal = aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh,
+      retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh,
                                                myPathShape, aNodeStart,
-                                               AnglesCheck->isChecked(), anAngles.inout(),
+                                               AnglesCheck->isChecked(), anAngles,
                                                BasePointCheck->isChecked(), aBasePoint);
 
     //wc.stop();
index c10a0898b9a3ed82c766ad7ae0b626b4d2a431ed..91a66ec1378e97c0f25caef0d8a68672d33d8c2f 100644 (file)
@@ -34,6 +34,7 @@
 #include "SMESHGUI_VTKUtils.h"
 #include "SMESHGUI_MeshUtils.h"
 #include "SMESHGUI_IdValidator.h"
+#include "SMESHGUI_MeshEditPreview.h"
 
 #include "SMESH_Actor.h"
 #include "SMESH_TypeFilter.hxx"
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_Session.h"
 #include "SUIT_MessageBox.h"
+#include "SUIT_OverrideCursor.h"
 
 #include "LightApp_Application.h"
+#include "SalomeApp_Application.h"
 
 #include "SVTK_ViewModel.h"
 #include "SVTK_ViewWindow.h"
 #include "SVTK_Selector.h"
 #include "SVTK_Selection.h"
 #include "SALOME_ListIO.hxx"
+#include "VTKViewer_CellLocationsArray.h"
 
 #include "utilities.h"
 
 // OCCT Includes
 #include <TColStd_MapOfInteger.hxx>
-#include <TColStd_IndexedMapOfInteger.hxx>
 
 // QT Includes
 #include <qapplication.h>
@@ -83,6 +86,7 @@ using namespace std;
 // class    : SMESHGUI_RevolutionDlg()
 // purpose  :
 //=================================================================================
+
 SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* name,
                                                 bool modal, WFlags fl)
      : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
@@ -90,6 +94,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
      mySMESHGUI( theModule ),
      mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
 {
+  mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+
   SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
   QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
   QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
@@ -267,34 +273,60 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3);
 
   // Controls for angle defining
-  TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle");
-  TextLabelAngle->setText(tr("SMESH_ANGLE" ));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1);
-
-  SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle");
-  GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2);
-
-  // Controls for nb. steps defining
-  TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps");
+  GroupAngle = new QButtonGroup(GroupArguments, "GroupAngle");
+  GroupAngle->setTitle(tr("SMESH_ANGLE"));
+  GroupAngle->setExclusive(TRUE);
+  GroupAngle->setColumnLayout(0, Qt::Horizontal);
+  GroupAngle->layout()->setSpacing(0);
+  GroupAngle->layout()->setMargin(0);
+  QGridLayout* GroupAngleLayout = new QGridLayout(GroupAngle->layout());
+  GroupAngleLayout->setAlignment(Qt::AlignTop);
+  GroupAngleLayout->setSpacing(6);
+  GroupAngleLayout->setMargin(11);
+
+  RadioButton3 = new QRadioButton(GroupAngle, "RadioButton3");
+  RadioButton3->setText(tr("ANGLE_BY_STEP"));
+  GroupAngleLayout->addMultiCellWidget(RadioButton3, 0, 0, 0, 1);
+
+  RadioButton4 = new QRadioButton(GroupAngle, "RadioButton4");
+  RadioButton4->setText(tr("TOTAL_ANGLE"));
+  GroupAngleLayout->addWidget(RadioButton4, 0, 2);
+
+  TextLabelAngle = new QLabel(GroupAngle, "TextLabelAngle");
+  TextLabelAngle->setText(tr("SMESH_ANGLE"));
+  GroupAngleLayout->addWidget(TextLabelAngle, 1, 0);
+
+  SpinBox_Angle = new SMESHGUI_SpinBox(GroupAngle, "SpinBox_Angle");
+  GroupAngleLayout->addMultiCellWidget(SpinBox_Angle, 1, 1, 1, 2);
+
+  // Controls for number of steps defining
+  TextLabelNbSteps = new QLabel(GroupAngle, "TextLabelNbSteps");
   TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" ));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 4, 4, 0, 1);
+  TextLabelNbSteps->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+  GroupAngleLayout->addWidget(TextLabelNbSteps, 2, 0);
+
+  SpinBox_NbSteps = new QSpinBox(GroupAngle, "SpinBox_NbSteps");
+  GroupAngleLayout->addMultiCellWidget(SpinBox_NbSteps, 2, 2, 1, 2);
 
-  SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps");
-  GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2);
+  GroupArgumentsLayout->addMultiCellWidget(GroupAngle, 3, 3, 0, 3);
 
   // Controls for tolerance defining
   TextLabelTolerance = new QLabel(GroupArguments, "TextLabelTolerance");
   TextLabelTolerance->setText(tr("SMESH_TOLERANCE"));
-  GroupArgumentsLayout->addMultiCellWidget(TextLabelTolerance, 5, 5, 0, 1);
+  GroupArgumentsLayout->addWidget(TextLabelTolerance, 4, 0);
 
   SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance");
-  GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2);
+  GroupArgumentsLayout->addMultiCellWidget(SpinBox_Tolerance, 4, 4, 1, 3);
 
   // CheckBox for groups generation
   MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
   MakeGroupsCheck->setChecked(true);
   GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 6, 6, 0, 3);
 
+  // Control for mesh preview
+  CheckBoxPreview = new QCheckBox(GroupArguments, "CheckBoxPreview");
+  CheckBoxPreview->setText(tr("PREVIEW" ));
+  GroupArgumentsLayout->addMultiCellWidget(CheckBoxPreview, 5, 5, 0, 3);
 
   SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0);
 
@@ -306,6 +338,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
   SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3);
 
+  RadioButton3->setChecked(TRUE);
+
   SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3);
 
   QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps);
@@ -347,6 +381,10 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   connect(SelectPointButton, SIGNAL (clicked()),    this, SLOT(SetEditCurrentArgument()));
   connect(SelectVectorButton, SIGNAL (clicked()),   this, SLOT(SetEditCurrentArgument()));
 
+  connect(SpinBox_X, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Y, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Z, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+
   connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
   connect(SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged()));
@@ -358,6 +396,12 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
   connect(LineEditElements, SIGNAL(textChanged(const QString&)),   SLOT(onTextChange(const QString&)));
   connect(CheckBoxMesh,     SIGNAL(toggled(bool)),                 SLOT(onSelectMesh(bool)));
 
+  connect(GroupAngle,        SIGNAL(clicked(int)),               SLOT(toDisplaySimulation()));
+  connect(SpinBox_Angle,     SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_NbSteps,   SIGNAL(valueChanged(int)),   this, SLOT(toDisplaySimulation()));
+  connect(SpinBox_Tolerance, SIGNAL(valueChanged(double)), this, SLOT(toDisplaySimulation()));
+  connect(CheckBoxPreview,   SIGNAL(toggled(bool)),              SLOT(onDisplaySimulation(bool)));
+
   this->show(); /* displays Dialog */
 
   ConstructorsClicked(0);
@@ -371,6 +415,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char*
 //=================================================================================
 SMESHGUI_RevolutionDlg::~SMESHGUI_RevolutionDlg()
 {
+  delete mySimulation;
   // no need to delete child widgets, Qt does it all for us
 }
 
@@ -404,6 +449,8 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 
     CheckBoxMesh->setChecked(false);
     onSelectMesh(false);
+    CheckBoxPreview->setChecked(false);
+    onDisplaySimulation(false);
   }
 }
 
@@ -413,7 +460,17 @@ void SMESHGUI_RevolutionDlg::Init (bool ResetControls)
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(mySelectionMgr, 0, this, 0);
+  //disconnect(mySelectionMgr, 0, this, 0);
+
+  SALOME_ListIO io;
+  mySelectionMgr->selectedObjects( io );
+  SALOME_ListIO aList;
+  mySelectionMgr->setSelectedObjects( aList );
+//   LineEditElements->clear();
+  myNbOkElements = 0;
+  buttonApply->setEnabled(false);
+  buttonOk->setEnabled(false);
+  mySimulation->SetVisibility(false);
 
   Selection_Mode aSelMode = ActorSelection;
 
@@ -448,7 +505,8 @@ void SMESHGUI_RevolutionDlg::ConstructorsClicked (int constructorId)
   if (CheckBoxMesh->isChecked())
     onSelectMesh(true);
 
-  connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  mySelectionMgr->setSelectedObjects( io );
 }
 
 //=================================================================================
@@ -482,6 +540,9 @@ void SMESHGUI_RevolutionDlg::ClickOnApply()
     long aNbSteps = (long)SpinBox_NbSteps->value();
     double aTolerance = SpinBox_Tolerance->GetValue();
 
+    if (GroupAngle->selectedId() == 1)
+      anAngle = anAngle/aNbSteps;
+
     try {
       SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
       QApplication::setOverrideCursor(Qt::waitCursor);
@@ -604,6 +665,7 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText)
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+  onDisplaySimulation(true);
 
   myBusy = false;
 }
@@ -774,6 +836,8 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     buttonOk->setEnabled(true);
     buttonApply->setEnabled(true);
   }
+
+  onDisplaySimulation(true);
 }
 
 //=================================================================================
@@ -789,6 +853,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
   mySelectionMgr->clearFilters();
 
   if (send == SelectElementsButton) {
+    mySimulation->SetVisibility(false);
     myEditCurrentArgument = (QWidget*)LineEditElements;
     SMESH::SetPointRepresentation(false);
     if (CheckBoxMesh->isChecked()) {
@@ -808,6 +873,7 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
            aViewWindow->SetSelectionMode(FaceSelection);
        }
     }
+    
   } else if (send == SelectPointButton) {
     myEditCurrentArgument = (QWidget*)SpinBox_X;
     SMESH::SetPointRepresentation(true);
@@ -902,6 +968,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
 
   if (myEditCurrentArgument != LineEditElements) {
     LineEditElements->clear();
+    mySimulation->SetVisibility(false);
     return;
   }
 
@@ -928,6 +995,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh)
 
     LineEditElements->setReadOnly(false);
     onTextChange(LineEditElements->text());
+    mySimulation->SetVisibility(false);
   }
 
   SelectionIntoArgument();
@@ -968,6 +1036,7 @@ void SMESHGUI_RevolutionDlg::onVectorChanged()
     buttonOk->setEnabled(false);
     buttonApply->setEnabled(false);
   }
+  onDisplaySimulation(true);
 }
 
 //=================================================================================
@@ -986,3 +1055,70 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e )
       ClickOnHelp();
     }
 }
+
+//=================================================================================
+// function : toDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::toDisplaySimulation()
+{
+  onDisplaySimulation(true);
+}
+
+//=================================================================================
+// function : onDisplaySimulation()
+// purpose  :
+//=================================================================================
+void SMESHGUI_RevolutionDlg::onDisplaySimulation(bool toDisplayPreview)
+{
+  if (CheckBoxPreview->isChecked() && toDisplayPreview)
+    {
+      //display preview
+      if (myNbOkElements && IsAxisOk()) {
+       QStringList aListElementsId = QStringList::split(" ", myElementsId, false);
+
+       SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+       anElementsId->length(aListElementsId.count());
+       for (int i = 0; i < aListElementsId.count(); i++)
+         anElementsId[i] = aListElementsId[i].toInt();
+
+       SMESH::AxisStruct anAxis;
+
+       anAxis.x =  SpinBox_X->GetValue();
+       anAxis.y =  SpinBox_Y->GetValue();
+       anAxis.z =  SpinBox_Z->GetValue();
+       anAxis.vx = SpinBox_DX->GetValue();
+       anAxis.vy = SpinBox_DY->GetValue();
+       anAxis.vz = SpinBox_DZ->GetValue();
+
+       double anAngle = (SpinBox_Angle->GetValue())*PI/180;
+       long aNbSteps = (long)SpinBox_NbSteps->value();
+       double aTolerance = SpinBox_Tolerance->GetValue();
+
+       if (GroupAngle->selectedId() == 1)
+         anAngle = anAngle/aNbSteps;
+
+       try {
+          SUIT_OverrideCursor aWaitCursor;
+         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
+          aMeshEditor->RotationSweep(anElementsId.inout(), 
+                                     anAxis, 
+                                     anAngle, 
+                                     aNbSteps, 
+                                     aTolerance);
+          SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
+         mySimulation->SetData(aMeshPreviewStruct._retn());
+       } catch (...) {}
+      }
+      else
+       {
+         mySimulation->SetVisibility(false);
+       }
+    }
+  else
+    {
+      //erase preview
+      mySimulation->SetVisibility(false);
+    }
+}
index 389c380a110810c8ea23189caa6e1d8ad89deb1e..add06b5c55cbfac938a830ec63d81c1b5896bfe7 100644 (file)
@@ -53,7 +53,8 @@ class SMESH_Actor;
 class SMESHGUI_SpinBox;
 class SVTK_ViewWindow;
 class SVTK_Selector;
-
+class SALOME_Actor;
+class SMESHGUI_MeshEditPreview;
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -95,6 +96,8 @@ private:
     SMESH::SMESH_Mesh_var         myMesh;
     SMESH_Actor*                  myActor;
     SMESH_LogicalFilter*          myMeshOrSubMeshOrGroupFilter;
+    SMESHGUI_MeshEditPreview*     mySimulation;
+    SALOME_Actor*                 myPreviewActor;
 
     QButtonGroup* GroupConstructors;
     QRadioButton* RadioButton1;
@@ -111,6 +114,10 @@ private:
     QLineEdit* LineEditElements;
     QCheckBox* CheckBoxMesh;
     QCheckBox* MakeGroupsCheck;
+    QButtonGroup* GroupAngle;
+    QRadioButton* RadioButton3;
+    QRadioButton* RadioButton4;
+    QCheckBox* CheckBoxPreview;
 
     QLabel* TextLabelPoint;
     QPushButton* SelectPointButton;
@@ -152,6 +159,8 @@ private slots:
     void onTextChange (const QString&);
     void onSelectMesh (bool toSelectMesh);
     void onVectorChanged();
+    void toDisplaySimulation();
+    void onDisplaySimulation(bool toDisplayPreview);
 
 protected:
     QGridLayout* SMESHGUI_RevolutionDlgLayout;
index d29cf68169804005aa5a4c4e4034599ff7cbcd77..3d6c79719769726693c15e1bbb110d9f398ced75 100644 (file)
@@ -1871,10 +1871,10 @@ msgid "SMESHGUI_RevolutionDlg::REVOLUTION_2D"
 msgstr "Revolution of 2D elements"
 
 msgid "SMESHGUI_RevolutionDlg::ANGLE_BY_STEP"
-msgstr "Use Angle by Step"
+msgstr "Angle by Step"
 
 msgid "SMESHGUI_RevolutionDlg::TOTAL_ANGLE"
-msgstr "Use Total Angle"
+msgstr "Total Angle"
 
 msgid "SMESHGUI_RevolutionDlg::PREVIEW"
 msgstr "Preview"
index c9f00811c2ba18111b6b757fcf8933d8c2a206c1..507b3a23f96e8bad8650dfbc6b0abbbef1ddf055 100644 (file)
@@ -2089,6 +2089,57 @@ SMESH_MeshEditor_i::LinearAnglesVariation(SMESH::SMESH_Mesh_ptr       thePathMes
                                           const SMESH::double_array & theAngles)
 {
   SMESH::double_array_var aResult = new SMESH::double_array();
+  int nbAngles = theAngles.length();
+  if ( nbAngles > 0 && !thePathMesh->_is_nil() && !thePathShape->_is_nil() )
+  {
+    SMESH_Mesh_i* aMeshImp = SMESH::DownCast<SMESH_Mesh_i*>( thePathMesh );
+    TopoDS_Shape aShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( thePathShape );
+    SMESH_subMesh* aSubMesh = aMeshImp->GetImpl().GetSubMesh( aShape );
+    if ( !aSubMesh || !aSubMesh->GetSubMeshDS())
+      return aResult._retn();
+    int nbSteps = aSubMesh->GetSubMeshDS()->NbElements();
+    if ( nbSteps == nbAngles )
+    {
+      aResult.inout() = theAngles;
+    }
+    else
+    {
+      aResult->length( nbSteps );
+      double rAn2St = double( nbAngles ) / double( nbSteps );
+      double angPrev = 0, angle;
+      for ( int iSt = 0; iSt < nbSteps; ++iSt )
+      {
+        double angCur = rAn2St * ( iSt+1 );
+        double angCurFloor  = floor( angCur );
+        double angPrevFloor = floor( angPrev );
+        if ( angPrevFloor == angCurFloor )
+          angle = rAn2St * theAngles[ int( angCurFloor ) ];
+        else
+        {
+          int iP = int( angPrevFloor );
+          double angPrevCeil = ceil(angPrev);
+          angle = ( angPrevCeil - angPrev ) * theAngles[ iP ];
+          
+          int iC = int( angCurFloor );
+          if ( iC < nbAngles )
+            angle += ( angCur - angCurFloor ) * theAngles[ iC ];
+
+          iP = int( angPrevCeil );
+          while ( iC-- > iP )
+            angle += theAngles[ iC ];
+        }
+        aResult[ iSt ] = angle;
+        angPrev = angCur;
+      }
+    }
+  }
+  // Update Python script
+  TPythonDump() << "rotAngles = " << theAngles;
+  TPythonDump() << "rotAngles = " << this << ".LinearAnglesVariation( "
+                << thePathMesh  << ", "
+                << thePathShape << ", "
+                << "rotAngles )";
+
   return aResult._retn();
 }
 
index 266473c88c5b4a287d78b885d8c7af29248530f8..a5560ba044bdcd2a0e7193a22568762df402530d 100644 (file)
@@ -150,6 +150,11 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo):
         print hypName, "was not assigned to",geomName,":", reason
         pass
 
+## Convert angle in degrees to radians
+def DegreesToRadians(AngleInDegrees):
+    from math import pi
+    return AngleInDegrees * pi / 180.0
+
 ## Methods of package smesh.py: general services of MESH component.
 #
 #  This class has been designed to provide general services of the MESH component.
@@ -1907,12 +1912,17 @@ class Mesh:
     #  @param NbOfSteps number of steps
     #  @param Tolerance tolerance
     #  @param MakeGroups to generate new groups from existing ones
+    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size
+    #  of all steps, else - size of each step
     #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
-    def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
+    def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance,
+                      MakeGroups=False, TotalAngle=False):
         if IDsOfElements == []:
             IDsOfElements = self.GetElementsId()
         if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
             Axix = self.smeshpyD.GetAxisStruct(Axix)
+        if TotalAngle and NbOfSteps:
+            AngleInRadians /= NbOfSteps
         if MakeGroups:
             return self.editor.RotationSweepMakeGroups(IDsOfElements, Axix,
                                                        AngleInRadians, NbOfSteps, Tolerance)
@@ -1926,12 +1936,17 @@ class Mesh:
     #  @param NbOfSteps number of steps
     #  @param Tolerance tolerance
     #  @param MakeGroups to generate new groups from existing ones
+    #  @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size
+    #  of all steps, else - size of each step
     #  @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
-    def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance, MakeGroups=False):
+    def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance,
+                            MakeGroups=False, TotalAngle=False):
         if ( isinstance( theObject, Mesh )):
             theObject = theObject.GetMesh()
         if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
             Axix = self.smeshpyD.GetAxisStruct(Axix)
+        if TotalAngle and NbOfSteps:
+            AngleInRadians /= NbOfSteps
         if MakeGroups:
             return self.editor.RotationSweepObjectMakeGroups(theObject, Axix, AngleInRadians,
                                                              NbOfSteps, Tolerance)
@@ -2044,11 +2059,16 @@ class Mesh:
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
             RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
             pass
+        if ( isinstance( PathMesh, Mesh )):
+            PathMesh = PathMesh.GetMesh()
+        if HasAngles and Angles and LinearVariation:
+            Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
+            pass
         if MakeGroups:
-            return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh.GetMesh(),
+            return self.editor.ExtrusionAlongPathMakeGroups(IDsOfElements, PathMesh,
                                                             PathShape, NodeStart, HasAngles,
                                                             Angles, HasRefPoint, RefPoint)
-        return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh.GetMesh(), PathShape,
+        return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape,
                                               NodeStart, HasAngles, Angles, HasRefPoint, RefPoint)
 
     ## Generate new elements by extrusion of the elements belong to object
@@ -2073,11 +2093,16 @@ class Mesh:
             theObject = theObject.GetMesh()
         if ( isinstance( RefPoint, geompyDC.GEOM._objref_GEOM_Object)):
             RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
+        if ( isinstance( PathMesh, Mesh )):
+            PathMesh = PathMesh.GetMesh()
+        if HasAngles and Angles and LinearVariation:
+            Angles = self.editor.LinearAnglesVariation( PathMesh, PathShape, Angles )
+            pass
         if MakeGroups:
-            return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh.GetMesh(),
+            return self.editor.ExtrusionAlongPathObjectMakeGroups(theObject, PathMesh,
                                                                   PathShape, NodeStart, HasAngles,
                                                                   Angles, HasRefPoint, RefPoint)
-        return self.editor.ExtrusionAlongPathObject(theObject, PathMesh.GetMesh(), PathShape,
+        return self.editor.ExtrusionAlongPathObject(theObject, PathMesh, PathShape,
                                                     NodeStart, HasAngles, Angles, HasRefPoint,
                                                     RefPoint)
 
@@ -3228,7 +3253,6 @@ class Mesh_Netgen(Mesh_Algorithm):
 #
 #  More details.
 class Mesh_Projection1D(Mesh_Algorithm):
-
     ## Private constructor.
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
@@ -3273,7 +3297,6 @@ class Mesh_Projection2D(Mesh_Algorithm):
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
         self.Create(mesh, geom, "Projection_2D")
-
     ## Define "Source Face" hypothesis, specifying a meshed face to
     #  take a mesh pattern from, and optionally association of vertices
     #  between the source face and a target one (where a hipothesis is assigned to)
index 5850cb74ea5523b2b9922e542490b845c7488303..eccc3f5afd625e80f53836c09c7fdc3a9a1168c0 100644 (file)
@@ -44,6 +44,7 @@
 #include <BRep_Builder.hxx>
 #include <BRep_Tool.hxx>
 #include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
 #include <TopoDS_Face.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Wire.hxx>
@@ -505,12 +506,20 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
         return TSideVector(0);
       }
     }
+    // find out side orientation, which is important if there are several wires (PAL19080) 
+    bool isForward = true;
+    if ( nbWires > 1 ) {
+      TopExp_Explorer e( theFace, TopAbs_EDGE );
+      while ( ! e.Current().IsSame( wireEdges.back() ))
+        e.Next();
+      isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() );
+    }
+
     StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
-                                                         true, theIgnoreMediumNodes);
+                                                         isForward, theIgnoreMediumNodes);
     wires[ iW ] = StdMeshers_FaceSidePtr( wire );
     from = to;
   }
   return wires;
 }
 
-
index 7b76b35455e95acc1fba4b4cfcb831cb2a266415..6307f167ebeacbe09a4f816af3f7ccfccc01f4a3 100644 (file)
@@ -113,6 +113,8 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
 {
   _hypMaxElementArea = NULL;
   _hypLengthFromEdges = NULL;
+  _edgeLength = 0;
+  _maxElementArea = 0;
 
   list <const SMESHDS_Hypothesis * >::const_iterator itl;
   const SMESHDS_Hypothesis *theHyp;
@@ -121,8 +123,8 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
   int nbHyp = hyps.size();
   if (!nbHyp)
   {
-    aStatus = SMESH_Hypothesis::HYP_MISSING;
-    return false;  // can't work with no hypothesis
+    aStatus = SMESH_Hypothesis::HYP_OK; //SMESH_Hypothesis::HYP_MISSING;
+    return true;  // (PAL13464) can work with no hypothesis, LengthFromEdges is default one
   }
 
   itl = hyps.begin();
@@ -137,7 +139,6 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
     _hypMaxElementArea = static_cast<const StdMeshers_MaxElementArea *>(theHyp);
     ASSERT(_hypMaxElementArea);
     _maxElementArea = _hypMaxElementArea->GetMaxArea();
-    _edgeLength = 0;
     isOk = true;
     aStatus = SMESH_Hypothesis::HYP_OK;
   }
@@ -146,8 +147,6 @@ bool StdMeshers_MEFISTO_2D::CheckHypothesis
   {
     _hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges *>(theHyp);
     ASSERT(_hypLengthFromEdges);
-    _edgeLength = 0;
-    _maxElementArea = 0;
     isOk = true;
     aStatus = SMESH_Hypothesis::HYP_OK;
   }
@@ -201,7 +200,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
                  SMESH_Comment("Too few segments: ")<<wires[0]->NbSegments());
 
   // compute average edge length
-  if (_hypLengthFromEdges)
+  if (!_hypMaxElementArea)
   {
     _edgeLength = 0;
     int nbSegments = 0;
@@ -215,7 +214,7 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
       _edgeLength /= nbSegments;
   }
 
-  if (_hypLengthFromEdges && _edgeLength < DBL_MIN )
+  if (/*_hypLengthFromEdges &&*/ _edgeLength < DBL_MIN )
     _edgeLength = 100;
 
   Z nblf;                 //nombre de lignes fermees (enveloppe en tete)
index bc229bd2c61554b012fc8042d4e1aea49a844849..8ca0b72b8dc02ec278c5c929dc76ddb757bce4d7 100644 (file)
@@ -83,7 +83,7 @@ protected:
 
   std::list<const SMDS_MeshNode*> myNodesOnCommonV;
 
-  SMESH_MesherHelper* myTool; // toll for working with quadratic elements
+  SMESH_MesherHelper* myTool; // tool for working with quadratic elements
 };
 
 #endif