Skip to content

Commit fe7f353

Browse files
authored
Merge pull request #1124 from compas-dev/fix-polyline
fix: #1122 gh not showing polylines (only points)
2 parents 3123668 + a48e958 commit fe7f353

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

CHANGELOG.md

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

1414
* Fixed bug that caused a new-line at the end of the `compas.HERE` constant in IronPython for Mac.
15+
* Fixed Grasshopper `draw_polylines` method to return `PolylineCurve` instead of `Polyline` because the latter shows as only points.
1516

1617
### Removed
1718

src/compas_ghpython/utilities/drawing.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@
22
from __future__ import division
33
from __future__ import print_function
44

5-
from compas_rhino.utilities.drawing import _face_to_max_quad
6-
7-
from System.Enum import ToObject
8-
from System.Array import CreateInstance
9-
from System.Drawing import Color
10-
115
import rhinoscriptsyntax as rs
126
import scriptcontext as sc
13-
14-
from compas.geometry import centroid_points
15-
from compas.utilities import pairwise
16-
17-
from Rhino.Geometry import Point3d
18-
from Rhino.Geometry import Vector3d
19-
from Rhino.Geometry import Line
20-
from Rhino.Geometry import Polyline
217
from Rhino.Geometry import Brep
22-
from Rhino.Geometry import Cylinder
238
from Rhino.Geometry import Circle
24-
from Rhino.Geometry import Plane
25-
from Rhino.Geometry import PipeCapMode
269
from Rhino.Geometry import Curve
27-
from Rhino.Geometry import Sphere
10+
from Rhino.Geometry import Cylinder
11+
from Rhino.Geometry import Line
2812
from Rhino.Geometry import Mesh
29-
from Rhino.Geometry import Vector3f
13+
from Rhino.Geometry import PipeCapMode
14+
from Rhino.Geometry import Plane
3015
from Rhino.Geometry import Point2f
16+
from Rhino.Geometry import Point3d
17+
from Rhino.Geometry import PolylineCurve
18+
from Rhino.Geometry import Sphere
19+
from Rhino.Geometry import Vector3d
20+
from Rhino.Geometry import Vector3f
21+
from System.Array import CreateInstance
22+
from System.Drawing import Color
23+
from System.Enum import ToObject
24+
25+
from compas.geometry import centroid_points
26+
from compas.utilities import pairwise
27+
from compas_rhino.utilities.drawing import _face_to_max_quad
3128

3229
try:
3330
from Rhino.Geometry import MeshNgon
@@ -146,7 +143,7 @@ def draw_polylines(polylines):
146143
147144
Returns
148145
-------
149-
list[:rhino:`Rhino.Geometry.Polyline`]
146+
list[:rhino:`Rhino.Geometry.PolylineCurve`]
150147
151148
Notes
152149
-----
@@ -158,10 +155,11 @@ def draw_polylines(polylines):
158155
159156
"""
160157
rg_polylines = []
158+
# We need to use PolylineCurve because of this:
159+
# https://discourse.mcneel.com/t/polyline-output-wanted-but-got-a-list-of-points/77509
161160
for p in iter(polylines):
162161
points = p["points"]
163-
poly = Polyline([Point3d(*xyz) for xyz in points])
164-
poly.DeleteShortSegments(TOL)
162+
poly = PolylineCurve([Point3d(*xyz) for xyz in points])
165163
rg_polylines.append(poly)
166164
return rg_polylines
167165

0 commit comments

Comments
 (0)