Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
openmesh-python
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
openmesh-python
Commits
5d358812
Commit
5d358812
authored
Jun 11, 2018
by
Isaak Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update readwrite.rst
parent
40f8a82f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
60 deletions
+6
-60
readwrite.rst
docs/readwrite.rst
+6
-60
No files found.
docs/readwrite.rst
View file @
5d358812
...
...
@@ -3,70 +3,16 @@
I/O Functions
*************
OpenMesh provides
two
functions that read and write meshes from and to files:
:func:`~openmesh.read_mesh` and :func:`~openmesh.write_mesh`
OpenMesh provides functions that read and write meshes from and to files:
:func:`~openmesh.read_
trimesh`, :func:`~openmesh.read_poly
mesh` and :func:`~openmesh.write_mesh`
.. code:: python
import openmesh as om
mesh = om.TriMesh()
om.read_mesh(mesh, "bunny.ply")
trimesh = om.read_trimesh("bunny.ply")
polymesh = om.read_polymesh("bunny.ply")
# modify mesh ...
om.write_mesh(mesh, "bunny.ply")
The file type is automatically deduced from the file extension. OpenMesh
currently supports five file types: .obj, .off, .ply, .stl and .om
The behaviour of the I/O functions can be fine-tuned by passing an instance of
the :class:`~openmesh.Options` class to either :func:`~openmesh.read_mesh` or
:func:`~openmesh.write_mesh`. When reading a file the options are used as hints,
i.e. depending on the format we can help the reader to interpret the data
correctly. When writing a file the options determine whether or not to use the
binary variant of the respective file format and the desired byte-ordering.
.. code:: python
import openmesh as om
mesh = om.TriMesh()
# hint: read vertex normals
options = om.Options()
options += om.Options.VertexNormal
om.read_mesh(mesh, "bunny.ply", options)
# write binary file
options = om.Options()
options += om.Options.Binary
om.write_mesh(mesh, "bunny_binary.ply", options)
The :class:`~openmesh.Options` class controls the behaviour of the I/O functions
by means of enabled/disabled bits in a bitset. The following list contains all
available option bits:
- mode bits - control binary reading/writing
- Options.Binary
- Options.MSB
- Options.LSB
- Options.Swap (MSB|LSB)
- property bits - controls which standard properties to read/write
- Options.VertexNormal
- Options.VertexTexCoord
- Options.VertexColor
- Options.FaceNormal
- Options.FaceColor
- Options.ColorAlpha
- Options.ColorFloat
Multiple options can be combined using simple arithmetic:
.. code:: python
om.write_mesh(trimesh, "bunny.ply")
options = om.Options()
options += om.Options.VertexNormal
options += om.Options.VertexColor
OpenMesh currently supports five file types: .obj, .off, .ply, .stl and .om
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment