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 1 commit
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
17 changes: 17 additions & 0 deletions src/gh/components/DF_colorize_cloud/code.py
Original file line number Diff line number Diff line change
@@ -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
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": "ColorizeCloud",
"category": "diffCheck",
"subcategory": "Cloud",
"description": "Colorizes the point clouds of a list to differentiate them.",
"exposure": 4,
"instanceGuid": "9f2c57d5-38bc-4525-8176-9f17c3e58a3d",
"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 downsampled cloud.",
"optional": false,
"sourceCount": 0,
"graft": false
}
]
}
}
Loading