diff --git a/CHANGELOG.md b/CHANGELOG.md index afce9e69104..8baf02dc1b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed use of `compas.geometry.allclose` to `compas.tolerance.TOL.is_allclose`. * Changed use of `compas.geometry.close` to `compas.tolerance.TOL.is_close`. * Changed imports of itertools to `compas.itertools` instead of `compas.utilities`. +* Updated `compas_rhino.conversions.point_to_compas` to allow for `Rhino.Geometry.Point` as input. ### Removed diff --git a/src/compas_rhino/conversions/geometry.py b/src/compas_rhino/conversions/geometry.py index 118e4302e84..cceb72bbe7e 100644 --- a/src/compas_rhino/conversions/geometry.py +++ b/src/compas_rhino/conversions/geometry.py @@ -3,6 +3,7 @@ from __future__ import print_function import Rhino # type: ignore +from System import MissingMemberException # type: ignore from compas.geometry import Frame from compas.geometry import Plane @@ -103,14 +104,20 @@ def point_to_compas(point): Parameters ---------- - point : :rhino:`Rhino.Geometry.Point3d` + point : :rhino:`Rhino.Geometry.Point3d` | :rhino:`Rhino.Geometry.Point` Returns ------- :class:`compas.geometry.Point` """ - return Point(point.X, point.Y, point.Z) + try: + return Point(point.X, point.Y, point.Z) + except MissingMemberException: + try: + return Point(point.Location.X, point.Location.Y, point.Location.Z) + except MissingMemberException: + raise TypeError("Unexpected point type, got: {}".format(type(point))) def vector_to_compas(vector):