asalzburger / sms2024-actsvg-dbv

0 stars 0 forks source link

Introduce coloured module display #3

Open asalzburger opened 1 week ago

asalzburger commented 1 week ago

Make sure the virtual python environment of #2 is activated.

import actsvg
from actsvg import core, examples, proto, display, style, io
# import polygons from the obj file
polygons = io.obj.read_polygons(['<source_area>/data/ITk_coupled_ring.obj'], ['<source_area>/data/ITk_coupled_ring.mtl'])

After this, we create drawable objects

 modules_xy = display.surfaces_as_oriented_polygons(polygons, 'xy')

Create a file and write it out:

m_xy_file = actsvg.io.file()
m_xy_file.add_objects(modules_xy)
m_xy_file.write("oriented_polygons_tests.svg")

Open the resulting SVG file, it should show a coupled ring of the upcoming ATLAS ITk detector with its individual modules:

Screenshot 2024-06-20 at 14 35 53
asalzburger commented 1 week ago

The SVG file is human readable and can be modified, inspect the file you will see polygons with unique IDs and individual colours, as a first task we would like to:

This can be done first by directly modifying the SVG file, the aim is, however, to generate the C++ code that can do this automatically.