compas-dev / compas-dev/compas

Polyline & Polygon length bug

Open
#1,156 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
386
Forks
122
Avg merge
11d 46m
Merged PRs (30d)
1

Description

**Describe the bug**
When modifying a Polyline's or Polygon's `points` attribute by adding or removings items from the list, the `length` attribute is not updated. This problem also occurs when using methods, such as `shorten`, which directly perform modifications to the list.

**To Reproduce**
Steps to reproduce the behavior:
1. Environment: VS Code
2. Sample code:
```
pl = Polyline([(0,0), (1,0)])
print(pl.length)
pl.points.append(Point(2,0))
print(pl.length)
```
4. The results are: 1.0 and 1.0

**Expected behavior**
It would be normal that modifying the `points` would result in the recalculation of the polyline's length (and on this note, the `lines` as well)

**Desktop (please complete the following information):**
- OS: Windows 11
- Python version [e.g. 3.10.8]
- conda

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.