OCCT Exception in "Cutting of quadrangles" dialog

This commit is contained in:
eap 2016-01-22 20:29:39 +03:00
parent dbf226547f
commit f0e2178ff8

View File

@ -2939,14 +2939,13 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
SMESH_MesherHelper helper( *GetMesh() ); SMESH_MesherHelper helper( *GetMesh() );
TIDSortedElemSet::iterator itElem; TIDSortedElemSet::iterator itElem;
for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) { for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
{
const SMDS_MeshElement* elem = *itElem; const SMDS_MeshElement* elem = *itElem;
if ( !elem || elem->GetType() != SMDSAbs_Face ) if ( !elem || elem->GetGeomType() != SMDSGeom_QUADRANGLE )
continue; continue;
bool isquad = elem->NbNodes()==4 || elem->NbNodes()==8;
if(!isquad) continue;
if(elem->NbNodes()==4) { if ( elem->NbNodes() == 4 ) {
// retrieve element nodes // retrieve element nodes
const SMDS_MeshNode* aNodes [4]; const SMDS_MeshNode* aNodes [4];
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
@ -2969,10 +2968,10 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
myLastCreatedElems.Append(newElem2); myLastCreatedElems.Append(newElem2);
// put a new triangle on the same shape and add to the same groups // put a new triangle on the same shape and add to the same groups
if ( aShapeId ) if ( aShapeId )
{ {
aMesh->SetMeshElementOnShape( newElem1, aShapeId ); aMesh->SetMeshElementOnShape( newElem1, aShapeId );
aMesh->SetMeshElementOnShape( newElem2, aShapeId ); aMesh->SetMeshElementOnShape( newElem2, aShapeId );
} }
AddToSameGroups( newElem1, elem, aMesh ); AddToSameGroups( newElem1, elem, aMesh );
AddToSameGroups( newElem2, elem, aMesh ); AddToSameGroups( newElem2, elem, aMesh );
aMesh->RemoveElement( elem ); aMesh->RemoveElement( elem );
@ -2980,8 +2979,8 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
// Quadratic quadrangle // Quadratic quadrangle
if( elem->NbNodes()==8 && elem->IsQuadratic() ) { else if ( elem->NbNodes() == 8 )
{
// get surface elem is on // get surface elem is on
int aShapeId = FindShape( elem ); int aShapeId = FindShape( elem );
if ( aShapeId != helper.GetSubShapeID() ) { if ( aShapeId != helper.GetSubShapeID() ) {
@ -3001,14 +3000,14 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
const SMDS_MeshNode* inFaceNode = 0; const SMDS_MeshNode* inFaceNode = 0;
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
int i = 0; int i = 0;
while ( itN->more() ) { if ( helper.GetNodeUVneedInFaceNode() )
aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() ); while ( itN->more() && !inFaceNode ) {
if ( !inFaceNode && helper.GetNodeUVneedInFaceNode() && aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
aNodes[ i-1 ]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) if ( aNodes[ i-1 ]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE )
{ {
inFaceNode = aNodes[ i-1 ]; inFaceNode = aNodes[ i-1 ];
}
} }
}
// find middle point for (0,1,2,3) // find middle point for (0,1,2,3)
// and create a node in this point; // and create a node in this point;
@ -3048,10 +3047,10 @@ bool SMESH_MeshEditor::QuadToTri (TIDSortedElemSet & theElems,
myLastCreatedElems.Append(newElem2); myLastCreatedElems.Append(newElem2);
// put a new triangle on the same shape and add to the same groups // put a new triangle on the same shape and add to the same groups
if ( aShapeId ) if ( aShapeId )
{ {
aMesh->SetMeshElementOnShape( newElem1, aShapeId ); aMesh->SetMeshElementOnShape( newElem1, aShapeId );
aMesh->SetMeshElementOnShape( newElem2, aShapeId ); aMesh->SetMeshElementOnShape( newElem2, aShapeId );
} }
AddToSameGroups( newElem1, elem, aMesh ); AddToSameGroups( newElem1, elem, aMesh );
AddToSameGroups( newElem2, elem, aMesh ); AddToSameGroups( newElem2, elem, aMesh );
aMesh->RemoveElement( elem ); aMesh->RemoveElement( elem );