From 1bb6d4e22c120c3ca869ee50c5f07c238ddb8ccc Mon Sep 17 00:00:00 2001 From: qu1ck Date: Mon, 27 Jul 2020 19:59:16 -0700 Subject: [PATCH] Fix pads python api compatibility * Add GetCustomShapeAsPolygon() to swig wrapper * Make shared_ptr usable for GetEffectivePolygon() Fixes #4999 --- common/swig/kicad.i | 4 ++++ pcbnew/swig/pad.i | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/common/swig/kicad.i b/common/swig/kicad.i index be4ee016b3..2508cfd6be 100644 --- a/common/swig/kicad.i +++ b/common/swig/kicad.i @@ -135,6 +135,10 @@ typedef long time_t; // KiCad plugin handling %include "kicadplugins.i" +%shared_ptr(SHAPE) +%shared_ptr(SHAPE_POLY_SET) +%shared_ptr(SHAPE_LINE_CHAIN) + #include %include diff --git a/pcbnew/swig/pad.i b/pcbnew/swig/pad.i index be8c7dda0c..492206fa94 100644 --- a/pcbnew/swig/pad.i +++ b/pcbnew/swig/pad.i @@ -41,5 +41,11 @@ return self.AddPrimitiveCurve(*args) else: raise TypeError("Arguments not recognized.") + + # GetCustomShapeAsPolygon() is the old accessor to get custom shapes + def GetCustomShapeAsPolygon(self): + polygon_set = SHAPE_POLY_SET() + self.MergePrimitivesAsPolygon(polygon_set) + return polygon_set %} }