kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #15129
Re: Fix absence of PCB_TARGET class in python interface. was: Trying to
In response to a message written on 11.10.2014 20:28, from LordBlick:
> 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 ?
>
Always self-help is the fastest…
Please apply attached patch at the earliest opportunity…
Nick Østergaard, after that, you can panelize with pcb targets(mires) too ;)
--
Best Regards,
LordBlick
--- pcbnew/scripting/pcbnew.i.old 2014-10-11 12:29:01.000000000 +0200
+++ pcbnew/scripting/pcbnew.i 2014-10-11 21:43:10.640380605 +0200
@@ -93,6 +93,7 @@
#include <class_pad.h>
#include <pad_shapes.h>
#include <class_netinfo.h>
+ #include <class_mire.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <class_drawsegment.h>
@@ -129,6 +130,7 @@
%include <class_pad.h>
%include <pad_shapes.h>
%include <class_netinfo.h>
+%include <class_mire.h>
%include <class_pcb_text.h>
%include <class_dimension.h>
%include <class_drawsegment.h>
--- pcbnew/scripting/board_item.i.old 2014-10-11 12:29:01.000000000 +0200
+++ pcbnew/scripting/board_item.i 2014-10-11 22:14:23.420335733 +0200
@@ -37,6 +37,7 @@
%extend BOARD_ITEM
{
+ PCB_TARGET* Cast_to_PCB_TARGET() { return dynamic_cast<PCB_TARGET*>(self); }
TEXTE_PCB* Cast_to_TEXTE_PCB() { return dynamic_cast<TEXTE_PCB*>(self); }
DIMENSION* Cast_to_DIMENSION() { return dynamic_cast<DIMENSION*>(self); }
MODULE* Cast_to_MODULE() { return dynamic_cast<MODULE*>(self); }
@@ -47,8 +48,8 @@
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);}
%pythoncode
@@ -77,9 +78,12 @@
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:
+ print("Warning: Uncatched Cast() to %s" % ct)
return None
--- pcbnew/class_mire.h.old 2014-10-11 23:53:51.394626461 +0200
+++ pcbnew/class_mire.h 2014-10-11 23:57:14.451290771 +0200
@@ -89,6 +89,11 @@
*/
bool HitTest( const EDA_RECT& aRect, bool aContained = true, int aAccuracy = 0 ) const;
+ wxString GetClass() const
+ {
+ return wxT( "PCB_TARGET" );
+ }
+
// Virtual function
const EDA_RECT GetBoundingBox() const;
Follow ups
References