Allow local size on any face and solid
This commit is contained in:
parent
b6ac276690
commit
8b187bb352
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 14 KiB |
@ -59,12 +59,13 @@ but are topologically different.
|
||||
\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
|
||||
|
@ -80,6 +80,7 @@ enum {
|
||||
LSZ_VERTEX_BTN,
|
||||
LSZ_EDGE_BTN,
|
||||
LSZ_FACE_BTN,
|
||||
LSZ_SOLID_BTN,
|
||||
LSZ_SEPARATOR2,
|
||||
LSZ_REMOVE_BTN
|
||||
};
|
||||
@ -262,6 +263,8 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
|
||||
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);
|
||||
@ -274,6 +277,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
|
||||
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)));
|
||||
|
||||
@ -638,6 +642,11 @@ void NETGENPluginGUI_HypothesisCreator::onAddLocalSizeOnFace()
|
||||
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());
|
||||
|
@ -80,6 +80,7 @@ protected slots:
|
||||
virtual void onAddLocalSizeOnVertex();
|
||||
virtual void onAddLocalSizeOnEdge();
|
||||
virtual void onAddLocalSizeOnFace();
|
||||
virtual void onAddLocalSizeOnSolid();
|
||||
virtual void onRemoveLocalSizeOnShape();
|
||||
virtual void onSetLocalSize(int,int);
|
||||
|
||||
|
@ -137,7 +137,11 @@
|
||||
</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>
|
||||
|
@ -137,7 +137,11 @@
|
||||
</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>
|
||||
|
@ -39,6 +39,7 @@
|
||||
#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>
|
||||
@ -120,6 +121,7 @@ TopTools_IndexedMapOfShape ShapesWithLocalSize;
|
||||
std::map<int,double> VertexId2LocalSize;
|
||||
std::map<int,double> EdgeId2LocalSize;
|
||||
std::map<int,double> FaceId2LocalSize;
|
||||
std::map<int,double> SolidId2LocalSize;
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
@ -149,6 +151,7 @@ NETGENPlugin_Mesher::NETGENPlugin_Mesher (SMESH_Mesh* mesh,
|
||||
VertexId2LocalSize.clear();
|
||||
EdgeId2LocalSize.clear();
|
||||
FaceId2LocalSize.clear();
|
||||
SolidId2LocalSize.clear();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -240,6 +243,8 @@ void SetLocalSize(TopoDS_Shape GeomShape, double LocalSize)
|
||||
EdgeId2LocalSize[key] = LocalSize;
|
||||
} else if (GeomType == TopAbs_FACE) {
|
||||
FaceId2LocalSize[key] = LocalSize;
|
||||
} else if (GeomType == TopAbs_SOLID) {
|
||||
SolidId2LocalSize[key] = LocalSize;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2555,16 +2560,40 @@ bool NETGENPlugin_Mesher::Compute()
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user