Skip to content

Commit 4a21871

Browse files
authored
Merge pull request #343 from compas-dev/feature/new_config_components
new: add zero-config and merge-config GH components
2 parents 103c3f7 + 1ea3223 commit 4a21871

File tree

7 files changed

+89
-0
lines changed

7 files changed

+89
-0
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Unreleased
1313
**Added**
1414

1515
* Added ``compas_fab.backends.PyBulletClient.load_ur5()`` method to simplify some examples.
16+
* Added Grasshopper components to get a zero configuration and to merge two configurations.
1617

1718
**Changed**
1819

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Merge two configurations.
3+
4+
COMPAS FAB v0.22.0
5+
"""
6+
from ghpythonlib.componentbase import executingcomponent as component
7+
8+
9+
class ConfigMerge(component):
10+
def RunScript(self, config_a, config_b):
11+
12+
if config_a and config_b:
13+
return config_a.merged(config_b)
14+
15+
return None
5.45 KB
Loading
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "Merge config",
3+
"nickname": "Merge config",
4+
"category": "COMPAS FAB",
5+
"subcategory": "Config",
6+
"description": "Merge two configurations.",
7+
"exposure": 4,
8+
9+
"ghpython": {
10+
"isAdvancedMode": true,
11+
"inputParameters": [
12+
{
13+
"name": "config_a",
14+
"description": "The configuration to use as base for the merge."
15+
},
16+
{
17+
"name": "config_b",
18+
"description": "The configuration used to merge into the base one."
19+
}
20+
],
21+
"outputParameters": [
22+
{
23+
"name": "config",
24+
"description": "The merged configuration."
25+
}
26+
]
27+
}
28+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""
2+
Get a zero configuration for a robot.
3+
4+
COMPAS FAB v0.22.0
5+
"""
6+
from ghpythonlib.componentbase import executingcomponent as component
7+
8+
9+
class ConfigZero(component):
10+
def RunScript(self, robot, group):
11+
12+
if robot:
13+
return robot.zero_configuration(group)
14+
15+
return None
2.03 KB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "Zero config",
3+
"nickname": "Zero config",
4+
"category": "COMPAS FAB",
5+
"subcategory": "Config",
6+
"description": "Get a zero configuration for a robot.",
7+
"exposure": 4,
8+
9+
"ghpython": {
10+
"isAdvancedMode": true,
11+
"inputParameters": [
12+
{
13+
"name": "robot",
14+
"description": "The robot.",
15+
"wireDisplay": "hidden"
16+
},
17+
{
18+
"name": "group",
19+
"description": "If assigned, it will return the zero configuration for the given group, otherwise a full zero configuration.",
20+
"typeHintID": "str"
21+
}
22+
],
23+
"outputParameters": [
24+
{
25+
"name": "config",
26+
"description": "The zero configuration."
27+
}
28+
]
29+
}
30+
}

0 commit comments

Comments
 (0)