How does one achieve this?
I noticed that @mondalaci mentioned an option
The current SMD vs PTH vs virtual properties seem entirely sufficient given that the “include PTH components to .POS file” option is in place.
over on launchpad:
Allow to export the positions of through-hole components
Our contract manufacturer has recently asked me to provide a file containing the positions of every SMD and PTH component.
Normally, only the positions of SMD components are needed for pick and place machines, but this time they're about program...
However, I cannot find this option in 4.0.7 nor in the most recent nightly Windows build (as of March 19, 2017).
bobc
March 20, 2018, 8:11am
2
There is no option, the user meant IF there was an option on export (which is his proposed fix), then it would be sufficient. It seems like a reasonable proposal, but when a developer doesn’t want to do something they make up excuses
I would suggest a script, there may be one already.
pedro
March 20, 2018, 8:29am
3
There is a workaround
In the footprint properties window, under placement type select surfface mount for all your throug-hole components.
Then generate the .pos file
Drawback: the .pos file will have all the components, th and smd, mixed ordered by reference.
Oops. I missed the fact that it was his proposal. Thanks for setting me straight.
I do have some experience with scripting Kicad but what did you have in mind here? Iterating through board.GetModules() and generating the POS file myself?
bobc
March 20, 2018, 8:53am
5
Yes, I think it should be straightforward.
maui
March 20, 2018, 9:17am
6
You can simply produce the SMD POS file and then the the POS file forcing INSERT for all footprint (export menu option).
Then just compare the two files… the diff are the TH POS
(EDIT you may also find the virtual in the diff)
bobc
March 20, 2018, 9:22am
7
Here is a script that seems to reproduce the KiCad pos export
import sys
import pcbnew
import datetime
"""
execfile ("c:/python_progs/test_pcb/get_pos.py")
"""
def pcbfunc(Filename = None):
if Filename:
my_board = pcbnew.LoadBoard (Filename)
else:
my_board = pcbnew.GetBoard()
print ("### Module positions - created on %s ###" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
print ("### Printed by get_pos v1")
print ("## Unit = mm, Angle = deg.")
print ("## Side : All")
print ("# Ref Val Package PosX PosY Rot Side")
for module in my_board.GetModules():
print ("%s \"%s\" %s %1.3f %1.3f %1.3f %s" % ( module.GetReference(),
module.GetValue(),
module.GetFPID().GetFootprintName(),
pcbnew.ToMM(module.GetPosition().x),
pcbnew.ToMM(module.GetPosition().y),
module.GetOrientation(),
"top" if module.GetLayer() == 0 else "bottom"
))
print ("## End")
# pcbfunc("C:\\git_bobc\\bobc_hardware_live\\Smart_RGB_LED_AT85\\rgb_led.kicad_pcb")
pcbfunc()
Sample output
execfile ("c:/python_progs/test_pcb/get_pos.py")
### Module positions - created on 2018-03-20 09:20 ###
### Printed by get_pos v1
## Unit = mm, Angle = deg.
## Side : All
# Ref Val Package PosX PosY Rot Side
J1 "CONN_01X01" Pin_Header_Angled_1x01_Pitch1.27mm 130.000 125.000 0.000 top
J2 "CONN_01X01" Pin_Header_Angled_1x01_Pitch1.27mm 130.000 115.000 0.000 top
J3 "External supply" Pin_Header_Angled_1x02_Pitch2.54mm 130.000 90.000 0.000 top
J4 "CONN_01X01" Pin_Header_Angled_1x01_Pitch2.54mm 130.000 105.000 0.000 top
J5 "CONN_01X01" Pin_Header_Angled_1x01_Pitch2.54mm 130.000 80.000 0.000 top
J6 "External regulated power" Pin_Header_Straight_1x02_Pitch2.54mm 70.000 90.000 0.000 top
U4 "7805" SOT-23 97.500 80.000 0.000 top
U5 "74AHC1G04" SOT-223 75.000 115.000 0.000 top
U6 "74AHC1G04" SOT-223 113.000 105.000 0.000 top
U7 "74AHC1G04" SOT-223 85.000 132.321 3300.000 top
U8 "74AHC1G04" SOT-223 112.000 80.500 0.000 top
U9 "74AHC1G04" SOT-223 113.000 93.000 0.000 top
U10 "74AHC1G04" SOT-223 97.500 93.000 0.000 top
## End
Writing to a file is standard Python, so exercise left to reader
My POS file generation dialog looks like this:
There is no “forcing INSERT for all footprint” option AFAIK?
Thank you very much! This is perfect.
I must be misunderstanding something in your suggestion because this will not include the TH components?
maui
March 20, 2018, 10:35am
12
try it and compare the files
I did but there was no difference. Both files include only SMD parts and are exactly the same.
maui
March 20, 2018, 10:49am
14
you are right, I remember once it did the trick on nightly, but now it doesn’t anymore
Darn! I guess that means at some point the developers did consider making the change but then put it back.
bobc
March 20, 2018, 11:11am
16
No, it has never been an option, that code hasn’t changed much for years. The option for “Force INSERT” was a workaround for a lot of SMD library footprints that did not have Insert attribute set, but were actually SMD footprints.
Btw, module.GetAtttributes() returns an int which gives the type, PTH=0, SMD=1, virtual = 2.
maui
March 20, 2018, 11:24am
17
it seems that
module.GetFPID().GetFootprintName()
doesn’t work anymore on nightlies
bobc
March 20, 2018, 11:29am
18
Yes, it’s changed to GetLibItemName() instead of GetFootprintName().
bobc:
Btw, module.GetAtttributes() returns an int which gives the type, PTH=0, SMD=1, virtual = 2.
This is useful to know. Thanks!
maui
March 20, 2018, 12:21pm
20
you may find also useful this
print ("Board Aux Origin: " + str(my_board.GetAuxOrigin()))