Skip to content

Commit

Permalink
Merge pull request #1356 from gidodielemans/main
Browse files Browse the repository at this point in the history
RobotModel SceneObject with Python3 in Rhino8
  • Loading branch information
tomvanmele authored May 29, 2024
2 parents b0fcf16 + 36f2ecb commit bb60abc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added `maxiter` parameter to `compas.geometry.icp_numpy`.

### Changed

* Changed `compas_ghpython/utilities/drawing.py` to remove `System` dependency.
* Fixed bug in `compas.geometry.ic_numpy`, which was caused by returning only the last transformation of the iteration process.

### Removed

* Removed `System`dependency in `compas_ghpython/utilities/drawing.py`.

## [2.1.1] 2024-05-14

Expand Down
17 changes: 4 additions & 13 deletions src/compas_ghpython/utilities/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
from Rhino.Geometry import Sphere
from Rhino.Geometry import Vector3d
from Rhino.Geometry import Vector3f
from System.Array import CreateInstance
from System.Drawing import Color
from System.Enum import ToObject

from compas.geometry import centroid_points
from compas.itertools import pairwise
Expand Down Expand Up @@ -284,7 +281,7 @@ def draw_pipes(pipes, cap=2, fit=1.0):
points = p["points"]
radius = p["radius"]
params = [0.0, 1.0]
cap = ToObject(PipeCapMode, cap)
cap = PipeCapMode(cap)
if type(radius) in (int, float):
radius = [radius] * 2
radius = [float(r) for r in radius]
Expand Down Expand Up @@ -366,23 +363,17 @@ def draw_mesh(vertices, faces, color=None, vertex_normals=None, texture_coordina

if vertex_normals:
count = len(vertex_normals)
normals = CreateInstance(Vector3f, count)
for i, normal in enumerate(vertex_normals):
normals[i] = Vector3f(normal[0], normal[1], normal[2])
normals = [Vector3f(normal[0], normal[1], normal[2]) for normal in vertex_normals]
mesh.Normals.SetNormals(normals)

if texture_coordinates:
count = len(texture_coordinates)
tcs = CreateInstance(Point2f, count)
for i, tc in enumerate(texture_coordinates):
tcs[i] = Point2f(tc[0], tc[1])
tcs = [Point2f(tc[0], tc[1]) for tc in texture_coordinates]
mesh.TextureCoordinates.SetTextureCoordinates(tcs)

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

return mesh
Expand Down

0 comments on commit bb60abc

Please sign in to comment.