Salome HOME
IPAL54585: Extrusion 3D algo fails with "OCC exception. Standard_NoSuchObject: NColle...
authoreap <eap@opencascade.com>
Fri, 2 Aug 2019 15:14:14 +0000 (18:14 +0300)
committereap <eap@opencascade.com>
Fri, 2 Aug 2019 15:14:14 +0000 (18:14 +0300)
  Issue (2) with Geometric Progression reported in
  https://www.salome-platform.org/forum/forum_10/976643804#300891023
  Fixed in StdMeshers_Prism_3D.cxx

+ Minor changes:
1) SMESHGUI_PreVisualObj::myMesh in now SMESHDS_Mesh*
2) TPythonDump::DumpArray is now public method
3) In StdMeshers_FixedPoints1D, make args of Set*() methods const
4) Install SMESHGUI_PreVisualObj.h
5) Make StdMeshers_QuadrangleParams::SetCorners() available via CORBA

12 files changed:
idl/SMESH_BasicHypothesis.idl
src/SMESH/SMESH_Gen.cxx
src/SMESHGUI/CMakeLists.txt
src/SMESHGUI/SMESHGUI_PreVisualObj.cxx
src/SMESHGUI/SMESHGUI_PreVisualObj.h
src/SMESHUtils/SMESH_Indexer.hxx
src/SMESH_I/SMESH_PythonDump.cxx
src/SMESH_I/SMESH_PythonDump.hxx
src/SMESH_SWIG/StdMeshersBuilder.py
src/StdMeshers/StdMeshers_FixedPoints1D.cxx
src/StdMeshers/StdMeshers_FixedPoints1D.hxx
src/StdMeshers/StdMeshers_Prism_3D.cxx

index 1d2c9261f5241141a45eaffe09b3835bc2713dae..a4bb746a64ef4ad059e0c35039c5e9afcef0c6b9 100644 (file)
@@ -813,6 +813,16 @@ module StdMeshers
      * Returns entries of shapes defining enforced nodes
      */
     SMESH::string_array GetEnfVertices();
