Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colorize cloud component #114

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
]
}
}
Loading