今晚又做了一次认真和正式的实践
首先是kicad绘制成PDF后 PS以1200dpi打开为光栅图片
然后发现微软的3d build不够精细 对于一般的电路或许够用 但是这次我的电路有点细 仔细看发现方块不够方 圆焊盘不够圆 此外切片出来的精度也有点不太好 因此Python先写了两个程序 用于提取(展开)和生成(压缩).CWS文件中的特殊PNG图片(那是一种把灰度像素按顺序放在BGR(不是RGB大概是因为小端优先的原因)的特殊格式)
做成了bat方便点
----cwsexp.bat---
0<0# : ^
'''
@python %~f0 %*
@goto :eof
'''
from PIL import Image
import numpy
import sys
if len(sys.argv)<3 :
print('Expand Compressed image in CWS zipped file')
print('Usage: python',sys.argv[0],'<image file name> <output file name>')
print('Example: python',sys.argv[0],'a.png b.bmp')
exit(1)
img = numpy.array(Image.open(sys.argv[1]).convert('RGB'))
(h,w)=img.shape[0:2]
nw=w*3
print ('Original:', w, 'X', h, ' New:', nw, 'X', h)
img2=numpy.empty([h,nw,3], dtype=img.dtype)
for y in range(h):
for x in range(w):
img2[y,x*3,0]=img[y,x,2]
img2[y,x*3,1]=img[y,x,2]
img2[y,x*3,2]=img[y,x,2]
img2[y,x*3+1,0]=img[y,x,1]
img2[y,x*3+1,1]=img[y,x,1]
img2[y,x*3+1,2]=img[y,x,1]
img2[y,x*3+2,0]=img[y,x,0]
img2[y,x*3+2,1]=img[y,x,0]
img2[y,x*3+2,2]=img[y,x,0]
Image.fromarray(img2).save(sys.argv[2])
exit(0)
0<0# : ^
'''
@python %~f0 %*
@goto :eof
'''
from PIL import Image
import numpy
import sys
if len(sys.argv)<3 :
print('Compress normal image to fit CWS zipped file')
print('Usage: python',sys.argv[0],'<image file name> <output file name>')
print('Example: python',sys.argv[0],'a.jpg b.png')
exit(1)
img = numpy.array(Image.open(sys.argv[1]).convert('L'))
(h,w)=img.shape
nw=int((w+2)/3)
print ('Original:', w, 'X', h, ' New:', nw, 'X', h)
img2=numpy.empty([h,nw,3], dtype=img.dtype)
for y in range(h):
for x in range(nw):
img2[y,x,2]=img[y,x*3]
img2[y,x,1]=img[y,x*3+1] if x*3+1<w else 0
img2[y,x,0]=img[y,x*3+2] if x*3+2<w else 0
Image.fromarray(img2).save(sys.argv[2])
exit(0)