-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <SMESH_HypoFilter.hxx>
#include <SMESH_MesherHelper.hxx>
#include <SMESH_subMesh.hxx>
+#include <SMESH_MeshEditor.hxx>
#include <SMESH_ControlPnt.hxx>
#include <list>
#endif
_computeCanceled = false;
- // Copy of what is done in BLSURFPLugin TODO : share the code
- smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/Study");
-
- myStudy = SALOMEDS::Study::_narrow(anObject);;
- if ( !myStudy->_is_nil() )
- MESSAGE("myStudy not empty");
}
//=============================================================================
bool HexoticPlugin_Hexotic::CheckBLSURFHypothesis( SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape )
{
- // MESSAGE("HexoticPlugin_Hexotic::CheckBLSURFHypothesis");
+ MESSAGE("HexoticPlugin_Hexotic::CheckBLSURFHypothesis");
_blsurfHypo = NULL;
std::list<const SMESHDS_Hypothesis*>::const_iterator itl;
// If a BLSURF hypothesis is applied, get it
SMESH_HypoFilter blsurfFilter;
- blsurfFilter.Init( blsurfFilter.HasName( BLSURFPlugin_Hypothesis::GetHypType() ));
+ blsurfFilter.Init( blsurfFilter.HasName( BLSURFPlugin_Hypothesis::GetHypType(true) ));
+ blsurfFilter.Or ( blsurfFilter.HasName( BLSURFPlugin_Hypothesis::GetHypType(false)));
std::list<const SMESHDS_Hypothesis *> appliedHyps;
aMesh.GetHypotheses( aShape, blsurfFilter, appliedHyps, false );
itl = appliedHyps.begin();
theHyp = (*itl); // use only the first hypothesis
std::string hypName = theHyp->GetName();
- if (hypName == BLSURFPlugin_Hypothesis::GetHypType()) {
+ if (hypName == BLSURFPlugin_Hypothesis::GetHypType(true) ||
+ hypName == BLSURFPlugin_Hypothesis::GetHypType(false) )
+ {
_blsurfHypo = static_cast<const BLSURFPlugin_Hypothesis*> (theHyp);
ASSERT(_blsurfHypo);
return true;
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus )
{
- // MESSAGE("HexoticPlugin_Hexotic::CheckHypothesis");
+ MESSAGE("HexoticPlugin_Hexotic::CheckHypothesis");
_hypothesis = NULL;
std::list<const SMESHDS_Hypothesis*>::const_iterator itl;
const std::list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
int nbHyp = hyps.size();
if (!nbHyp) {
+ // retrieve BLSURF hypothesis if no hexotic hypothesis has been set
+#ifdef WITH_BLSURFPLUGIN
+ CheckBLSURFHypothesis(aMesh, aShape);
+#endif
aStatus = SMESH_Hypothesis::HYP_OK;
return true; // can work with no hypothesis
}
TopoDS_Shape HexoticPlugin_Hexotic::entryToShape(std::string entry)
{
MESSAGE("HexoticPlugin_Hexotic::entryToShape "<<entry );
- if ( myStudy->_is_nil() )
- throw SALOME_Exception("MG-Hexa plugin can't work w/o publishing in the study");
+
GEOM::GEOM_Object_var aGeomObj;
TopoDS_Shape S = TopoDS_Shape();
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() );
+ SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
if (!aSObj->_is_nil()) {
CORBA::Object_var obj = aSObj->GetObject();
aGeomObj = GEOM::GEOM_Object::_narrow(obj);
aSObj->UnRegister();
}
if ( !aGeomObj->_is_nil() )
- S = smeshGen_i->GeomObjectToShape( aGeomObj.in() );
+ S = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( aGeomObj.in() );
return S;
}
Hexotic_Out = aTmpDir + "Hexotic"+getSuffix()+"_Out.mesh";
#ifdef WITH_BLSURFPLUGIN
bool defaultInputFile = true;
- if (_blsurfHypo && !_blsurfHypo->GetQuadAllowed()) {
+ if (_blsurfHypo && _blsurfHypo->GetElementType() == BLSURFPlugin_Hypothesis::Triangles ) {
Hexotic_In = _blsurfHypo->GetGMFFile().c_str();
if ( !Hexotic_In.IsEmpty() &&
SMESH_File( _blsurfHypo->GetGMFFile() ).exists() )
{
+ MESSAGE("Use output file from blsurf as input file from hexotic: " << Hexotic_In);
mgHexa.SetUseExecutable();
defaultInputFile = false;
}