Skip to content

Commit

Permalink
ADD: extra tip on readme for tree convertion
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Aug 21, 2024
1 parent 646e246 commit d3a1a24
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Binary file added GH/PyGH/assets/img/listtreeauto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ To close `script-sync` in RhinoV8, run the command `ScriptSyncStop` in RhinoV8.
<img src="GH\PyGH\assets\img\gh_snap2.png" width="550">
</p>

> [!TIP]
> `script-sync` automatically converts lists and nested lists to Grasshopper data trees. Just return the python list as value. It also supports the `ghpythonlib.treehelpers` module. Example:
> ```python
> # option 1
> py_nlist = [
> [[1, 2], [3, 4]],
> [[5, 6], [7, 8]]
> ]
>
> # options 2
> import ghpythonlib.treehelpers as th
> gh_tree = th.list_to_tree(py_nlist)
>
> o_as_nlist = py_nlist
> o_as_tree = gh_tree
> ```
> ![imgtreeconv](GH\PyGH\assets\img\listtreeauto.png)
👩‍💻 **`VScode`**: Open a script in VSCode and run it in RhinoV8 by pressing `F4` to run in Rhino or `shift+F4` for Grasshopper.
For Python files, add a `shebang` to the first line of the file to specify the interpreter to use, e.g.:
* `#! python3` to interpret it with CPython
Expand Down

0 comments on commit d3a1a24

Please sign in to comment.