← Back to team overview

kicad-developers team mailing list archive

Trying to fix absence of PCB_TARGET class in python interface

 

I've tried as in subject, applied attached patch, but success is half. I've got
required class, but pcb enumeration method pcb.GetDrawings() still returns None.
https://bugs.launchpad.net/kicad/+bug/1380096
Are here someone™, who can help ?
-- 
Best Regards,
LordBlick
--- pcbnew/scripting/pcbnew.i.old	2014-10-11 19:19:25.286082190 +0200
+++ pcbnew/scripting/pcbnew.i	2014-10-11 19:24:56.596078344 +0200
@@ -97,6 +97,7 @@
   #include <class_dimension.h>
   #include <class_drawsegment.h>
   #include <class_marker_pcb.h>
+  #include <class_mire.h>
   #include <class_text_mod.h>
   #include <class_edge_mod.h>
   #include <dlist.h>
@@ -133,6 +134,7 @@
 %include <class_dimension.h>
 %include <class_drawsegment.h>
 %include <class_marker_pcb.h>
+%include <class_mire.h>
 %include <class_text_mod.h>
 %include <class_edge_mod.h>
 %include <dlist.h>
--- pcbnew/scripting/board_item.i.old	2014-10-11 19:20:44.436081271 +0200
+++ pcbnew/scripting/board_item.i	2014-10-11 19:24:53.786078377 +0200
@@ -47,8 +47,9 @@
     EDGE_MODULE*      Cast_to_EDGE_MODULE()       {  return dynamic_cast<EDGE_MODULE*>(self);   }
     D_PAD*            Cast_to_D_PAD()             {  return dynamic_cast<D_PAD*>(self);         }
     TRACK*            Cast_to_TRACK()             {  return dynamic_cast<TRACK*>(self);         }
-    ZONE_CONTAINER*   Cast_to_ZONE_CONTAINER()    {  return dynamic_cast<ZONE_CONTAINER*>(self);}
     VIA*              Cast_to_VIA()               {  return dynamic_cast<VIA*>(self);           }
+    ZONE_CONTAINER*   Cast_to_ZONE_CONTAINER()    {  return dynamic_cast<ZONE_CONTAINER*>(self);}
+    PCB_TARGET*       Cast_to_PCB_TARGET()        {  return dynamic_cast<PCB_TARGET*>(self);    }
 
 
     %pythoncode
@@ -77,6 +78,8 @@
             return self.Cast_to_VIA()
         elif ct=="TRACK":
             return self.Cast_to_TRACK()
+        elif ct=="PCB_TARGET":
+            return self.Cast_to_PCB_TARGET()
         elif ct=="ZONE_CONTAINER":
             return self.Cast_to_ZONE_CONTAINER()
         else:

Follow ups