Skip to content

Commit 86d9abd

Browse files
committed
fix bugs in shape conversions
1 parent 4720aaa commit 86d9abd

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
### Changed
1313

1414
* Changed supported Blender versions to latest LTS versions (3.3, 3.6, 4.2).
15+
* Fixed bug in `compas_rhino.conversions.cone_to_compas`.
16+
* Fixed bug in `compas_rhino.conversions.cylinder_to_compas`.
1517

1618
### Removed
1719

src/compas_rhino/conversions/shapes.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
import scriptcontext as sc # type: ignore
77

88
from compas.geometry import Box
9-
from compas.geometry import Circle
109
from compas.geometry import Cone
1110
from compas.geometry import Cylinder
1211
from compas.geometry import Frame
13-
from compas.geometry import Plane
1412
from compas.geometry import Sphere
1513
from compas.geometry import Torus
1614

@@ -19,11 +17,9 @@
1917

2018
# from .geometry import plane_to_rhino
2119
from .geometry import frame_to_rhino
22-
from .geometry import plane_to_compas
2320
from .geometry import plane_to_compas_frame
2421
from .geometry import point_to_compas
2522
from .geometry import point_to_rhino
26-
from .geometry import vector_to_compas
2723

2824
# =============================================================================
2925
# To Rhino
@@ -253,8 +249,9 @@ def cone_to_compas(cone):
253249
:class:`compas.geometry.Cone`
254250
255251
"""
256-
plane = Plane(cone.BasePoint, vector_to_compas(cone.Plane.Normal).inverted())
257-
return Cone(Circle(plane, cone.Radius), cone.Height)
252+
frame = plane_to_compas_frame(cone.Plane)
253+
frame.point = point_to_compas(cone.BasePoint) # invert the z-axis?
254+
return Cone(radius=cone.Radius, height=cone.Height, frame=frame)
258255

259256

260257
def cylinder_to_compas(cylinder):
@@ -269,10 +266,10 @@ def cylinder_to_compas(cylinder):
269266
:class:`compas.geometry.Cylinder`
270267
271268
"""
272-
plane = plane_to_compas(cylinder.BasePlane)
269+
frame = plane_to_compas_frame(cylinder.BasePlane)
273270
height = cylinder.TotalHeight
274-
plane.point += plane.normal * (0.5 * height)
275-
return Cylinder(Circle(plane, cylinder.Radius), height)
271+
frame.point += frame.normal * (0.5 * height)
272+
return Cylinder(radius=cylinder.Radius, height=height, frame=frame)
276273

277274

278275
def torus_to_compas(torus):

0 commit comments

Comments
 (0)