# [Gmsh] Compound lines in STL

Bart Vermeulen bart.vermeulen at wur.nl
Wed Sep 3 12:17:27 CEST 2014

```Dear all,

I am trying to create a mesh starting with a STL model. This model
consists of 6 different surfaces. I use the file included below (quite
similar to one of the tutorials). When I load this into gmsh I can see
the geometry with the different surfaces. At the corners of each of the
surfaces there is a point (4 points for each surface). The Compound
lines connect these points directly instead of following the geometry
(see attached screenshot). Obviously the meshing fails.

Any idea how to properly define the compound lines? (The surfaces ar OK)

Bart Vermeulen

Merge "mmbendo.stl";
CreateTopology;

// We can now define a compound line (resp. surface) for each discrete
// line (resp. surface) in the model
ll[] = Line "*";
For j In {0 : #ll[]-1}
Compound Line(newl) = ll[j];
EndFor
ss[] = Surface "*";
s = news;
For i In {0 : #ss[]-1}
Compound Surface(s+i) = ss[i];
EndFor

// And we can create the volume based on the new compound entities
Surface Loop(1) = {s : s + #ss[]-1};
Volume(1) = {1};

Physical Surface(1) = {s : s + #ss[]-1};
Physical Volume(1) = 1;

uniform = 1;
If(uniform)
// uniform mesh size...
Mesh.CharacteristicLengthMin = 15;
Mesh.CharacteristicLengthMax = 15;
EndIf
If(!uniform)
// ... or apply a funny mesh size field, just because we can :-)
Field[1] = MathEval;
Field[1].F = "2*Sin((x+y)/5) + 3";
Background Field = 1;
EndIf

Mesh.RemeshAlgorithm = 0; // (0) no split (1) automatic (2) automatic
only with metis
Mesh.RemeshParametrization = 7; // (0) harmonic (1) conformal spectral
(7) conformal finite element
Geometry.HideCompounds = 0; // don't hide the compound entities
Mesh.Algorithm = 6; // Frontal

--
Bart Vermeulen
Wageningen University, Department of Environmental Sciences
Hydrology and Quantitative Water Management Group
Postal address: Postbus 47, 6700AA Wageningen,The Netherlands
Visiting address: Room 0.C027, Droevendaalsesteeg 3,6708PB Wageningen, The Netherlands
Tel. +31-317-482765 Fax +31-317-419000
email: bart.vermeulen at wur.nl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sshot.png
Type: image/png
Size: 254405 bytes
Desc: not available