# The mesh file

The APM Preprocessor supports mesh files in **.stl** format. The **.stl** file is a commonly used mesh file format which represents bodies with triangular elements. If a body is represented only with triangular elements its mesh is said to be unstructured. Conversely, if a body is represented only with quadrilateral elements its mesh is said to be structured. The images below show an unstructured mesh of a fixed-wing UAV, a structured mesh of a NACA0015 wing, and a hybrid (mixed) mesh of a fixed-wing UAV.

![Unstructured mesh of a fixed-wing UAV](/files/-MVXJEk3BcPa9XXm-j7b)

![Structured mesh of a NACA0015 wing](/files/-MVgEqNERMDyInDgYYtf)

<figure><img src="/files/LUFjb7aQxiR5FxKTB39O" alt=""><figcaption></figcaption></figure>

## File formats

### .stl

The **.stl** mesh file format can only store unstructured meshes. However, the APM Preprocessor supports a non-standard **.stl** mesh file format which can store structured meshes. A typical structure of a **.stl** mesh file is shown below:

```
solid "name"
    facet normal nx ny nz      
        outer loop
            vertex x y z
            vertex x y z
            vertex x y z
        endloop
    endfacet                   
    facet normal nx ny nz      
        outer loop
            vertex x y z
            vertex x y z
            vertex x y z
        endloop
    endfacet       
    ...
    ...
    ...
endsolid
```

Each mesh element is defined by the `facet` keyword. The `normal` keyword and the `nx`, `ny`, `nz` variables specify the unit normal vector of the element. The `vertex` keyword and the `x`, `y`, `z` variables specify a vertex of the element. Since each element has 3 vertices the `vertex` keyword and the `x`, `y`, `z` variables are repeated three times.

For structured meshes, a fourth vertex is added to each element.

{% hint style="info" %}
A **.stl** file with four vertices per element is non-standard and is specific to the APM Preprocessor.
{% endhint %}

{% file src="/files/P6052hUA0c3urCPWVmAi" %}

### .ucd

The **.ucd** mesh file format can only store unstructured and structured meshes. A typical structure of a **.ucd** mesh file is shown below:

```
# <comment 1>
.
.
.
# <comment n>
<num_nodes> <num_cells> <num_ndata> <num_cdata> <num_mdata>
<node_id 1> <x> <y> <z>
<node_id 2> <x> <y> <z>
<node_id num_nodes> <x> <y> <z>
<cell_id 1> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n>
<cell_id 2> <mat_id> <cell_type> <cell_vert 1> ... <cell_vert n>
<cell_id num_cells> <mat_id> <cell_type> <cell_vert 1> ...<cell_vert n>
```

{% file src="/files/2KGqhO0whmA9qqvENvqU" %}

### .wrl

The **.wrl** mesh file format can only store unstructured and structured meshes. A typical structure of a **.wrl** mesh file is shown below:

```
Shape {
    geometry IndexedFaceSet {
        coord Coordinate {
            point [
                <x> <y> <z>
                <x> <y> <z>
                <x> <y> <z>
                ...
            ]
        }
        coordIndex [
            <cell_vert 1> ... <cell_vert n>
            <cell_vert 1> ... <cell_vert n>
            <cell_vert 1> ... <cell_vert n>
            ...
        ]
    }
}
```

{% file src="/files/zyvjIV9Sd6RG7JORTKmw" %}


---

# 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://docs.aviumtechnologies.com/user-guide/the-mesh-file.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.
