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
97ccebf3
Commit
97ccebf3
authored
Apr 18, 2013
by
Matthew Beckler
Committed by
Miguel Angel Ajo
Apr 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes to scripting after refactoring & interface cleanups,
parent
c597e75b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
19 deletions
+14
-19
createFPC40.py
pcbnew/scripting/examples/createFPC40.py
+2
-2
createPcb.py
pcbnew/scripting/examples/createPcb.py
+3
-3
hidePcbValuesShowReferences.py
pcbnew/scripting/examples/hidePcbValuesShowReferences.py
+3
-3
listPcb.py
pcbnew/scripting/examples/listPcb.py
+2
-2
listPcbLibrary.py
pcbnew/scripting/examples/listPcbLibrary.py
+2
-2
module.i
pcbnew/scripting/module.i
+2
-7
No files found.
pcbnew/scripting/examples/createFPC40.py
View file @
97ccebf3
...
@@ -13,7 +13,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
...
@@ -13,7 +13,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb
# create a new module, it's parent is our previously created pcb
module
=
MODULE
(
pcb
)
module
=
MODULE
(
pcb
)
module
.
SetReference
(
"FPC"
+
str
(
pads
))
# give it a reference name
module
.
SetReference
(
"FPC"
+
str
(
pads
))
# give it a reference name
module
.
m_Reference
.
SetPos0
(
wxPointMM
(
-
1
,
-
1
))
module
.
Reference
()
.
SetPos0
(
wxPointMM
(
-
1
,
-
1
))
pcb
.
Add
(
module
)
# add it to our pcb
pcb
.
Add
(
module
)
# add it to our pcb
m_pos
=
wxPointMM
(
50
,
50
)
m_pos
=
wxPointMM
(
50
,
50
)
module
.
SetPosition
(
m_pos
)
module
.
SetPosition
(
m_pos
)
...
@@ -52,7 +52,7 @@ module.Add(e)
...
@@ -52,7 +52,7 @@ module.Add(e)
# save the PCB to disk
# save the PCB to disk
module
.
SetLibRef
(
"FPC"
+
str
(
pads
))
module
.
SetLibRef
(
"FPC"
+
str
(
pads
))
try
:
try
:
FootprintLibCreate
(
"fpc.mod"
)
FootprintLibCreate
(
"fpc
40
.mod"
)
except
:
except
:
pass
# we try to create, but may be it exists already
pass
# we try to create, but may be it exists already
FootprintSave
(
"fpc40.mod"
,
module
)
FootprintSave
(
"fpc40.mod"
,
module
)
...
...
pcbnew/scripting/examples/createPcb.py
View file @
97ccebf3
...
@@ -12,7 +12,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
...
@@ -12,7 +12,7 @@ pcb.m_NetClasses.GetDefault().SetClearance(FromMM(0.1))
# create a new module, it's parent is our previously created pcb
# create a new module, it's parent is our previously created pcb
module
=
MODULE
(
pcb
)
module
=
MODULE
(
pcb
)
module
.
SetReference
(
"M1"
)
# give it a reference name
module
.
SetReference
(
"M1"
)
# give it a reference name
module
.
m_Reference
.
SetPos0
(
wxPointMM
(
-
10
,
-
10
))
module
.
Reference
()
.
SetPos0
(
wxPointMM
(
-
10
,
-
10
))
pcb
.
Add
(
module
)
# add it to our pcb
pcb
.
Add
(
module
)
# add it to our pcb
m_pos
=
wxPointMM
(
50
,
50
)
m_pos
=
wxPointMM
(
50
,
50
)
module
.
SetPosition
(
m_pos
)
module
.
SetPosition
(
m_pos
)
...
@@ -41,8 +41,8 @@ pcb = LoadBoard("/tmp/my2.brd")
...
@@ -41,8 +41,8 @@ pcb = LoadBoard("/tmp/my2.brd")
print
map
(
lambda
x
:
x
.
GetReference
()
,
list
(
pcb
.
GetModules
()))
print
map
(
lambda
x
:
x
.
GetReference
()
,
list
(
pcb
.
GetModules
()))
for
m
in
pcb
.
GetModules
():
for
m
in
pcb
.
GetModules
():
for
p
in
m
.
Get
Pads
():
for
p
in
m
.
Pads
():
print
p
.
GetPadName
(),
p
.
GetPosition
(),
p
.
GetOffset
()
print
p
.
GetPadName
(),
p
.
GetPosition
(),
p
.
GetOffset
()
# pcb.GetDesignSettings()
# pcb.GetDesignSettings()
pcbnew/scripting/examples/hidePcbValuesShowReferences.py
View file @
97ccebf3
...
@@ -8,7 +8,7 @@ pcb = LoadBoard(filename)
...
@@ -8,7 +8,7 @@ pcb = LoadBoard(filename)
for
module
in
pcb
.
GetModules
():
for
module
in
pcb
.
GetModules
():
print
"* Module:
%
s"
%
module
.
GetReference
()
print
"* Module:
%
s"
%
module
.
GetReference
()
module
.
GetValueObj
()
.
SetVisible
(
False
)
# set Value as Hidden
module
.
Value
()
.
SetVisible
(
False
)
# set Value as Hidden
module
.
GetReferenceObj
()
.
SetVisible
(
True
)
# set Reference as Visible
module
.
Reference
()
.
SetVisible
(
True
)
# set Reference as Visible
pcb
.
Save
(
"mod_"
+
filename
)
pcb
.
Save
(
"mod_"
+
filename
)
pcbnew/scripting/examples/listPcb.py
View file @
97ccebf3
...
@@ -37,7 +37,7 @@ print "LISTING DRAWINGS:"
...
@@ -37,7 +37,7 @@ print "LISTING DRAWINGS:"
for
item
in
pcb
.
GetDrawings
():
for
item
in
pcb
.
GetDrawings
():
if
type
(
item
)
is
TEXTE_PCB
:
if
type
(
item
)
is
TEXTE_PCB
:
print
"* Text: '
%
s' at
%
s"
%
(
item
.
GetText
(),
item
.
GetPosition
())
print
"* Text: '
%
s' at
%
s"
%
(
item
.
GetText
(),
item
.
GetPosition
())
elif
type
(
item
)
is
DRAWSEGMENT
:
elif
type
(
item
)
is
DRAWSEGMENT
:
print
"* Drawing:
%
s"
%
item
.
GetShapeStr
()
# dir(item)
print
"* Drawing:
%
s"
%
item
.
GetShapeStr
()
# dir(item)
else
:
else
:
...
...
pcbnew/scripting/examples/listPcbLibrary.py
View file @
97ccebf3
...
@@ -4,6 +4,6 @@ lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod")
...
@@ -4,6 +4,6 @@ lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod")
for
name
in
lst
:
for
name
in
lst
:
m
=
FootprintLoad
(
"/usr/share/kicad/modules/sockets.mod"
,
name
)
m
=
FootprintLoad
(
"/usr/share/kicad/modules/sockets.mod"
,
name
)
print
name
,
"->"
,
m
.
GetLibRef
(),
m
.
GetReference
()
print
name
,
"->"
,
m
.
GetLibRef
(),
m
.
GetReference
()
for
p
in
m
.
Get
Pads
():
for
p
in
m
.
Pads
():
print
"
\t
"
,
p
.
GetPadName
(),
p
.
GetPosition
(),
p
.
GetPos0
(),
p
.
GetOffset
()
print
"
\t
"
,
p
.
GetPadName
(),
p
.
GetPosition
(),
p
.
GetPos0
(),
p
.
GetOffset
()
pcbnew/scripting/module.i
View file @
97ccebf3
...
@@ -33,11 +33,6 @@
...
@@ -33,11 +33,6 @@
%pythoncode
%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 SaveToLibrary(self,filename):
#def SaveToLibrary(self,filename):
# return SaveModuleToLibrary(filename,self)
# return SaveModuleToLibrary(filename,self)
...
@@ -52,10 +47,10 @@
...
@@ -52,10 +47,10 @@
if type(itemC) is D_PAD:
if type(itemC) is D_PAD:
item.thisown=0
item.thisown=0
self.
m_Pads
.PushBack(itemC)
self.
Pads()
.PushBack(itemC)
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]:
item.thisown = 0
item.thisown = 0
self.
m_Drawings
.PushBack(item)
self.
GraphicalItems()
.PushBack(item)
}
}
}
}
...
...
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