[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Geometry module

Gmsh's geometry module provides a simple CAD engine, using a bottom-up (boundary representation) approach: you need to first define points (using the Point command: see below), then lines (using Line, Circle, Spline, ..., commands or by extruding points), then surfaces (using for example the Plane Surface or Ruled Surface commands, or by extruding lines), and finally volumes (using the Volume command or by extruding surfaces).

These geometrical entities are called "elementary" in Gmsh's jargon, and are assigned identification numbers when they are created:

  1. each elementary point must possess a unique identification number;
  2. each elementary line must possess a unique identification number;
  3. each elementary surface must possess a unique identification number;
  4. each elementary volume must possess a unique identification number.

Elementary geometrical entities can then be manipulated in various ways, for example using the Translate, Rotate, Scale or Symmetry commands.

Compound groups of elementary geometrical entities can also be defined and are called "physical" entities. These physical entities cannot be modified by geometry commands: their only purpose is to assemble elementary entities into larger groups, possibly modifying their orientation, so that they can be referred to by the mesh module as single entities. As is the case with elementary entities, each physical point, physical line, physical surface or physical volume must be assigned a unique identification number. See 4. Mesh module, for more information about how physical entities affect the way meshes are saved.

3.1 Geometry commands  
3.2 Geometry options  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Geometry commands

The next subsections describe all the available geometry commands. These commands can be used anywhere in a Gmsh ASCII text input file. Note that the following general syntax rule is followed for the definition of geometrical entities: "If an expression defines a new entity, it is enclosed between parentheses. If an expression refers to a previously defined entity, it is enclosed between braces."

3.1.1 Points  
3.1.2 Lines  
3.1.3 Surfaces  
3.1.4 Volumes  
3.1.5 Extrusions  
3.1.6 Transformations  
3.1.7 Miscellaneous  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.1 Points

Point ( expression ) = { expression, expression, expression, expression };
Creates an elementary point. The expression inside the parentheses is the point's identification number; the three first expressions inside the braces on the right hand side give the three X, Y and Z coordinates of the point in the three-dimensional Euclidean space; the last expression sets the characteristic mesh length at that point. See 4.2.1 Characteristic lengths, for more information about how this characteristic length information is used in the meshing process.

Physical Point ( expression | char-expression ) = { expression-list };
Creates a physical point. The expression inside the parentheses is the physical point's identification number (if a char-expression is given instead, a unique identification number is automatically created); the expression-list on the right hand side should contain the identification numbers of all the elementary points that need to be grouped inside the physical point.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.2 Lines

BSpline ( expression ) = { expression-list };
Creates a B-spline curve. The expression inside the parentheses is the B-spline curve's identification number; the expression-list on the right hand side should contain the identification numbers of all the B-spline's control points. Repeating control points has the expected effect.

Circle ( expression ) = { expression, expression, expression };
Creates a circle arc (strictly) smaller than Pi. The expression inside the parentheses is the circle arc's identification number; the first expression inside the braces on the right hand side gives the identification number of the start point of the arc; the second expression gives the identification number of the center of the circle; the last expression gives the identification number of the end point of the arc.

CatmullRom ( expression ) = { expression-list };
CatmullRom is a synonym for Spline.

Ellipse ( expression ) = { expression, expression, expression, expression };
Creates an ellipse arc. The expression inside the parentheses is the ellipse arc's identification number; the first expression inside the braces on the right hand side gives the identification number of the start point of the arc; the second expression gives the identification number of the center of the ellipse; the third expression gives the identification number of any point located on the major axis of the ellipse; the last expression gives the identification number of the end point of the arc.

(A deprecated synonym for Ellipse is Ellipsis.)

Line ( expression ) = { expression, expression };
Creates a straight line segment. The expression inside the parentheses is the line segment's identification number; the two expressions inside the braces on the right hand side give identification numbers of the start and end points of the segment.

Spline ( expression ) = { expression-list };
Creates a spline curve. The expression inside the parentheses is the spline's identification number; the expression-list on the right hand side should contain the identification numbers of all the spline's control points.

Line Loop ( expression ) = { expression-list };
Creates an oriented line loop. The expression inside the parentheses is the line loop's identification number; the expression-list on the right hand side should contain the identification numbers of all the elementary lines that constitute the line loop. A line loop must be a closed loop, and the elementary lines should be ordered and oriented (using negative identification numbers to specify reverse orientation). If the orientation is correct, but the ordering is wrong, Gmsh will actually reorder the list internally to create a consistent loop. Although Gmsh supports it, it is not recommended to specify multiple line loops (or subloops) in a single Line Loop command. (Line loops are used to create surfaces: see 3.1.3 Surfaces.)

Physical Line ( expression | char-expression ) = { expression-list };
Creates a physical line. The expression inside the parentheses is the physical line's identification number (if a char-expression is given instead, a unique identification number is automatically created); the expression-list on the right hand side should contain the identification numbers of all the elementary lines that need to be grouped inside the physical line. Specifying negative identification numbers in the expression-list will reverse the orientation of the mesh elements belonging to the corresponding elementary lines in the saved mesh.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.3 Surfaces

Plane Surface ( expression ) = { expression-list };
Creates a plane surface. The expression inside the parentheses is the plane surface's identification number; the expression-list on the right hand side should contain the identification numbers of all the line loops defining the surface. The first line loop defines the exterior boundary of the surface; all other line loops define holes in the surface. A line loop defining a hole should not have any lines in common with the exterior line loop (in which case it is not a hole, and the two surfaces should be defined separately). Likewise, a line loop defining a hole should not have any lines in common with another line loop defining a hole in the same surface (in which case the two line loops should be combined).

Ruled Surface ( expression ) = { expression-list } < In Sphere { expression } >;
Creates a ruled surface, i.e., a surface that can be interpolated using transfinite interpolation. The expression inside the parentheses is the ruled surface's identification number; the first expression-list on the right hand side should the identification number of a line loop composed of either three or four elementary lines. The optional In Sphere argument forces the surface to be a spherical patch (the extra parameter gives the identification number of the center of the sphere).

Surface Loop ( expression ) = { expression-list };
Creates a surface loop (a shell). The expression inside the parentheses is the surface loop's identification number; the expression-list on the right hand side should contain the identification numbers of all the elementary surfaces that constitute the surface loop. A surface loop must always represent a closed shell, and the elementary surfaces should be oriented consistently (using negative identification numbers to specify reverse orientation). (Surface loops are used to create volumes: see 3.1.4 Volumes.)

Physical Surface ( expression | char-expression ) = { expression-list };
Creates a physical surface. The expression inside the parentheses is the physical surface's identification number (if a char-expression is given instead, a unique identification number is automatically created); the expression-list on the right hand side should contain the identification numbers of all the elementary surfaces that need to be grouped inside the physical surface. Specifying negative identification numbers in the expression-list will reverse the orientation of the mesh elements belonging to the corresponding elementary surfaces in the saved mesh.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.4 Volumes

Volume ( expression ) = { expression-list };
Creates a volume. The expression inside the parentheses is the volume's identification number; the expression-list on the right hand side should contain the identification numbers of all the surface loops defining the volume. The first surface loop defines the exterior boundary of the volume; all other surface loops define holes in the volume. A surface loop defining a hole should not have any surfaces in common with the exterior surface loop (in which case it is not a hole, and the two volumes should be defined separately). Likewise, a surface loop defining a hole should not have any surfaces in common with another surface loop defining a hole in the same volume (in which case the two surface loops should be combined).

(A deprecated synonym for Volume is Complex Volume.)

Physical Volume ( expression | char-expression ) = { expression-list };
Creates a physical volume. The expression inside the parentheses is the physical volume's identification number (if a char-expression is given instead, a unique identification number is automatically created); the expression-list on the right hand side should contain the identification numbers of all the elementary volumes that need to be grouped inside the physical volume.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.5 Extrusions

Lines, surfaces and volumes can also be created through extrusion of points, lines and surfaces, respectively. Here is the syntax of the geometrical extrusion commands (go to 4.2.2 Structured grids, to see how these commands can be extended in order to also extrude the mesh):

extrude:

Extrude { expression-list } { extrude-list }
Extrudes all elementary entities (points, lines or surfaces) in extrude-list using a translation. The expression-list should contain three expressions giving the X, Y and Z components of the translation vector.

Extrude { { expression-list }, { expression-list }, expression } { extrude-list }
Extrudes all elementary entities (points, lines or surfaces) in extrude-list using a rotation. The first expression-list should contain three expressions giving the X, Y and Z direction of the rotation axis; the second expression-list should contain three expressions giving the X, Y and Z components of any point on this axis; the last expression should contain the rotation angle (in radians).

Extrude { { expression-list }, { expression-list }, { expression-list }, expression } { extrude-list }
Extrudes all elementary entities (points, lines or surfaces) in extrude-list using a translation combined with a rotation. The first expression-list should contain three expressions giving the X, Y and Z components of the translation vector; the second expression-list should contain three expressions giving the X, Y and Z direction of the rotation axis; the third expression-list should contain three expressions giving the X, Y and Z components of any point on this axis; the last expression should contain the rotation angle (in radians).

with

 
extrude-list: 
  Point | Line | Surface { expression-list }; ...


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.6 Transformations

Geometrical transformations can be applied to elementary entities, or to copies of elementary entities (using the Duplicata command: see below). The syntax of the transformation commands is:

transform:

Dilate { { expression-list }, expression } { transform-list }
Scales all elementary entities in transform-list by a factor expression. The expression-list should contain three expressions giving the X, Y and Z direction of the homothetic transformation.

Rotate { { expression-list }, { expression-list }, expression } { transform-list }
Rotates all elementary entities in transform-list by an angle of expression radians. The first expression-list should contain three expressions giving the X, Y and Z direction of the rotation axis; the second expression-list should contain three expressions giving the X, Y and Z components of any point on this axis.

Symmetry { expression-list } { transform-list }
Transforms all elementary entities symmetrically to a plane. The expression-list should contain four expressions giving the coefficients of the plane's equation.

Translate { expression-list } { transform-list }
Translates all elementary entities in transform-list. The expression-list should contain three expressions giving the X, Y and Z components of the translation vector.

Boundary { transform-list }
(Not a transformation per-se.) Returns the boundary of the elementary entities in transform-list.

with

 
transform-list: 
  Point | Line | Surface { expression-list }; ... |
  Duplicata { Point | Line | Surface { expression-list }; ... } |
  transform


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.7 Miscellaneous

Here is a list of all other geometry commands currently available:

Coherence;
Removes all duplicate elementary geometrical entities (e.g., points having identical coordinates). Note that Gmsh executes the Coherence command automatically after each geometrical transformation, unless Geometry.AutoCoherence is set to zero (see section 3.2 Geometry options).

Delete { Point | Line | Surface | Volume { expression-list }; ... }
Deletes all elementary entities whose identification numbers are given in expression-list.

Hide { Point | Line | Surface | Volume { expression-list }; ... }
Hide the entities listed in expression-list, if General.VisibilityMode is set to 0 or 1.

Hide char-expression;
Hide the entity char-expression, if General.VisibilityMode is set to 0 or 1 (char-expression can for example be "*").

Show { Point | Line | Surface | Volume { expression-list }; ... }
Show the entities listed in expression-list, if General.VisibilityMode is set to 0 or 1.

Show char-expression;
Show the entity char-expression, if General.VisibilityMode is set to 0 or 1 (char-expression can for example be "*").


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Geometry options

Geometry options control the behavior of geometry commands, as well as the way geometrical entities are handled in the graphical user interface. For the signification of the `Saved in:' field in the following list, see 2.7 General options.

Geometry.AutoCoherence
Should all duplicate entities be automatically removed?
Default value: 1
Saved in: General.OptionsFileName

Geometry.CirclePoints
Number of points used to draw a circle/ellipse
Default value: 20
Saved in: General.OptionsFileName

Geometry.ExtrudeReturnLateralEntities
Add lateral entities in lists returned by extrusion commands?
Default value: 1
Saved in: General.OptionsFileName

Geometry.ExtrudeSplinePoints
Number of control points for splines created during extrusion
Default value: 5
Saved in: General.OptionsFileName

Geometry.HighlightOrphans
Highlight orphan entities (lines connected to a single surface, etc.)?
Default value: 0
Saved in: General.OptionsFileName

Geometry.Light
Enable lighting for the geometry
Default value: 1
Saved in: General.OptionsFileName

Geometry.LightTwoSide
Light both sides of surfaces (leads to slower rendering)
Default value: 1
Saved in: General.OptionsFileName

Geometry.Lines
Display geometry curves?
Default value: 1
Saved in: General.OptionsFileName

Geometry.LineNumbers
Display curve numbers?
Default value: 0
Saved in: General.OptionsFileName

Geometry.LineSelectWidth
Display width of selected lines (in pixels)
Default value: 2
Saved in: General.OptionsFileName

Geometry.LineType
Display lines as solid color segments (0), 3D cylinders (1) or tapered cylinders (2)
Default value: 0
Saved in: General.OptionsFileName

Geometry.LineWidth
Display width of lines (in pixels)
Default value: 2
Saved in: General.OptionsFileName

Geometry.Normals
Display size of normal vectors (in pixels)
Default value: 0
Saved in: General.OptionsFileName

Geometry.OCCFixSmallEdges
Fix small edges in STEP, IGES and BRep models
Default value: 1
Saved in: General.OptionsFileName

Geometry.OCCFixSmallFaces
Fix small faces in STEP, IGES and BRep models
Default value: 1
Saved in: General.OptionsFileName

Geometry.OCCSewFaces
Sew faces in STEP, IGES and BRep models
Default value: 0
Saved in: General.OptionsFileName

Geometry.OldCircle
Use old circle description (compatibility option for old Gmsh geometries)
Default value: 0
Saved in: General.OptionsFileName

Geometry.OldNewReg
Use old newreg definition for geometrical transformations (compatibility option for old Gmsh geometries)
Default value: 1
Saved in: General.OptionsFileName

Geometry.Points
Display geometry points?
Default value: 1
Saved in: General.OptionsFileName

Geometry.PointNumbers
Display points numbers?
Default value: 0
Saved in: General.OptionsFileName

Geometry.PointSelectSize
Display size of selected points (in pixels)
Default value: 5
Saved in: General.OptionsFileName

Geometry.PointSize
Display size of points (in pixels)
Default value: 4
Saved in: General.OptionsFileName

Geometry.PointType
Display points as solid color dots (0), 3D spheres (1) or scaled spheres (2)
Default value: 0
Saved in: General.OptionsFileName

Geometry.ScalingFactor
Global geometry scaling factor
Default value: 1
Saved in: General.OptionsFileName

Geometry.SnapX
Snapping grid spacing along the X-axis
Default value: 0.1
Saved in: General.OptionsFileName

Geometry.SnapY
Snapping grid spacing along the Y-axis
Default value: 0.1
Saved in: General.OptionsFileName

Geometry.SnapZ
Snapping grid spacing along the Z-axis
Default value: 0.1
Saved in: General.OptionsFileName

Geometry.Surfaces
Display geometry surfaces?
Default value: 0
Saved in: General.OptionsFileName

Geometry.SurfaceNumbers
Display surface numbers?
Default value: 0
Saved in: General.OptionsFileName

Geometry.SurfaceType
Surface display type (0=cross, 1=wireframe, 2=solid
Default value: 2
Saved in: General.OptionsFileName

Geometry.Tangents
Display size of tangent vectors (in pixels)
Default value: 0
Saved in: General.OptionsFileName

Geometry.Tolerance
Geometrical tolerance
Default value: 1e-06
Saved in: General.OptionsFileName

Geometry.Volumes
Display geometry volumes? (not implemented yet)
Default value: 0
Saved in: General.OptionsFileName

Geometry.VolumeNumbers
Display volume numbers? (not implemented yet)
Default value: 0
Saved in: General.OptionsFileName

Geometry.Color.Points
Normal geometry point color
Default value: {90,90,90}
Saved in: General.OptionsFileName

Geometry.Color.Lines
Normal geometry curve color
Default value: {0,0,255}
Saved in: General.OptionsFileName

Geometry.Color.Surfaces
Normal geometry surface color
Default value: {128,128,128}
Saved in: General.OptionsFileName

Geometry.Color.Volumes
Normal geometry volume color
Default value: {255,255,0}
Saved in: General.OptionsFileName

Geometry.Color.Selection
Selected geometry color
Default value: {255,0,0}
Saved in: General.OptionsFileName

Geometry.Color.HighlightZero
Highlight 0 color
Default value: {255,0,0}
Saved in: General.OptionsFileName

Geometry.Color.HighlightOne
Highlight 1 color
Default value: {255,150,0}
Saved in: General.OptionsFileName

Geometry.Color.HighlightTwo
Highlight 2 color
Default value: {255,255,0}
Saved in: General.OptionsFileName

Geometry.Color.Tangents
Tangent geometry vectors color
Default value: {255,255,0}
Saved in: General.OptionsFileName

Geometry.Color.Normals
Normal geometry vectors color
Default value: {255,0,0}
Saved in: General.OptionsFileName

Geometry.Color.Projection
Projection surface color
Default value: {0,255,0}
Saved in: General.OptionsFileName


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

Back to geuz.org/gmsh