- if ( shapeIDs[ elemIndex ] > 0 )
- aMeshDS->SetMeshElementOnShape( elem, shapeIDs[ elemIndex ] );
+ int shapeID = shapeIDs[ elemIndex ];
+ if ( shapeID > 0 ) {
+ aMeshDS->SetMeshElementOnShape( elem, shapeID );
+ // set nodes on a shape
+ TopoDS_Shape S = aMeshDS->IndexToShape( shapeID );
+ if ( S.ShapeType() == TopAbs_SOLID ) {
+ TopoDS_Iterator shellIt( S );
+ if ( shellIt.More() )
+ shapeID = aMeshDS->ShapeToIndex( shellIt.Value() );
+ }
+ SMDS_ElemIteratorPtr noIt = elem->nodesIterator();
+ while ( noIt->more() ) {
+ SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>
+ ( static_cast<const SMDS_MeshNode*>( noIt->next() ));
+ if ( !node->GetPosition() || !node->GetPosition()->GetShapeId() ) {
+ if ( S.ShapeType() == TopAbs_FACE )
+ aMeshDS->SetNodeOnFace( node, shapeID );
+ else
+ aMeshDS->SetNodeInVolume( node, shapeID );
+ }
+ }
+ }