Lua: Create Meshes with create_mesh
Description
In Lua context, modalys.create_mesh creates a mesh from a parameter table. The same function is also available as create_mesh, make_mesh, and modalys.make_mesh.
Lua Syntax
local mesh = modalys.create_mesh{
kind = "single-point",
position = { 0, 0, 0 }
}
Supported Kinds
The implementation currently handles the following values for kind:
- read-from-file or from-file
- single-point
- add
- copy
- edge
- quadrilateral
- restrict-quadrilateral
- restrict-plane
- restrict-line
- restrict-point or restrict-points
The hexahedra, beam, and restrict-edge kinds are present as placeholders in the Lua implementation.
Examples
local point = create_mesh{
kind = "single-point",
position = { 0, 0.1, 0 }
}
local edge = create_mesh{
kind = "edge",
position1 = { 0, 0, 0 },
position2 = { 1, 0, 0 }
}
local quad = create_mesh{
kind = "quadrilateral",
vertices = {
{ 0, 0, 0 },
{ 1, 0, 0 },
{ 1, 1, 0 },
{ 0, 1, 0 }
}
}
local combined = create_mesh{
kind = "add",
parts = { edge, quad }
}
Reading a Mesh File
local mesh = create_mesh{
kind = "read-from-file",
path = "diapason.mesh",
scale = 1
}
★