From 39c98dc2ffb314e0425323597bf1ee83ffb0ef66 Mon Sep 17 00:00:00 2001 From: DamienGilliard <127743632+DamienGilliard@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:16:44 +0200 Subject: [PATCH] colorize cloud component (#114) * ADD: colorize cloud component * FIX: PR reviews fixes here and there, ready for merge --------- Co-authored-by: Andrea Settimi --- deps/eigen | 2 +- deps/pybind11 | 2 +- doc/gh_DFColorizeCloud.rst | 8 ++++ doc/gh_components.rst | 7 +-- src/gh/components/DF_colorize_cloud/code.py | 19 +++++++++ src/gh/components/DF_colorize_cloud/icon.png | Bin 0 -> 7366 bytes .../DF_colorize_cloud/metadata.json | 40 ++++++++++++++++++ 7 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 doc/gh_DFColorizeCloud.rst create mode 100644 src/gh/components/DF_colorize_cloud/code.py create mode 100644 src/gh/components/DF_colorize_cloud/icon.png create mode 100644 src/gh/components/DF_colorize_cloud/metadata.json diff --git a/deps/eigen b/deps/eigen index 84282c42..2d4c9b40 160000 --- a/deps/eigen +++ b/deps/eigen @@ -1 +1 @@ -Subproject commit 84282c42fc05d08216331203206de7ceb024a9c6 +Subproject commit 2d4c9b400cca33d2f5cf316efc7151236244edb1 diff --git a/deps/pybind11 b/deps/pybind11 index 5efc7439..1f8b4a7f 160000 --- a/deps/pybind11 +++ b/deps/pybind11 @@ -1 +1 @@ -Subproject commit 5efc7439d43f3dbe8de2526df3436b8d99b10dab +Subproject commit 1f8b4a7f1a1c5cc9bd6e0d63fe15540e6c458b24 diff --git a/doc/gh_DFColorizeCloud.rst b/doc/gh_DFColorizeCloud.rst new file mode 100644 index 00000000..fa4f1725 --- /dev/null +++ b/doc/gh_DFColorizeCloud.rst @@ -0,0 +1,8 @@ +.. image:: ../src/gh/components/DF_colorize_cloud/icon.png + :align: left + :width: 40px + +``DFColorizeCloud`` component +================================= + +.. ghcomponent_to_rst:: ../src/gh/components/DF_colorize_cloud \ No newline at end of file diff --git a/doc/gh_components.rst b/doc/gh_components.rst index 80a85b29..202fa923 100644 --- a/doc/gh_components.rst +++ b/doc/gh_components.rst @@ -73,8 +73,8 @@ DF has a Grasshopper_ plugin with a set of components that allows the user to in * - .. image:: ../src/gh/components/DF_remove_beam/icon.png - `gh_DFRemoveBeam `_ - - - - + - .. image:: ../src/gh/components/DF_colorize_cloud/icon.png + - `gh_DFColorizeCloud `_ @@ -106,4 +106,5 @@ DF has a Grasshopper_ plugin with a set of components that allows the user to in gh_DFVisualizationSettings gh_DFXMLExporter gh_DFPreviewAssembly - gh_DFRemoveBeam \ No newline at end of file + gh_DFRemoveBeam + gh_DFColorizeCloud \ No newline at end of file diff --git a/src/gh/components/DF_colorize_cloud/code.py b/src/gh/components/DF_colorize_cloud/code.py new file mode 100644 index 00000000..4beab843 --- /dev/null +++ b/src/gh/components/DF_colorize_cloud/code.py @@ -0,0 +1,19 @@ +#! python3 + +import System + +import Rhino +from ghpythonlib.componentbase import executingcomponent as component + +import numpy as np + +class DFColorizeCloud(component): + def RunScript(self, i_clouds: System.Collections.Generic.List[Rhino.Geometry.PointCloud]): + for cloud in i_clouds: + random_color = System.Drawing.Color.FromArgb( + np.random.randint(0, 255), + np.random.randint(0, 255), + np.random.randint(0, 255)) + for j in range(cloud.Count): + cloud[j].Color = random_color + return i_clouds diff --git a/src/gh/components/DF_colorize_cloud/icon.png b/src/gh/components/DF_colorize_cloud/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..6b272496758d7b8247ee28327fb14e62d8ddbbbf GIT binary patch literal 7366 zcmeHKc{G&m`ya}Zkffr}7+Nf2#u#SFAWL>xiwLvPU}iKk_VN}9S+Zuy5-KDq*{33F zq*V4LB&o=jy~yvO-rnBx`=0YV?>WEkfA7qBW}fG|KhNj7uFrkl*SYU7GgCbQzCC;( z5JlUf$!5a4K5bjquud12i6aNdnWf|_6<{j%@hTD{iZ?hLwZ z6dQiLBmBheyh{zb6_Y0pXM8vOF#G)rqqSOBUhTQ^Urcit=+alG=f>y3Krp!3jRP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