pcbnew.ZONE_CONTAINER_DIAGONAL_EDGE

I’m converting some scripts over to kicad 5.1.5, and everything is working apart from drawing areas on the board.

This used to work,

newarea = self.brd.InsertArea(0, 0, layer, FromMM(x1), FromMM(y1), pcbnew.CPolyLine.DIAGONAL_EDGE)

but now I get a error because pcbnew no longer has CPolyLine.DIAGONAL_EDGE.

Looks from https://docs.kicad.org/doxygen-python/pcbnew_8py.html it might now be
pcbnew.ZONE_CONTAINER_DIAGONAL_EDGE. However this isn’t in my pcbnew python module.

Any ideas on how I can create rectangular areas on silkscreen without this?

Thanks,
Matt

After a frustrating couple of hours I have a version that works with kicad5.

The DIAGONAL_EDGE constant moved to the ZONE_CONTAINER class, and the AddFilledPolygon method changed name to SetFilledPolysList.

This is what is now needed to add a filled area to a board:

newarea = self.brd.InsertArea(0, 0, layer, FromMM(x1), FromMM(y1), pcbnew.ZONE_CONTAINER.DIAGONAL_EDGE)
poly_set = pcbnew.SHAPE_POLY_SET()
poly_set.NewOutline()
poly_set.Append(FromMM(x1),FromMM(y1))
poly_set.Append(FromMM(x2),FromMM(y1))
poly_set.Append(FromMM(x2),FromMM(y2))
poly_set.Append(FromMM(x1),FromMM(y2))
poly_set.Append(FromMM(x1),FromMM(y1))
newarea.SetFilledPolysList(poly_set)

Hope this helps someone!

1 Like

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