forked from compas-dev/compas-actions.ghpython_components
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CAP: working marshalling python code
- Loading branch information
Showing
8 changed files
with
425 additions
and
176 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
- port to py3 | ||
- added new guid for typehints (extrusion and pointcloud) and modified the old ones for str, float, ghdoc, and none. | ||
|
||
- [?] propose type-hint for component hints instead of the metadata (?) | ||
- [?] propose type-hint for component hints instead of the metadata (?) | ||
- [?] propose to have the "out" parameter as out and set to false by default in the metadata.json (guid out param: 3ede854e-c753-40eb-84cb-b48008f14fd4) | ||
|
||
|
||
doubts: | ||
- I have doubts about the utility of setting the "SourceCount" in the metadata.json. I think it is not necessary, since the number of inputs is already defined by the number of parameters in the function. I think it is to leave it by deafult to 0. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Do something silly. | ||
This component does nothing useful, it's only a kitchen sink example showing most available options. | ||
Args: | ||
x: X value | ||
y: Y value | ||
z: Z value | ||
Returns: | ||
result: The sum of all three values. | ||
""" | ||
# from ghpythonlib.componentbase import executingcomponent as component | ||
|
||
import System | ||
import Rhino | ||
import Grasshopper | ||
|
||
import rhinoscriptsyntax as rs | ||
|
||
|
||
class MyComponent(Grasshopper.Kernel.GH_ScriptInstance): | ||
def RunScript(self, x: float, y: float, z: float): | ||
self.Message = 'COMPONENT v{{version}}' | ||
result = x + y + z | ||
return result |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"name": "Kitchen sink component example", | ||
"nickname": "Everything", | ||
"category": "Componentizer", | ||
"subcategory": "ALL", | ||
"description": "This is an example with the everything and the kitchen sink in it, just to show all available options.", | ||
"exposure": 4, | ||
"instanceGuid": "cdd47086-f902-4b77-825b-6b79c3aaecc1", | ||
"ghpython": { | ||
"marshalGuids": true, | ||
"iconDisplay": 2, | ||
"inputParameters": [ | ||
{ | ||
"name": "X", | ||
"nickname": "x", | ||
"description": "The X value of the component.", | ||
"optional": true, | ||
"allowTreeAccess": true, | ||
"showTypeHints": true, | ||
"scriptParamAccess": "item", | ||
"wireDisplay": "faint", | ||
"sourceCount": 0, | ||
"typeHintID": "float", | ||
"reverse": true, | ||
"simplify": false | ||
}, | ||
{ | ||
"name": "Y", | ||
"nickname": "y", | ||
"description": "The Y value of the component.", | ||
"optional": true, | ||
"allowTreeAccess": true, | ||
"showTypeHints": true, | ||
"scriptParamAccess": "item", | ||
"wireDisplay": "default", | ||
"sourceCount": 0, | ||
"typeHintID": "float", | ||
"simplify": true | ||
}, | ||
{ | ||
"name": "Z", | ||
"nickname": "z", | ||
"description": "The Z value of the component.", | ||
"optional": true, | ||
"allowTreeAccess": true, | ||
"showTypeHints": true, | ||
"scriptParamAccess": "item", | ||
"wireDisplay": "faint", | ||
"sourceCount": 0, | ||
"typeHintID": "float", | ||
"flatten": true | ||
} | ||
], | ||
"outputParameters": [ | ||
{ | ||
"name": "result", | ||
"nickname": "result", | ||
"description": "Result of the computation", | ||
"optional": false, | ||
"sourceCount": 0, | ||
"graft": true | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters