Skip to content

Commit 7629a94

Browse files
FIX init
1 parent 24e5138 commit 7629a94

File tree

2 files changed

+26
-24
lines changed

2 files changed

+26
-24
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,3 @@ Note that the functionality of the package is not directly available in Rhino, b
4545
## License
4646

4747
Libigl (and therefore also `compas_libigl`) is licensed under MPL-2.
48-
49-
## Credits
50-
51-
COMPAS libigl is developed by Tom Van Mele and Petras Vestartas at the Block Research Group, ETH Zurich, with additional contributions from:
52-
- Li Chen
53-
- Rafael Pastrana
54-
- Ziqi Wang

src/compas_libigl/__init__.py

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ def get(filename):
3030
----------
3131
filename : str
3232
The name of the data file.
33-
The filename should be specified relative to the COMPAS data directory,
34-
without leading or trailing slashes.
33+
The following are available.
34+
35+
* boxes.obj
36+
* faces.obj
37+
* fink.obj
38+
* hypar.obj
39+
* lines.obj
40+
* saddle.obj
3541
3642
Returns
3743
-------
@@ -40,14 +46,17 @@ def get(filename):
4046
4147
Notes
4248
-----
43-
The file name should be specified relative to the package data directory
44-
(``compas_libigl/data``).
49+
The file name should be specified relative to the sample data folder.
50+
This folder is only locally available if you installed :mod:`compas_libigl` from source,
51+
or if you are working directly with the source.
52+
In all other cases, the function will get the corresponding files direcly from
53+
the GitHub repo.
4554
4655
Examples
4756
--------
48-
>>> import os
49-
>>> from compas_libigl import get
50-
>>> get('tubemesh.json')
57+
>>> import compas_libigl as igl
58+
>>> from compas.datastructures import Mesh
59+
>>> mesh = Mesh.from_off(igl.get("bunny.off"))
5160
5261
"""
5362
filename = filename.strip("/")
@@ -56,21 +65,20 @@ def get(filename):
5665

5766
if os.path.exists(localpath):
5867
return localpath
68+
else:
69+
return "https://github.com/BlockResearchGroup/compas_libigl/raw/master/data/{}".format(filename)
5970

60-
return None
6171

72+
def get_beetle():
73+
return "https://raw.githubusercontent.com/libigl/libigl-tutorial-data/master/beetle.off"
6274

63-
def find(name):
64-
"""Find a file in the data directory through recursive search.
6575

66-
"""
67-
datapath = DATA
68-
return compas.find(name, datapath)
76+
def get_armadillo():
77+
return "https://raw.githubusercontent.com/libigl/libigl-tutorial-data/master/armadillo.obj"
6978

7079

7180
__all_plugins__ = [
72-
"compas_libigl._nanobind",
73-
"compas_libigl.boundaries",
81+
"compas_libigl._nanobindcompas_libigl._boundaries",
7482
"compas_libigl.curvature",
7583
"compas_libigl.geodistance",
7684
"compas_libigl.intersections",
@@ -89,7 +97,8 @@ def find(name):
8997
"add",
9098
"__doc__",
9199
"get",
92-
"find",
100+
"get_beetle",
101+
"get_armadillo",
93102
"trimesh_boundaries",
94103
"trimesh_gaussian_curvature",
95104
"trimesh_principal_curvature",
@@ -105,4 +114,4 @@ def find(name):
105114
"quadmesh_planarize",
106115
"trimesh_remesh_along_isoline",
107116
"trimesh_remesh_along_isolines",
108-
]
117+
]

0 commit comments

Comments
 (0)