\image html blsurf_parameters_enforced_vertices.png
It is possible to define some enforced vertices to MG-CADSurf algorithm.
-An enforced vertex is defined on a Face or a Compound by
+An enforced vertex is defined by
- selecting an existing Vertex or Compound,
-- or creating a new vertex given its coordinates.
+- or by its coordinates.
The enforced vertex is the projection of a point defined by its
-(x,y,z) coordinates on the selected face.
+(x,y,z) coordinates on the closest face found by the application.
-- It is possible to define several enforced vertices on a face or a group of faces.
+- It is possible to define several enforced vertices.
- If the projected point is on the boundary or outside of the face, it will be ignored.
-- If a group name is specified : If the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created.
+- If a group name is specified : if the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created.
-All the internal vertices of the faces can be considered as enforced vertices if the corresponding checkbox is checked.
+All the internal vertices of faces can be considered as enforced vertices if the corresponding checkbox is checked.
A group can optionnaly be defined on those enforced vertices.
\sa Sample TUI Script of the \ref tui_blsurf "creation of a MG-CADSurf hypothesis", including enforced vertices.
/*!
* Set/get/unset an enforced vertex on geom face
*/
+ // OBSOLETE
boolean SetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexNamed(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexNamedWithGroup(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
-
TEnfVertexList GetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception);
-
boolean UnsetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
boolean UnsetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
boolean UnsetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception);
- /*!
- * Set/get/unset an enforced vertex on geom face given by entry
- */
- boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z,
+ // NEW - no face
+ boolean AddEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexNamed(in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexWithGroup(in double x, in double y, in double z, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexNamedWithGroup(in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+
+ boolean RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertices() raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Set/get/unset an enforced vertex on geom face given by entry
+ */
+ boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z,
in TEnfName theVertexName, in TEntry theVertexEntry, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
TEnfVertexList GetEnforcedVerticesEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception);
UnsetEnforcedVertex,
UnsetEnforcedVertexGeom,
UnsetEnforcedVertices,
+ AddEnforcedVertex,
+ AddEnforcedVertexNamed,
+ AddEnforcedVertexGeom,
+ AddEnforcedVertexWithGroup,
+ AddEnforcedVertexNamedWithGroup,
+ AddEnforcedVertexGeomWithGroup,
+ RemoveEnforcedVertex,
+ RemoveEnforcedVertexGeom,
+ RemoveEnforcedVertices,
AddPreCadFacesPeriodicity
</accumulative-methods>
</python-wrap>
return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName)
pass
+ ## Set an enforced vertex on a face given the coordinates of a point.
+ # The face if found by the application.
+ # @param x : x coordinate
+ # @param y : y coordinate
+ # @param z : z coordinate
+ # @param vertexName : name of the enforced vertex
+ # @param groupName : name of the group
+ def AddEnforcedVertex(self, x, y, z, vertexName = "", groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
+ if vertexName == "":
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertex(x, y, z)
+ else:
+ return self.Parameters().AddEnforcedVertexWithGroup(x, y, z, groupName)
+ pass
+ else:
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertexNamed(x, y, z, vertexName)
+ else:
+ return self.Parameters().AddEnforcedVertexNamedWithGroup( x, y, z, vertexName, groupName)
+ pass
+ pass
+
+ ## To set an enforced vertex on a face given a GEOM vertex, group or compound.
+ # The face if found by the application.
+ # @param theVertex : GEOM vertex (or group, compound).
+ # @param groupName : name of the group
+ def AddEnforcedVertexGeom(self, theVertex, groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
+ AssureGeomPublished( self.mesh, theVertex )
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertexGeom(theVertex)
+ else:
+ return self.Parameters().AddEnforcedVertexGeomWithGroup(theVertex,groupName)
+ pass
+
## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates.
# @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
# @param x : x coordinate
SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, studyId, gen)
{
- MESSAGE("BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF");
-
_name = "MG-CADSurf";//"BLSURF";
_shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
_compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType());
CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
- MESSAGE("studyid = " << _studyId);
-
myStudy = NULL;
myStudy = aStudyMgr->GetStudyByID(_studyId);
- if ( !myStudy->_is_nil() )
- MESSAGE("myStudy->StudyId() = " << myStudy->StudyId());
/* Initialize the Python interpreter */
assert(Py_IsInitialized());
BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF()
{
- MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF");
}
/////////////////////////////////////////////////////////
TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
{
- MESSAGE("BLSURFPlugin_BLSURF::entryToShape "<<entry );
- GEOM::GEOM_Object_var aGeomObj;
- TopoDS_Shape S = TopoDS_Shape();
- SALOMEDS::SObject_var aSObj = myStudy->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() );
+ TopoDS_Shape S;
+ if ( !entry.empty() )
+ {
+ GEOM::GEOM_Object_var aGeomObj;
+ SALOMEDS::SObject_var aSObj = myStudy->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() );
+ }
return S;
}
void _createEnforcedVertexOnFace(TopoDS_Face faceShape, gp_Pnt aPnt, BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex)
{
BLSURFPlugin_Hypothesis::TEnfVertexCoords enf_coords, coords, s_coords;
- enf_coords.clear();
- coords.clear();
- s_coords.clear();
// Get the (u,v) values of the enforced vertex on the face
projectionPoint myPoint = getProjectionPoint(faceShape,aPnt);
- MESSAGE("Enforced Vertex: " << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z());
- MESSAGE("Projected Vertex: " << myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z());
- MESSAGE("Parametric coordinates: " << myPoint.uv.X() << ", " << myPoint.uv.Y() );
-
enf_coords.push_back(aPnt.X());
enf_coords.push_back(aPnt.Y());
enf_coords.push_back(aPnt.Z());
s_coords.push_back(myPoint.xyz.Z());
// Save pair projected vertex / enf vertex
- MESSAGE("Storing pair projected vertex / enf vertex:");
- MESSAGE("("<< myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z() <<") / (" << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z()<<")");
EnfVertexCoords2ProjVertex[s_coords] = enf_coords;
- MESSAGE("Group name is: \"" << enfVertex->grpName << "\"");
pair<BLSURFPlugin_Hypothesis::TEnfVertexList::iterator,bool> ret;
BLSURFPlugin_Hypothesis::TEnfVertexList::iterator it;
ret = EnfVertexCoords2EnfVertexList[s_coords].insert(enfVertex);
sameAttractor = true;
if (FaceId2EnforcedVertexCoords.find(key) != FaceId2EnforcedVertexCoords.end()) {
- MESSAGE("Map of enf. vertex has key " << key)
- MESSAGE("Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
if (! sameAttractor)
FaceId2EnforcedVertexCoords[key].insert(coords); // there should be no redondant coords here (see std::set management)
- else
- MESSAGE("An attractor node is already defined: I don't add the enforced vertex");
- MESSAGE("New Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
}
else {
- MESSAGE("Map of enf. vertex has not key " << key << ": creating it")
if (! sameAttractor) {
BLSURFPlugin_Hypothesis::TEnfVertexCoordsList ens;
ens.insert(coords);
FaceId2EnforcedVertexCoords[key] = ens;
}
+ }
+}
+
+/*!
+ * \brief Find geom faces supporting given points
+ */
+TopoDS_Shape BLSURFPlugin_BLSURF::
+findFaces( const BLSURFPlugin_Hypothesis::TEnfVertexList& enfVertexList )
+{
+ // get points from enfVertexList
+ vector< gp_Pnt > points;
+ BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfVertexListIt = enfVertexList.begin();
+ for( ; enfVertexListIt != enfVertexList.end() ; ++enfVertexListIt )
+ {
+ BLSURFPlugin_Hypothesis::TEnfVertex * enfVertex = *enfVertexListIt;
+ if ( enfVertex->coords.size() >= 3 )
+ {
+ points.push_back( gp_Pnt( enfVertex->coords[0], enfVertex->coords[1], enfVertex->coords[2]));
+ }
else
- MESSAGE("An attractor node is already defined: I don't add the enforced vertex");
+ {
+ TopoDS_Shape GeomShape = entryToShape( enfVertex->geomEntry );
+ if ( !GeomShape.IsNull() )
+ {
+ if ( GeomShape.ShapeType() == TopAbs_VERTEX )
+ points.push_back( BRep_Tool::Pnt( TopoDS::Vertex( GeomShape )));
+
+ else if ( GeomShape.ShapeType() == TopAbs_COMPOUND)
+ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next())
+ if ( it.Value().ShapeType() == TopAbs_VERTEX )
+ points.push_back( BRep_Tool::Pnt( TopoDS::Vertex( it.Value() )));
+ }
+ }
}
+
+ TopoDS_Shape resultShape, myShape = myHelper->GetSubShape();
+ TopoDS_Compound compound;
+
+ for ( size_t i = 0; i <= points.size(); ++i )
+ {
+ TopoDS_Face foundFace;
+ TopTools_MapOfShape checkedFaces;
+ std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > > dist2face;
+
+ for ( TopExp_Explorer exp ( myShape, TopAbs_FACE ); exp.More(); exp.Next())
+ {
+ const TopoDS_Face& face = TopoDS::Face( exp.Current() );
+ if ( !checkedFaces.Add( face )) continue;
+
+ // check distance to face
+ Handle(ShapeAnalysis_Surface) surface = myHelper->GetSurface( face );
+ gp_Pnt2d uv = surface->ValueOfUV( points[i], Precision::Confusion());
+ double distance = surface->Gap();
+ if ( distance > Precision::Confusion() )
+ {
+ // the face is far, store for future analysis
+ dist2face.insert( std::make_pair( distance, std::make_pair( face, uv )));
+ }
+ else
+ {
+ // check location on the face
+ BRepClass_FaceClassifier FC( face, uv, Precision::Confusion());
+ if ( FC.State() == TopAbs_IN )
+ {
+ foundFace = face;
+ break;
+ }
+ }
+ }
+ if ( foundFace.IsNull() )
+ {
+ // find the closest face
+ std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > >::iterator d2f = dist2face.begin();
+ for ( ; d2f != dist2face.end(); ++d2f )
+ {
+ const TopoDS_Face& face = d2f->second.first;
+ const gp_Pnt2d & uv = d2f->second.second;
+ BRepClass_FaceClassifier FC( face, uv, Precision::Confusion());
+ if ( FC.State() == TopAbs_IN )
+ {
+ foundFace = face;
+ break;
+ }
+ }
+ }
+ // set the resultShape
+ if ( !foundFace.IsNull() )
+ {
+ if ( resultShape.IsNull() )
+ {
+ resultShape = foundFace;
+ }
+ else
+ {
+ BRep_Builder builder;
+ if ( compound.IsNull() )
+ {
+ builder.MakeCompound( compound );
+ resultShape = compound;
+ }
+ builder.Add( compound, foundFace );
+ }
+ }
+ } // loop on points
+
+ return resultShape;
}
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction, double defaultSize)
{
- MESSAGE("Attractor function: "<< AttractorFunction);
double xa, ya, za; // Coordinates of attractor point
double a, b; // Attractor parameter
double d = 0.;
pos2 = AttractorFunction.find(sep, pos1+1);
if (pos2!=string::npos) {
string createNodeStr = AttractorFunction.substr(pos1+1, pos2-pos1-1);
- MESSAGE("createNode: " << createNodeStr);
createNode = (AttractorFunction.substr(pos1+1, pos2-pos1-1) == "True");
pos1=pos2;
}
// of r-d where r is the distance to (u0,v0)
attractorFunctionStream << "*exp(-(0.5*(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"+abs(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"))/(" << b << "))**2)";
- MESSAGE("Python function for attractor:" << std::endl << attractorFunctionStream.str());
-
int key;
if (! FacesWithSizeMap.Contains(TopoDS::Face(GeomShape))) {
key = FacesWithSizeMap.Add(TopoDS::Face(GeomShape));
}
FaceId2SizeMap[key] =attractorFunctionStream.str();
if (createNode) {
- MESSAGE("Creating node on ("<<x0<<","<<y0<<","<<z0<<")");
FaceId2AttractorCoords[key] = coords;
}
// // Test for new attractors
// myAttractor.SetType(1);
// FaceId2ClassAttractor[key] = myAttractor;
// if(FaceId2ClassAttractor[key].GetFace().IsNull()){
-// MESSAGE("face nulle ");
// }
-// else
-// MESSAGE("face OK");
-//
-// if (FaceId2ClassAttractor[key].GetAttractorShape().IsNull()){
-// MESSAGE("pas de point");
-// }
-// else
-// MESSAGE("point OK");
}
// One sub-shape to get ids from
void BLSURFPlugin_BLSURF::addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords)
{
for (std::vector<std::string>::const_iterator it = theVerticesEntries.begin(); it != theVerticesEntries.end(); it++)
- {
- BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it;
- MESSAGE("Vertex entry " << theVertexEntry);
- addCoordsFromVertex(theVertexEntry, theVerticesCoords);
- }
+ {
+ BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it;
+ addCoordsFromVertex(theVertexEntry, theVerticesCoords);
+ }
}
void BLSURFPlugin_BLSURF::addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords)
{
if (theVertexEntry!="")
- {
- TopoDS_Shape aShape = entryToShape(theVertexEntry);
+ {
+ TopoDS_Shape aShape = entryToShape(theVertexEntry);
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
- double theX, theY, theZ;
- theX = aPnt.X();
- theY = aPnt.Y();
- theZ = aPnt.Z();
+ gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ double theX, theY, theZ;
+ theX = aPnt.X();
+ theY = aPnt.Y();
+ theZ = aPnt.Z();
- theVerticesCoords.push_back(theX);
- theVerticesCoords.push_back(theY);
- theVerticesCoords.push_back(theZ);
- }
+ theVerticesCoords.push_back(theX);
+ theVerticesCoords.push_back(theY);
+ theVerticesCoords.push_back(theZ);
+ }
}
/////////////////////////////////////////////////////////
void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
{
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity");
-
TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
preCadFacesPeriodicityIDs.shape1IDs = theFace1_ids;
preCadFacesPeriodicityIDs.shape2IDs = theFace2_ids;
- MESSAGE("preCadPeriodicity.theSourceVerticesEntries.size(): " << preCadPeriodicity.theSourceVerticesEntries.size());
- MESSAGE("preCadPeriodicity.theTargetVerticesEntries.size(): " << preCadPeriodicity.theTargetVerticesEntries.size());
-
addCoordsFromVertices(preCadPeriodicity.theSourceVerticesEntries, preCadFacesPeriodicityIDs.theSourceVerticesCoords);
addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadFacesPeriodicityIDs.theTargetVerticesCoords);
- MESSAGE("preCadFacesPeriodicityIDs.theSourceVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theSourceVerticesCoords.size());
- MESSAGE("preCadFacesPeriodicityIDs.theTargetVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theTargetVerticesCoords.size());
-
_preCadFacesIDsPeriodicityVector.push_back(preCadFacesPeriodicityIDs);
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity END");
-
}
/////////////////////////////////////////////////////////
void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
{
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity");
-
TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadEdgesPeriodicityIDs.theTargetVerticesCoords);
_preCadEdgesIDsPeriodicityVector.push_back(preCadEdgesPeriodicityIDs);
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity END");
-
}
if (hyp) {
- MESSAGE("BLSURFPlugin_BLSURF::SetParameters");
_physicalMesh = (int) hyp->GetPhysicalMesh();
_geometricMesh = (int) hyp->GetGeometricMesh();
if (hyp->GetPhySize() > 0) {
BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt;
for ( opIt = opts.begin(); opIt != opts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
const BLSURFPlugin_Hypothesis::TOptionValues& custom_opts = hyp->GetCustomOptionValues();
for ( opIt = custom_opts.begin(); opIt != custom_opts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues();
for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
}
if ( _verb > 0 )
std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl;
- if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize){
+ if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize)
+ {
TopoDS_Shape GeomShape;
TopoDS_Shape AttShape;
TopAbs_ShapeEnum GeomType;
//
// Standard Size Maps
//
- MESSAGE("Setting a Size Map");
const BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = BLSURFPlugin_Hypothesis::GetSizeMapEntries(hyp);
BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
for ( ; smIt != sizeMaps.end(); ++smIt ) {
if ( !smIt->second.empty() ) {
- MESSAGE("cadsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second);
GeomShape = entryToShape(smIt->first);
GeomType = GeomShape.ShapeType();
- MESSAGE("Geomtype is " << GeomType);
int key = -1;
// Group Management
if (GeomType == TopAbs_COMPOUND) {
}
else {
key = FacesWithSizeMap.FindIndex(TopoDS::Face(it.Value()));
-// MESSAGE("Face with key " << key << " already in map");
}
FaceId2SizeMap[key] = smIt->second;
}
}
else {
key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(it.Value()));
-// MESSAGE("Edge with key " << key << " already in map");
}
EdgeId2SizeMap[key] = smIt->second;
}
}
else {
key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(it.Value()));
- MESSAGE("Group of vertices with key " << key << " already in map");
}
- MESSAGE("Group of vertices with key " << key << " has a size map: " << smIt->second);
VertexId2SizeMap[key] = smIt->second;
}
}
}
else {
key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape));
-// MESSAGE("Face with key " << key << " already in map");
}
FaceId2SizeMap[key] = smIt->second;
}
}
else {
key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(GeomShape));
-// MESSAGE("Edge with key " << key << " already in map");
}
EdgeId2SizeMap[key] = smIt->second;
}
}
else {
key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(GeomShape));
- MESSAGE("Vertex with key " << key << " already in map");
}
- MESSAGE("Vertex with key " << key << " has a size map: " << smIt->second);
VertexId2SizeMap[key] = smIt->second;
}
}
// Attractors
//
// TODO appeler le constructeur des attracteurs directement ici
- MESSAGE("Setting Attractors");
// if ( !_phySizeRel ) {
const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp);
BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
for ( ; atIt != attractors.end(); ++atIt ) {
if ( !atIt->second.empty() ) {
- MESSAGE("cadsurf_set_attractor(): " << atIt->first << " = " << atIt->second);
GeomShape = entryToShape(atIt->first);
GeomType = GeomShape.ShapeType();
// Group Management
}
}
// }
-// else
-// MESSAGE("Impossible to create the attractors when the physical size is relative");
// Class Attractors
// temporary commented out for testing
BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator AtIt = class_attractors.begin();
for ( ; AtIt != class_attractors.end(); ++AtIt ) {
if ( !AtIt->second->Empty() ) {
- // MESSAGE("cadsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second);
GeomShape = entryToShape(AtIt->first);
if ( !SMESH_MesherHelper::IsSubShape( GeomShape, theGeomShape ))
continue;
//
// Enforced Vertices
//
- MESSAGE("Setting Enforced Vertices");
const BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap entryEnfVertexListMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByFace(hyp);
BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator enfIt = entryEnfVertexListMap.begin();
for ( ; enfIt != entryEnfVertexListMap.end(); ++enfIt ) {
if ( !enfIt->second.empty() ) {
GeomShape = entryToShape(enfIt->first);
- GeomType = GeomShape.ShapeType();
+ if ( GeomShape.IsNull() )
+ {
+ GeomShape = findFaces( enfIt->second );
+ if ( GeomShape.IsNull() )
+ continue;
+ }
// Group Management
- if (GeomType == TopAbs_COMPOUND){
+ if ( GeomShape.ShapeType() == TopAbs_COMPOUND){
for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
if (it.Value().ShapeType() == TopAbs_FACE){
HasSizeMapOnFace = true;
}
}
}
-
- if (GeomType == TopAbs_FACE){
+ if ( GeomShape.ShapeType() == TopAbs_FACE){
HasSizeMapOnFace = true;
createEnforcedVertexOnFace(GeomShape, enfIt->second);
}
bool useInternalVertexAllFaces = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFaces(hyp);
if (useInternalVertexAllFaces) {
std::string grpName = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFacesGroup(hyp);
- MESSAGE("Setting Internal Enforced Vertices");
gp_Pnt aPnt;
TopExp_Explorer exp (theGeomShape, TopAbs_FACE);
for (; exp.More(); exp.Next()){
- MESSAGE("Iterating shapes. Shape type is " << exp.Current().ShapeType());
TopExp_Explorer exp_face (exp.Current(), TopAbs_VERTEX, TopAbs_EDGE);
for (; exp_face.More(); exp_face.Next())
{
// Check if current coords is already in enfVertexList
// If coords not in enfVertexList, add new enfVertex
aPnt = BRep_Tool::Pnt(TopoDS::Vertex(exp_face.Current()));
- MESSAGE("Found vertex on face at " << aPnt.X() <<", "<<aPnt.Y()<<", "<<aPnt.Z());
BLSURFPlugin_Hypothesis::TEnfVertex* enfVertex = new BLSURFPlugin_Hypothesis::TEnfVertex();
enfVertex->coords.push_back(aPnt.X());
enfVertex->coords.push_back(aPnt.Y());
}
}
- MESSAGE("Setting Size Map on FACES ");
cadsurf_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size);
if (HasSizeMapOnEdge){
- MESSAGE("Setting Size Map on EDGES ");
cadsurf_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size);
}
if (HasSizeMapOnVertex){
- MESSAGE("Setting Size Map on VERTICES ");
cadsurf_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size);
}
}
_preCadFacesIDsPeriodicityVector.clear();
_preCadEdgesIDsPeriodicityVector.clear();
- MESSAGE("SetParameters preCadFacesPeriodicityVector");
const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp);
for (std::size_t i = 0; i<preCadFacesPeriodicityVector.size(); i++){
- MESSAGE("SetParameters preCadFacesPeriodicityVector[" << i << "]");
createPreCadFacesPeriodicity(theGeomShape, preCadFacesPeriodicityVector[i]);
}
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- MESSAGE("SetParameters preCadEdgesPeriodicityVector");
const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadEdgesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadEdgesPeriodicityVector(hyp);
for (std::size_t i = 0; i<preCadEdgesPeriodicityVector.size(); i++){
- MESSAGE("SetParameters preCadEdgesPeriodicityVector[" << i << "]");
createPreCadEdgesPeriodicity(theGeomShape, preCadEdgesPeriodicityVector[i]);
}
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
-
}
//================================================================================
bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) {
- MESSAGE("BLSURFPlugin_BLSURF::Compute");
-
// Fix problem with locales
Kernel_Utils::Localizer aLocalizer;
/* create a distene context (generic object) */
status_t status = STATUS_ERROR;
- myMesh = &aMesh;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
- SMESH_MesherHelper helper( aMesh );
+ SMESH_MesherHelper helper( aMesh ), helperWithShape( aMesh );
+ myHelper = & helperWithShape;
// do not call helper.IsQuadraticSubMesh() because sub-meshes
// may be cleaned and helper.myTLinkNodeMap gets invalid in such a case
- bool haveQuadraticSubMesh = SMESH_MesherHelper( aMesh ).IsQuadraticSubMesh( aShape );
+ bool haveQuadraticSubMesh = helperWithShape.IsQuadraticSubMesh( aShape );
bool quadraticSubMeshAndViscousLayer = false;
bool needMerge = false;
typedef set< SMESHDS_SubMesh*, ShapeTypeCompare > TSubMeshSet;
// an object that correctly deletes all cadsurf objects at destruction
BLSURF_Cleaner cleaner( ctx,css,c,dcad );
- MESSAGE("BEGIN SetParameters");
SetParameters(_hypothesis, css, aShape);
- MESSAGE("END SetParameters");
-
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
haveQuadraticSubMesh = haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh());
helper.SetIsQuadratic( haveQuadraticSubMesh );
faceKey = FacesWithSizeMap.FindIndex(f);
- if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()) {
- MESSAGE("A size map is defined on face :"<<faceKey);
+ if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end())
+ {
theSizeMapStr = FaceId2SizeMap[faceKey];
// check if function ends with "return"
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
std::map<int,std::vector<double> >::iterator attractor_iter = FaceId2AttractorCoords.begin();
for (; attractor_iter != FaceId2AttractorCoords.end(); ++attractor_iter) {
- if (attractor_iter->first == faceKey) {
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding attractor");
-
+ if (attractor_iter->first == faceKey)
+ {
double xyzCoords[3] = {attractor_iter->second[2],
attractor_iter->second[3],
attractor_iter->second[4]};
- MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")");
gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]);
BRepClass_FaceClassifier scl(f,P,1e-7);
- // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten
- // BRepClass_FaceClassifierPerform(&scl,f,P,1e-7);
- // OCC 6.5.2: scl.Perform() is not bugged anymore
scl.Perform(f, P, 1e-7);
TopAbs_State result = scl.State();
- MESSAGE("Position of point on face: "<<result);
if ( result == TopAbs_OUT )
MESSAGE("Point is out of face: node is not created");
if ( result == TopAbs_UNKNOWN )
if ( result == TopAbs_IN )
{
// Point is inside face and not on border
- MESSAGE("Point is in face: node is created");
double uvCoords[2] = {attractor_iter->second[0],attractor_iter->second[1]};
ienf++;
- MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf);
cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
cad_point_set_tag(point_p, ienf);
}
// -----------------
TId2ClsAttractorVec::iterator clAttractor_iter = FaceId2ClassAttractor.find(faceKey);
if (clAttractor_iter != FaceId2ClassAttractor.end()){
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding attractor");
std::vector< BLSURFPlugin_Attractor* > & attVec = clAttractor_iter->second;
for ( size_t i = 0; i < attVec.size(); ++i )
if ( !attVec[i]->IsMapBuilt() ) {
faceKey = FacesWithEnforcedVertices.FindIndex(f);
std::map<int,BLSURFPlugin_Hypothesis::TEnfVertexCoordsList >::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey);
if (evmIt != FaceId2EnforcedVertexCoords.end()) {
- MESSAGE("Some enforced vertices are defined");
BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl;
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding enforced vertices");
evl = evmIt->second;
- MESSAGE("Number of vertices to add: "<< evl.size());
BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator evlIt = evl.begin();
for (; evlIt != evl.end(); ++evlIt) {
BLSURFPlugin_Hypothesis::TEnfVertexCoords xyzCoords;
xyzCoords.push_back(evlIt->at(2));
xyzCoords.push_back(evlIt->at(3));
xyzCoords.push_back(evlIt->at(4));
- MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")");
gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]);
BRepClass_FaceClassifier scl(f,P,1e-7);
// OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten
// OCC 6.5.2: scl.Perform() is not bugged anymore
scl.Perform(f, P, 1e-7);
TopAbs_State result = scl.State();
- MESSAGE("Position of point on face: "<<result);
if ( result == TopAbs_OUT ) {
- MESSAGE("Point is out of face: node is not created");
if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
EnfVertexCoords2ProjVertex.erase(xyzCoords);
// isssue 22783. Do not erase as this point can be IN other face of a group
}
}
if ( result == TopAbs_UNKNOWN ) {
- MESSAGE("Point position on face is unknown: node is not created");
if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
EnfVertexCoords2ProjVertex.erase(xyzCoords);
//EnfVertexCoords2EnfVertexList.erase(xyzCoords);
}
}
if ( result == TopAbs_ON ) {
- MESSAGE("Point is on border of face: node is not created");
if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
EnfVertexCoords2ProjVertex.erase(xyzCoords);
//EnfVertexCoords2EnfVertexList.erase(xyzCoords);
if ( result == TopAbs_IN )
{
// Point is inside face and not on border
- MESSAGE("Point is in face: node is created");
double uvCoords[2] = {evlIt->at(0),evlIt->at(1)};
ienf++;
- MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf);
cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
int tag = 0;
std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords);
if (HasSizeMapOnEdge){
edgeKey = EdgesWithSizeMap.FindIndex(e);
- if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end()) {
- MESSAGE("Sizemap defined on edge with index " << edgeKey);
+ if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end())
+ {
theSizeMapStr = EdgeId2SizeMap[edgeKey];
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
continue;
vertexKey = VerticesWithSizeMap.FindIndex(v);
if (VertexId2SizeMap.find(vertexKey)!=VertexId2SizeMap.end()){
theSizeMapStr = VertexId2SizeMap[vertexKey];
- //MESSAGE("VertexId2SizeMap[faceKey]: " << VertexId2SizeMap[vertexKey]);
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
continue;
// Expr To Python function, verification is performed at validation in GUI
// PERIODICITY //
///////////////////////
- MESSAGE("BEFORE PERIODICITY");
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- if (! _preCadFacesIDsPeriodicityVector.empty()) {
- MESSAGE("INTO PRECAD FACES PERIODICITY");
+ if (! _preCadFacesIDsPeriodicityVector.empty())
+ {
for (std::size_t i=0; i < _preCadFacesIDsPeriodicityVector.size(); i++){
std::vector<int> theFace1_ids = _preCadFacesIDsPeriodicityVector[i].shape1IDs;
std::vector<int> theFace2_ids = _preCadFacesIDsPeriodicityVector[i].shape2IDs;
for (std::size_t j=0; j < theFace2_ids.size(); j++)
o << theFace2_ids[j] << ", ";
o << "]";
- MESSAGE(o.str());
- MESSAGE("theFace1_ids.size(): " << theFace1_ids.size());
- MESSAGE("theFace2_ids.size(): " << theFace2_ids.size());
if (_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.empty())
- {
- // If no source points, call peridoicity without transformation function
- MESSAGE("periodicity without transformation function");
- meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
- status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(),
- theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL);
- if(status != STATUS_OK)
- cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
- }
+ {
+ // If no source points, call peridoicity without transformation function
+ meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+ status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(),
+ theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL);
+ if(status != STATUS_OK)
+ cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+ }
else
- {
- // get the transformation vertices
- MESSAGE("periodicity with transformation vertices");
- double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
- double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
- int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
- int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
-
- MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices);
-
- status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(),
- theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
- if(status != STATUS_OK)
- cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
- }
+ {
+ // get the transformation vertices
+ double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
+ double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
+ int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
+ int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
+
+ status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(),
+ theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
+ if(status != STATUS_OK)
+ cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
+ }
}
-
- MESSAGE("END PRECAD FACES PERIODICITY");
}
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
- if (! _preCadEdgesIDsPeriodicityVector.empty()) {
- MESSAGE("INTO PRECAD EDGES PERIODICITY");
+ if (! _preCadEdgesIDsPeriodicityVector.empty())
+ {
for (std::size_t i=0; i < _preCadEdgesIDsPeriodicityVector.size(); i++){
std::vector<int> theEdge1_ids = _preCadEdgesIDsPeriodicityVector[i].shape1IDs;
std::vector<int> theEdge2_ids = _preCadEdgesIDsPeriodicityVector[i].shape2IDs;
for (std::size_t j=0; j < theEdge2_ids.size(); j++)
o << theEdge2_ids[j] << ", ";
o << "]";
- MESSAGE(o.str());
- MESSAGE("theEdge1_ids.size(): " << theEdge1_ids.size());
- MESSAGE("theEdge2_ids.size(): " << theEdge2_ids.size());
if (_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.empty())
- {
- // If no source points, call peridoicity without transformation function
- MESSAGE("periodicity without transformation function");
- meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
- status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(),
- theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL);
- if(status != STATUS_OK)
- cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
- }
+ {
+ // If no source points, call peridoicity without transformation function
+ meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+ status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(),
+ theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL);
+ if(status != STATUS_OK)
+ cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+ }
else
- {
- // get the transformation vertices
- MESSAGE("periodicity with transformation vertices");
- double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
- double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
- int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
- int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
-
- MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices);
-
- status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(),
- theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
- if(status != STATUS_OK)
- cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
- else
- MESSAGE("cad_add_edge_multiple_periodicity_with_transformation_function_by_points succeeded.\n");
- }
+ {
+ // get the transformation vertices
+ double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
+ double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
+ int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
+ int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
+
+ status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(),
+ theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
+ if(status != STATUS_OK)
+ cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
+ }
}
-
- MESSAGE("END PRECAD EDGES PERIODICITY");
}
projVertex.push_back((double)xyz[1]);
projVertex.push_back((double)xyz[2]);
std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
- if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
- MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]);
+ if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end())
+ {
BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
if (currentEnfVertex->grpName != "") {
bool groupDone = false;
SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups();
- MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
- MESSAGE("Parsing the groups of the mesh");
while (grIt->more()) {
SMESH_Group * group = grIt->next();
if ( !group ) continue;
- MESSAGE("Group: " << group->GetName());
SMESHDS_GroupBase* groupDS = group->GetGroupDS();
if ( !groupDS ) continue;
- MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType()));
- MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node));
- MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0));
if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) {
SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Node ID: " << nodes[iv]->GetID());
// How can I inform the hypothesis ?
// _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID());
groupDone = true;
- MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName);
break;
}
}
aGroup->SetName( currentEnfVertex->grpName.c_str() );
SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Successfully created enforced vertex group " << currentEnfVertex->grpName);
groupDone = true;
}
if (!groupDone)
FacesWithEnforcedVertices.Statistics(std::cout);
*/
- MESSAGE("END OF BLSURFPlugin_BLSURF::Compute()");
return ( status == STATUS_OK && !quadraticSubMeshAndViscousLayer );
}
if ( pyresult != NULL) {
result = PyFloat_AsDouble(pyresult);
Py_DECREF(pyresult);
-// *size = result;
+ // *size = result;
}
else{
fflush(stderr);
*size = result;
PyGILState_Release(gstate);
}
- else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty()){
-// MESSAGE("attractor used on face :"<<face_id)
- // MESSAGE("List of attractor is not empty")
- // MESSAGE("Attractor empty : "<< FaceIndex2ClassAttractor[face_id]->Empty())
+ else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty())
+ {
real result = 0;
result = 1e100;
std::vector< BLSURFPlugin_Attractor* > & attVec = f2attVec->second;
*size = result;
}
else {
- // MESSAGE("List of attractor is empty !!!")
*size = *((real*)user_data);
}
-// std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl;
+ // std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl;
return STATUS_OK;
}
//0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry
// GetDefaultPhySize() sometimes leads to computation failure
_phySize = aMesh.GetShapeDiagonalSize() / _gen->GetBoundaryBoxSegmentation();
- MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults");
}
bool IsQuadratic = _quadraticMesh;
TopoDS_Shape entryToShape(std::string entry);
void addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords);
void addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords);
+ TopoDS_Shape findFaces( const BLSURFPlugin_Hypothesis::TEnfVertexList& enfVertexList );
void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList);
void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity);
private:
PyObject * main_mod;
PyObject * main_dict;
- SMESH_Mesh* myMesh;
+ SMESH_MesherHelper* myHelper;
SALOMEDS::Study_var myStudy;
SMESH_Gen_i* smeshGen_i;
TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
{
- MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<<entry );
GEOM::GEOM_Object_var aGeomObj;
SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
_phySizeRel = isRelative;
if (theVal == 0) {
_phySize = GetMaxSize();
- MESSAGE("Warning: nul physical size is not allowed");
}
else
_phySize = theVal;
++it_clAt;
}
while ( it_clAt != _classAttractors.end() );
- MESSAGE("_classAttractors.size() = "<<_classAttractors.size())
NotifySubMeshesHypothesisModification();
}
else
// bool toEnforceInternalVertices,
// TEnfGroupName theGroupName) {
-// MESSAGE("BLSURFPlugin_Hypothesis::SetInternalEnforcedVertex("<< theFaceEntry << ", "
// << toEnforceInternalVertices << ", " << theGroupName << ")");
// TFaceEntryInternalVerticesList::iterator it = _faceEntryInternalVerticesList.find(theFaceEntry);
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
-bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry,
- TEnfGroupName theGroupName, double x, double y, double z) {
-
- MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex("<< theFaceEntry << ", "
- << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theVertexEntry << ", " << theGroupName << ")");
-
+bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry,
+ TEnfName theVertexName,
+ TEntry theVertexEntry,
+ TEnfGroupName theGroupName,
+ double x, double y, double z)
+{
SetPhysicalMesh(PhysicalLocalSize);
- // TEnfVertexList::iterator it;
bool toNotify = false;
bool toCreate = true;
newEnfVertex->grpName = theGroupName;
newEnfVertex->faceEntries.clear();
newEnfVertex->faceEntries.insert(theFaceEntry);
-
-
+
+
// update _enfVertexList
TEnfVertexList::iterator it = _enfVertexList.find(newEnfVertex);
if (it != _enfVertexList.end()) {
toCreate = false;
oldEnVertex = (*it);
- MESSAGE("Enforced Vertex was found => Update");
if (oldEnVertex->name != theVertexName) {
- MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theVertexName << "\"");
oldEnVertex->name = theVertexName;
toNotify = true;
}
if (oldEnVertex->grpName != theGroupName) {
- MESSAGE("Update group name from \"" << oldEnVertex->grpName << "\" to \"" << theGroupName << "\"");
oldEnVertex->grpName = theGroupName;
toNotify = true;
}
TEntryList::iterator it_faceEntries = oldEnVertex->faceEntries.find(theFaceEntry);
if (it_faceEntries == oldEnVertex->faceEntries.end()) {
- MESSAGE("Update face list by adding \"" << theFaceEntry << "\"");
oldEnVertex->faceEntries.insert(theFaceEntry);
_faceEntryEnfVertexListMap[theFaceEntry].insert(oldEnVertex);
toNotify = true;
// //////// CREATE ////////////
if (toCreate) {
toNotify = true;
- MESSAGE("Creating new enforced vertex");
_faceEntryEnfVertexListMap[theFaceEntry].insert(newEnfVertex);
_enfVertexList.insert(newEnfVertex);
if (theVertexEntry == "") {
if (toNotify)
NotifySubMeshesHypothesisModification();
- MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex END");
return toNotify;
}
TEnfVertexEntryEnfVertexMap::iterator it_enfVertexEntry = _enfVertexEntryEnfVertexMap.find(theVertexEntry);
if (it_enfVertexEntry != _enfVertexEntryEnfVertexMap.end()) {
// Success
- MESSAGE("Found enforced vertex with geom entry " << theVertexEntry);
oldEnfVertex = it_enfVertexEntry->second;
_enfVertexEntryEnfVertexMap.erase(it_enfVertexEntry);
TCoordsEnfVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
if (it_coords_enf != _coordsEnfVertexMap.end()) {
// Success
- MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
oldEnfVertex = it_coords_enf->second;
_coordsEnfVertexMap.erase(it_coords_enf);
}
}
- MESSAGE("Remove enf vertex from _enfVertexList");
-
// update _enfVertexList
TEnfVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
if (it != _enfVertexList.end()) {
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
// update _faceEntryEnfVertexListMap
currentEnfVertexList.erase(oldEnfVertex);
if (currentEnfVertexList.size() == 0) {
- MESSAGE("Remove _faceEntryEnfVertexListMap[" << theFaceEntry <<"]");
_faceEntryEnfVertexListMap.erase(theFaceEntry);
- MESSAGE("Done");
}
if (toNotify)
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
}
_faceEntryCoordsListMap.erase(it_entry_coords);
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
}
_faceEntryEnfVertexEntryListMap.erase(it_entry_entry);
}
save << " " << "__NEW_ATTRACTORS_END__";
test << " " << "__NEW_ATTRACTORS_END__";
- MESSAGE(" Attractor hypothesis saved as "<<test.str())
}
TEnfVertexList::const_iterator it_enf = _enfVertexList.begin();
save << " " << "__BEGIN_FACELIST__";
}
for (; faceEntriesIt != enfVertex->faceEntries.end(); ++faceEntriesIt)
- save << " " << (*faceEntriesIt);
+ if ( faceEntriesIt->empty() )
+ save << " _no_face_";
+ else
+ save << " " << (*faceEntriesIt);
if (hasFaces)
save << " " << "__END_FACELIST__";
save << " " << "__END_VERTEX__";
TFacesPeriodicityVector::const_iterator it_faces_periodicity = _facesPeriodicityVector.begin();
if (it_faces_periodicity != _facesPeriodicityVector.end()) {
- MESSAGE("__FACES_PERIODICITY_BEGIN__");
save << " " << "__FACES_PERIODICITY_BEGIN__";
for (; it_faces_periodicity != _facesPeriodicityVector.end(); ++it_faces_periodicity) {
TFacesPeriodicity periodicity_i = (*it_faces_periodicity);
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__FACES_PERIODICITY_END__";
- MESSAGE("__FACES_PERIODICITY_END__");
}
}
TEdgesPeriodicityVector::const_iterator it_edges_periodicity = _edgesPeriodicityVector.begin();
if (it_edges_periodicity != _edgesPeriodicityVector.end()) {
save << " " << "__EDGES_PERIODICITY_BEGIN__";
- MESSAGE("__EDGES_PERIODICITY_BEGIN__");
for (; it_edges_periodicity != _edgesPeriodicityVector.end(); ++it_edges_periodicity) {
TEdgePeriodicity periodicity_i = (*it_edges_periodicity);
save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__EDGES_PERIODICITY_END__";
- MESSAGE("__EDGES_PERIODICITY_END__");
}
}
TVerticesPeriodicityVector::const_iterator it_vertices_periodicity = _verticesPeriodicityVector.begin();
if (it_vertices_periodicity != _verticesPeriodicityVector.end()) {
- MESSAGE("__VERTICES_PERIODICITY_BEGIN__");
save << " " << "__VERTICES_PERIODICITY_BEGIN__";
for (; it_vertices_periodicity != _verticesPeriodicityVector.end(); ++it_vertices_periodicity) {
TVertexPeriodicity periodicity_i = (*it_vertices_periodicity);
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__VERTICES_PERIODICITY_END__";
- MESSAGE("__VERTICES_PERIODICITY_END__");
}
}
isOK = static_cast<bool>(load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]); //>>step);
}
if (isOK) {
- MESSAGE(" LOADING ATTRACTOR HYPOTHESIS ")
const TopoDS_Shape attractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry);
const TopoDS_Face faceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry));
BLSURFPlugin_Attractor* attractor = new BLSURFPlugin_Attractor(faceShape, attractorShape, newAtShapeEntry);//, step);
while (isOK && hasEnforcedVertex) {
isOK = static_cast<bool>(load >> enfSeparator); // __BEGIN_VERTEX__
TEnfVertex *enfVertex = new TEnfVertex();
-// MESSAGE("enfSeparator: " <<enfSeparator);
if (enfSeparator == "__ENFORCED_VERTICES_END__")
break; // __ENFORCED_VERTICES_END__
if (enfSeparator != "__BEGIN_VERTEX__")
while (isOK) {
isOK = static_cast<bool>(load >> enfSeparator);
- MESSAGE("enfSeparator: " <<enfSeparator);
if (enfSeparator == "__END_VERTEX__") {
enfVertex->name = enfName;
enfName += enfSeparator;
}
}
- MESSAGE("enfName: " <<enfName);
}
if (enfSeparator == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
isOK = static_cast<bool>(load >> enfSeparator); // __END_ENTRY__
if (enfSeparator != "__END_ENTRY__")
throw std::exception();
- MESSAGE("enfGeomEntry: " <<enfGeomEntry);
}
if (enfSeparator == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
enfGroup += enfSeparator;
}
}
- MESSAGE("enfGroup: " <<enfGroup);
}
if (enfSeparator == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
isOK = static_cast<bool>(load >> enfSeparator); // __END_COORDS__
if (enfSeparator != "__END_COORDS__")
throw std::exception();
- MESSAGE("enfCoords: " << enfCoords[0] <<","<< enfCoords[1] <<","<< enfCoords[2]);
}
if (enfSeparator == "__BEGIN_FACELIST__") { // __BEGIN_FACELIST__
isOK = static_cast<bool>(load >> enfSeparator);
if (enfSeparator != "__END_FACELIST__") {
enfFaceEntryList.insert(enfSeparator);
- MESSAGE(enfSeparator << " was inserted into enfFaceEntryList");
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TFacesPeriodicity *periodicity_i = new TFacesPeriodicity();
if (periodicitySeparator == "__FACES_PERIODICITY_END__")
break; // __FACES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->first = shape1Entry;
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY1__
if (periodicitySeparator != "__END_ENTRY1__")
throw std::exception();
- MESSAGE("shape1Entry: " <<shape1Entry);
}
if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY2__
if (periodicitySeparator != "__END_ENTRY2__")
throw std::exception();
- MESSAGE("shape2Entry: " <<shape2Entry);
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TEdgePeriodicity *periodicity_i = new TEdgePeriodicity();
if (periodicitySeparator == "__EDGES_PERIODICITY_END__")
break; // __EDGES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->theFace1Entry = theFace1Entry;
if (periodicitySeparator == "__BEGIN_FACE1__") { // __BEGIN_FACE1__
isOK = static_cast<bool>(load >> theFace1Entry);
- MESSAGE("//" << theFace1Entry << "//");
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_FACE1__
if (periodicitySeparator != "__END_FACE1__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
- MESSAGE("theFace1Entry: " <<theFace1Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE1__") { // __BEGIN_EDGE1__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE1__
if (periodicitySeparator != "__END_EDGE1__")
throw std::exception();
- MESSAGE("theEdge1Entry: " <<theEdge1Entry);
}
if (periodicitySeparator == "__BEGIN_FACE2__") { // __BEGIN_FACE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_FACE2__
if (periodicitySeparator != "__END_FACE2__")
throw std::exception();
- MESSAGE("theFace2Entry: " <<theFace2Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE2__
if (periodicitySeparator != "__END_EDGE2__")
throw std::exception();
- MESSAGE("theEdge2Entry: " <<theEdge2Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE_ORIENTATION__") { // __BEGIN_EDGE_ORIENTATION__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE_ORIENTATION__
if (periodicitySeparator != "__END_EDGE_ORIENTATION__")
throw std::exception();
- MESSAGE("edge_orientation: " <<edge_orientation);
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TVertexPeriodicity *periodicity_i = new TVertexPeriodicity();
if (periodicitySeparator == "__VERTICES_PERIODICITY_END__")
break; // __VERTICES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->theEdge1Entry = theEdge1Entry;
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE1__
if (periodicitySeparator != "__END_EDGE1__")
throw std::exception();
- MESSAGE("theEdge1Entry: " <<theEdge1Entry);
}
if (periodicitySeparator == "__BEGIN_VERTEX1__") { // __BEGIN_VERTEX1__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_VERTEX1__
if (periodicitySeparator != "__END_VERTEX1__")
throw std::exception();
- MESSAGE("theVertex1Entry: " <<theVertex1Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE2__
if (periodicitySeparator != "__END_EDGE2__")
throw std::exception();
- MESSAGE("theEdge2Entry: " <<theEdge2Entry);
}
if (periodicitySeparator == "__BEGIN_VERTEX2__") { // __BEGIN_VERTEX2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_VERTEX2__
if (periodicitySeparator != "__END_VERTEX2__")
throw std::exception();
- MESSAGE("theVertex2Entry: " <<theVertex2Entry);
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TPreCadPeriodicity *periodicity_i = new TPreCadPeriodicity();
-// MESSAGE("periodicitySeparator: " <<periodicitySeparator);
std::string endSeparator = "__PRECAD_" + std::string(shapeType) + "_PERIODICITY_END__";
if (periodicitySeparator == endSeparator)
break; // __PRECAD_FACES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << endSeparator << "//");
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->shape1Entry = shape1Entry;
periodicity_i->shape2Entry = shape2Entry;
- MESSAGE("theSourceVerticesEntries.size(): " << theSourceVerticesEntries.size());
- MESSAGE("theTargetVerticesEntries.size(): " << theTargetVerticesEntries.size());
-
if (hasSourceVertices)
periodicity_i->theSourceVerticesEntries = theSourceVerticesEntries;
if (hasTargetVertices)
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY1__
if (periodicitySeparator != "__END_ENTRY1__")
throw std::exception();
- MESSAGE("shape1Entry: " <<shape1Entry);
}
if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY2__
if (periodicitySeparator != "__END_ENTRY2__")
throw std::exception();
- MESSAGE("shape2Entry: " <<shape2Entry);
}
if (periodicitySeparator == "__BEGIN_SOURCE_VERTICES_LIST__") { // __BEGIN_SOURCE_VERTICES_LIST__
isOK = static_cast<bool>(load >> periodicitySeparator);
if (periodicitySeparator != "__END_SOURCE_VERTICES_LIST__") {
theSourceVerticesEntries.push_back(periodicitySeparator);
- MESSAGE("theSourceVerticesEntries: " <<periodicitySeparator);
}
}
}
isOK = static_cast<bool>(load >> periodicitySeparator);
if (periodicitySeparator != "__END_TARGET_VERTICES_LIST__") {
theTargetVerticesEntries.push_back(periodicitySeparator);
- MESSAGE("theTargetVerticesEntries: " <<periodicitySeparator);
}
}
}
}
/*!
- * Set/get/unset an enforced vertex on face
+ * Set/get/unset an enforced vertex on face - OBSOLETE
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
CORBA::Double z) throw (SALOME::SALOME_Exception) {
}
/*!
- * Set/get/unset an enforced vertex on geom object given by entry
+ * Set/get/unset an enforced vertex on face - NEW (no face)
*/
-bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with geom object on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with name and group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with geom entry and group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ std::string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ try {
+ return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVerticesEntry("");
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex on geom object given by entry
+ */
+bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ const char* theVertexName,
+ const char* theVertexEntry,
+ const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
bool newValue = false;
if (string(theVertexEntry).empty()) {
try {
coords.push_back(y);
coords.push_back(z);
if (coordsList.find(coords) == coordsList.end()) {
- MESSAGE("Coords not found: add it in coordsList");
newValue = true;
} else {
- MESSAGE("Coords already found, compare names");
::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
- MESSAGE("The names are different: update");
- // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
newValue = true;
}
- else {
- MESSAGE("The names are identical");
- }
}
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
- MESSAGE("Face entry not found : add it to the list");
newValue = true;
}
if (newValue) {
if (string(theVertexName).empty()) {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
}
else {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
<< theVertexName << "\", \"" << theGroupName << "\")";
}
}
::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
if ( it == enfVertexEntryList.end()) {
- MESSAGE("Geom entry not found: add it in enfVertexEntryList");
newValue = true;
}
else {
- MESSAGE("Geom entry already found, compare names");
::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
- MESSAGE("The names are different: update");
-// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
newValue = true;
}
- else {
- MESSAGE("The names are identical");
- }
}
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
- MESSAGE("Face entry not found : add it to the list");
newValue = true;
}
if (newValue) {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
}
}
if (newValue)
this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
- MESSAGE("IDL : SetEnforcedVertexEntry END");
return newValue;
}
-//Enable internal enforced vertices on specific face if requested by user
-//CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
-// throw (SALOME::SALOME_Exception) {
-// ASSERT(myBaseImpl);
-// try {
-// return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
-// } catch (const std::exception& ex) {
-// std::cout << "Exception: " << ex.what() << std::endl;
-// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-// }
-//}
-
BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
-
+ throw (SALOME::SALOME_Exception)
+{
try {
BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
}
}
-bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
bool res = false;
try {
res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
if (string(theVertexEntry).empty())
- SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
+ SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
<< ")";
else
- SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
+ SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
} catch (const std::invalid_argument& ex) {
return false;
MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
return res;
}
-
-//bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
-// CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
-// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
-//
-// bool ret = false;
-//
-// try {
-// ret = _unsetEnfVertex(theFaceEntry, x, y, z);
-// } catch (SALOME_Exception& ex) {
-// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-// }
-//
-// if (ret)
-// SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
-// << ")";
-//
-// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
-// return ret;
-//}
-
-bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
try {
this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
- SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
+ SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
} catch (const std::invalid_argument& ex) {
return false;
} catch (const std::exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
return true;
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
std::string theValueStr = theValue ? "True" : "False";
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
}
* Set group name
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
* Get group name
*/
//=============================================================================
-char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
+char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
+{
ASSERT(myBaseImpl);
return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
}
/*!
* Set/get/unset an enforced vertex on geom object
*/
+ // OBSOLETE
bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
throw (SALOME::SALOME_Exception);
bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
throw (SALOME::SALOME_Exception);
bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
+ // NEW - no face
+ bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+
+ bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception);
+
/*!
* Set/get/unset an enforced vertex on geom object given by entry
*/
// Enforced vertices inputs
enum {
ENF_VER_FACE = 0,
- ENF_VER_VERTEX,
+ ENF_VER_VERTEX = 0,
ENF_VER_X_COORD,
ENF_VER_Y_COORD,
ENF_VER_Z_COORD,
BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType )
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator");
this->mySMPMap.clear();
GeomToolSelected = NULL;
bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams");
bool ok = true;
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
{
QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry ="<<entry.toStdString())
if ( !sizeMap.isEmpty() ) {
if (that->sizeMapValidationFromRow(row))
{
try {
- MESSAGE("entry ="<<entry.toStdString())
- MESSAGE("sizeMap ="<<sizeMap.toStdString())
-
e = entry.toStdString();
s = that->mySMPMap[entry].toStdString();
- MESSAGE("row = "<<row)
- MESSAGE("e = "<<e)
- MESSAGE("s = "<<s)
h->SetSizeMapEntry( e.c_str(), s.c_str() );
}
catch ( const SALOME::SALOME_Exception& ex )
QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
-
QFrame* fr = new QFrame( 0 );
// fr-> setMinimumSize(600,400);
QVBoxLayout* lay = new QVBoxLayout( fr );
//
// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
// anEnfLayout->addWidget(myEnforcedVertexWidget);
-// MESSAGE("Creating DlgBlSurfHyp_Enforced widget instance");
// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced();
myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
shapeTypes2.Add( TopAbs_VERTEX );
shapeTypes2.Add( TopAbs_COMPOUND );
- SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
- myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
- myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
+ // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
+ // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
+ // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }");
- myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
+ //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1);
QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
// FACE AND VERTEX SELECTION
- anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
+ //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
*/
void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
}
/** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
-This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
+ This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
*/
-void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theItem, double x, double y, double z,
- std::string vertexName, std::string geomEntry, std::string groupName) {
-
- std::string theFaceName = theItem->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
-// MESSAGE("theItemName is " << theItem->text(ENF_VER_NAME_COLUMN).toStdString());
+void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z,
+ std::string vertexName,
+ std::string geomEntry,
+ std::string groupName)
+{
bool okToCreate = true;
- const int nbVert = theItem->childCount();
-// MESSAGE("Number of child rows: " << nbVert);
- if (nbVert >0) {
- double childValueX,childValueY,childValueZ;
- QString childEntry, childGroupName;
- QTreeWidgetItem* child;
- for (int row = 0;row<nbVert;row++) {
- child = theItem->child(row);
- childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
- childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || ( (childEntry.toStdString() != "") && (childEntry.toStdString() == geomEntry))) {
- // update group name
- if (childGroupName.toStdString() != groupName) {
- MESSAGE("Group is updated from \"" << childGroupName.toStdString() << "\" to \"" << groupName << "\"");
- child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- }
- okToCreate = false;
- break;
- } // if
- } // for
- } // if
+ const int nbVert = myEnforcedTreeWidget->topLevelItemCount();
+ for (int row = 0; row < nbVert; row++ )
+ {
+ QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row );
+ QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
+ QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
+ double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) ||
+ ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() ))
+ {
+ // update group name
+ if ( childGroupName != groupName.c_str() ) {
+ child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
+ }
+ okToCreate = false;
+ break;
+ } // if
+ } // for
if (!okToCreate) {
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with entry " << geomEntry << " already exist: dont create again");
- }
return;
}
-
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z<< " is created");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with geom entry " << geomEntry << " is created");
- }
- QTreeWidgetItem *vertexItem = new QTreeWidgetItem( theItem);
+ QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget );
vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
QSize iconSize = iconSelect.size()*0.7;
-
- int vertexIndex=myEnforcedTreeWidget->indexOfTopLevelItem(theItem);
+
+ int vertexIndex=nbVert;
QString myVertexName;
int indexRef = -1;
while(indexRef != vertexIndex) {
myVertexName = QString(vertexName.c_str());
for (int row = 0;row<nbVert;row++) {
- QString name = theItem->child(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
+ QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
if (myVertexName == name) {
vertexIndex++;
break;
if (groupName != "")
vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- QString toolTip = QString(theFaceName.c_str())+QString(": ")+myVertexName;
+ QString toolTip = myVertexName;
if (geomEntry.empty()) {
- toolTip += QString(" (%1, ").arg(x);
- toolTip += QString("%1, ").arg(y);
- toolTip += QString("%1)").arg(z);
+ toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z);
}
if (groupName != "")
toolTip += QString(" [%1]").arg(groupName.c_str());
vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
- theItem->setExpanded(true);
myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
}
This method is called when a item is added into the enforced vertices tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfFaceWdg->deactivateSelection();
+ //myEnfFaceWdg->deactivateSelection();
myEnfVertexWdg->deactivateSelection();
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
// Vertex selection
- int selEnfFace = myEnfFaceWdg->NbObjects();
+ //int selEnfFace = myEnfFaceWdg->NbObjects();
int selEnfVertex = myEnfVertexWdg->NbObjects();
bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
- if (selEnfFace == 0)
- return;
+ // if (selEnfFace == 0)
+ // return;
if ((selEnfVertex == 0) && coordsEmpty)
return;
string entry, shapeName;
- for (int i = 0 ; i < selEnfFace ; i++) {
- myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
- entry = myEnfFace->GetStudyEntry();
- shapeName = myEnfFace->GetName();
+ //for (int i = 0 ; i < selEnfVertex + !coordsEmpty; i++)
+ {
+ //myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
+ //entry = myEnfFace->GetStudyEntry();
+ //shapeName = myEnfFace->GetName();
- QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
+ //QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
std::string groupName = myGroupName->text().toStdString();
z = myZCoord->GetValue();
if (selEnfVertex == 1) {
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
else
- addEnforcedVertex(faceItem, x, y, z, "", "", groupName);
+ addEnforcedVertex(x, y, z, "", "", groupName);
}
else
{
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
measureOp->PointCoordinates (myEnfVertex, x, y, z);
if ( measureOp->IsDone() )
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
} else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
- addEnforcedVertex(faceItem, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
}
}
}
- myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
+ //myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
This method is called when a item is removed from the enforced vertices tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myEnforcedTreeWidget->selectedItems();
QList<QTreeWidgetItem *> selectedVertices;
QSet<QTreeWidgetItem *> selectedEntries;
foreach(item,selectedVertices) {
QTreeWidgetItem* parent = item->parent();
-// MESSAGE("From geometry "<< parent->text(ENF_VER_NAME_COLUMN).toStdString()<<" remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
- parent->removeChild(item);
+ if ( parent )
+ parent->removeChild(item);
delete item;
- if (parent->childCount() == 0) {
+ if ( parent && parent->childCount() == 0) {
if (selectedEntries.contains(parent))
selectedEntries.remove(parent);
delete parent;
}
foreach(item,selectedEntries) {
-// MESSAGE("Remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
delete item;
}
This method is called when a item is added into the periodicity table widget
*/
void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
This method is called when a item is removed from the periodicity tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
QTreeWidgetItem* item;
foreach(item,selectedItems) {
- MESSAGE("Remove " << item->text(0).toStdString());
delete item;
}
//{
// if (myPeriodicityOnFaceRadioButton->isChecked())
// {
-// MESSAGE("Show Face");
// myPeriodicitySourceEdgeWdg->hide();
// myPeriodicityTargetEdgeWdg->hide();
// myPeriodicitySourceFaceWdg->show();
// }
// else
// {
-// MESSAGE("Show Edge");
// myPeriodicitySourceFaceWdg->hide();
// myPeriodicityTargetFaceWdg->hide();
// myPeriodicitySourceEdgeWdg->show();
*/
void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::retrieveParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
// myGMFFileMode->setChecked(data.myGMFFileMode);
// Sizemaps
- MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size());
QMapIterator<QString, QString> i(that->mySMPMap);
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
while (i.hasNext()) {
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
// Enforced vertices
- MESSAGE("retrieveParams(): data.entryCoordsListMap.size() = " << data.faceEntryEnfVertexListMap.size());
TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin();
for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
TEntry entry = (*evmIt).first;
std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
- MESSAGE("Face entry: " << entry);
- MESSAGE("Face name: " << shapeName);
- QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
+ //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
TEnfVertexList evs = (*evmIt).second;
TEnfVertex *enfVertex;
for ( ; evsIt != evs.end() ; ++evsIt) {
enfVertex = (*evsIt);
- MESSAGE("Name: " << enfVertex->name);
double x = 0, y = 0, z = 0;
if (enfVertex->coords.size()) {
x = enfVertex->coords[0];
y = enfVertex->coords[1];
z = enfVertex->coords[2];
}
- that->addEnforcedVertex(faceItem, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
+ that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
}
}
myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
// Periodicity
- MESSAGE("retrieveParams(): periodicity ");
// Add an item in the tree widget for each association
*/
QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
*/
bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
// classic size maps
BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
-// MESSAGE("mySizeMaps->length() = " << mySizeMaps->length());
QString fullSizeMaps;
QStringList fullSizeMapList;
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
for ( CORBA::ULong i = 0;i<mySizeMaps->length(); ++i ) {
fullSizeMaps = mySizeMaps[i].in();
-// MESSAGE("fullSizeMaps: " << fullSizeMaps.toStdString());
fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts );
if ( fullSizeMapList.count() > 1 ) {
string fullSizeMap = fullSizeMapList[1].toStdString();
int pos = fullSizeMap.find("return")+7;
-// MESSAGE("pos:" << pos);
QString sizeMap;
try {
sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
continue;
}
that->mySMPMap[fullSizeMapList[0]] = sizeMap;
-// MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString());
that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]);
}
}
// custom size maps
/*
BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries();
- MESSAGE("myCustomSizeMaps->length() = " << myCustomSizeMaps->length());
for ( int i = 0;i<myCustomSizeMaps->length(); ++i ) {
QString fullCustomSizeMaps = myCustomSizeMaps[i].in();
if ( fullCustomSizeMapList.count() > 1 ) {
that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
- MESSAGE("mySMPMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << fullCustomSizeMapList[1].toStdString());
- MESSAGE("mySMPShapeTypeMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullCustomSizeMapList[0]]);
}
}
*/
// attractor
BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
-// MESSAGE("myAttractors->length() = " << allMyAttractors->length());
for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
QString myAttractors = allMyAttractors[i].in();
if ( myAttractorList.count() > 1 ) {
that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
-// MESSAGE("mySMPMap[" << myAttractorList[0].toStdString() << "] = " << myAttractorList[1].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]);
}
}
// attractor new version
- MESSAGE("readParamsFromHypo, Attractors")
BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
QString faceEntry = myAttractorParams.faceEntry.in();
QString attEntry = myAttractorParams.attEntry.in();
- MESSAGE("attEntry = "<<attEntry.toStdString())
that->mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher)
that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(),
*/
BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
- MESSAGE("faceEntryEnfVertexListMap->length() = " << faceEntryEnfVertexListMap->length());
- for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i ) {
- std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
-// BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList.in();
+ for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i )
+ {
+ std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
-// BLSURFPlugin::TEnfVertexList_var vertexList = h->GetEnforcedVerticesEntry(entry.c_str());
-
-// TEnfVertexList& enfVertexList = h_data.faceEntryEnfVertexListMap[entry];
- for (CORBA::ULong j=0 ; j<vertexList.length(); ++j) {
+ for (CORBA::ULong j=0 ; j<vertexList.length(); ++j)
+ {
TEnfVertex *enfVertex = new TEnfVertex();
-
- enfVertex->name = CORBA::string_dup(vertexList[j].name.in());
- enfVertex->geomEntry = CORBA::string_dup(vertexList[j].geomEntry.in());
- enfVertex->grpName = CORBA::string_dup(vertexList[j].grpName.in());
+ enfVertex->name = vertexList[j].name.in();
+ enfVertex->geomEntry = vertexList[j].geomEntry.in();
+ enfVertex->grpName = vertexList[j].grpName.in();
for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
enfVertex->coords.push_back(vertexList[j].coords[k]);
h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
// Periodicity
- MESSAGE("readParamsFromHypo, Periodicity")
h_data.preCadPeriodicityVector.clear();
*/
bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
const QString sizeMap = i.value();
if (sizeMap == "__TO_DELETE__") {
- MESSAGE("Delete entry " << entry.toStdString() << " from engine");
h->UnsetEntry(entry.toLatin1().constData());
}
else if (sizeMap.startsWith("ATTRACTOR")) {
-// MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
}
else if (sizeMap.startsWith("def")) {
-// MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
}
else {
fullSizeMap = QString("def f(t): return ") + sizeMap;
else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
fullSizeMap = QString("def f(): return ") + sizeMap;
- MESSAGE("SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString());
h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
}
}
{
faceEntry = evmIt->first;
evs = evmIt->second;
- MESSAGE("Number of enforced vertices for face entry " << faceEntry << ": " << evs.size());
evsIt = evs.begin();
for ( ; evsIt != evs.end() ; ++evsIt)
{
if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
h->ClearPreCadPeriodicityVectors();
- MESSAGE("h_data.preCadPeriodicityVector.size(): " << h_data.preCadPeriodicityVector.size());
TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
{
h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end periodicity");
} // try
// // SalomeApp_Tools::QtCatchCorbaException(ex);
// // ok = false;
// }
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end");
return ok;
}
*/
QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets");
h_data.myName = myName ? myName->text() : "";
h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex();
h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex();
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
{
- QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
- if ( that->mySMPMap.contains(entry) )
- guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
+ QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
+ if ( that->mySMPMap.contains(entry) )
+ guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
}
// Enforced vertices
h_data.faceEntryEnfVertexListMap.clear();
int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
- int nbEnforcedVertices = 0;
- std::string groupName = "";
-// MESSAGE("Nb of enforced shapes: " << nbEnforcedShapes);
- for (int i=0 ; i<nbEnforcedShapes ; i++) {
- QTreeWidgetItem* shapeItem = myEnforcedTreeWidget->topLevelItem(i);
- if (shapeItem) {
- std::string faceEntry = shapeItem->data(ENF_VER_FACE_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
- nbEnforcedVertices = shapeItem->childCount();
- if (nbEnforcedVertices >0) {
- double childValueX,childValueY,childValueZ;
- std::string childName, vertexEntry;
- QTreeWidgetItem* child;
- TEnfVertexList evs;
- evs.clear();
- for (row = 0;row<nbEnforcedVertices;row++) {
- child = shapeItem->child(row);
- childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
-// else
- groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
-
- TEnfVertex *enfVertex = new TEnfVertex();
- enfVertex->name = childName;
- if (vertexEntry.empty()) {
- enfVertex->coords.push_back(childValueX);
- enfVertex->coords.push_back(childValueY);
- enfVertex->coords.push_back(childValueZ);
- }
- else
- enfVertex->geomEntry = vertexEntry;
- enfVertex->grpName = groupName;
-// TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
-// if (it == h_data.enfVertexList.end())
- h_data.enfVertexList.insert(enfVertex);
- evs.insert(enfVertex);
- /* TODO GROUPS
- if (groupName != "")
- h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
- */
- }
- h_data.faceEntryEnfVertexListMap[faceEntry] = evs;
- }
+ std::string groupName = "", faceEntry = "";
+ for (int i=0 ; i<nbEnforcedShapes ; i++)
+ {
+ double childValueX,childValueY,childValueZ;
+ std::string childName, vertexEntry;
+ QTreeWidgetItem* child;
+
+ child = myEnforcedTreeWidget->topLevelItem(i);
+ childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
+ childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
+ // if (myGlobalGroupName->isChecked())
+ // groupName = myGlobalGroupName->text().toStdString();
+ // else
+ groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
+
+ TEnfVertex *enfVertex = new TEnfVertex();
+ enfVertex->name = childName;
+ if (vertexEntry.empty()) {
+ enfVertex->coords.push_back(childValueX);
+ enfVertex->coords.push_back(childValueY);
+ enfVertex->coords.push_back(childValueZ);
}
+ else
+ enfVertex->geomEntry = vertexEntry;
+ enfVertex->grpName = groupName;
+ // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
+ // if (it == h_data.enfVertexList.end())
+ h_data.enfVertexList.insert(enfVertex);
+ /* TODO GROUPS
+ if (groupName != "")
+ h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
+ */
+ h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex );
}
h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
if (item) {
for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
{
- MESSAGE(k);
std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
- MESSAGE(entry);
periodicity_i.push_back(entry);
}
h_data.preCadPeriodicityVector.push_back(periodicity_i);
guiHyp += "PERIODICITY = yes; ";
}
- MESSAGE("guiHyp : " << guiHyp.toLatin1().data());
return guiHyp;
}
void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<col<<")")
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (col == SMP_SIZEMAP_COLUMN) {
QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
myGeomSelWdg1 ->deactivateSelection();
myGeomSelWdg2 ->deactivateSelection();
myAttSelWdg ->deactivateSelection();
- myEnfFaceWdg ->deactivateSelection();
+ //myEnfFaceWdg ->deactivateSelection();
myEnfVertexWdg ->deactivateSelection();
myPeriodicitySourceFaceWdg->deactivateSelection();
myPeriodicityTargetFaceWdg->deactivateSelection();
void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()");
QList<int> selectedRows;
QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
QTreeWidgetItem* item;
void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< col << ")");
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
if (col == SMP_SIZEMAP_COLUMN) {
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString());
if (! that->mySMPShapeTypeMap.contains(entry))
- MESSAGE("no such entry in mySMPShapeTypeMap")
return;
if (that->mySMPMap.contains(entry))
if (that->mySMPMap[entry] == sizeMap
sizeMapValidationFromEntry(entry);
}
else {
- MESSAGE("Size map empty: reverse to precedent value" );
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
}
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onModifyMap()");
bool res = false;
if ( smpTab->currentIndex() == ATT_TAB ){
if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()");
// BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
// BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
TopAbs_ShapeEnum shapeType;
string entry, shapeName;
entry = (string) anObject->GetStudyEntry();
- MESSAGE("entry = "<<entry);
shapeName = anObject->GetName();
shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
// Group management : the type of entities in the group is stored in the SMPShapeTypeMap
else{
if (that->mySMPMap.contains(shapeEntry)) {
if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
return false;
}
}
bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
else{
// if (that->mySMPMap.contains(shapeEntry)) {
// if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
// return false;
// }
// }
myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
myStdWidget->onPhysicalMeshChanged();
}
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
return true;
}
bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
if (! sizeMapValidationFromRow(row))
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<<myRow);
QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
bool res = sizeMapValidationFromEntry(myEntry,displayError);
mySizeMapTable->setFocus();
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()");
- MESSAGE("myEntry = "<<myEntry.toStdString())
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (! that->mySMPMap.contains(myEntry)) {
-// MESSAGE("Geometry with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
if (! that->mySMPShapeTypeMap.contains(myEntry)) {
-// MESSAGE("Shape type with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
string expr;
if (that->mySMPMap[myEntry].startsWith("def")) {
-// MESSAGE("custom function" );
expr = that->mySMPMap[myEntry].toStdString();
}
else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
-// MESSAGE("Attractor" );
if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) {
if (displayError)
PyGILState_Release(gstate);
-// MESSAGE("SizeMap expression "<<expr<<" is valid");
return true;
}
if (entry == entryForChecking )
break;
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
return row;
}
void onSetSizeMap(QTreeWidgetItem *, int);
// Enforced vertices tab
QTreeWidgetItem* addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
- void addEnforcedVertex(QTreeWidgetItem * theFaceItem, double x=0, double y=0, double z=0,
+ void addEnforcedVertex(double x=0, double y=0, double z=0,
std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
-r = 10
-dist = 10
dist_coin = 10.1
p1 = geompy.MakeVertex(0., 0., 0.)
left = geompy.GetFaceNearPoint(box, p3)
geompy.addToStudyInFather(box, left, "left")
+allEnforcedCoords = []
+allEnforcedCoords.append(( dist_coin, 0, dist_coin ))
+allEnforcedCoords.append(( 20, 0, 15.3 ))
+allEnforcedCoords.append(( 25, 1, 25.3 ))
+allEnforcedCoords.append(( 35, 1, 45.3 ))
+allEnforcedCoords.append(( 35, 1, 55.3 ))
+
+p4 = geompy.MakeVertex( *(allEnforcedCoords[1] ))
+p5 = geompy.MakeVertex( *(allEnforcedCoords[2] ))
+pp = geompy.MakeCompound( [p4,p5], theName="p4,p5" )
+p6 = geompy.MakeVertex( *(allEnforcedCoords[3] ), theName="p6")
+p7 = geompy.MakeVertex( *(allEnforcedCoords[4] ), theName="p7")
+
+xyz7 = allEnforcedCoords[4]
+
# Mesh
# ====
algo2d.SetPhySize( 8 )
algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
+algo2d.AddEnforcedVertexGeom( pp )
+algo2d.AddEnforcedVertexGeom( p6 )
+algo2d.AddEnforcedVertex( *xyz7 )
Mesh.Compute()
-id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
+for x,y,z in allEnforcedCoords:
-x, y, z = Mesh.GetNodeXYZ(id_node)
+ id_node = Mesh.FindNodeClosestTo( x,y,z )
+ xn, yn, zn = Mesh.GetNodeXYZ( id_node )
-assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
+ # compare X and Z
+ assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
+ "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
salome.sg.updateObjBrowser(True)
-