Input/output
PMesh
provides only few basic I/O capabilities by read
and write
. Instead, we plan to rely on FileIO.jl and GeomeytryBasics.jl, see also Interoperability.
The current implementation does not provide dynamic creation of attributes, e.g. by read
!
mesh = read(:off, "path-to/input.off"; exceptions=false)
write(:off, "path/to/output.off"; exceptions=false)
# format from file extension
mesh = read("path-to/input.off")
write("path/to/output.off")
See also FileIO
and GeometryBasics
Base.read
— Functionmesh = read([format,] filename, template::Mesh[;
position=Val(:x), uv=:nothing, exceptions=false])
Read a polygonal mesh from file filename
assuming format
, where template
defines the concrete type of mesh (e.g., which attributes exist) and state of attributes (i.e., which attributes are enabled).
In case read
fails, the optional argument exceptions
determines whether an exception is thrown or read
return nothing
.
The following formats are currently supported
:off
OFF file, only vertex positions:obj
OBJ file, vertex positions and texture coordinates (optional)
See also write
Base.write
— Functionsuccess = write([format,] filename, mesh::Mesh[;
position=Val(:x), uv=nothing, exceptions=false])
Write a polygonal mesh
to file filename
using format
. Returns true
on success.
In case write
fails, the optional argument exceptions
determines whether an exception is thrown or
writereturns
false`.
The following formats are currently supported
:off
OFF file, only vertex positions:obj
OBJ file, vertex positions and texture coordinates (optional)
See also read