IPAL54585: Extrusion 3D algo fails with "OCC exception. Standard_NoSuchObject: NCollection_DataMap::Find" error

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
This commit is contained in:
eap 2019-08-02 18:14:14 +03:00
parent fb2fc07236
commit 0146a69d82
12 changed files with 92 additions and 39 deletions

View 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();
};
/*!

View 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;
}

View 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

View File

@ -22,12 +22,17 @@
#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 )

View 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
@ -37,13 +39,14 @@
*/
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; }

View 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 a desired positions:
* appear in desired positions:
* \code
* for ( int ori = 0; ori < SMESH_OrientedIndexer::MAX_ORI+1; ++ori )
* {

View 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)
{

View 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();

View 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):

View 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;

View 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; }

View 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;