Skip to content

Commit 107c9b5

Browse files
committed
Fix a bug when the user wants to reuse the visualization component
1 parent a006a92 commit 107c9b5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

geomdl/BSpline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def render(self, cpcolor="blue", curvecolor="black"):
220220
self.evaluate()
221221

222222
# Run the visualization component
223+
self._vis_component.clear()
223224
self._vis_component.add(self.ctrlpts, "Control Points", cpcolor)
224225
self._vis_component.add(self.curvepts, "Curve", curvecolor)
225226
self._vis_component.render()
@@ -1067,6 +1068,7 @@ def render(self, cpcolor="blue", surfcolor="green"):
10671068
ctrlpts = utils.make_quad(self.ctrlpts, self._control_points_size_v, self._control_points_size_u)
10681069

10691070
# Run the visualization component
1071+
self._vis_component.clear()
10701072
self._vis_component.add(ctrlpts, "Control Points", cpcolor)
10711073
self._vis_component.add(self.surfpts, "Surface", surfcolor)
10721074
self._vis_component.render()

geomdl/visualization/VisBase.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def __init__(self):
1818
self._colors = []
1919
self._names = []
2020

21+
def clear(self):
22+
if self._points:
23+
self._points[:] = []
24+
self._colors[:] = []
25+
self._names[:] = []
26+
2127
def add(self, ptsarr=(), name=None, color=None):
2228
if not ptsarr or not color or not name:
2329
return

0 commit comments

Comments
 (0)