\image html netgen3d_local_size.png
- <b>Local sizes</b> - allows to define size of elements on and
-around specified geometrical edges and vertices. To define the local
-size it is necessary to select a geometrical edge or vertex in the
-object browser or in the viewer, and to click <b>On Edge</b> or <b>On
-Vertex</b> correspondingly. <b>Name</b> of the geometrical object and
-a default <b>Value</b> will be added in the table where the
-<b>Value</b> can be changed.
+around specified geometrical objects. To define the local
+size it is necessary to select a geometrical objects in the
+object browser or in the viewer, and to click a button corresponding
+to the type of the geometrical objects: <b>On Vertex</b>, <b>On
+ Edge</b> etc. <b>Name</b> of the geometrical object and a
+default <b>Value</b> will be added in the table where the <b>Value</b>
+can be changed.
- <b>Remove</b> - deletes a selected row from the table.
\image html netgen2d3d_simple.png
LSZ_VERTEX_BTN,
LSZ_EDGE_BTN,
LSZ_FACE_BTN,
+ LSZ_SOLID_BTN,
LSZ_SEPARATOR2,
LSZ_REMOVE_BTN
};
localSizeLayout->addWidget(addEdgeButton, LSZ_EDGE_BTN, 1, 1, 1);
QPushButton* addFaceButton = new QPushButton(tr("NETGEN_LSZ_FACE"), localSizeGroup);
localSizeLayout->addWidget(addFaceButton, LSZ_FACE_BTN, 1, 1, 1);
+ QPushButton* addSolidButton = new QPushButton(tr("NETGEN_LSZ_SOLID"), localSizeGroup);
+ localSizeLayout->addWidget(addSolidButton, LSZ_SOLID_BTN, 1, 1, 1);
QFrame *line2 = new QFrame(localSizeGroup);
line2->setFrameShape(QFrame::HLine);
connect( addVertexButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnVertex()));
connect( addEdgeButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnEdge()));
connect( addFaceButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnFace()));
+ connect( addSolidButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnSolid()));
connect( removeButton, SIGNAL(clicked()), this, SLOT(onRemoveLocalSizeOnShape()));
connect( myLocalSizeTable, SIGNAL(cellChanged(int, int)), this, SLOT(onSetLocalSize(int, int)));
addLocalSizeOnShape(TopAbs_FACE);
}
+void NETGENPluginGUI_HypothesisCreator::onAddLocalSizeOnSolid()
+{
+ addLocalSizeOnShape(TopAbs_SOLID);
+}
+
void NETGENPluginGUI_HypothesisCreator::addLocalSizeOnShape(TopAbs_ShapeEnum typeShapeAsked)
{
NETGENPlugin::NETGENPlugin_Hypothesis_var h = NETGENPlugin::NETGENPlugin_Hypothesis::_narrow(initParamsHypothesis());
virtual void onAddLocalSizeOnVertex();
virtual void onAddLocalSizeOnEdge();
virtual void onAddLocalSizeOnFace();
+ virtual void onAddLocalSizeOnSolid();
virtual void onRemoveLocalSizeOnShape();
virtual void onSetLocalSize(int,int);
</message>
<message>
<source>NETGEN_LSZ_FACE</source>
- <translation>On Sub-Face</translation>
+ <translation>On Face</translation>
+ </message>
+ <message>
+ <source>NETGEN_LSZ_SOLID</source>
+ <translation>On Solid</translation>
</message>
<message>
<source>NETGEN_LSZ_REMOVE</source>
</message>
<message>
<source>NETGEN_LSZ_FACE</source>
- <translation>Sur une sous-face</translation>
+ <translation>Sur une face</translation>
+ </message>
+ <message>
+ <source>NETGEN_LSZ_SOLID</source>
+ <translation>Sur une solide</translation>
</message>
<message>
<source>NETGEN_LSZ_REMOVE</source>
#include <SMESH_Block.hxx>
#include <SMESH_Comment.hxx>
#include <SMESH_ComputeError.hxx>
+#include <SMESH_ControlPnt.hxx>
#include <SMESH_File.hxx>
#include <SMESH_Gen_i.hxx>
#include <SMESH_Mesh.hxx>
std::map<int,double> VertexId2LocalSize;
std::map<int,double> EdgeId2LocalSize;
std::map<int,double> FaceId2LocalSize;
+std::map<int,double> SolidId2LocalSize;
//=============================================================================
/*!
VertexId2LocalSize.clear();
EdgeId2LocalSize.clear();
FaceId2LocalSize.clear();
+ SolidId2LocalSize.clear();
}
//================================================================================
EdgeId2LocalSize[key] = LocalSize;
} else if (GeomType == TopAbs_FACE) {
FaceId2LocalSize[key] = LocalSize;
+ } else if (GeomType == TopAbs_SOLID) {
+ SolidId2LocalSize[key] = LocalSize;
}
}
gp_Pnt p = BRep_Tool::Pnt(v);
NETGENPlugin_Mesher::RestrictLocalSize( *_ngMesh, p.XYZ(), hi );
}
- for(map<int,double>::const_iterator it=FaceId2LocalSize.begin();
- it!=FaceId2LocalSize.end(); it++)
+ for(map<int,double>::const_iterator it=FaceId2LocalSize.begin(); it!=FaceId2LocalSize.end(); it++)
{
int key = (*it).first;
double val = (*it).second;
const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key);
int faceNgID = occgeo.fmap.FindIndex(shape);
- occgeo.SetFaceMaxH(faceNgID, val);
- for ( TopExp_Explorer edgeExp( shape, TopAbs_EDGE ); edgeExp.More(); edgeExp.Next() )
- setLocalSize( TopoDS::Edge( edgeExp.Current() ), val, *_ngMesh );
+ if ( faceNgID >= 1 )
+ {
+ occgeo.SetFaceMaxH(faceNgID, val);
+ for ( TopExp_Explorer edgeExp( shape, TopAbs_EDGE ); edgeExp.More(); edgeExp.Next() )
+ setLocalSize( TopoDS::Edge( edgeExp.Current() ), val, *_ngMesh );
+ }
+ else
+ {
+ std::vector<SMESHUtils::ControlPnt> pnt;
+ SMESHUtils::createPointsSampleFromFace( TopoDS::Face( shape ), val, pnt );
+ if ( !pnt.empty() )
+ NETGENPlugin_Mesher::RestrictLocalSize( *_ngMesh, pnt[0].XYZ(), val );
+ for ( size_t i = 1; i < pnt.size(); ++i )
+ _ngMesh->RestrictLocalH( netgen::Point3d( pnt[i].X(), pnt[i].Y(), pnt[i].Z() ), val );
+ }
+ }
+ for(map<int,double>::const_iterator it=SolidId2LocalSize.begin(); it!=SolidId2LocalSize.end(); it++)
+ {
+ int key = (*it).first;
+ double val = (*it).second;
+ const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key);
+
+ std::vector<SMESHUtils::ControlPnt> pnt;
+ SMESHUtils::createPointsSampleFromSolid( TopoDS::Solid( shape ), val, pnt );
+ if ( !pnt.empty() )
+ NETGENPlugin_Mesher::RestrictLocalSize( *_ngMesh, pnt[0].XYZ(), val );
+ for ( size_t i = 1; i < pnt.size(); ++i )
+ _ngMesh->RestrictLocalH( netgen::Point3d( pnt[i].X(), pnt[i].Y(), pnt[i].Z() ), val );
}
}