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
2a9b8df8
Commit
2a9b8df8
authored
Jul 15, 2012
by
Miguel Angel Ajo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for nanometer build, extra example
parent
974fe74f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
31 deletions
+50
-31
CMakeLists.txt
pcbnew/CMakeLists.txt
+7
-7
hidePcbValuesShowReferences.py
pcbnew/scripting/examples/hidePcbValuesShowReferences.py
+14
-0
units.i
pcbnew/scripting/units.i
+18
-18
kicad.i
scripting/kicad.i
+5
-1
python_scripting.cpp
scripting/python_scripting.cpp
+6
-5
No files found.
pcbnew/CMakeLists.txt
View file @
2a9b8df8
...
...
@@ -2,15 +2,12 @@ add_definitions(-DPCBNEW)
if
(
KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES
)
EXECUTE_PROCESS
(
COMMAND python2 -c
"import sys;print
\"
%s.%s
\"
%sys.version_info[0:2]"
OUTPUT_VARIABLE PYTHON_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET
(
PYTHON_DEST
"lib/python
${
PYTHON_VERSION
}
/dist-packages"
)
file
(
MAKE_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/scripting
)
FIND_PACKAGE
(
SWIG REQUIRED
)
INCLUDE
(
${
SWIG_USE_FILE
}
)
FIND_PACKAGE
(
PythonLibs
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_PATH
}
)
FIND_PACKAGE
(
SWIG REQUIRED
)
INCLUDE
(
${
SWIG_USE_FILE
}
)
FIND_PACKAGE
(
PythonLibs
)
INCLUDE_DIRECTORIES
(
${
PYTHON_INCLUDE_PATH
}
)
add_definitions
(
-DPCBNEW -DKICAD_SCRIPTING
)
endif
()
...
...
@@ -280,6 +277,9 @@ if (KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
if
(
USE_NEW_PCBNEW_LOAD OR USE_NEW_PCBNEW_SAVE
)
SET
(
SWIG_FLAGS
${
SWIG_FLAGS
}
-DBUILD_WITH_PLUGIN
)
endif
()
if
(
USE_PCBNEW_NANOMETRES
)
SET
(
SWIG_FLAGS
${
SWIG_FLAGS
}
-DUSE_PCBNEW_NANOMETRES
)
endif
()
endif
()
...
...
pcbnew/scripting/examples/hidePcbValuesShowReferences.py
0 → 100644
View file @
2a9b8df8
#!/usr/bin/env python
import
sys
from
pcbnew
import
*
filename
=
sys
.
argv
[
1
]
pcb
=
LoadBoard
(
filename
)
for
module
in
pcb
.
GetModules
():
print
"* Module:
%
s"
%
module
.
GetReference
()
module
.
GetValueObj
()
.
SetVisible
(
False
)
# set Value as Hidden
module
.
GetReferenceObj
()
.
SetVisible
(
True
)
# set Reference as Visible
pcb
.
Save
(
"mod_"
+
filename
)
\ No newline at end of file
pcbnew/scripting/units.i
View file @
2a9b8df8
...
...
@@ -34,42 +34,42 @@
{
def ToMM(iu):
if type(iu) in [int,float]:
return
iu * 0.00254
return
float(iu) / float(IU_PER_MM)
elif type(iu) in [wxPoint,wxSize]:
return tuple(map(ToMM,iu))
def FromMM(
iu
):
if type(
iu
) in [int,float]:
return i
u / 0.00254
elif type(
iu
) in [wxPoint,wxSize]:
return tuple(map(FromMM,
iu
))
def FromMM(
mm
):
if type(
mm
) in [int,float]:
return i
nt(float(mm) * float(IU_PER_MM))
elif type(
mm
) in [wxPoint,wxSize]:
return tuple(map(FromMM,
mm
))
def ToMils(iu):
if type(iu) in [int,float]:
return
iu / 10.0
return
float(iu) / float(IU_PER_MILS)
elif type(iu) in [wxPoint,wxSize]:
return tuple(map(ToMils,iu))
def FromMils(
iu
):
if type(
iu
) in [int,float]:
return i
u*10.0
elif type(
iu
) in [wxPoint,wxSize]:
return tuple(map(FromMils,
iu
))
def FromMils(
mils
):
if type(
mils
) in [int,float]:
return i
nt(float(mils)*float(IU_PER_MILS))
elif type(
mils
) in [wxPoint,wxSize]:
return tuple(map(FromMils,
mils
))
def SizeMM(mmx,mmy): return wxSize(FromMM(mmx),FromMM(mmy))
def SizeMils(mmx,mmy): return wxSize(FromMils(mmx),FromMils(mmy))
def
wx
SizeMM(mmx,mmy): return wxSize(FromMM(mmx),FromMM(mmy))
def
wx
SizeMils(mmx,mmy): return wxSize(FromMils(mmx),FromMils(mmy))
def PointMM(mmx,mmy): return wxPoint(FromMM(mmx),FromMM(mmy))
def PointMils(mmx,mmy): return wxPoint(FromMils(mmx),FromMils(mmy))
def
wx
PointMM(mmx,mmy): return wxPoint(FromMM(mmx),FromMM(mmy))
def
wx
PointMils(mmx,mmy): return wxPoint(FromMils(mmx),FromMils(mmy))
def RectMM(x,y,wx,wy):
def
wx
RectMM(x,y,wx,wy):
x = int(FromMM(x))
y = int(FromMM(y))
wx = int(FromMM(wx))
wy = int (FromMM(wy))
return wxRect(x,y,wx,wy)
def RectMils(x,y,wx,wy):
def
wx
RectMils(x,y,wx,wy):
x = int(FromMils(x))
y = int(FromMils(y))
wx = int(FromMils(wx))
...
...
scripting/kicad.i
View file @
2a9b8df8
...
...
@@ -68,7 +68,9 @@
#include <class_title_block.h>
#include <class_colors_design_settings.h>
#include <class_marker_base.h>
#include <eda_text.h>
#include <eda_text.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
%}
...
...
@@ -100,6 +102,8 @@
%include <class_colors_design_settings.h>
%include <class_marker_base.h>
%include <eda_text.h>
%include <convert_from_iu.h>
%include <convert_to_biu.h>
/* special iteration wrapper for DLIST objects */
%include "dlist.i"
...
...
scripting/python_scripting.cpp
View file @
2a9b8df8
...
...
@@ -68,14 +68,15 @@ static void swigAddBuiltin()
{
int
i
=
0
;
while
(
PyImport_Inittab
[
i
].
name
)
{
i
++
;
}
/* discover the length of the pyimport inittab */
while
(
PyImport_Inittab
[
i
].
name
)
i
++
;
/* allocate memory for the python module table */
SwigImportInittab
=
(
struct
_inittab
*
)
malloc
(
sizeof
(
struct
_inittab
)
*
(
i
+
EXTRA_PYTHON_MODULES
));
/* copy all pre-existing python modules into our newly created table */
i
=
0
;
while
(
PyImport_Inittab
[
i
].
name
)
{
swigAddModule
(
PyImport_Inittab
[
i
].
name
,
PyImport_Inittab
[
i
].
initfunc
);
...
...
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