Skip to content

Commit 39c98dc

Browse files
colorize cloud component (#114)
* ADD: colorize cloud component * FIX: PR reviews fixes here and there, ready for merge --------- Co-authored-by: Andrea Settimi <andreasettimi39@gmail.com>
1 parent 3629571 commit 39c98dc

File tree

7 files changed

+73
-5
lines changed

7 files changed

+73
-5
lines changed

deps/eigen

Submodule eigen updated from 84282c4 to 2d4c9b4

doc/gh_DFColorizeCloud.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. image:: ../src/gh/components/DF_colorize_cloud/icon.png
2+
:align: left
3+
:width: 40px
4+
5+
``DFColorizeCloud`` component
6+
=================================
7+
8+
.. ghcomponent_to_rst:: ../src/gh/components/DF_colorize_cloud

doc/gh_components.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ DF has a Grasshopper_ plugin with a set of components that allows the user to in
7373

7474
* - .. image:: ../src/gh/components/DF_remove_beam/icon.png
7575
- `gh_DFRemoveBeam <gh_DFRemoveBeam.html>`_
76-
-
77-
-
76+
- .. image:: ../src/gh/components/DF_colorize_cloud/icon.png
77+
- `gh_DFColorizeCloud <gh_DFColorizeCloud.html>`_
7878

7979

8080

@@ -106,4 +106,5 @@ DF has a Grasshopper_ plugin with a set of components that allows the user to in
106106
gh_DFVisualizationSettings
107107
gh_DFXMLExporter
108108
gh_DFPreviewAssembly
109-
gh_DFRemoveBeam
109+
gh_DFRemoveBeam
110+
gh_DFColorizeCloud
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! python3
2+
3+
import System
4+
5+
import Rhino
6+
from ghpythonlib.componentbase import executingcomponent as component
7+
8+
import numpy as np
9+
10+
class DFColorizeCloud(component):
11+
def RunScript(self, i_clouds: System.Collections.Generic.List[Rhino.Geometry.PointCloud]):
12+
for cloud in i_clouds:
13+
random_color = System.Drawing.Color.FromArgb(
14+
np.random.randint(0, 255),
15+
np.random.randint(0, 255),
16+
np.random.randint(0, 255))
17+
for j in range(cloud.Count):
18+
cloud[j].Color = random_color
19+
return i_clouds
7.19 KB
Loading
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "DFColorizeCloud",
3+
"nickname": "DFColorizeCloud",
4+
"category": "diffCheck",
5+
"subcategory": "Cloud",
6+
"description": "Colorizes randomly a list of point clouds.",
7+
"exposure": 4,
8+
"instanceGuid": "c18ff8d2-6c5a-431d-a0b7-c44e2d7a690a",
9+
"ghpython": {
10+
"hideOutput": true,
11+
"hideInput": true,
12+
"isAdvancedMode": true,
13+
"marshalOutGuids": true,
14+
"iconDisplay": 2,
15+
"inputParameters": [
16+
{
17+
"name": "i_clouds",
18+
"nickname": "i_clouds",
19+
"description": "The pointclouds to be colorized.",
20+
"optional": true,
21+
"allowTreeAccess": true,
22+
"showTypeHints": true,
23+
"scriptParamAccess": "list",
24+
"wireDisplay": "default",
25+
"sourceCount": 0,
26+
"typeHintID": "pointcloud"
27+
}
28+
],
29+
"outputParameters": [
30+
{
31+
"name": "o_clouds",
32+
"nickname": "o_clouds",
33+
"description": "The point clouds now colorized.",
34+
"optional": false,
35+
"sourceCount": 0,
36+
"graft": false
37+
}
38+
]
39+
}
40+
}

0 commit comments

Comments
 (0)