https://github.com/mpewsey/off_parser
Parses OFF (Object File Format) 3D model files to a class container. Includes helper functions for downloading and parsing publicly available datasets.
https://github.com/mpewsey/off_parser
3d-models modelnet off-file parser
Last synced: 9 months ago
JSON representation
Parses OFF (Object File Format) 3D model files to a class container. Includes helper functions for downloading and parsing publicly available datasets.
- Host: GitHub
- URL: https://github.com/mpewsey/off_parser
- Owner: mpewsey
- License: bsd-3-clause
- Archived: true
- Created: 2019-02-01T01:30:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-27T04:34:23.000Z (almost 7 years ago)
- Last Synced: 2025-03-18T12:15:16.239Z (11 months ago)
- Topics: 3d-models, modelnet, off-file, parser
- Language: Python
- Homepage: https://off-parser.readthedocs.io/
- Size: 151 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OFF Parser
[](https://travis-ci.com/mpewsey/off_parser)
[](https://off_parser.readthedocs.io/en/latest/?badge=latest)
[](https://codecov.io/gh/mpewsey/off_parser)
## About
This package provides a class for parsing .OFF (Object File Format) 3D model
files for manipulation of the data using Python. In addition, it provides
helper functions for downloading and parsing data from the below datasets.
| Dataset | Function | Source |
|----------------------|-------------------|-----------------------------------|
| Princeton ModelNet10 | `load_modelnet10` | [http://modelnet.cs.princeton.edu/](http://modelnet.cs.princeton.edu/) |
| Princeton ModelNet40 | `load_modelnet40` | [http://modelnet.cs.princeton.edu/](http://modelnet.cs.princeton.edu/) |
This package is in no way affiliated with these datasets. For terms of dataset
usage, please consult each datasets respective licensing and conditions.
## Installation
The latest development version of this package may be installed via `pip`:
```
pip install git+https://github.com/mpewsey/off_parser#egg=off_parser
```
## Parsing Files
An .OFF file may be loaded by passing the file path to the class constructor:
```
from off_parser import OffParser
p = OffParser('path/file.off')
```
The points and faces contained in the file can then be accessed via the
`points` and `faces` properties.
The 3D model may also be plotted using `matplotlib` by calling the `plot`
method:
```
p.plot()
```

## Loading Datasets
The functions specified in the table in the [About](#about) section
may be used to load their respective datasets. The first time a function
is called, the dataset will be downloaded to the operating system's temporary
directory. If the download is interrupted or you encounter a problem with
the file, delete the file from the temporary directory and try calling
the function again. The dataset files can take some time to download so
please be patient.