Skip to content

Commit

Permalink
colorize cloud component (#114)
Browse files Browse the repository at this point in the history
* ADD: colorize cloud component

* FIX: PR reviews fixes here and there, ready for merge

---------

Co-authored-by: Andrea Settimi <[email protected]>
  • Loading branch information
DamienGilliard and 9and3 authored Sep 20, 2024
1 parent 3629571 commit 39c98dc
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deps/eigen
Submodule eigen updated from 84282c to 2d4c9b
8 changes: 8 additions & 0 deletions doc/gh_DFColorizeCloud.rst
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions doc/gh_components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gh_DFRemoveBeam.html>`_
-
-
- .. image:: ../src/gh/components/DF_colorize_cloud/icon.png
- `gh_DFColorizeCloud <gh_DFColorizeCloud.html>`_



Expand Down Expand Up @@ -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
gh_DFRemoveBeam
gh_DFColorizeCloud
19 changes: 19 additions & 0 deletions src/gh/components/DF_colorize_cloud/code.py
Original file line number Diff line number Diff line change
@@ -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
Binary file added src/gh/components/DF_colorize_cloud/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions src/gh/components/DF_colorize_cloud/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "DFColorizeCloud",
"nickname": "DFColorizeCloud",
"category": "diffCheck",
"subcategory": "Cloud",
"description": "Colorizes randomly a list of point clouds.",
"exposure": 4,
"instanceGuid": "c18ff8d2-6c5a-431d-a0b7-c44e2d7a690a",
"ghpython": {
"hideOutput": true,
"hideInput": true,
"isAdvancedMode": true,
"marshalOutGuids": true,
"iconDisplay": 2,
"inputParameters": [
{
"name": "i_clouds",
"nickname": "i_clouds",
"description": "The pointclouds to be colorized.",
"optional": true,
"allowTreeAccess": true,
"showTypeHints": true,
"scriptParamAccess": "list",
"wireDisplay": "default",
"sourceCount": 0,
"typeHintID": "pointcloud"
}
],
"outputParameters": [
{
"name": "o_clouds",
"nickname": "o_clouds",
"description": "The point clouds now colorized.",
"optional": false,
"sourceCount": 0,
"graft": false
}
]
}
}

0 comments on commit 39c98dc

Please sign in to comment.