python- Grease Pencil selection?

I need to step thru the vertices that are selected.

I imagine its down this path although I expect to need to see “selected” and “selection_count” ??

gp.layers.active.select. ??

Thank you

I think I found my solution…

if is step thru the vertices, (i don’t have an efficient way to show you)

this attribute shows weather or not the vertex is selected…
gp.layers.active.active_frame.strokes[y].points[x].select

2 questions now-

  • Is there an attribute to show a pointCount for each gpencil stroke?
  • How do I mark this thread “[solved]”. (like I see in some entries)

Thank you

Here’s an example that iterates over the scene’s GP layers and prints all strokes and their points and if they are selected:

import bpy

scene = bpy.context.scene
for gp_layer in scene.grease_pencil.layers:
    print(gp_layer.info)
    for frame in gp_layer.frames:
        print("  Frame {}".format(frame.frame_number))
        for i, stroke in enumerate(frame.strokes):
            print("    Stroke {}{}".format(i, " - selected" if stroke.select else ""))
            for j, point in enumerate(stroke.points):
                print("      Point {}{}".format(j, " - selected" if point.select else ""))

Thank you so much

How do I mark this thread “[solved]”? (like I see in some entries)