mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-05 03:04:18 +05:00
Implementation of NPAL13504 improvement.
This commit is contained in:
parent
8d59a5ffda
commit
e28cd63140
@ -83,6 +83,7 @@
|
||||
<hypothesis type="MaxElementVolume"
|
||||
label-id="Max. Element Volume"
|
||||
icon-id="mesh_hypo_volume.png"
|
||||
need-geom = "false"
|
||||
dim="3"/>
|
||||
|
||||
<hypothesis type="ProjectionSource3D"
|
||||
|
@ -162,6 +162,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
|
||||
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
|
||||
ret = false;;
|
||||
}
|
||||
if ((algo && !aMesh.HasShapeToMesh()))
|
||||
{
|
||||
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
||||
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
||||
|
||||
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
|
||||
ret = false;;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
|
@ -214,7 +214,7 @@ int SMESH_Mesh::UNVToMesh(const char* theFileName)
|
||||
if(MYDEBUG) MESSAGE("UNVToMesh - theFileName = "<<theFileName);
|
||||
if(_isShapeToMesh)
|
||||
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||
_isShapeToMesh = true;
|
||||
_isShapeToMesh = false;
|
||||
DriverUNV_R_SMDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
@ -269,7 +269,7 @@ int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
|
||||
if(MYDEBUG) MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
|
||||
if(_isShapeToMesh)
|
||||
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||
_isShapeToMesh = true;
|
||||
_isShapeToMesh = false;
|
||||
DriverMED_R_SMESHDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetMeshId(-1);
|
||||
@ -312,7 +312,7 @@ int SMESH_Mesh::STLToMesh(const char* theFileName)
|
||||
if(MYDEBUG) MESSAGE("STLToMesh - theFileName = "<<theFileName);
|
||||
if(_isShapeToMesh)
|
||||
throw SALOME_Exception(LOCALIZED("a shape to mesh has already been defined"));
|
||||
_isShapeToMesh = true;
|
||||
_isShapeToMesh = false;
|
||||
DriverSTL_R_SMDS_Mesh myReader;
|
||||
myReader.SetMesh(_myMeshDS);
|
||||
myReader.SetFile(theFileName);
|
||||
|
@ -1138,3 +1138,36 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check mesh without geometry for: if all elements on this shape are quadratic,
|
||||
* quadratic elements will be created.
|
||||
* Used then generated 3D mesh without geometry.
|
||||
*/
|
||||
SMESH_MesherHelper:: MType SMESH_MesherHelper::IsQuadraticMesh()
|
||||
{
|
||||
int NbAllEdgsAndFaces=0;
|
||||
int NbQuadFacesAndEdgs=0;
|
||||
int NbFacesAndEdges=0;
|
||||
//All faces and edges
|
||||
NbAllEdgsAndFaces = myMesh->NbEdges() + myMesh->NbFaces();
|
||||
|
||||
//Quadratic faces and edges
|
||||
NbQuadFacesAndEdgs = myMesh->NbEdges(ORDER_QUADRATIC) + myMesh->NbFaces(ORDER_QUADRATIC);
|
||||
|
||||
//Linear faces and edges
|
||||
NbFacesAndEdges = myMesh->NbEdges(ORDER_LINEAR) + myMesh->NbFaces(ORDER_LINEAR);
|
||||
|
||||
if (NbAllEdgsAndFaces == NbQuadFacesAndEdgs) {
|
||||
//Quadratic mesh
|
||||
return SMESH_MesherHelper::QUADRATIC;
|
||||
}
|
||||
else if (NbAllEdgsAndFaces == NbFacesAndEdges) {
|
||||
//Linear mesh
|
||||
return SMESH_MesherHelper::LINEAR;
|
||||
}
|
||||
else
|
||||
//Mesh with both type of elements
|
||||
return SMESH_MesherHelper::COMP;
|
||||
}
|
||||
|
||||
|
@ -306,6 +306,14 @@ public:
|
||||
*/
|
||||
const NLinkNodeMap& GetNLinkNodeMap() const { return myNLinkNodeMap; }
|
||||
|
||||
/**
|
||||
* Check mesh without geometry for: if all elements on this shape are quadratic,
|
||||
* quadratic elements will be created.
|
||||
* Used then generated 3D mesh without geometry.
|
||||
*/
|
||||
enum MType{ LINEAR, QUADRATIC, COMP };
|
||||
MType IsQuadraticMesh();
|
||||
|
||||
protected:
|
||||
|
||||
/*!
|
||||
|
@ -412,11 +412,13 @@ const map < int, SMESH_subMesh * >& SMESH_subMesh::DependsOn()
|
||||
case TopAbs_SOLID:
|
||||
{
|
||||
//MESSAGE("solid");
|
||||
if(_father->HasShapeToMesh()) {
|
||||
for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
|
||||
exp.Next())
|
||||
{
|
||||
InsertDependence(exp.Current());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TopAbs_FACE:
|
||||
@ -496,9 +498,14 @@ const TopoDS_Shape & SMESH_subMesh::GetSubShape() const
|
||||
bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const
|
||||
{
|
||||
int aHypDim = theHypothesis->GetDim();
|
||||
if(_father->HasShapeToMesh()) {
|
||||
int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
|
||||
if ( aHypDim <= aShapeDim )
|
||||
return true;
|
||||
}
|
||||
else
|
||||
//Only 3D hypothesis may be assigned to the mesh w/o geometry
|
||||
return aHypDim == 3;
|
||||
// if ( aHypDim < aShapeDim )
|
||||
// return ( _father->IsMainShape( _subShape ));
|
||||
|
||||
@ -601,6 +608,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
// check if a shape needed by algo is present
|
||||
// -------------------------------------------
|
||||
algo = static_cast< SMESH_Algo* >( anHyp );
|
||||
if(_father->GetShapeToMesh() != SMESH_Mesh::PseudoShape())
|
||||
if ( !_father->HasShapeToMesh() && algo->NeedShape() )
|
||||
return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
|
||||
// ----------------------
|
||||
@ -618,6 +626,17 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
if ( ! CanAddHypothesis( anHyp )) // check dimension
|
||||
return SMESH_Hypothesis::HYP_BAD_DIM;
|
||||
|
||||
if(anHyp->GetDim() == 3 && !_father->HasShapeToMesh()
|
||||
&& event == ADD_ALGO) {
|
||||
//Only NETGEN_3D and GHS3D_3D can be assigned to the Mesh w/o geometryy
|
||||
bool isNetgen3D = (strcmp( "NETGEN_3D", anHyp->GetName()) == 0);
|
||||
bool isGhs3d = (strcmp( "GHS3D_3D", anHyp->GetName()) == 0);
|
||||
if( !isNetgen3D && !isGhs3d)
|
||||
return SMESH_Hypothesis::HYP_BAD_DIM;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
|
||||
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
|
||||
|
||||
|
@ -806,7 +806,9 @@ void SMESHGUI_ComputeOp::startOperation()
|
||||
MemoryReserve aMemoryReserve;
|
||||
_PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
|
||||
myMainShape = aMesh->GetShapeToMesh();
|
||||
if ( !myMainShape->_is_nil() && aMeshSObj )
|
||||
if ( ((!myMainShape->_is_nil() && aMesh->HasShapeToMesh()) ||
|
||||
(myMainShape->_is_nil() && !aMesh->HasShapeToMesh()))
|
||||
&& aMeshSObj )
|
||||
{
|
||||
myDlg->myMeshName->setText( aMeshSObj->GetName() );
|
||||
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
|
||||
@ -920,9 +922,19 @@ void SMESHGUI_ComputeOp::startOperation()
|
||||
myDlg->myFullInfo->hide();
|
||||
myDlg->myErrorGroup->show();
|
||||
|
||||
bool hasShape = aMesh->HasShapeToMesh();
|
||||
if ( !hasShape )
|
||||
{
|
||||
myDlg->myPublishBtn->hide();
|
||||
myDlg->myShowBtn->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
myDlg->myPublishBtn->show();
|
||||
myDlg->myShowBtn->show();
|
||||
}
|
||||
// fill table of errors
|
||||
tbl->setNumRows( anErrors->length() );
|
||||
bool hasShape = aMesh->HasShapeToMesh();
|
||||
if ( !hasShape ) tbl->hideColumn( COL_SHAPE );
|
||||
else tbl->showColumn( COL_SHAPE );
|
||||
tbl->setColumnWidth( COL_ERROR, 200 );
|
||||
|
@ -149,7 +149,8 @@ class HypothesisData
|
||||
const QStringList& theNeededHypos,
|
||||
const QStringList& theOptionalHypos,
|
||||
const QStringList& theInputTypes,
|
||||
const QStringList& theOutputTypes)
|
||||
const QStringList& theOutputTypes,
|
||||
const bool theIsNeedGeometry = true)
|
||||
: TypeName( theTypeName ),
|
||||
PluginName( thePluginName ),
|
||||
ServerLibName( theServerLibName ),
|
||||
@ -159,7 +160,8 @@ class HypothesisData
|
||||
Dim( theDim ),
|
||||
IsAux( theIsAux ),
|
||||
NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ),
|
||||
InputTypes( theInputTypes ), OutputTypes( theOutputTypes )
|
||||
InputTypes( theInputTypes ), OutputTypes( theOutputTypes ),
|
||||
IsNeedGeometry( theIsNeedGeometry )
|
||||
{};
|
||||
|
||||
QString TypeName; //!< hypothesis type name
|
||||
@ -170,6 +172,7 @@ class HypothesisData
|
||||
QString IconId; //!< icon identifier
|
||||
QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
|
||||
bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
|
||||
bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise
|
||||
|
||||
// for algorithm only: dependencies algo <-> algo and algo -> hypos
|
||||
QStringList NeededHypos; //!< list of obligatory hypotheses
|
||||
|
@ -208,13 +208,14 @@ namespace SMESH{
|
||||
|
||||
QStringList GetAvailableHypotheses( const bool isAlgo,
|
||||
const int theDim,
|
||||
const bool isAux )
|
||||
const bool isAux,
|
||||
const bool isNeedGeometry)
|
||||
{
|
||||
QStringList aHypList;
|
||||
|
||||
// Init list of available hypotheses, if needed
|
||||
InitAvailableHypotheses();
|
||||
|
||||
bool checkGeometry = !isNeedGeometry;
|
||||
// fill list of hypotheses/algorithms
|
||||
THypothesisDataMap* pMap = isAlgo ? &myAlgorithmsMap : &myHypothesesMap;
|
||||
THypothesisDataMap::iterator anIter;
|
||||
@ -222,6 +223,11 @@ namespace SMESH{
|
||||
{
|
||||
HypothesisData* aData = (*anIter).second;
|
||||
if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux)
|
||||
if (checkGeometry){
|
||||
if (aData->IsNeedGeometry == isNeedGeometry)
|
||||
aHypList.append(((*anIter).first).c_str());
|
||||
}
|
||||
else
|
||||
aHypList.append(((*anIter).first).c_str());
|
||||
}
|
||||
return aHypList;
|
||||
@ -533,7 +539,6 @@ namespace SMESH{
|
||||
if (MorSM) {
|
||||
try {
|
||||
GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
|
||||
if (!aShapeObject->_is_nil()) {
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
|
||||
|
||||
@ -541,19 +546,29 @@ namespace SMESH{
|
||||
aMesh = aSubMesh->GetFather();
|
||||
|
||||
if (!aMesh->_is_nil()) {
|
||||
if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
|
||||
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
|
||||
if (meshSO)
|
||||
SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
|
||||
}
|
||||
|
||||
}
|
||||
else if(!aMesh->HasShapeToMesh()){
|
||||
res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
|
||||
if (res < SMESH::HYP_UNKNOWN_FATAL) {
|
||||
_PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
|
||||
if (meshSO)
|
||||
SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
|
||||
}
|
||||
}
|
||||
if (res > SMESH::HYP_OK) {
|
||||
wc.suspend();
|
||||
processHypothesisStatus(res, anHyp, false);
|
||||
wc.resume();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
wc.suspend();
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
|
@ -57,7 +57,8 @@ namespace SMESH{
|
||||
SMESHGUI_EXPORT
|
||||
QStringList GetAvailableHypotheses( const bool isAlgo,
|
||||
const int theDim = -1,
|
||||
const bool isAux = false);
|
||||
const bool isAux = false,
|
||||
const bool isNeedGeometry = true);
|
||||
SMESHGUI_EXPORT
|
||||
QStringList GetHypothesesSets();
|
||||
|
||||
|
@ -569,6 +569,27 @@ void SMESHGUI_MeshDlg::setGeomPopupEnabled( const bool enable )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Disable tab
|
||||
* \param int - tab ID
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshDlg::disableTab(const int theTabId) {
|
||||
myTabWg->setTabEnabled( myTabs[ theTabId ], false );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Enable tabs
|
||||
* \param int - tab ID
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshDlg::enableTab(const int theTabId) {
|
||||
myTabWg->setTabEnabled( myTabs[ theTabId ], true );
|
||||
}
|
||||
|
||||
void SMESHGUI_MeshDlg::onGeomSelectionButton(bool isBtnOn)
|
||||
{
|
||||
if ( myGeomPopup && isBtnOn )
|
||||
|
@ -74,6 +74,9 @@ public:
|
||||
void setMaxHypoDim( const int );
|
||||
void setHypoSets( const QStringList& );
|
||||
void setGeomPopupEnabled( const bool );
|
||||
void disableTab(const int);
|
||||
void enableTab(const int);
|
||||
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -102,6 +102,7 @@ SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
|
||||
{
|
||||
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
|
||||
GeometryGUI::InitGeomGen();
|
||||
myIsOnGeometry = true;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -417,10 +418,29 @@ void SMESHGUI_MeshOp::selectionDone()
|
||||
|
||||
try
|
||||
{
|
||||
//Check geometry for mesh
|
||||
QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
|
||||
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
|
||||
if ( !pObj )
|
||||
return;
|
||||
|
||||
SMESH::SMESH_subMesh_var aSubMeshVar =
|
||||
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||
if ( !aSubMeshVar->_is_nil() )
|
||||
myIsOnGeometry = true;
|
||||
else {
|
||||
SMESH::SMESH_Mesh_var aMeshVar =
|
||||
SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||
if ( !myToCreate && !aMeshVar->HasShapeToMesh() )
|
||||
myIsOnGeometry = false;
|
||||
else
|
||||
myIsOnGeometry = true;
|
||||
}
|
||||
|
||||
if ( myIsOnGeometry ) {
|
||||
// Enable tabs according to shape dimension
|
||||
|
||||
int shapeDim = 3;
|
||||
|
||||
QStringList aGEOMs;
|
||||
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
|
||||
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
|
||||
@ -484,10 +504,13 @@ void SMESHGUI_MeshOp::selectionDone()
|
||||
_PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() );
|
||||
if ( pObj != 0 )
|
||||
{
|
||||
|
||||
SMESH::SMESH_subMesh_var aVar =
|
||||
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true );
|
||||
myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
|
||||
myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide();
|
||||
myDlg->updateGeometry();
|
||||
myDlg->adjustSize();
|
||||
readMesh();
|
||||
@ -533,6 +556,24 @@ void SMESHGUI_MeshOp::selectionDone()
|
||||
myDlg->setGeomPopupEnabled( enable );
|
||||
}
|
||||
}
|
||||
else {
|
||||
myDlg->enableTab( SMESH::DIM_3D );
|
||||
QStringList hypList;
|
||||
availableHyps( SMESH::DIM_3D, Algo, hypList,
|
||||
myAvailableHypData[SMESH::DIM_3D][Algo]);
|
||||
|
||||
SMESHGUI_MeshTab* aTab = myDlg->tab( SMESH::DIM_3D );
|
||||
aTab->setAvailableHyps( Algo, hypList );
|
||||
for( int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i ) {
|
||||
myDlg->disableTab(i);
|
||||
}
|
||||
//Hide labels and fields (Mesh ang Geometry)
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, false );
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, false );
|
||||
myDlg->adjustSize();
|
||||
readMesh();
|
||||
}
|
||||
}
|
||||
catch ( const SALOME::SALOME_Exception& S_ex )
|
||||
{
|
||||
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||
@ -570,7 +611,7 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
// Imported mesh, if create sub-mesh or edit mesh
|
||||
/* // Imported mesh, if create sub-mesh or edit mesh
|
||||
if ( !myToCreate || ( myToCreate && !myIsMesh ))
|
||||
{
|
||||
QString aMeshEntry = myDlg->selectedObject
|
||||
@ -582,7 +623,7 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Geom
|
||||
if ( myToCreate )
|
||||
@ -673,7 +714,7 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim,
|
||||
theHyps.clear();
|
||||
bool isAlgo = ( theHypType == Algo );
|
||||
bool isAux = ( theHypType == AddHyp );
|
||||
QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux );
|
||||
QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry );
|
||||
|
||||
QStringList::const_iterator anIter;
|
||||
for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter )
|
||||
@ -1224,6 +1265,9 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
|
||||
}
|
||||
else {
|
||||
bool mainHyp = true;
|
||||
QStringList anAvailable;
|
||||
availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
|
||||
myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
|
||||
int index = myAvailableHypData[aDim][MainHyp].findIndex( aHypData );
|
||||
if ( index < 0 ) {
|
||||
mainHyp = false;
|
||||
@ -1591,6 +1635,7 @@ void SMESHGUI_MeshOp::readMesh()
|
||||
if ( !pObj )
|
||||
return;
|
||||
|
||||
if( myIsOnGeometry ) {
|
||||
// Get name of mesh if current object is sub-mesh
|
||||
SMESH::SMESH_subMesh_var aSubMeshVar =
|
||||
SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
|
||||
@ -1613,10 +1658,12 @@ void SMESHGUI_MeshOp::readMesh()
|
||||
QString aShapeName = name( aGeomSO );
|
||||
myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName );
|
||||
}
|
||||
}
|
||||
|
||||
// Get hypotheses and algorithms assigned to the mesh/sub-mesh
|
||||
QStringList anExisting;
|
||||
for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
|
||||
const int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
|
||||
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
||||
{
|
||||
// get algorithm
|
||||
existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
|
||||
@ -1641,7 +1688,7 @@ void SMESHGUI_MeshOp::readMesh()
|
||||
|
||||
// get hypotheses
|
||||
bool hypWithoutAlgo = false;
|
||||
for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
|
||||
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
||||
{
|
||||
for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
|
||||
{
|
||||
@ -1754,18 +1801,19 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
|
||||
// Set new name
|
||||
QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
|
||||
SMESH::SetName( pObj, aName.latin1() );
|
||||
int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
|
||||
|
||||
// First, remove old algos in order to avoid messages on algorithm hiding
|
||||
for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
|
||||
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
||||
{
|
||||
if ( isAccessibleDim( dim ) && myObjHyps[ dim ][ Algo ].count() > 0 )
|
||||
{
|
||||
SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first().first;
|
||||
CORBA::String_var anOldName = anOldAlgo->GetName();
|
||||
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
|
||||
CORBA::String_var anAlgoName = anAlgoVar->GetName();
|
||||
// CORBA::String_var anAlgoName = anAlgoVar->GetName();
|
||||
if ( anAlgoVar->_is_nil() || // no new algo selected or
|
||||
strcmp(anOldName.in(), anAlgoName.in()) ) // algo change
|
||||
strcmp(anOldName.in(), anAlgoVar->GetName()) ) // algo change
|
||||
{
|
||||
// remove old algorithm
|
||||
SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first().first );
|
||||
@ -1775,7 +1823,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
|
||||
}
|
||||
|
||||
// Assign new algorithms and hypotheses
|
||||
for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
|
||||
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
|
||||
{
|
||||
if ( !isAccessibleDim( dim )) continue;
|
||||
|
||||
|
@ -137,6 +137,7 @@ private:
|
||||
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
|
||||
bool myToCreate;
|
||||
bool myIsMesh;
|
||||
bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
|
||||
|
||||
TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
|
||||
TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
|
||||
|
@ -296,9 +296,26 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const
|
||||
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
|
||||
//FindSObject( mesh );
|
||||
if ( so ) {
|
||||
CORBA::Object_var obj = SMESH::SObjectToObject(so, SMESH::GetActiveStudyDocument());
|
||||
if(!CORBA::is_nil(obj)){
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||
if (!mesh->_is_nil()){
|
||||
if(mesh->HasShapeToMesh()) {
|
||||
GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
|
||||
return QVariant( !shape->_is_nil(), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant(!mesh->NbFaces()==0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
|
||||
return QVariant( !shape->_is_nil(), 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -130,6 +130,10 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
|
||||
QString aLabel = atts.value("label-id");
|
||||
QString anIcon = atts.value("icon-id");
|
||||
bool isAux = atts.value("auxiliary") == "true";
|
||||
bool isNeedGeom = true;
|
||||
QString aNeedGeom = atts.value("need-geom");
|
||||
if ( !aNeedGeom.isEmpty() )
|
||||
isNeedGeom = (aNeedGeom == "true");
|
||||
|
||||
QString aDimStr = atts.value("dim");
|
||||
aDimStr = aDimStr.remove( ' ' );
|
||||
@ -159,7 +163,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
|
||||
HypothesisData* aHypData =
|
||||
new HypothesisData (aHypAlType, myPluginName, myServerLib, myClientLib,
|
||||
aLabel, anIcon, aDim, isAux,
|
||||
attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ]);
|
||||
attr[ HYPOS ], attr[ OPT_HYPOS ], attr[ INPUT ], attr[ OUTPUT ], isNeedGeom );
|
||||
|
||||
if (qName == "algorithm")
|
||||
{
|
||||
|
@ -81,6 +81,7 @@ static TCollection_AsciiString theEmptyString;
|
||||
#undef DUMP_CONVERSION
|
||||
#endif
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
//================================================================================
|
||||
@ -250,7 +251,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
AddMeshAccessorMethod( aCommand );
|
||||
|
||||
// Add access to a wrapped algorithm
|
||||
AddAlgoAccessorMethod( aCommand ); // ??? what if algo won't be wrapped at all ???
|
||||
// AddAlgoAccessorMethod( aCommand ); // ??? what if algo won't be wrapped at all ???
|
||||
|
||||
// PAL12227. PythonDump was not updated at proper time; result is
|
||||
// aCriteria.append(SMESH.Filter.Criterion(17,26,0,'L1',26,25,1e-07,SMESH.EDGE,-1))
|
||||
@ -287,16 +288,26 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
// Concatenate( [mesh1, ...], ... )
|
||||
// CreateHypothesis( theHypType, theLibName )
|
||||
// Compute( mesh, geom )
|
||||
|
||||
// mesh creation
|
||||
if ( theCommand->GetMethod() == "CreateMesh" ||
|
||||
theCommand->GetMethod() == "CreateEmptyMesh" )
|
||||
theCommand->GetMethod() == "CreateEmptyMesh" ||
|
||||
theCommand->GetMethod() == "CreateMeshesFromUNV" ||
|
||||
theCommand->GetMethod() == "CreateMeshesFromSTL")
|
||||
{
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand );
|
||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
||||
return;
|
||||
}
|
||||
|
||||
if(theCommand->GetMethod() == "CreateMeshesFromMED")
|
||||
{
|
||||
for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
|
||||
{
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind));
|
||||
myMeshes.insert( make_pair( theCommand->GetResultValue(ind), mesh ));
|
||||
}
|
||||
}
|
||||
|
||||
// CreateHypothesis()
|
||||
if ( theCommand->GetMethod() == "CreateHypothesis" )
|
||||
{
|
||||
@ -589,12 +600,32 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd):
|
||||
{
|
||||
// convert my creation command
|
||||
Handle(_pyCommand) creationCmd = GetCreationCmd();
|
||||
TCollection_AsciiString str = creationCmd->GetMethod();
|
||||
|
||||
creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
|
||||
if(str != "CreateMeshesFromUNV" &&
|
||||
str != "CreateMeshesFromMED" &&
|
||||
str != "CreateMeshesFromSTL")
|
||||
creationCmd->SetMethod( "Mesh" );
|
||||
|
||||
theGen->SetAccessorMethod( GetID(), "GetMesh()" );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief
|
||||
* \param theCreationCmd -
|
||||
*/
|
||||
//================================================================================
|
||||
_pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const TCollection_AsciiString& id):
|
||||
_pyObject(theCreationCmd), myHasEditor(false)
|
||||
{
|
||||
// convert my creation command
|
||||
Handle(_pyCommand) creationCmd = GetCreationCmd();
|
||||
creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
|
||||
theGen->SetAccessorMethod( id, "GetMesh()" );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Convert a IDL API command of SMESH::Mesh to a method call of python Mesh
|
||||
@ -676,7 +707,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
|
||||
}
|
||||
}
|
||||
Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
|
||||
if ( ! hasAddCmd ) { // hypo addition already wrapped
|
||||
if ( ! hasAddCmd && hypID.Length() != 0 ) { // hypo addition already wrapped
|
||||
// RemoveHypothesis(geom, hyp) --> RemoveHypothesis( hyp, geom=0 )
|
||||
_pyID geom = theCommand->GetArg( 1 );
|
||||
theCommand->RemoveArgs();
|
||||
@ -1562,6 +1593,54 @@ const TCollection_AsciiString & _pyCommand::GetResultValue()
|
||||
return myRes;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return number of python command result value ResultValue = Obj.Meth()
|
||||
* \retval const int
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
const int _pyCommand::GetNbResultValues()
|
||||
{
|
||||
int begPos = 1;
|
||||
int Nb=0;
|
||||
int endPos = myString.Location( "=", 1, Length() );
|
||||
TCollection_AsciiString str = "";
|
||||
while ( begPos < endPos) {
|
||||
str = GetWord( myString, begPos, true );
|
||||
begPos = begPos+ str.Length();
|
||||
Nb++;
|
||||
}
|
||||
return (Nb-1);
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return substring of python command looking like
|
||||
* ResultValue1 , ResultValue1,... = Obj.Meth() with res index
|
||||
* \retval const TCollection_AsciiString & - ResultValue with res index substring
|
||||
*/
|
||||
//================================================================================
|
||||
const TCollection_AsciiString & _pyCommand::GetResultValue(int res)
|
||||
{
|
||||
int begPos = 1;
|
||||
int Nb=0;
|
||||
int endPos = myString.Location( "=", 1, Length() );
|
||||
while ( begPos < endPos) {
|
||||
myRes = GetWord( myString, begPos, true );
|
||||
begPos = begPos + myRes.Length();
|
||||
Nb++;
|
||||
if(res == Nb){
|
||||
myRes.RemoveAll('[');myRes.RemoveAll(']');
|
||||
return myRes;
|
||||
}
|
||||
if(Nb>res)
|
||||
break;
|
||||
}
|
||||
return theEmptyString;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return substring of python command looking like ResVal = Object.Meth()
|
||||
|
@ -111,6 +111,8 @@ public:
|
||||
bool IsEmpty() const { return myString.IsEmpty(); }
|
||||
TCollection_AsciiString GetIndentation();
|
||||
const TCollection_AsciiString & GetResultValue();
|
||||
const int GetNbResultValues();
|
||||
const TCollection_AsciiString & GetResultValue(int res);
|
||||
const TCollection_AsciiString & GetObject();
|
||||
const TCollection_AsciiString & GetMethod();
|
||||
const TCollection_AsciiString & GetArg( int index );
|
||||
@ -210,6 +212,7 @@ class _pyMesh: public _pyObject
|
||||
bool myHasEditor;
|
||||
public:
|
||||
_pyMesh(const Handle(_pyCommand) theCreationCmd);
|
||||
_pyMesh(const Handle(_pyCommand) theCreationCmd, const TCollection_AsciiString &);
|
||||
const _pyID& GetGeom() { return GetCreationCmd()->GetArg(1); }
|
||||
void Process( const Handle(_pyCommand)& theCommand);
|
||||
void Flush();
|
||||
|
@ -1030,7 +1030,7 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetComputeErrors()" );
|
||||
|
||||
if ( CORBA::is_nil( theSubObject ) )
|
||||
if ( CORBA::is_nil( theSubObject ) && theMesh->HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
|
||||
|
||||
if ( CORBA::is_nil( theMesh ) )
|
||||
@ -1040,7 +1040,12 @@ SMESH::compute_error_array* SMESH_Gen_i::GetComputeErrors( SMESH::SMESH_Mesh_ptr
|
||||
try {
|
||||
if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ))
|
||||
{
|
||||
TopoDS_Shape shape = GeomObjectToShape( theSubObject );
|
||||
TopoDS_Shape shape;
|
||||
if(theMesh->HasShapeToMesh())
|
||||
shape = GeomObjectToShape( theSubObject );
|
||||
else
|
||||
shape = SMESH_Mesh::PseudoShape();
|
||||
|
||||
::SMESH_Mesh& mesh = meshServant->GetImpl();
|
||||
|
||||
error_array->length( mesh.GetMeshDS()->MaxShapeIndex() );
|
||||
@ -1095,7 +1100,7 @@ SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMes
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetAlgoState()" );
|
||||
|
||||
if ( CORBA::is_nil( theSubObject ) )
|
||||
if ( CORBA::is_nil( theSubObject ) && theMesh->HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
|
||||
|
||||
if ( CORBA::is_nil( theMesh ) )
|
||||
@ -1106,7 +1111,12 @@ SMESH::algo_error_array* SMESH_Gen_i::GetAlgoState( SMESH::SMESH_Mesh_ptr theMes
|
||||
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
|
||||
ASSERT( meshServant );
|
||||
if ( meshServant ) {
|
||||
TopoDS_Shape myLocShape = GeomObjectToShape( theSubObject );
|
||||
TopoDS_Shape myLocShape;
|
||||
if(theMesh->HasShapeToMesh())
|
||||
myLocShape = GeomObjectToShape( theSubObject );
|
||||
else
|
||||
myLocShape = SMESH_Mesh::PseudoShape();
|
||||
|
||||
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
|
||||
list< ::SMESH_Gen::TAlgoStateError > error_list;
|
||||
list< ::SMESH_Gen::TAlgoStateError >::iterator error;
|
||||
@ -1224,7 +1234,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
|
||||
|
||||
if ( CORBA::is_nil( theShapeObject ) )
|
||||
if ( CORBA::is_nil( theShapeObject ) && theMesh->HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
|
||||
SALOME::BAD_PARAM );
|
||||
|
||||
@ -1244,7 +1254,11 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
// NPAL16168: "geometrical group edition from a submesh don't modifiy mesh computation"
|
||||
meshServant->CheckGeomGroupModif();
|
||||
// get local TopoDS_Shape
|
||||
TopoDS_Shape myLocShape = GeomObjectToShape( theShapeObject );
|
||||
TopoDS_Shape myLocShape;
|
||||
if(theMesh->HasShapeToMesh())
|
||||
myLocShape = GeomObjectToShape( theShapeObject );
|
||||
else
|
||||
myLocShape = SMESH_Mesh::PseudoShape();
|
||||
// call implementation compute
|
||||
::SMESH_Mesh& myLocMesh = meshServant->GetImpl();
|
||||
return myGen.Compute( myLocMesh, myLocShape);
|
||||
@ -1785,6 +1799,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
int id = myStudyContext->findId( string( objStr.in() ) );
|
||||
::SMESH_Mesh& myLocMesh = myImpl->GetImpl();
|
||||
SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS();
|
||||
bool hasShape = myLocMesh.HasShapeToMesh();
|
||||
|
||||
// for each mesh open the HDF group basing on its id
|
||||
char meshGrpName[ 30 ];
|
||||
@ -1830,10 +1845,10 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
// write applied hypotheses if exist
|
||||
SALOMEDS::SObject_var myHypBranch;
|
||||
found = gotBranch->FindSubObject( GetRefOnAppliedHypothesisTag(), myHypBranch );
|
||||
if ( found && !shapeRefFound ) { // remove applied hyps
|
||||
if ( found && !shapeRefFound && hasShape) { // remove applied hyps
|
||||
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myHypBranch );
|
||||
}
|
||||
if ( found && shapeRefFound ) {
|
||||
if ( found && (shapeRefFound || !hasShape) ) {
|
||||
aGroup = new HDFgroup( "Applied Hypotheses", aTopGroup );
|
||||
aGroup->CreateOnDisk();
|
||||
|
||||
@ -1873,10 +1888,10 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
// write applied algorithms if exist
|
||||
SALOMEDS::SObject_var myAlgoBranch;
|
||||
found = gotBranch->FindSubObject( GetRefOnAppliedAlgorithmsTag(), myAlgoBranch );
|
||||
if ( found && !shapeRefFound ) { // remove applied algos
|
||||
if ( found && !shapeRefFound && hasShape) { // remove applied algos
|
||||
myCurrentStudy->NewBuilder()->RemoveObjectWithChildren( myAlgoBranch );
|
||||
}
|
||||
if ( found && shapeRefFound ) {
|
||||
if ( found && (shapeRefFound || !hasShape)) {
|
||||
aGroup = new HDFgroup( "Applied Algorithms", aTopGroup );
|
||||
aGroup->CreateOnDisk();
|
||||
|
||||
@ -2185,7 +2200,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
myWriter.Perform();
|
||||
|
||||
// maybe a shape was deleted in the study
|
||||
if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() ) {
|
||||
if ( !shapeRefFound && !mySMESHDSMesh->ShapeToMesh().IsNull() && hasShape) {
|
||||
TopoDS_Shape nullShape;
|
||||
myLocMesh.ShapeToMesh( nullShape ); // remove shape referring data
|
||||
}
|
||||
@ -2911,7 +2926,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
|
||||
if ( !CORBA::is_nil( hypObject ) ) {
|
||||
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
|
||||
if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
|
||||
if ( !anHyp->_is_nil() && (!aShapeObject->_is_nil()
|
||||
|| !myNewMeshImpl->HasShapeToMesh()) )
|
||||
myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
|
||||
}
|
||||
}
|
||||
@ -2948,7 +2964,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
CORBA::Object_var hypObject = GetORB()->string_to_object( anIOR.c_str() );
|
||||
if ( !CORBA::is_nil( hypObject ) ) {
|
||||
SMESH::SMESH_Hypothesis_var anHyp = SMESH::SMESH_Hypothesis::_narrow( hypObject );
|
||||
if ( !anHyp->_is_nil() && !aShapeObject->_is_nil() )
|
||||
if ( !anHyp->_is_nil() && (!aShapeObject->_is_nil()
|
||||
|| !myNewMeshImpl->HasShapeToMesh()) )
|
||||
myNewMeshImpl->addHypothesis( aShapeObject, anHyp );
|
||||
}
|
||||
}
|
||||
@ -3314,9 +3331,14 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
} // if ( hasData )
|
||||
|
||||
// Recompute State (as computed sub-meshes are restored from MED)
|
||||
if ( !aShapeObject->_is_nil() ) {
|
||||
if ( !aShapeObject->_is_nil() || !myNewMeshImpl->HasShapeToMesh()) {
|
||||
MESSAGE("Compute State Engine ...");
|
||||
TopoDS_Shape myLocShape = GeomObjectToShape( aShapeObject );
|
||||
TopoDS_Shape myLocShape;
|
||||
if(myNewMeshImpl->HasShapeToMesh())
|
||||
myLocShape = GeomObjectToShape( aShapeObject );
|
||||
else
|
||||
myLocShape = SMESH_Mesh::PseudoShape();
|
||||
|
||||
myNewMeshImpl->GetImpl().GetSubMesh(myLocShape)->ComputeStateEngine
|
||||
(SMESH_subMesh::SUBMESH_RESTORED);
|
||||
MESSAGE("Compute State Engine finished");
|
||||
|
@ -740,10 +740,15 @@ SALOMEDS::SObject_ptr
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape")
|
||||
SALOMEDS::SObject_var aMeshOrSubMesh;
|
||||
if ( theShape->_is_nil() || theMesh->_is_nil() )
|
||||
if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh()))
|
||||
return aMeshOrSubMesh._retn();
|
||||
|
||||
TopoDS_Shape aShape = GeomObjectToShape( theShape );
|
||||
TopoDS_Shape aShape;
|
||||
if(theMesh->HasShapeToMesh())
|
||||
aShape = GeomObjectToShape( theShape );
|
||||
else
|
||||
aShape = SMESH_Mesh::PseudoShape();
|
||||
|
||||
SMESH_Mesh_i* mesh_i = objectToServant<SMESH_Mesh_i>( theMesh );
|
||||
|
||||
if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) {
|
||||
@ -773,7 +778,8 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr theStudy,
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("AddHypothesisToShape")
|
||||
if (theStudy->_is_nil() || theMesh->_is_nil() ||
|
||||
theHyp->_is_nil() || theShape->_is_nil() )
|
||||
theHyp->_is_nil() || (theShape->_is_nil()
|
||||
&& theMesh->HasShapeToMesh()) )
|
||||
return false;
|
||||
|
||||
SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh );
|
||||
@ -827,7 +833,8 @@ bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy
|
||||
SMESH::SMESH_Hypothesis_ptr theHyp)
|
||||
{
|
||||
if (theStudy->_is_nil() || theMesh->_is_nil() ||
|
||||
theHyp->_is_nil() || theShape->_is_nil() )
|
||||
theHyp->_is_nil() || (theShape->_is_nil()
|
||||
&& theMesh->HasShapeToMesh()))
|
||||
return false;
|
||||
|
||||
SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp );
|
||||
|
@ -364,8 +364,13 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Object_ptr aSubS
|
||||
if(MYDEBUG) MESSAGE( " AddHypothesis(): status = " << status );
|
||||
|
||||
// Update Python script
|
||||
if(_impl->HasShapeToMesh()) {
|
||||
TPythonDump() << "status = " << _this() << ".AddHypothesis( "
|
||||
<< aSubShapeObject << ", " << anHyp << " )";
|
||||
}
|
||||
else {
|
||||
TPythonDump() << "status = " << _this() << ".AddHypothesis( "<< anHyp << " )";
|
||||
}
|
||||
|
||||
return ConvertHypothesisStatus(status);
|
||||
}
|
||||
@ -382,7 +387,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
{
|
||||
if(MYDEBUG) MESSAGE("addHypothesis");
|
||||
|
||||
if (CORBA::is_nil(aSubShapeObject))
|
||||
if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
|
||||
SALOME::BAD_PARAM);
|
||||
|
||||
@ -394,7 +399,13 @@ SMESH_Hypothesis::Hypothesis_Status
|
||||
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
|
||||
try
|
||||
{
|
||||
TopoDS_Shape myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
|
||||
TopoDS_Shape myLocSubShape;
|
||||
//use PseudoShape in case if mesh has no shape
|
||||
if(HasShapeToMesh())
|
||||
myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
|
||||
else
|
||||
myLocSubShape = _impl->GetShapeToMesh();
|
||||
|
||||
int hypId = myHyp->GetId();
|
||||
status = _impl->AddHypothesis(myLocSubShape, hypId);
|
||||
if ( !SMESH_Hypothesis::IsStatusFatal(status) ) {
|
||||
@ -432,8 +443,15 @@ SMESH::Hypothesis_Status SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Object_ptr aS
|
||||
aSubShapeObject, anHyp );
|
||||
|
||||
// Update Python script
|
||||
// Update Python script
|
||||
if(_impl->HasShapeToMesh()) {
|
||||
TPythonDump() << "status = " << _this() << ".RemoveHypothesis( "
|
||||
<< aSubShapeObject << ", " << anHyp << " )";
|
||||
}
|
||||
else {
|
||||
TPythonDump() << "status = " << _this() << ".RemoveHypothesis( "
|
||||
<< anHyp << " )";
|
||||
}
|
||||
|
||||
return ConvertHypothesisStatus(status);
|
||||
}
|
||||
@ -450,7 +468,7 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Ob
|
||||
if(MYDEBUG) MESSAGE("removeHypothesis()");
|
||||
// **** proposer liste de subShape (selection multiple)
|
||||
|
||||
if (CORBA::is_nil(aSubShapeObject))
|
||||
if (CORBA::is_nil(aSubShapeObject) && HasShapeToMesh())
|
||||
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference",
|
||||
SALOME::BAD_PARAM);
|
||||
|
||||
@ -462,7 +480,13 @@ SMESH_Hypothesis::Hypothesis_Status SMESH_Mesh_i::removeHypothesis(GEOM::GEOM_Ob
|
||||
SMESH_Hypothesis::Hypothesis_Status status = SMESH_Hypothesis::HYP_OK;
|
||||
try
|
||||
{
|
||||
TopoDS_Shape myLocSubShape = _gen_i->GeomObjectToShape(aSubShapeObject);
|
||||
TopoDS_Shape myLocSubShape;
|
||||
//use PseudoShape in case if mesh has no shape
|
||||
if(HasShapeToMesh())
|
||||
myLocSubShape = _gen_i->GeomObjectToShape( aSubShapeObject);
|
||||
else
|
||||
myLocSubShape = _impl->GetShapeToMesh();
|
||||
|
||||
int hypId = myHyp->GetId();
|
||||
status = _impl->RemoveHypothesis(myLocSubShape, hypId);
|
||||
if ( !SMESH_Hypothesis::IsStatusFatal(status) )
|
||||
|
Loading…
Reference in New Issue
Block a user