kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #09843
Patch to fix pcbnew example scripts and SWIG interface
Hello,
I've been trying to explore the python scripting interface for pcbnew. I
see that some changes have been made to the pcbnew/class_module.h file,
such that GetReference() returns a wxString& and Reference() returns the
TEXTE_MODULE& itself.
To get the scripting examples to work again, I made a few small changes in
pcbnew/scripting/module.i :
=== modified file 'pcbnew/scripting/module.i'
--- pcbnew/scripting/module.i 2012-05-16 09:35:18 +0000
+++ pcbnew/scripting/module.i 2013-04-08 19:27:00 +0000
@@ -33,10 +33,10 @@
%pythoncode
{
- def GetPads(self): return self.m_Pads
- def GetDrawings(self): return self.m_Drawings
- def GetReferenceObj(self): return self.m_Reference
- def GetValueObj(self): return self.m_Value
+ def GetPads(self): return self.Pads()
+ def GetDrawings(self): return self.GraphicalItems()
+ def GetReferenceObj(self): return self.Reference()
+ def GetValueObj(self): return self.Value()
#def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self)
@@ -52,10 +52,10 @@
if type(itemC) is D_PAD:
item.thisown=0
- self.m_Pads.PushBack(itemC)
+ self.GetPads().PushBack(itemC)
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE,
DRAWSEGMENT,EDGE_MODULE]:
item.thisown = 0
- self.m_Drawings.PushBack(item)
+ self.GetDrawings().PushBack(item)
}
}
I also made some changes to two of the example scripts in
pcbnew/scripting/examples/ to work with these new functions instead of
accessing e.g. m_Reference directly (as that member is now Private).
Hopefully I have prepared the patch correctly and followed all coding
standards. Please let me know if I need to fix the patch in any way.
Thanks much,
Matthew Beckler
Wayne and Layne, LLC
Attachment:
mbeckler_patch_pcbnew_scripting_module_createPcb_createFPC40.py
Description: Binary data
Follow ups