SMESH_TRY;
// Read mesh with name = <theMeshName> into SMESH_Mesh
- _impl->STLToMesh( theFileName );
+ std::string name = _impl->STLToMesh( theFileName );
+ if ( !name.empty() )
+ {
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( study, _this() );
+ _gen_i->SetName( meshSO, name.c_str() );
+ }
SMESH_CATCH( SMESH::throwCorbaException );
TPythonDump() << SMESH::SMESH_Mesh_var(_this())
<< ".ExportSTL( r'" << file << "', " << isascii << " )";
+ CORBA::String_var name;
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, _this() );
+ if ( !so->_is_nil() )
+ name = so->GetName();
+
// Perform Export
- PrepareForWriting(file);
- _impl->ExportSTL(file, isascii);
+ PrepareForWriting( file );
+ _impl->ExportSTL( file, isascii, name.in() );
}
//================================================================================
PrepareForWriting(file);
+ CORBA::String_var name;
+ SALOMEDS::Study_var study = _gen_i->GetCurrentStudy();
+ SALOMEDS::SObject_wrap so = _gen_i->ObjectToSObject( study, meshPart );
+ if ( !so->_is_nil() )
+ name = so->GetName();
+
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportSTL(file, isascii, &partDS);
+ _impl->ExportSTL( file, isascii, name.in(), &partDS );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportPartToSTL( "
<< meshPart<< ", r'" << file << "', " << isascii << ")";
void SMESH_Mesh_i::ExportCGNS(::SMESH::SMESH_IDSource_ptr meshPart,
const char* file,
- CORBA::Boolean overwrite)
+ CORBA::Boolean overwrite,
+ CORBA::Boolean groupElemsByType)
throw (SALOME::SALOME_Exception)
{
#ifdef WITH_CGNS
CORBA::String_var name = so->GetName();
meshName = name.in();
}
+ SMESH_TRY;
+
SMESH_MeshPartDS partDS( meshPart );
- _impl->ExportCGNS(file, &partDS, meshName.c_str() );
+ _impl->ExportCGNS(file, &partDS, meshName.c_str(), groupElemsByType );
+
+ SMESH_CATCH( SMESH::throwCorbaException );
TPythonDump() << SMESH::SMESH_Mesh_var(_this()) << ".ExportCGNS( "
<< meshPart<< ", r'" << file << "', " << overwrite << ")";
return elemID;
}
+//================================================================================
+/*!
+ * \brief Return elements including all given nodes.
+ */
+//================================================================================
+
+SMESH::long_array* SMESH_Mesh_i::GetElementsByNodes(const SMESH::long_array& nodes,
+ SMESH::ElementType elemType)
+{
+ if ( _preMeshInfo )
+ _preMeshInfo->FullLoadFromFile();
+
+ SMESH::long_array_var result = new SMESH::long_array();
+
+ if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
+ {
+ vector< const SMDS_MeshNode * > nn( nodes.length() );
+ for ( CORBA::ULong i = 0; i < nodes.length(); ++i )
+ nn[i] = mesh->FindNode( nodes[i] );
+
+ std::vector<const SMDS_MeshElement *> elems;
+ mesh->GetElementsByNodes( nn, elems, (SMDSAbs_ElementType) elemType );
+ result->length( elems.size() );
+ for ( size_t i = 0; i < elems.size(); ++i )
+ result[i] = elems[i]->GetID();
+ }
+ return result._retn();
+}
+
//=============================================================================
/*!
* Returns true if given element is polygon