mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-16 10:38:33 +05:00
745 lines
20 KiB
HTML
Executable File
745 lines
20 KiB
HTML
Executable File
<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
<title>Constructing Meshes</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
|
|
<meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com"><style type="text/css">
|
|
<!--
|
|
p.whs1 { margin-top:0pt; margin-bottom:0pt; font-family:'Lucida Console' , monospace; }
|
|
p.whs2 { margin-top:0pt; margin-bottom:0pt; }
|
|
p.whs3 { font-family:'Lucida Console' , monospace; margin-top:0px; margin-bottom:0px; }
|
|
p.whs4 { margin-top:0px; margin-bottom:0px; }
|
|
p.whs5 { margin-top:0px; margin-bottom:0px; font-family:'Times New Roman' , serif; }
|
|
-->
|
|
</style><script type="text/javascript" language="JavaScript">
|
|
<!--
|
|
if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))
|
|
{
|
|
var strNSS = "<style type='text/css'>";
|
|
strNSS += "p.whs1 {margin-top:1pt;margin-bottom:1pt; }";
|
|
strNSS += "p.whs2 {margin-top:1pt;margin-bottom:1pt; }";
|
|
strNSS += "p.whs3 {margin-top:1pt;margin-bottom:1pt; }";
|
|
strNSS += "p.whs4 {margin-top:1pt;margin-bottom:1pt; }";
|
|
strNSS += "p.whs5 {margin-top:1pt;margin-bottom:1pt; }";
|
|
strNSS +="</style>";
|
|
document.write(strNSS);
|
|
}
|
|
//-->
|
|
</script>
|
|
<script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
|
|
<!--
|
|
function reDo() {
|
|
if (innerWidth != origWidth || innerHeight != origHeight)
|
|
location.reload();
|
|
}
|
|
if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
|
|
origWidth = innerWidth;
|
|
origHeight = innerHeight;
|
|
onresize = reDo;
|
|
}
|
|
onerror = null;
|
|
//-->
|
|
</script>
|
|
<style type="text/css">
|
|
<!--
|
|
div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
|
|
p.WebHelpNavBar { text-align:right; }
|
|
-->
|
|
</style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
|
|
<script type="text/javascript" language="javascript" src="whver.js"></script>
|
|
<script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
|
|
<script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
|
|
<script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.gbWhTopic)
|
|
{
|
|
if (window.setRelStartPage)
|
|
{
|
|
addTocInfo("MESH module\nTUI Scripts\nCreating Meshes");
|
|
addButton("show",BTN_IMG,"Show","","","","",0,0,"whd_show0.gif","whd_show2.gif","whd_show1.gif");
|
|
addButton("hide",BTN_IMG,"Hide","","","","",0,0,"whd_hide0.gif","whd_hide2.gif","whd_hide1.gif");
|
|
|
|
}
|
|
|
|
|
|
if (window.setRelStartPage)
|
|
{
|
|
setRelStartPage("index.htm");
|
|
|
|
autoSync(1);
|
|
sendSyncInfo();
|
|
sendAveInfoOut();
|
|
}
|
|
|
|
}
|
|
else
|
|
if (window.gbIE4)
|
|
document.location.reload();
|
|
//-->
|
|
</script>
|
|
</head>
|
|
<body><script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(4);
|
|
//-->
|
|
</script>
|
|
<h1>Creating Meshes</h1>
|
|
|
|
<p>At first see <a href="smesh_py_introduction.htm">Example of 3d mesh generation</a>, using <b>smesh</b> package.
|
|
<p>Other examples of python scripts will be also updated soon to use <b>smesh</b> package instead of direct usage of idl interface.
|
|
|
|
<h3><a name=bookmark>Construction of a Mesh</a></h3>
|
|
|
|
<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.
|
|
<br>
|
|
|
|
<p class="whs1">import salome</p>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import StdMeshers</p>
|
|
|
|
<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
|
|
"SMESH")</p>
|
|
|
|
<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>
|
|
|
|
<p class="whs1">smeshgui.Init(salome.myStudyId);</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create a box</p>
|
|
|
|
<p class="whs1">box = geompy.MakeBox(0.,
|
|
0., 0., 100., 200., 300.)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># add box to the study</p>
|
|
|
|
<p class="whs1">idbox = geompy.addToStudy(box,
|
|
"box")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create a hypothesis</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
create Hypothesis"</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
NumberOfSegments"</p>
|
|
|
|
<p class="whs1">numberOfSegments
|
|
= 7</p>
|
|
|
|
<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetName()</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetId()</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg),
|
|
"NumberOfSegments_10")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MaxElementArea"</p>
|
|
|
|
<p class="whs1">maxElementArea =
|
|
800</p>
|
|
|
|
<p class="whs1">hypArea = smesh.CreateHypothesis("MaxElementArea",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>
|
|
|
|
<p class="whs1">print hypArea.GetName()</p>
|
|
|
|
<p class="whs1">print hypArea.GetId()</p>
|
|
|
|
<p class="whs1">print hypArea.GetMaxElementArea()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea),
|
|
"MaxElementArea_500")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MaxElementVolume"</p>
|
|
|
|
<p class="whs1">maxElementVolume
|
|
= 900</p>
|
|
|
|
<p class="whs1">hypVolume = smesh.CreateHypothesis("MaxElementVolume",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>
|
|
|
|
<p class="whs1">print hypVolume.GetName()</p>
|
|
|
|
<p class="whs1">print hypVolume.GetId()</p>
|
|
|
|
<p class="whs1">print hypVolume.GetMaxElementVolume()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume),
|
|
"MaxElementVolume_500")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create algorithms</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
create Algorithms"</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
Regular_1D"</p>
|
|
|
|
<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D),
|
|
"Wire Discretisation")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MEFISTO_2D"</p>
|
|
|
|
<p class="whs1">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D),
|
|
"MEFISTO_2D")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># initialize a mesh with
|
|
the box</p>
|
|
|
|
<p class="whs1">mesh = smesh.CreateMesh(box)</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh),
|
|
"MeshBox")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># add the hypothesis to
|
|
the box</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
add hypothesis to the box"</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypArea)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># compute the mesh</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
compute the mesh of the box"</p>
|
|
|
|
<p class="whs1">ret = smesh.Compute(mesh,box)</p>
|
|
|
|
<p class="whs1">print ret</p>
|
|
|
|
<p class="whs1">if ret == 0:</p>
|
|
|
|
<p class="whs1"> print
|
|
"probleme when computing the mesh"</p>
|
|
|
|
<p class="whs1">salome.sg.updateObjBrowser(1)</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<h3><a name=bookmark1>Construction of a Submesh</a></h3>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">from
|
|
geompy import *</span></p>
|
|
|
|
<p class="whs3">import smesh</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create vertices</p>
|
|
|
|
<p class="whs3">Point111 = MakeVertex( 0, 0,
|
|
0)</p>
|
|
|
|
<p class="whs3">Point211 = MakeVertex(10, 0,
|
|
0)</p>
|
|
|
|
<p class="whs3">Point121 = MakeVertex( 0, 10, 0)</p>
|
|
|
|
<p class="whs3">Point221 = MakeVertex(10, 10, 0)</p>
|
|
|
|
<p class="whs3">Point112 = MakeVertex( 0, 0,
|
|
10)</p>
|
|
|
|
<p class="whs3">Point212 = MakeVertex(10, 0,
|
|
10)</p>
|
|
|
|
<p class="whs3">Point122 = MakeVertex( 0, 10, 10)</p>
|
|
|
|
<p class="whs3">Point222 = MakeVertex(10, 10, 10)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create edges</p>
|
|
|
|
<p class="whs3">EdgeX111 = MakeEdge(Point111, Point211)</p>
|
|
|
|
<p class="whs3">EdgeX121 = MakeEdge(Point121, Point221)</p>
|
|
|
|
<p class="whs3">EdgeX112 = MakeEdge(Point112, Point212)</p>
|
|
|
|
<p class="whs3">EdgeX122 = MakeEdge(Point122, Point222)</p>
|
|
|
|
<p class="whs3">EdgeY11 = MakeEdge(Point111, Point121)</p>
|
|
|
|
<p class="whs3">EdgeY21 = MakeEdge(Point211, Point221)</p>
|
|
|
|
<p class="whs3">EdgeY12 = MakeEdge(Point112, Point122)</p>
|
|
|
|
<p class="whs3">EdgeY22 = MakeEdge(Point212, Point222)</p>
|
|
|
|
<p class="whs3">EdgeZ111 = MakeEdge(Point111, Point112)</p>
|
|
|
|
<p class="whs3">EdgeZ211 = MakeEdge(Point211, Point212)</p>
|
|
|
|
<p class="whs3">EdgeZ121 = MakeEdge(Point121, Point122)</p>
|
|
|
|
<p class="whs3">EdgeZ221 = MakeEdge(Point221, Point222)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create faces</p>
|
|
|
|
<p class="whs3">FaceX11 = MakeQuad(EdgeY11, EdgeZ111,
|
|
EdgeY12, EdgeZ121)</p>
|
|
|
|
<p class="whs3">FaceX21 = MakeQuad(EdgeY21, EdgeZ211,
|
|
EdgeY22, EdgeZ221)</p>
|
|
|
|
<p class="whs3">FaceY111 = MakeQuad(EdgeX111, EdgeZ111,
|
|
EdgeX112, EdgeZ211)</p>
|
|
|
|
<p class="whs3">FaceY121 = MakeQuad(EdgeX121, EdgeZ121,
|
|
EdgeX122, EdgeZ221)</p>
|
|
|
|
<p class="whs3">FaceZ11 = MakeQuad(EdgeX111, EdgeY11,
|
|
EdgeX121, EdgeY21)</p>
|
|
|
|
<p class="whs3">FaceZ12 = MakeQuad(EdgeX112, EdgeY12,
|
|
EdgeX122, EdgeY22)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create a solid</p>
|
|
|
|
<p class="whs3">Block = MakeHexa(FaceX11, FaceX21, FaceY111,
|
|
FaceY121, FaceZ11, FaceZ12)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create a compound</p>
|
|
|
|
<p class="whs3">box = MakeCompound([Block])</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># add in the study</p>
|
|
|
|
<p class="whs3">box_id = addToStudy(box, "Box compound")</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># create hexahedral mesh
|
|
on the box</p>
|
|
|
|
<p class="whs3">hexa = smesh.Mesh(box, "Box compound
|
|
: hexahedrical mesh")</p>
|
|
|
|
<p class="whs3">algo = hexa.Segment()</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># define "NumberOfSegments"
|
|
hypothesis to cut the edge in a fixed number of segments</p>
|
|
|
|
<p class="whs3">algo.NumberOfSegments(4)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># creates a quadrangle
|
|
2D algorithm for the faces</p>
|
|
|
|
<p class="whs3">hexa.Quadrangle()</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># construct a submesh with
|
|
a local hypothesis</p>
|
|
|
|
<p class="whs3">algo = hexa.Segment(EdgeX111)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># define "Arithmetic1D"
|
|
hypothesis to cut an edge in several segments with increasing arithmetic
|
|
length </p>
|
|
|
|
<p class="whs3">algo.Arithmetic1D(1, 4)</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># define "Propagation"
|
|
hypothesis that propagates all other hypothesis on all edges on the opposite
|
|
side in case of quadrangular faces</p>
|
|
|
|
<p class="whs3">algo.Propagation()</p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs4"># compute the mesh</p>
|
|
|
|
<p class="whs3">hexa.Compute() </p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<h3><a name=bookmark2>Editing of a mesh</a></h3>
|
|
|
|
<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.
|
|
<br>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3"><span style="font-family: 'Lucida Console', monospace;">import
|
|
salome</span></p>
|
|
|
|
<p class="whs3">import geompy</p>
|
|
|
|
<p class="whs3">import SMESH</p>
|
|
|
|
<p class="whs3">import StdMeshers</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
|
|
"SMESH")</p>
|
|
|
|
<p class="whs3">smesh.SetCurrentStudy(salome.myStudy)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">box =
|
|
geompy.MakeBox(0., 0., 0., 20., 20., 20.)</p>
|
|
|
|
<p class="whs3">idbox = geompy.addToStudy(box, "box")</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">subShapeList = geompy.SubShapeAll(box,
|
|
geompy.ShapeType["EDGE"])</p>
|
|
|
|
<p class="whs3">edge =
|
|
subShapeList[0]</p>
|
|
|
|
<p class="whs3">name =
|
|
geompy.SubShapeName(edge, box)</p>
|
|
|
|
<p class="whs3">idedge = geompy.addToStudyInFather(box,
|
|
edge, name)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">box =
|
|
salome.IDToObject(idbox)</p>
|
|
|
|
<p class="whs3">edge = salome.IDToObject(idedge)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">hyp1 = smesh.CreateHypothesis("NumberOfSegments",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3">hyp1.SetNumberOfSegments(3)</p>
|
|
|
|
<p class="whs3">hyp2 = smesh.CreateHypothesis("MaxElementArea",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3">hyp2.SetMaxElementArea(10)</p>
|
|
|
|
<p class="whs3">hyp3 = smesh.CreateHypothesis("Arithmetic1D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3">hyp3.SetLength(1,1)</p>
|
|
|
|
<p class="whs3">hyp3.SetLength(6,0)</p>
|
|
|
|
<p class="whs3">hyp4 = smesh.CreateHypothesis("Propagation",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">algo1 = smesh.CreateHypothesis("Regular_1D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3">algo2 = smesh.CreateHypothesis("MEFISTO_2D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">mesh = smesh.CreateMesh(box)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(box,hyp1)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(box,hyp2)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(box,algo1)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(box,algo2)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(edge,hyp3)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(edge,hyp4)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(edge,algo1)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">smesh.Compute(mesh,box)</p>
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs5"># remove a hypothesis</p>
|
|
|
|
<p class="whs3">mesh.RemoveHypothesis(edge,hyp4)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">smesh.Compute(mesh,box)</p>
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs5"># change the value
|
|
of the hypothesis</p>
|
|
|
|
<p class="whs3">hyp2.SetMaxElementArea(2)</p>
|
|
|
|
<p class="whs3">mesh.AddHypothesis(box,hyp2)</p>
|
|
|
|
<p class="whs3"> </p>
|
|
|
|
<p class="whs3">smesh.Compute(mesh,box)</p>
|
|
|
|
<p class="whs3">salome.sg.updateObjBrowser(1) </p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<h3><a name=bookmark3>Export of a Mesh</a></h3>
|
|
|
|
<p>Attention! This script was written using old approach, based on direct usage of SMESH idl interface. To be updated for version 3.2.1 to use <b>smesh</b> package.
|
|
<br>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
|
|
salome</span></p>
|
|
|
|
<p class="whs1">import geompy</p>
|
|
|
|
<p class="whs1">import StdMeshers</p>
|
|
|
|
<p class="whs1">smesh = salome.lcc.FindOrLoadComponent("FactoryServer",
|
|
"SMESH")</p>
|
|
|
|
<p class="whs1">smeshgui = salome.ImportComponentGUI("SMESH")</p>
|
|
|
|
<p class="whs1">smeshgui.Init(salome.myStudyId);</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create a box</p>
|
|
|
|
<p class="whs1">box = geompy.MakeBox(0.,
|
|
0., 0., 100., 200., 300.)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># add the box to the study</p>
|
|
|
|
<p class="whs1">idbox = geompy.addToStudy(box,
|
|
"box")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create a hypothesis</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
create Hypothesis"</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
NumberOfSegments"</p>
|
|
|
|
<p class="whs1">numberOfSegments
|
|
= 7</p>
|
|
|
|
<p class="whs1">hypNbSeg = smesh.CreateHypothesis("NumberOfSegments",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypNbSeg.SetNumberOfSegments(numberOfSegments)</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetName()</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetId()</p>
|
|
|
|
<p class="whs1">print hypNbSeg.GetNumberOfSegments()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypNbSeg),
|
|
"NumberOfSegments_10")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MaxElementArea"</p>
|
|
|
|
<p class="whs1">maxElementArea =
|
|
800</p>
|
|
|
|
<p class="whs1">hypArea = smesh.CreateHypothesis("MaxElementArea",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypArea.SetMaxElementArea(maxElementArea)</p>
|
|
|
|
<p class="whs1">print hypArea.GetName()</p>
|
|
|
|
<p class="whs1">print hypArea.GetId()</p>
|
|
|
|
<p class="whs1">print hypArea.GetMaxElementArea()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypArea),
|
|
"MaxElementArea_500")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MaxElementVolume"</p>
|
|
|
|
<p class="whs1">maxElementVolume
|
|
= 900</p>
|
|
|
|
<p class="whs1">hypVolume = smesh.CreateHypothesis("MaxElementVolume",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">hypVolume.SetMaxElementVolume(maxElementVolume)</p>
|
|
|
|
<p class="whs1">print hypVolume.GetName()</p>
|
|
|
|
<p class="whs1">print hypVolume.GetId()</p>
|
|
|
|
<p class="whs1">print hypVolume.GetMaxElementVolume()</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(hypVolume),
|
|
"MaxElementVolume_500")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># create algorithms</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
create Algorithms"</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
Regular_1D"</p>
|
|
|
|
<p class="whs1">regular1D = smesh.CreateHypothesis("Regular_1D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(regular1D),
|
|
"Wire Discretisation")</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
MEFISTO_2D"</p>
|
|
|
|
<p class="whs1">mefisto2D = smesh.CreateHypothesis("MEFISTO_2D",
|
|
"libStdMeshersEngine.so")</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(mefisto2D),
|
|
"MEFISTO_2D")</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># initialize a mesh with
|
|
the box</p>
|
|
|
|
<p class="whs1">mesh = smesh.CreateMesh(box)</p>
|
|
|
|
<p class="whs1">smeshgui.SetName(salome.ObjectToID(mesh),
|
|
"MeshBox")</p>
|
|
|
|
<p class="whs1"> </p>
|
|
|
|
<p class="whs2"># add the hypothesis to
|
|
the box</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
add hypothesis to the box"</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypNbSeg)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypArea)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,hypVolume)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,regular1D)</p>
|
|
|
|
<p class="whs1">mesh.AddHypothesis(box,mefisto2D)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs2"># compute the mesh</p>
|
|
|
|
<p class="whs1">print "--------------------------
|
|
compute the mesh of the box"</p>
|
|
|
|
<p class="whs1">ret = smesh.Compute(mesh,box)</p>
|
|
|
|
<p class="whs1">print ret</p>
|
|
|
|
<p class="whs1">if ret == 0:</p>
|
|
|
|
<p class="whs1"> print
|
|
"probleme when computing the mesh"</p>
|
|
|
|
<p class="whs1">salome.sg.updateObjBrowser(1)</p>
|
|
|
|
<p class="whs1">mesh.ExportMED("/tmp/meshMED.med",0)</p>
|
|
|
|
<p class="whs2"> </p>
|
|
|
|
<p class="whs4"> </p>
|
|
|
|
<script type="text/javascript" language="javascript1.2">
|
|
<!--
|
|
if (window.writeIntopicBar)
|
|
writeIntopicBar(0);
|
|
//-->
|
|
</script>
|
|
</body>
|
|
</html>
|