+
+    /*!
+     * Set corner vertices
+     */
+    void SetCorners( in SMESH::long_array vertexIDs );
+
+    /*!
+     * Return IDs of corner vertices
+     */
+    SMESH::long_array GetCorners();
   };
 
   /*!
index d98bb8fc1dbb8734b20e3451ce40ac179de155a7..1e9c1471a1e404d52c46ef6385ab35fb437f9ca9 100644 (file)
@@ -93,12 +93,12 @@ namespace
 
 SMESH_Gen::~SMESH_Gen()
 {
-    std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin();
-    for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp )
-    {
-      if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
-        h->NullifyGen();
-    }
+  std::map < int, SMESH_Hypothesis * >::iterator i_hyp = _studyContext->mapHypothesis.begin();
+  for ( ; i_hyp != _studyContext->mapHypothesis.end(); ++i_hyp )
+  {
+    if ( _Hyp* h = static_cast< _Hyp*>( i_hyp->second ))
+      h->NullifyGen();
+  }
   delete _studyContext->myDocument;
   delete _studyContext;
 }
index fe5553be4388ca669f45a608afea6ad4e5c2c6c3..2cdeb50e685991be74d5b7b1de23909095bdc831 100644 (file)
@@ -145,6 +145,7 @@ SET(_moc_HEADERS
   SMESHGUI_DisplayEntitiesDlg.h
   SMESHGUI_SplitBiQuad.h
   SMESHGUI_IdPreview.h
+  SMESHGUI_PreVisualObj.h
 )
 
 # header files / no moc processing
index f1aebce8df8c178ed6819c36cab3be7d763cdb90..a01e907db7016461c563eb317e0f8a6322e3903a 100644 (file)
 
 #include "SMESHGUI_PreVisualObj.h"
 
-#include <SMDS_Mesh.hxx>
+#include <SMESHDS_Mesh.hxx>
 #include <SMESH_Actor.h>
 
 SMESHGUI_PreVisualObj::SMESHGUI_PreVisualObj()
 {
-  myMesh = new SMDS_Mesh();
+  myMesh = new SMESHDS_Mesh(0,true);
+}
+
+SMDS_Mesh* SMESHGUI_PreVisualObj::GetMesh() const
+{
+  return myMesh;
 }
 
 bool SMESHGUI_PreVisualObj::Update( int theIsClear = true )
index 83745e40fe0e4329e285c45fdbdc0ebf1e954bbf..33dc79e4114f0d5846d5962eaa342337e066798c 100644 (file)
@@ -29,6 +29,8 @@
 
 #include "SMESH_Object.h"
 
+class SMESHDS_Mesh;
+
 /*!
  * \brief Incarnation of SMESH_VisualObj allowing usage of SMESH_Actor
  *        to show arbitrary mesh data. SMESHGUI_PreVisualObj encapsulates
  */
 class SMESHGUI_EXPORT SMESHGUI_PreVisualObj : public SMESH_VisualObj
 {
-  mutable SMDS_Mesh* myMesh;
-  bool               myEntitiesFlag;
-  unsigned int       myEntitiesState;
+  mutable SMESHDS_Mesh* myMesh;
+  bool                  myEntitiesFlag;
+  unsigned int          myEntitiesState;
 
  public:
   SMESHGUI_PreVisualObj();
-  virtual SMDS_Mesh* GetMesh() const { return myMesh; }
+  virtual SMDS_Mesh* GetMesh() const;
+  SMESHDS_Mesh* GetMeshDS() const { return myMesh; }
 
   virtual bool Update( int theIsClear );
   virtual bool NulData() { return false; }
index ff5628bbe1f33f4e202c9068d67dc6cb414141da..161e69b5fba1941cc788396c48ce4994621dea87 100644 (file)
@@ -82,7 +82,7 @@ struct SMESH_Indexer3D
  * the directions. Any combination of these transformations is allowed.
  *
  * The following code picks up a transformation such that two known array items
- * appear in desired positions:
+ * appear in desired positions:
  * \code
  * for ( int ori = 0; ori < SMESH_OrientedIndexer::MAX_ORI+1; ++ori )
  * {
index 5c9163bf42e3d55b2439accd1f2d58e33f2f5636..6a88325b199fb0b142e6182df1d3ae052402c098 100644 (file)
@@ -244,25 +244,6 @@ namespace SMESH
     return *this;
   }
 
-  template<class TArray>
-  void DumpArray(const TArray& theArray, TPythonDump & theStream)
-  {
-    if ( theArray.length() == 0 )
-    {
-      theStream << "[]";
-    }
-    else
-    {
-      theStream << "[ ";
-      for (CORBA::ULong i = 1; i <= theArray.length(); i++) {
-        theStream << theArray[i-1];
-        if ( i < theArray.length() )
-          theStream << ", ";
-      }
-      theStream << " ]";
-    }
-  }
-
   TPythonDump&
   TPythonDump::operator<<(const SMESH::long_array& theArg)
   {
index 587b2bd6b5396ce650061061f4a8e787627d6f7b..a6dfb766922a54a010a4ff9e38daeea61427eba9 100644 (file)
@@ -239,6 +239,27 @@ namespace SMESH
     TPythonDump&
     operator<<(const std::string& theArg);
 
+
+    template<class TArray, class TStream>
+      static TStream& DumpArray(const TArray& theArray, TStream & theStream)
+    {
+      if ( theArray.length() == 0 )
+      {
+        theStream << "[]";
+      }
+      else
+      {
+        theStream << "[ ";
+        for (CORBA::ULong i = 1; i <= theArray.length(); i++) {
+          theStream << theArray[i-1];
+          if ( i < theArray.length() )
+            theStream << ", ";
+        }
+        theStream << " ]";
+      }
+      return theStream;
+    }
+
     static const char* SMESHGenName() { return "smeshgen"; }
     static const char* MeshEditorName() { return "mesh_editor"; }
     static const char* NotPublishedObjectName();
index d50665f4e4421f27c34aec61af3c9f8fc114fd27..858820238ad520dc15547e89a0b6bbd581b030d3 100644 (file)
@@ -726,7 +726,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
         pass
 
     def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
-                             enfVertices=[],enfPoints=[],UseExisting=0):
+                             enfVertices=[],enfPoints=[],corners=[],UseExisting=0):
         """
         Defines "QuadrangleParameters" hypothesis
             quadType defines the algorithm of transition between differently descretized
@@ -762,6 +762,13 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
                 or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
                 In the case if the defined QuadrangleParameters() refer to a sole face,
                 all given points must lie on this face, else the mesher fails.
+            corners: list of vertices that should be used as quadrangle corners.
+                The parameter can be useful for faces with more than four vertices,
+                since in some cases Quadrangle Mapping algorithm chooses corner vertices
+                differently than it is desired.
+                A hypothesis can be global and define corners for all CAD faces that
+                require it, but be sure that each specified vertex is a corner in all
+                faces the hypothesis will be applied to.
             UseExisting: if *True* - searches for the existing hypothesis created with
                 the same parameters, else (default) - Create a new one
         """
@@ -774,6 +781,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
         if isinstance( enfVertices, int ) and not enfPoints and not UseExisting:
             # a call of old syntax, before inserting enfVertices and enfPoints before UseExisting
             UseExisting, enfVertices = enfVertices, []
+
         pStructs, xyz = [], []
         for p in enfPoints:
             if isinstance( p, SMESH.PointStruct ):
