# [Gmsh] Experimenting with ThroughSection, Reviewed

Christophe Geuzaine cgeuzaine at ulg.ac.be
Thu Oct 26 20:49:32 CEST 2017

```Hi Marco,

No need to create the surfaces and the "spine": simply do

// Create base circle line loop
rd = 0.1;
base_circle = newl; Circle(newl) = {0,0,0, rd};
base_circle_ll = newll; Line Loop (newll) = {base_circle};
// Create upper circle line loop
upper_circle = Translate { 0, 0, .02 } { Duplicata{ Line { base_circle }; }};
upper_circle_ll = newll; Line Loop (newll) = {upper_circle};
// Create cylinder
Ruled ThruSections(newv) = {base_circle_ll, upper_circle_ll};

See demos/boolean/thrusections.geo for more examples.

Christophe

> On 26 Oct 2017, at 14:11, Marco Antolovic <marco_antolovic at yahoo.it> wrote:
>
> Hi all,
>
> it appears that my previous mail had some editing problems so I'm resending it, hoping that it will make a question clearer.
>
> The code below is trying to create a cylinder using ThruSections. I manage to create and mesh the cylinder but I always get an error during meshing (there is a strange curve inside the cylinder geometry...). To my knowledge there is no example on how to use so ThruSections I went on by trial & error.
> I'm aware that the command Cylinder will give the same result but I'm really curious about ThruSections...
> My code is as follows:
>
> // Create base circle line loop
> base_circle = newl; Circle(newl) = {0,0,0, rd};
> base_circle_ll = newll; Line Loop (newll) = {base_circle};
>
> // Create base circle surface, this will be used to draw the wire connecting upper and base circle
> base_circle_surface = news; Plane Surface (news) = {base_circle_ll};
>
> // Create upper circle line loop
> upper_circle = Translate { 0, 0, .02 } { Duplicata{ Line { base_circle }; }};
> upper_circle_ll = newll; Line Loop (newll) = {upper_circle};
>
> // Create upper circle surface, this will be used to draw the wire connecting upper and base circle
> upper_circle_surface = news; Plane Surface (news) = {upper_circle_ll};
>
> // Build wire connectiong upper and base circle
> extrac_points() = PointsOf { Surface{ base_circle_surface, upper_circle_surface }; };
> line_cylinder = newl; Line (line_cylinder) = { extrac_points(0), extrac_points(1) };
> wire_cylinder = newl; Wire (wire_cylinder) = { line_cylinder };
>
> // Create ruled surface
> Ruled ThruSections { base_circle_ll, wire_cylinder, upper_circle_ll }
>
>
> And the output log on a PC is:
>
> Info    : Finalized high order topology of periodic connections
> Info    : Meshing 1D...
> Info    : Meshing curve 1 (Circle)
> Info    : Meshing curve 2 (Circle)
> Info    : Meshing curve 6 (Line)
> Info    : Meshing curve 7 (BSpline)
> Info    : Meshing curve 8 (BSpline)
> Info    : Meshing curve 9 (BSpline)
> Info    : Meshing curve 10 (BSpline)
> Info    : Done meshing 1D (0 s)
> Info    : Meshing 2D...
> Info    : Meshing surface 3 (Plane, MeshAdapt)
> Info    : Meshing surface 5 (Plane, MeshAdapt)
> Info    : Meshing surface 6 (BSpline surface, MeshAdapt)
> .Error   : Unable to recover the edge 9 (7/7) on GEdge 1 (on GFace 6)
> Info    : Meshing surface 7 (BSpline surface, MeshAdapt)
> .Error   : Unable to recover the edge 16 (7/7) on GEdge 2 (on GFace 7)
> Info    : Done meshing 2D (0.015625 s)
> Info    : Meshing 3D...
> Info    : Done meshing 3D (0 s)
> Info    : 49 vertices 74 elements
> .Error   : ------------------------------
> .Error   : Mesh generation error summary
> .Error   :     0 warnings
> .Error   :     2 errors
> .Error   : Check the full log for details
> .Error   : ------------------------------
> Info    : Writing 'D:\Work area\Octave\GMSH\how_to_create_throughsection_OPENCASCADE_V06.output'...
>
> I hope somebody can give me a hand with this,
>
> Thanks,
>
> Marco
>
> PS: I attach the script and the output log just in case unexpected problems happens again.
>
>
>
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

--
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine

Free software: http://gmsh.info | http://getdp.info | http://onelab.info

```