← Back to team overview

kicad-developers team mailing list archive

[PATCH] export SHAPE_POLY_SET to pcbnew python

 

The recent refactoring work moving from cpolyline to shapepolyset means
that we need to expose shape poly set to the python interface. this patch
adds it and restores the ability to modify zones from scripts.

Note that unfracture does not have an implementation but swig tries to wrap
it, since it was in the header file. link error ensues. I've removed it
from the header. easy enough to put it back once it's implemented.


Miles
From 60bbd3ebc0fc688e70bab3736b5cba61f6dca69f Mon Sep 17 00:00:00 2001
From: Miles McCoo <mail@xxxxxxxxxx>
Date: Fri, 14 Apr 2017 14:11:24 +0200
Subject: [PATCH 2/2] Minor Pcbnew Python scripting fix to expose
 SHAPE_POLY_SET interface
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.7.4"

This is a multi-part message in MIME format.
--------------2.7.4
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


The recent refactoring work to move zones from CPolyLine to SHAPE_POLY_SET resulted in a reduction in pcbnew's python capabilities.
This change exposed SHAPE_POLY_SET to restore that functionality (albeit with slightly different method names)
---
 common/swig/kicad.i               | 5 ++++-
 include/geometry/shape_poly_set.h | 3 ---
 2 files changed, 4 insertions(+), 4 deletions(-)


--------------2.7.4
Content-Type: text/x-patch; name="0002-Minor-Pcbnew-Python-scripting-fix-to-expose-SHAPE_PO.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-Minor-Pcbnew-Python-scripting-fix-to-expose-SHAPE_PO.patch"

diff --git a/common/swig/kicad.i b/common/swig/kicad.i
index 1ce87c7..f0a03da 100644
--- a/common/swig/kicad.i
+++ b/common/swig/kicad.i
@@ -2,7 +2,7 @@
  * This program source code file is part of KiCad, a free EDA CAD application.
  *
  * Copyright (C) 2012 NBEE Embedded Systems, Miguel Angel Ajo <miguelangel@xxxxxxx>
- * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
+ * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -130,6 +130,9 @@ principle should be easily implemented by adapting the current STL containers.
 #include <../polygon/PolyLine.h>
 %include <../polygon/PolyLine.h>
 
+#include <geometry/shape_poly_set.h>
+%include <geometry/shape_poly_set.h>
+
 // ignore warning relative to operator = and operator ++:
 #pragma SWIG nowarn=362,383
 
diff --git a/include/geometry/shape_poly_set.h b/include/geometry/shape_poly_set.h
index efdd91e..5e90c61 100644
--- a/include/geometry/shape_poly_set.h
+++ b/include/geometry/shape_poly_set.h
@@ -760,9 +760,6 @@ class SHAPE_POLY_SET : public SHAPE
         ///> For aFastMode meaning, see function booleanOp
         void Fracture( POLYGON_MODE aFastMode );
 
-        ///> Converts a set of slitted polygons to a set of polygons with holes
-        void Unfracture();
-
         ///> Returns true if the polygon set has any holes.
         bool HasHoles() const;
 

--------------2.7.4--



Follow ups