From 591f1a99db350ae9b909346a945875c13543c7c5 Mon Sep 17 00:00:00 2001 From: DamienGilliard <127743632+DamienGilliard@users.noreply.github.com> Date: Fri, 20 Sep 2024 11:08:37 +0200 Subject: [PATCH 1/2] ADD: colorize cloud component --- src/gh/components/DF_colorize_cloud/code.py | 17 ++++++++ src/gh/components/DF_colorize_cloud/icon.png | Bin 0 -> 913 bytes .../DF_colorize_cloud/metadata.json | 40 ++++++++++++++++++ 3 files changed, 57 insertions(+) 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/src/gh/components/DF_colorize_cloud/code.py b/src/gh/components/DF_colorize_cloud/code.py new file mode 100644 index 00000000..910b1ffc --- /dev/null +++ b/src/gh/components/DF_colorize_cloud/code.py @@ -0,0 +1,17 @@ +"""assigns unique colors to each cloud of a list of clouds, to differentiate them in the Rhino viewport""" + +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..ac78fdced7c6472964e3cbe579b1df5592c68171 GIT binary patch literal 913 zcmV;C18)3@P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H110G34 zK~z|UwbxsSRdp1{@y~zH#j(7VU9@ykQ%jV|h?s{WhzNQSqQYK+Aj;{j=*8$Q3M8V( zAg2N!qCk?MheWzSl%U<9bOcSuj6?@ZN5^zLbIx8p>^TwM&fYVpA8a_Vf9t=#`@h#& z|Fu&@NYA)Yw?5&hPNO&*Z#!!WdUdr|ur@-6WKK%1i;xnxqI=R-!@fLhN}i7;a^K^I zi`M#G_z2r{ItY>(a=k*Ya3AhMFA~ff_tT3%SQpGF1DiP3sbQ65_GRw(N;YDnM!BaS z?Xj$p?92+dmI{Wl7_=Q*%B8rv)|~Kl7W&KjQ}{fa{Qbdnldt~M@MHTufX=cp^$y#b z0Bfg{JOz*bs-7lmp;Qb*ukCRtO9Q&_!gK(7>Y}4zMa8g>A(Om><uA^*umW5%llq}(y+l%%OvL0`kfBQ>Y`>pq#k$jKi^ zob1djnBQYgmbp-`+k5=HS|0kxC*;A(W^B$k1wd5mf-^a~;kFYv}IP8 z4|~R)gJeUT!n{_i>^Nih@<#cSu7pnKxd*e>K5lQ&=HxIpB`;?<(aL$GgK Date: Fri, 20 Sep 2024 16:12:54 +0200 Subject: [PATCH 2/2] FIX: PR reviews fixes here and there, ready for merge --- deps/eigen | 2 +- deps/pybind11 | 2 +- doc/gh_DFColorizeCloud.rst | 8 ++++++++ doc/gh_components.rst | 7 ++++--- src/gh/components/DF_colorize_cloud/code.py | 10 ++++++---- src/gh/components/DF_colorize_cloud/icon.png | Bin 913 -> 7366 bytes .../components/DF_colorize_cloud/metadata.json | 8 ++++---- 7 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 doc/gh_DFColorizeCloud.rst 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 index 910b1ffc..4beab843 100644 --- a/src/gh/components/DF_colorize_cloud/code.py +++ b/src/gh/components/DF_colorize_cloud/code.py @@ -1,4 +1,4 @@ -"""assigns unique colors to each cloud of a list of clouds, to differentiate them in the Rhino viewport""" +#! python3 import System @@ -8,10 +8,12 @@ import numpy as np class DFColorizeCloud(component): - def RunScript(self, - i_clouds: System.Collections.Generic.List[Rhino.Geometry.PointCloud]): + 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)) + 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/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) zuiJb4yjmXm$0y{$%4TfNHw8dc>w+^my5YQiPuDD-o4XS?VZdw_Uw?X}tx_Dl-KdTH z?Ux@|+)^fS#^KLS`*KC@2|QeZxj6%L-+Zk#kFT_4R+kTZ#+`#?L!83A zR;%ndWB2k#`ID}MPUpD?v(`RtZ_wuCFgGPHXE@Qyd8C7JMb)-bDY+-ZSFMb7Z0_-M zy8$pGlb4%@-kE8w5`Vi@QIW;FcH!Gr&Ke7jXZE%kpg56)H_MpMG4uZcNVemTR^~M2 zo_R%$W)PcAXt-Z^Ur}?HRd-%->S?Wm|Mr1+&yg7PtPXeJEiRdGY73(L&{;+)>`W0? z-qrM+RWf&D$>5mYhw28}36QbyssR7h@OqzOT^sZ7S+-SQsa{qLiPtgFMu7cP_=;J& z)pv)V^i+g5g6_mDe33X5#aMSeR!?3FTdfz#D3pE$RW!U_udqV0MslyPFtH?x3H-3I fD^E5p-)i4KOON?(E*?gP00000NkvXXu0mjfg(A8t diff --git a/src/gh/components/DF_colorize_cloud/metadata.json b/src/gh/components/DF_colorize_cloud/metadata.json index 184c0b77..8ab60bf7 100644 --- a/src/gh/components/DF_colorize_cloud/metadata.json +++ b/src/gh/components/DF_colorize_cloud/metadata.json @@ -1,11 +1,11 @@ { "name": "DFColorizeCloud", - "nickname": "ColorizeCloud", + "nickname": "DFColorizeCloud", "category": "diffCheck", "subcategory": "Cloud", - "description": "Colorizes the point clouds of a list to differentiate them.", + "description": "Colorizes randomly a list of point clouds.", "exposure": 4, - "instanceGuid": "9f2c57d5-38bc-4525-8176-9f17c3e58a3d", + "instanceGuid": "c18ff8d2-6c5a-431d-a0b7-c44e2d7a690a", "ghpython": { "hideOutput": true, "hideInput": true, @@ -30,7 +30,7 @@ { "name": "o_clouds", "nickname": "o_clouds", - "description": "The downsampled cloud.", + "description": "The point clouds now colorized.", "optional": false, "sourceCount": 0, "graft": false