Skip to content

Commit 96b03ab

Browse files
authored
Merge branch 'main' into thickening-direction
2 parents 580a630 + ec77a5f commit 96b03ab

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Added
1212

13-
* Added crease handling to catmull-clark subdivision scheme.
1413
* Added Python 3.9 support.
14+
* Added crease handling to catmull-clark subdivision scheme.
15+
* Added `compas_ghpython.get_grasshopper_userobjects_path` to retrieve User Objects target folder.
1516
* Added direction option for mesh thickening.
1617
* Added check for closed meshes.
1718

src/compas_ghpython/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,21 @@
2323

2424

2525
def get_grasshopper_library_path(version):
26+
"""Retrieve Grasshopper's library (components) path"""
27+
return _get_grasshopper_special_folder(version, 'Libraries')
28+
29+
30+
def get_grasshopper_userobjects_path(version):
31+
"""Retrieve Grasshopper's user objects path"""
32+
return _get_grasshopper_special_folder(version, 'UserObjects')
33+
34+
35+
def _get_grasshopper_special_folder(version, folder_name):
2636
if compas.WINDOWS:
27-
grasshopper_library_path = os.path.join(os.getenv('APPDATA'), 'Grasshopper', 'Libraries')
37+
grasshopper_library_path = os.path.join(os.getenv('APPDATA'), 'Grasshopper', folder_name)
2838
elif compas.OSX:
2939
grasshopper_library_path = os.path.join(os.getenv('HOME'), 'Library', 'Application Support', 'McNeel', 'Rhinoceros', '{}'.format(version),
30-
'Plug-ins', 'Grasshopper (b45a29b1-4343-4035-989e-044e8580d9cf)', 'Libraries')
40+
'Plug-ins', 'Grasshopper (b45a29b1-4343-4035-989e-044e8580d9cf)', folder_name)
3141
else:
3242
raise Exception('Unsupported platform')
3343
return grasshopper_library_path

0 commit comments

Comments
 (0)