@@ -791,6 +799,10 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
             self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz],
                                           UseExisting = UseExisting, CompareMethod=compFun)
             pass
+
+        if corners and isinstance( corners[0], GEOM._objref_GEOM_Object ):
+            corners = [ self.mesh.geompyD.GetSubShapeID( self.mesh.geom, v ) for v in corners ]
+
         if self.params.GetQuadType() != quadType:
             self.params.SetQuadType(quadType)
         if vertexID > 0:
@@ -799,6 +811,7 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
         for v in enfVertices:
             AssureGeomPublished( self.mesh, v )
         self.params.SetEnforcedNodes( enfVertices, pStructs )
+        self.params.SetCorners( corners )
         return self.params
 
     def QuadranglePreference(self, reversed=False, UseExisting=0):
index 81759f9110f0431437cacbf0082a085e38855afe..28432c8bf6a9f4c88d1adfeb9808f35a0ea22b6b 100644 (file)
@@ -60,7 +60,7 @@ StdMeshers_FixedPoints1D::~StdMeshers_FixedPoints1D()
  */
 //=============================================================================
 
-void StdMeshers_FixedPoints1D::SetPoints(std::vector<double>& listParams)
+void StdMeshers_FixedPoints1D::SetPoints(const std::vector<double>& listParams)
   throw(SALOME_Exception)
 {
   _params = listParams;
@@ -73,7 +73,7 @@ void StdMeshers_FixedPoints1D::SetPoints(std::vector<double>& listParams)
  */
 //=============================================================================
 
-void StdMeshers_FixedPoints1D::SetNbSegments(std::vector<int>& listNbSeg) 
+void StdMeshers_FixedPoints1D::SetNbSegments(const std::vector<int>& listNbSeg) 
   throw(SALOME_Exception)
 {
   _nbsegs = listNbSeg;
index 56366cb0079579ef40e63c8b795744956ea8cfb3..f8c42810d0c6dbd1d36c52e238f5f2a7b311c334 100644 (file)
@@ -41,10 +41,10 @@ public:
   StdMeshers_FixedPoints1D(int hypId, SMESH_Gen* gen);
   virtual ~StdMeshers_FixedPoints1D();
 
-  void SetPoints(std::vector<double>& listParams)
+  void SetPoints(const std::vector<double>& listParams)
     throw(SALOME_Exception);
 
-  void SetNbSegments(std::vector<int>& listNbSeg) 
+  void SetNbSegments(const std::vector<int>& listNbSeg) 
     throw(SALOME_Exception);
 
   const std::vector<double>& GetPoints() const { return _params; }
index 4d02c40bba688f46bbcbff375987ff0dcb4d32d2..2db5afa7bf213321beef3978e777a92c97670313 100644 (file)
@@ -5363,15 +5363,34 @@ void StdMeshers_Sweeper::fillZColumn( TZColumn&    zColumn,
 
 void StdMeshers_Sweeper::prepareTopBotDelaunay()
 {
+  SMESH_MesherHelper* helper[2] = { myHelper, myHelper };
+  SMESH_MesherHelper botHelper( *myHelper->GetMesh() );
+  SMESH_MesherHelper topHelper( *myHelper->GetMesh() );
+  const SMDS_MeshNode* intBotNode = 0;
+  const SMDS_MeshNode* intTopNode = 0;
+  if ( myHelper->HasSeam() || myHelper->HasDegeneratedEdges() ) // use individual helpers
+  {
+    botHelper.SetSubShape( myBotFace );
+    topHelper.SetSubShape( myTopFace );
+    helper[0] = & botHelper;
+    helper[1] = & topHelper;
+    if ( !myIntColumns.empty() )
+    {
+      TNodeColumn& nodes = *myIntColumns[ myIntColumns.size()/2 ];
+      intBotNode = nodes[0];
+      intTopNode = nodes.back();
+    }
+  }
+
   UVPtStructVec botUV( myBndColumns.size() );
   UVPtStructVec topUV( myBndColumns.size() );
   for ( size_t i = 0; i < myBndColumns.size(); ++i )
   {
     TNodeColumn& nodes = *myBndColumns[i];
     botUV[i].node = nodes[0];
-    botUV[i].SetUV( myHelper->GetNodeUV( myBotFace, nodes[0] ));
+    botUV[i].SetUV( helper[0]->GetNodeUV( myBotFace, nodes[0], intBotNode ));
     topUV[i].node = nodes.back();
-    topUV[i].SetUV( myHelper->GetNodeUV( myTopFace, nodes.back() ));
+    topUV[i].SetUV( helper[1]->GetNodeUV( myTopFace, nodes.back(), intTopNode ));
     botUV[i].node->setIsMarked( true );
   }
   TopoDS_Edge dummyE;