Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
5157657e
Commit
5157657e
authored
Apr 22, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merged to last testing, also added automatic file extension detection on save/load
parent
aef92a34
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
35 deletions
+25
-35
class_module.h
pcbnew/class_module.h
+0
-2
class_netclass.h
pcbnew/class_netclass.h
+0
-7
board.i
pcbnew/scripting/board.i
+7
-4
createPcb.py
pcbnew/scripting/examples/createPcb.py
+2
-2
pcbnew.i
pcbnew/scripting/pcbnew.i
+6
-8
pcbnew_scripting_helpers.cpp
pcbnew/scripting/pcbnew_scripting_helpers.cpp
+10
-12
No files found.
pcbnew/class_module.h
View file @
5157657e
...
@@ -235,8 +235,6 @@ public:
...
@@ -235,8 +235,6 @@ public:
*/
*/
bool
Read_GPCB_Descr
(
const
wxString
&
CmpFullFileName
);
bool
Read_GPCB_Descr
(
const
wxString
&
CmpFullFileName
);
int
Read_3D_Descr
(
LINE_READER
*
aReader
);
/* drawing functions */
/* drawing functions */
void
Draw
(
EDA_DRAW_PANEL
*
aPanel
,
void
Draw
(
EDA_DRAW_PANEL
*
aPanel
,
...
...
pcbnew/class_netclass.h
View file @
5157657e
...
@@ -294,13 +294,6 @@ public:
...
@@ -294,13 +294,6 @@ public:
*/
*/
NETCLASS
*
Find
(
const
wxString
&
aName
)
const
;
NETCLASS
*
Find
(
const
wxString
&
aName
)
const
;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
;
};
};
#endif // CLASS_NETCLASS_H
#endif // CLASS_NETCLASS_H
pcbnew/scripting/board.i
View file @
5157657e
...
@@ -45,8 +45,11 @@
...
@@ -45,8 +45,11 @@
def Save(self,filename,format = None):
def Save(self,filename,format = None):
if format is None:
if format is None:
return SaveBoard(filename,self)
str_filename = str(filename)
else:
if str_filename.endswith(".brd"):
format = IO_MGR.LEGACY
if str_filename.endswith(".kicad_brd"):
format = IO_MGR.KICAD
return SaveBoard(filename,self,format)
return SaveBoard(filename,self,format)
#
#
...
...
pcbnew/scripting/examples/createPcb.py
View file @
5157657e
...
@@ -34,9 +34,9 @@ for y in range (0,10):
...
@@ -34,9 +34,9 @@ for y in range (0,10):
# save the PCB to disk
# save the PCB to disk
pcb
.
Save
(
"/tmp/my2.kicad_brd"
)
pcb
.
Save
(
"/tmp/my2.kicad_brd"
)
pcb
.
Save
(
"/tmp/my2.brd"
,
IO_MGR
.
LEGACY
)
pcb
.
Save
(
"/tmp/my2.brd"
)
pcb
=
LoadBoard
(
"/tmp/my2.brd"
,
IO_MGR
.
LEGACY
)
pcb
=
LoadBoard
(
"/tmp/my2.brd"
)
print
map
(
lambda
x
:
x
.
GetReference
()
,
list
(
pcb
.
GetModules
()))
print
map
(
lambda
x
:
x
.
GetReference
()
,
list
(
pcb
.
GetModules
()))
...
...
pcbnew/scripting/pcbnew.i
View file @
5157657e
...
@@ -73,12 +73,11 @@
...
@@ -73,12 +73,11 @@
BOARD *GetBoard(); /* get current editor board */
BOARD *GetBoard(); /* get current editor board */
%}
%}
#ifdef BUILD_WITH_PLUGIN
%{
%{
#include <io_mgr.h>
#include <io_mgr.h>
#include <kicad_plugin.h>
#include <kicad_plugin.h>
%}
%}
#endif
%include <class_board_item.h>
%include <class_board_item.h>
%include <class_board_connected_item.h>
%include <class_board_connected_item.h>
...
@@ -104,15 +103,14 @@
...
@@ -104,15 +103,14 @@
%include <pcbnew_scripting_helpers.h>
%include <pcbnew_scripting_helpers.h>
#ifdef BUILD_WITH_PLUGIN
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%include <kicad_plugin.h>
#endif
// ignore RELEASER as nested classes are still unsupported by swig
%ignore IO_MGR::RELEASER;
%include <io_mgr.h>
%include <kicad_plugin.h>
%include "board.i"
%include "board.i"
%include "module.i"
%include "module.i"
%include "units.i"
%include "units.i"
pcbnew/scripting/pcbnew_scripting_helpers.cpp
View file @
5157657e
...
@@ -54,13 +54,20 @@ void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame)
...
@@ -54,13 +54,20 @@ void ScriptingSetPcbEditFrame(PCB_EDIT_FRAME *aPCBEdaFrame)
BOARD
*
LoadBoard
(
wxString
&
aFileName
)
BOARD
*
LoadBoard
(
wxString
&
aFileName
)
{
{
if
(
aFileName
.
EndsWith
(
wxT
(
".kicad_brd"
)))
return
LoadBoard
(
aFileName
,
IO_MGR
::
KICAD
);
return
LoadBoard
(
aFileName
,
IO_MGR
::
KICAD
);
else
if
(
aFileName
.
EndsWith
(
wxT
(
".brd"
)))
return
LoadBoard
(
aFileName
,
IO_MGR
::
LEGACY
);
// as fall back for any other kind use the legacy format
return
LoadBoard
(
aFileName
,
IO_MGR
::
LEGACY
);
}
}
BOARD
*
LoadBoard
(
wxString
&
aFileName
,
IO_MGR
::
PCB_FILE_T
aFormat
)
BOARD
*
LoadBoard
(
wxString
&
aFileName
,
IO_MGR
::
PCB_FILE_T
aFormat
)
{
{
static
char
ExceptionError
[
256
];
static
char
ExceptionError
[
256
];
#ifdef USE_NEW_PCBNEW_LOAD
try
{
try
{
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
return
IO_MGR
::
Load
(
aFormat
,
aFileName
);
}
catch
(
IO_ERROR
e
)
}
catch
(
IO_ERROR
e
)
...
@@ -69,10 +76,7 @@ BOARD* LoadBoard(wxString& aFileName,IO_MGR::PCB_FILE_T aFormat)
...
@@ -69,10 +76,7 @@ BOARD* LoadBoard(wxString& aFileName,IO_MGR::PCB_FILE_T aFormat)
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
PyErr_SetString
(
PyExc_IOError
,
ExceptionError
);
return
NULL
;
return
NULL
;
}
}
#else
fprintf
(
stderr
,
"Warning, LoadBoard not implemented without USE_NEW_PCBNEW_LOAD
\n
"
);
return
NULL
;
#endif
}
}
bool
SaveBoard
(
wxString
&
aFilename
,
BOARD
*
aBoard
)
bool
SaveBoard
(
wxString
&
aFilename
,
BOARD
*
aBoard
)
...
@@ -84,7 +88,6 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
...
@@ -84,7 +88,6 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
IO_MGR
::
PCB_FILE_T
aFormat
)
IO_MGR
::
PCB_FILE_T
aFormat
)
{
{
static
char
ExceptionError
[
256
];
static
char
ExceptionError
[
256
];
#ifdef USE_NEW_PCBNEW_LOAD
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
m_Status_Pcb
&=
~
CONNEXION_OK
;
aBoard
->
SynchronizeNetsAndNetClasses
();
aBoard
->
SynchronizeNetsAndNetClasses
();
aBoard
->
SetCurrentNetClass
(
aBoard
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
aBoard
->
SetCurrentNetClass
(
aBoard
->
m_NetClasses
.
GetDefault
()
->
GetName
()
);
...
@@ -115,11 +118,6 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
...
@@ -115,11 +118,6 @@ bool SaveBoard(wxString& aFileName, BOARD* aBoard,
return
false
;
return
false
;
}
}
#else
fprintf
(
stderr
,
"Warning, SaveBoard not implemented without USE_NEW_PCBNEW_LOAD
\n
"
);
return
false
;
#endif
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment