How can I determine the type of a graphic element?

Hi,
I’m working on a plugin to create slots in the pcb starting from graphic elements (lines, arcs, etc…)
Basically to create a closed shape on the “Edge.Cuts” layer around a single line on another layer.
I’m stuck on figuring out what kind of graphic elemnt I’m parsing, I can’t discriminate between line, arc or whatever…

I’ve already tried using several functions, including ".GetFriendlyName() " but this returns a localized string that I can’t use properly.

what function can I use to discriminate the type of graphic element?

example:

for segment in board.GetDrawings():
    shapetype = segment.GetFriendlyName()
    wx.MessageBox('Tipo = %s ' %(shapetype) )

edit:
btw I use Kicad Version: 7.0.2, release build

I managed to find a solution using the “.GetShape()” function

for segment in board.GetDrawings():
    shapetype = segment.GetFriendlyName()
    shapetypeID =segment.GetShape()
    wx.MessageBox('Tipo = %s ' %(shapetype) + +' [%s]' %(shapetypeID) )

But i can’t find the definition of the return values, i just got them manually
“GetShape(EDA_SHAPE self) → SHAPE_T”

1 Like

shape.SHAPE_T_asString()

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.