Skip to content

Commit 6189b0a

Browse files
authored
Merge pull request #1427 from compas-dev/rhino8_gh
Rhino8 gh
2 parents 6ac0643 + 23ae554 commit 6189b0a

File tree

23 files changed

+337
-4
lines changed

23 files changed

+337
-4
lines changed

.github/workflows/publish_yak.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: publish_yak
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
7+
publish_test_yak:
8+
runs-on: windows-latest
9+
10+
steps:
11+
12+
- name: Checkout repo
13+
uses: actions/checkout@v4
14+
15+
- name: Create CPython Grasshopper user objects
16+
run: |
17+
invoke build-cpython-ghuser-components
18+
19+
- name: Create IronPython Grasshopper user objects
20+
run: |
21+
choco install ironpython --version=2.7.8.1
22+
invoke clean
23+
invoke build-ghuser-components
24+
25+
- name: Create Rhino7 Yak package
26+
shell: pwsh
27+
run: |
28+
invoke yakerize -m $YAK_TEMPLATE\manifest.yml -l $YAK_TEMPLATE\icon.png -g $USER_OBJECTS -t rh7
29+
env:
30+
USER_OBJECTS: src\compas_ghpython\components\ghuser
31+
YAK_TEMPLATE: src\compas_ghpython\yak_template
32+
33+
- name: Create Rhino8 Yak package
34+
shell: pwsh
35+
run: |
36+
invoke yakerize -m $YAK_TEMPLATE\manifest.yml -l $YAK_TEMPLATE\icon.png -g $USER_OBJECTS -t rh8
37+
env:
38+
USER_OBJECTS: src\compas_ghpython\components_cpython\ghuser
39+
YAK_TEMPLATE: src\compas_ghpython\yak_template
40+
41+
- name: Publish to Yak test server (Rhino 7)
42+
shell: pwsh
43+
run: |
44+
$file = Get-ChildItem -Path dist\yak_package\*rh7*.yak -File | Select-Object -ExpandProperty Name
45+
invoke publish-yak --test-server -y $file
46+
env:
47+
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}
48+
49+
- name: Publish to Yak test server (Rhino 8)
50+
shell: pwsh
51+
run: |
52+
$file = Get-ChildItem -Path dist\yak_package\*rh8*.yak -File | Select-Object -ExpandProperty Name
53+
invoke publish-yak --test-server -y $file
54+
env:
55+
YAK_TOKEN: ${{ secrets.YAK_DF_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ data/ctralie
139139

140140
# Grasshopper generated objects
141141
src/compas_ghpython/components/**/*.ghuser
142+
src/compas_ghpython/components_cpython/**/*.ghuser
142143

143144
dev
144145

@@ -149,4 +150,4 @@ docs/reference/__old/
149150

150151
scripts/
151152

152-
.ruff_cache
153+
.ruff_cache

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
* Added `DevTools` with support for automatic reloading of local python modules.
1313
* Added implementation for `compas_rhino.geometry.RhinoBrep.from_step`.
14+
* Added CPython implementations of GH components for Rhino8.
15+
* Added import to new `yakerize` task from `compas_invocations2`.
16+
* Added import to new `publish_yak` task from `compas_invocations2`.
1417

1518
### Changed
1619

@@ -20,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2023
* Fixed bug in `compas.geometry.Polygon.points` setter by removing duplicate points if they exist.
2124
* Fixed bug in `compas.geometry.Polygon.plane` by aligning the normal of the bestfit plane with the approximate normal of the polygon faces.
2225
* Changed the order of face vertices in `compas.geometry.Surface.to_vertices_and_faces` to a counter clockwise cycling direction and outward facing normals for curved surfaces.>>>>>>> main
26+
* Deprecated the `-v8.0` flag in `compas_rhino.install`. Install to Rhino8 by following: https://compas.dev/compas/latest/userguide/cad.rhino8.html.
2327

2428
### Removed
2529

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ ruff
88
sphinx_compas2_theme
99
twine
1010
wheel
11+
pythonnet
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# r: compas>=2.8.1
2+
"""
3+
Deserializes JSON into COMPAS objects.
4+
"""
5+
6+
import Grasshopper
7+
8+
import compas
9+
10+
11+
class CompasLoadFromJson(Grasshopper.Kernel.GH_ScriptInstance):
12+
def RunScript(self, json: str):
13+
if not json:
14+
return None
15+
16+
try:
17+
return compas.json_load(json)
18+
except Exception:
19+
ghenv.Component.AddRuntimeMessage(Grasshopper.Kernel.GH_RuntimeMessageLevel.Warning, f"Failed to load JSON from path: {json}, Trying as string.") # noqa: F821
20+
return compas.json_loads(json)
988 Bytes
Loading
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "From JSON",
3+
"nickname": "From JSON",
4+
"category": "COMPAS",
5+
"subcategory": "Data",
6+
"description": "Deserializes JSON into COMPAS objects.",
7+
"exposure": 2,
8+
9+
"ghpython": {
10+
"isAdvancedMode": true,
11+
"iconDisplay": 2,
12+
"inputParameters": [
13+
{
14+
"name": "json",
15+
"description": "JSON file path or JSON string.",
16+
"typeHintID": "str"
17+
}
18+
],
19+
"outputParameters": [
20+
{
21+
"name": "result",
22+
"description": "Deserialized objects."
23+
}
24+
]
25+
}
26+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# r: compas>=2.8.1
2+
"""
3+
Displays information about the active COMPAS environment.
4+
"""
5+
6+
import compas_bootstrapper
7+
import Grasshopper
8+
9+
import compas
10+
11+
12+
class CompasInfo(Grasshopper.Kernel.GH_ScriptInstance):
13+
def RunScript(self):
14+
ghenv.Component.Message = "COMPAS v{}".format(compas.__version__) # noqa: F821
15+
info = "COMPAS Version: {}\nEnvironment: {}"
16+
return info.format(compas.__version__, compas_bootstrapper.ENVIRONMENT_NAME)
1.26 KB
Loading
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "Info",
3+
"nickname": "Info",
4+
"category": "COMPAS",
5+
"subcategory": "Info",
6+
"description": "Displays information about the active COMPAS environment.",
7+
"exposure": 2,
8+
9+
"ghpython": {
10+
"isAdvancedMode": true,
11+
"iconDisplay": 2,
12+
"inputParameters": [
13+
],
14+
"outputParameters": [
15+
{
16+
"name": "info",
17+
"description": "Environment info."
18+
}
19+
]
20+
}
21+
}

0 commit comments

Comments
 (0)