compas-dev / compas_view2

Standalone viewer for COMPAS
https://compas.dev/compas_view2/
MIT License
6 stars 8 forks source link

v120_ui_elements, v120_ui_elements2, v120_points: TypeError: __init__() got multiple values for keyword argument 'pointsize' #130

Closed nizartaha closed 11 months ago

nizartaha commented 2 years ago

Describe the bug

i installed compas_view2 in a new environment: conda create -n compas_view2 python=3.7 compas compas_view2 then i run example v120_ui_elements2.py from compas_view2/scripts/

Traceback (most recent call last):
  File "c:/Users/Documents/Projects/compas_view2/scripts/v120_points.py", line 10, in <module>
    viewer.add(point, pointcolor=Color(random(), random(), random()), pointsize=30)
  File "C:\Users\.conda\envs\compas_view2\lib\site-packages\compas_view2\app\app.py", line 200, in add
    obj = Object.build(data, **kwargs)
  File "C:\Users\.conda\envs\compas_view2\lib\site-packages\compas_view2\objects\object.py", line 45, in build
    obj = DATA_OBJECT[data.__class__](data, **kwargs)
  File "C:\Users\.conda\envs\compas_view2\lib\site-packages\compas_view2\objects\pointobject.py", line 9, in __init__
    super().__init__(data, show_points=True, pointsize=size, **kwargs)
TypeError: __init__() got multiple values for keyword argument 'pointsize'

To Reproduce

it happens the following examples: v120_points.py , v120_ui_elements.pyand v120_ui_elements2.py from compas_view2/scripts/

nizartaha commented 2 years ago

after updating to compas_view2 version 0.5.0 this issue happen only in example v120_points.py when adding each pointseparately in the loop. however, it works if pointsize is set when adding the cloudto viewer.

viewer = App()
for i in range(10):
    point = Point(random()*10, random()*10, random()*10)
    viewer.add(point, pointcolor=Color(random(), random(), random()))

cloud = Pointcloud.from_bounds(5, 5, 5, 1000)
colors = {i: Color(random(), random(), random()) for i in range(1000)}
viewer.add(cloud, pointcolors=colors, pointsize=30)

viewer.show()
ZacZhangzhuo commented 11 months ago

This should be fixed in the latest version. You can try the example files to test.