Personal tools
You are here: Home Mesh on 5 Edges ?

Mesh on 5 Edges ?

Up to How to use Salome?
• Mesh on 5 Edges ?

Posted by eXav at August 03. 2009

Hello...

I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

Thank for attention...

• Re: Mesh on 5 Edges ?

Posted by Erwan ADAM at August 03. 2009
eXav wrote:

Hello...

I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

Thank for attention...

Hi,

Could you describe more precisely the geometry you are trying to mesh ?

Regards,

E.A.
• Re: Mesh on 5 Edges ?

Posted by eXav at August 03. 2009
We work with hexahedral and tetrahedral meshes. For example, what do I do for create tetrahedral mesh on next wire: 1 ______ | | | | 2| |5 | | \ / 3\ /4 \/ I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.
• Re: Mesh on 5 Edges ?

Posted by eXav at August 03. 2009
Sorry... Figure: Point1 (0,0); Point2 (2,0); Point3 (2,1); Point4 (1,2); Point5 (0,2); Point5 (0,0); Like a house
• Re: Mesh on 5 Edges ?

Posted by Erwan ADAM at August 03. 2009
eXav wrote:
Sorry...
Figure:
Point1 (0,0);
Point2 (2,0);
Point3 (2,1);
Point4 (1,2);
Point5 (0,2);
Point5 (0,0);
Like a house

Something like that ?

• Re: Mesh on 5 Edges ?

Posted by eXav at August 05. 2009
 eXav wrote: Sorry... Figure: Point1 (0,0); Point2 (2,0); Point3 (2,1); Point4 (1,2); Point5 (0,2); Point5 (0,0); Like a house

Something like that ?

• Re: Mesh on 5 Edges ?

Posted by Erwan ADAM at August 05. 2009
eXav wrote:
eXav wrote:
Sorry...
Figure:
Point1 (0,0);
Point2 (2,0);
Point3 (2,1);
Point4 (1,2);
Point5 (0,2);
Point5 (0,0);
Like a house

Something like that ?

Save the following :

# -----------

# --
# Geom part ...
# --

import geompy

p1 = geompy.MakeVertex(0.0, 0.0, 0.0)
p2 = geompy.MakeVertex(2.0, 0.0, 0.0)
p3 = geompy.MakeVertex(2.0, 1.0, 0.0)
p4 = geompy.MakeVertex(1.0, 2.0, 0.0)
p5 = geompy.MakeVertex(0.0, 2.0, 0.0)

points = [p1, p2, p3, p4, p5]
edges = [geompy.MakeEdge(points[i], points[(i+1)%len(points)]) for i in range(len(points))]
wire = geompy.MakeWire(edges)
face = geompy.MakeFace(wire, 1)

shape = face

p12 = geompy.MakeVertex(1.0, 0.0, 0.0)

tools = [
geompy.MakeEdge(p12, p4),
]

shape = geompy.MakePartition([shape], tools)

tool_p1 = geompy.MakeVertex(0.0, 1.0, 0.0)
tool_p2 = geompy.MakeVertex(1.0, 1.0, 0.0)
tool_p3 = geompy.MakeVertex(2.0, 0.5, 0.0)

tools = [
geompy.MakeEdge(tool_p1, tool_p2),
geompy.MakeEdge(tool_p2, tool_p3),
]

shape = geompy.MakePartition([shape], tools)

salome.sg.updateObjBrowser(0)

# --
# Mesh part ...
# CAUTION : I use here the corba API of SMESH
# which is not the "official" API ... I've got my own reasons !
# --

import salome
import SMESH
import StdMeshers

smesh.SetCurrentStudy(salome.myStudy)
mesh = smesh.CreateMesh(shape)

