Skip to content

Commit

Permalink
Merge pull request #1382 from tetov/fix_expected_Array
Browse files Browse the repository at this point in the history
Fix error in ghpython draw_mesh where an System.Array was expected
  • Loading branch information
gonzalocasas authored Sep 2, 2024
2 parents ebaaa77 + 6de0bbe commit 9b617a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 9b617a1

Please sign in to comment.