Basic Usage

UFFFiles.jl implements reading and writing functionalities through the functions readuff and writeuff.

Note

UFFDataset is an abstract type representing a generic UFF dataset. Each specific UFF dataset type (e.g., Dataset15, Dataset58, etc.) is a concrete subtype of UFFDataset.

Reading UFF Files

using UFFFiles

data = readuff("path/to/your/file.uff")
readuff(filename::String) -> Vector{UFFDataset}

Reads a UFF (Universal File Format) file and parses its contents into a vector of UFFDataset objects.

Input

  • filename::String: The path to the UFF file to be read.

Output

  • data::Vector{UFFDataset}: A vector containing the parsed UFF datasets.

Because readuff returns a vector of datasets, you can interact with a given dataset as usually done in Julia. A dataset is a Julia composite type (i.e., a struct), having its own fields, corresponding to the UFF dataset type.

As an example, let’s say that you have read a UFF file containing multiple datasets. You can access each dataset by indexing the returned vector and interacting with it through its fields.

# Access to the first dataset extracted
# Suppose that the first dataset is of type Dataset15
d15 = data[1]

# Access to the list of node coordinates
node_coords = d15.coords

Writing UFF Files

writeuff("path/to/your/file.uff", data)
writeuff(filename::String, data::Vector{UFFDataset})

Writes a vector of UFFDataset objects to a UFF file.

Input

  • filename::String: The path to the UFF file to be written.

  • datasets::Vector{UFFDataset}: A vector containing the UFF datasets to be

written.

  • w58b::Bool: Optional flag to indicate if Dataset58 format must be written in binary format (default: false).