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

Fix error in ghpython draw_mesh where an System.Array was expected #1382

Merged
merged 3 commits into from
Sep 2, 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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

* Fixed args for `SceneObject` on Grasshopper `Draw` component.
* Replaced use of `Rhino.Geometry.VertexColors.SetColors` with a for loop and `SetColor` in `compas_ghpyton` since the former requires a `System.Array`.

### Removed

Expand All @@ -31,7 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed


## [2.4.0] 2024-08-22

### Added
Expand Down
6 changes: 4 additions & 2 deletions src/compas_ghpython/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,10 @@ def draw_mesh(vertices, faces, color=None, vertex_normals=None, texture_coordina

if color:
count = len(mesh.Vertices)
colors = [rs.coercecolor(color) for i in range(count)]
mesh.VertexColors.SetColors(colors)
color = rs.CreateColor(color)

for i in range(count):
mesh.VertexColors.SetColor(i, color.R, color.G, color.B)

return mesh

Expand Down
Loading