-
Notifications
You must be signed in to change notification settings - Fork 105
Description
Describe the bug
The generate_mesh() function in fullcontrol/visualize/plotly.py fails when colors_now is None. The code attempts to modify colors_now without first checking if it is set, causing a runtime error on the line colors_now[:] = np.array(colors_now, dtype=object)[good_points].
The error is triggered when generate_stl() in lab/fullcontrol/geometry_model/steps2geometry.py calls generate_mesh(), since it does not specify colors_now.
To Reproduce
Steps to reproduce the behavior:
- Call the
generate_mesh()function withcolors_now=Noneor simply omit thecolors_nowargument. - Observe the error thrown when
generate_mesh()tries to modifycolors_now.
Expected behavior
The generate_mesh() function should handle the case where the optional argument colors_now takes it default value None gracefully and proceed without modification to colors_now if it is not provided. Adding an if colors_now is not None: check before modifying colors_now resolves this issue.
Screenshots
N/A
Desktop (please complete the following information):
- OS: Windows 11 Home
- Python Version: 3.12
- Fullcontrol Version: 0.1.1
- Lab Version: 8.3
Smartphone (please complete the following information):
N/A
Additional context
Bug occurs in fullcontrol/visualize/plotly.py within generate_mesh()
Suggested solution:
if colors_now is not None:
colors_now[:] = np.array(colors_now, dtype=object)[good_points]
Or force the user to provide colors_now