# Meshing

`iota.mesh`

This method give access to Mesh generation and manipulation methods in Iota.

**Classes**

* [`Mesh`](https://github.com/particle-analytics/iota-python-api/tree/79ae110f50c92abf90b9e5d280ab032d313fe62c/mesh_mesh.md) : class containing mesh object
* [`MeshSearch`](https://github.com/particle-analytics/iota-python-api/tree/79ae110f50c92abf90b9e5d280ab032d313fe62c/mesh_mesh.md) : auxiliar class for spatial searches over a mesh

**Methods**

* [`load`](/iota-python-api/iota/mesh.md#mesh_load)
* [`export`](/iota-python-api/iota/mesh.md#mesh_export)
* [`create_line`](/iota-python-api/iota/mesh.md#mesh_create_line)
* [`create_circle`](/iota-python-api/iota/mesh.md#mesh_create_circle)
* [`create_rectangle`](/iota-python-api/iota/mesh.md#mesh_create_rectangle)
* [`create_cuboid`](/iota-python-api/iota/mesh.md#mesh_create_cuboid)
* [`create_cylinder`](/iota-python-api/iota/mesh.md#mesh_create_cylinder)

**Enum**

[`iota.mesh.export_format`](https://github.com/particle-analytics/iota-python-api/tree/79ae110f50c92abf90b9e5d280ab032d313fe62c/mesh_format/README.md) types of mesh formats for export

## Methods

### [load(filename, \[split\])](/iota-python-api/iota/mesh.md#mesh_load) <a href="#mesh_load" id="mesh_load"></a>

*Load a mesh list from file*

\*Returns a list of meshes

**Arguments**

* `filename`: (str) file containing the meshes to me readed
* `split`: (bool) split meshes by connectivities (default: True)

**Example**

```python
meshes = iota.mesh.load(
    filename = 'my_username',
    split = True
)
print(meshes)
```

### [export(mesh, filename, \[format\])](/iota-python-api/iota/mesh.md#mesh_load) <a href="#mesh_export" id="mesh_export"></a>

*Export a mesh to file*

**Arguments**

* `mesh`: (iota.mesh.Mesh) mesh object to be exported
* `filename`: (str) file to write the mesh
* `format`: (iota.mesh.export\_format) mesh format for to written (default: P4S)

**Example**

```python
status = iota.mesh.export(
    mesh = myMesh,
    filename = '/file/to/write/the/mesh/mesh.meta',
    format = iota.mesh.export_format.P4S
)
print('mesh is ok: ',status)
```

### [create\_line(start, end, element\_size, \[name\])](/iota-python-api/iota/mesh.md#mesh_create_line) <a href="#mesh_create_line" id="mesh_create_line"></a>

*Create a linear mesh of edges*

**Arguments**

* `start`: (iota.Vector3d) point representing the origin of the line
* `end`: (iota.Vector3d) point representing the end of the line
* `element_size`: (float) size of the triangular elements
* `name`: (str) name of the mesh (default: 'line')

**Example**

```python
line = iota.mesh.create_line(
    start = iota.Vector3d(0,0,0),
    end = iota.Vector3d(1,1,0),
    element_size = 0.1,
    name = 'my_linear_mesh'
)
```

### [create\_circle(centre, radius, normal, element\_size, \[name\])](/iota-python-api/iota/mesh.md#mesh_create_circle) <a href="#mesh_create_circle" id="mesh_create_circle"></a>

*Create a circular mesh of triangles*

**Arguments**

* `centre`: (iota.Vector3d) point representing the centre of the circle
* `radius`: (float) radius of the circle
* `normal`: (iota.Vector3d) normal vector representing the plane of the circle
* `element_size`: (float) size of the triangular elements
* `name`: (str) name of the mesh (default: 'circle')

**Example**

```python
circle = iota.mesh.create_circle(
    centre = iota.Vector3d(0,0,0),
    radius = 1.0,
    normal = iota.Vector3d(0,0,1),
    element_size = 0.1,
    name = 'my_circle'
)
```

### [create\_rectangle(origin, normal, lenght, width, element\_size, \[name\])](/iota-python-api/iota/mesh.md#mesh_create_rectangle) <a href="#mesh_create_rectangle" id="mesh_create_rectangle"></a>

*Create a rectangular mesh of triangles*

**Arguments**

* `origin`: (iota.Vector3d) point representing the origin of the rectangle
* `normal`: (iota.Vector3d) normal vector representing the plane of the rectangle
* `length`: (float) length of the rectangle
* `width`: (float) width of the rectangle
* `element_size`: (float) size of the triangular elements
* `name`: (str) name of the mesh (default: 'rectangle')

**Example**

```python
rectangle = iota.mesh.create_rectangle(
    origin = iota.Vector3d(0,0,0),
    normal = iota.Vector3d(0,0,1),
    length = 1.0,
    width = 1.0,
    element_size = 0.1,
    name = 'my_rectangle'
)
```

### [create\_cuboid(origin, up, lenght, width, height, element\_size, \[name\], \[skin\])](/iota-python-api/iota/mesh.md#mesh_create_cuboid) <a href="#mesh_create_cuboid" id="mesh_create_cuboid"></a>

*Create a cuboid mesh of tetrahedra*

**Arguments**

* `origin`: (iota.Vector3d) point representing the origin of the cuboid
* `up`: (iota.Vector3d) vector representing the up direction of the cuboid
* `length`: (float) length of the cuboid
* `width`: (float) width of the cuboid
* `height`: (float) height of the cuboid
* `element_size`: (float) size of the elements
* `name`: (str) name of the mesh (default: 'cuboid')
* `skin`: (bool) generate the surface instead of volume (default: False)

**Example**

```python
cuboid = iota.mesh.create_cuboid(
    origin = iota.Vector3d(0,0,0),
    up = iota.Vector3d(0,0,1),
    length = 1.0,
    width = 1.0,
    height = 1.0,
    element_size = 0.1,
    name = 'my_cuboid'
)
```

### [create\_cylinder(origin, up, radius, element\_size, \[name\], \[skin\])](/iota-python-api/iota/mesh.md#mesh_create_cylinder) <a href="#mesh_create_cylinder" id="mesh_create_cylinder"></a>

*Create a cylinder mesh of tetrahedra*

**Arguments**

* `origin`: (iota.Vector3d) point representing the origin of the cylinder
* `up`: (iota.Vector3d) vector representing the up direction of the cylinder
* `radius`: (float) radius of the cylinder
* `height`: (float) height of the cylinder
* `element_size`: (float) size of the elements
* `name`: (str) name of the mesh (default: 'cylinder')
* `skin`: (bool) generate the surface instead of volume (default: False)

**Example**

```python
cylinder = iota.mesh.create_cylinder(
    origin = iota.Vector3d(0,0,0),
    up = iota.Vector3d(0,0,1),
    radius = 1.0,
    height = 1.0,
    element_size = 0.1,
    name = 'my_cylinder'
)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://particle-analytics-1.gitbook.io/iota-python-api/iota/mesh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
