compas-dev / compas_view2

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

Collection with Text doesn’t work in compas_view2 #164

Open ZacZhangzhuo opened 1 year ago

ZacZhangzhuo commented 1 year ago

COPY OF: https://forum.compas-framework.org/t/collection-with-text-doesnt-work-in-compas-view2/720

The below code works for me:

from compas_view2.shapes import Text
from compas_view2 import app
from compas_view2.objects import Collection

viewer = app.App()

t0 = Text("a", [0, 0, 0], height=50)
t1 = Text("123", [3, 0, 0], height=50)
t2 = Text("ABC", [3, 3, 0], height=100)

viewer.add(t0, color=(1, 0, 0))
viewer.add(t1)
viewer.add(t2)

viewer.show()

but using Collection doesn’t:

from compas_view2.shapes import Text
from compas_view2 import app
from compas_view2.objects import Collection

viewer = app.App()

t0 = Text("a", [0, 0, 0], height=50)
t1 = Text("123", [3, 0, 0], height=50)
t2 = Text("ABC", [3, 3, 0], height=100)

viewer.add(Collection([t0,t1,t2]))

viewer.show()

Thanks for any help and reply!

ZacZhangzhuo commented 10 months ago

Knowing that the Collection object only draws shapes with point, line or face. The sprite doesn't work. Need a discussion with @Licini for a solution.

Licini commented 10 months ago

The solution could be creating an TextCollection, then later we have a mechanism to automatically chose the right "Collection". Let's discuss this on our next meeting