hypo = smesh.CreateHypothesis("NumberOfSegments", "StdMeshersEngine"
hypo.SetNumberOfSegments(10)

smesh.Compute(mesh, shape)

salome.sg.updateObjBrowser(0)

# -----------

in foo.py and launch :

runSalome --execute=foo.py

it should do the job

E.A.
• Re: Mesh on 5 Edges ?

Posted by eXav at August 10. 2009
Thank ypu for help...
• Re: Mesh on 5 Edges ?

Posted by Erwan ADAM at August 03. 2009
eXav wrote:
We work with hexahedral and tetrahedral meshes.
For example, what do I do for create tetrahedral mesh on next wire:

1 ______
| |
| |
2| |5
| |
\ /
3\ /4
\/
I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.

I'm sorry ... but I don't understand you drawing.
• Re: Mesh on 5 Edges ?

Posted by Erwan ADAM at August 03. 2009
eXav wrote:
We work with hexahedral and tetrahedral meshes.
For example, what do I do for create tetrahedral mesh on next wire:

1 ______
| |
| |
2| |5
| |
\ /
3\ /4
\/
I can not do it, because Quadrangle Algo need in 4 edge. I want represent edges 3 and 4 as ine edge.

I'm sorry ... but I don't understand you drawing.

Ooops ...
• Re: Mesh on 5 Edges ?

Posted by Nathalie Gore at August 04. 2009
eXav wrote:

Hello...

I have a problem... Is there possibility building 2D tetrahedral mesh on 5 edges? I tryed to union 2 edges in 1, but I can not do it. (I use Opencascade and salome )

Thank for attention...

This solution corresponds to your wanted meshing?

import geompy
import smesh

# Geom Creation
Vertex_1 = geompy.MakeVertex(0, 0, 0)
Vertex_2 = geompy.MakeVertex(2, 0, 0)
Vertex_3 = geompy.MakeVertex(2, 1, 0)
Vertex_4 = geompy.MakeVertex(1, 2, 0)
Vertex_5 = geompy.MakeVertex(0, 2, 0)
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_5)
Line_5 = geompy.MakeLineTwoPnt(Vertex_5, Vertex_1)
Face_2 = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4, Line_5], 1)
[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5] = geompy.SubShapeAllSorted(Face_2, geompy.ShapeType["EDGE"])
geomObj_1 = geompy.GetSubShape(Edge_2, [3])
Line_6 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_5)
Vertex_6 = geompy.MakeVertexOnCurve(Line_6, 0.5)
Vertex_7 = geompy.MakeVertexOnCurve(Edge_4, 0.5)
Line_7 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_6)
Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Vertex_7)
Partition_1 = geompy.MakePartition([Face_2], [Line_6, Line_8], [], [], geompy.ShapeType["FACE"], 0, [], 0)

[Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12,Edge_13,Edge_14] = geompy.SubShapeAllSorted(Partition_1, geompy.ShapeType["EDGE"])

# Mesh creation
smeshGlobal = smesh.Mesh(Partition_1, "GlobalMesh"

A0_1_2_2_2_1 = smeshGlobal.Segment(Edge_7)
A0_1_2_2_2_1.NumberOfSegments(15)
A0_1_2_2_2_2 = smeshGlobal.Segment(Edge_8)
A0_1_2_2_2_2.NumberOfSegments(15)
A0_1_2_2_2_3 = smeshGlobal.Segment(Edge_9)
A0_1_2_2_2_3.NumberOfSegments(15)
A0_1_2_2_2_4 = smeshGlobal.Segment(Edge_10)
A0_1_2_2_2_4.NumberOfSegments(15)
A0_1_2_2_2_5 = smeshGlobal.Segment(Edge_11)
A0_1_2_2_2_5.NumberOfSegments(15)
A0_1_2_2_2_6 = smeshGlobal.Segment(Edge_12)
A0_1_2_2_2_6.NumberOfSegments(15)
A0_1_2_2_2_7 = smeshGlobal.Segment(Edge_13)
A0_1_2_2_2_7.NumberOfSegments(15)
A0_1_2_2_2_8 = smeshGlobal.Segment(Edge_14)
A0_1_2_2_2_8.NumberOfSegments(15)
A0_1_2_2_2_9 = smeshGlobal.Segment(Edge_6)
A0_1_2_2_2_9.NumberOfSegments(15)
smeshGlobal.Compute()