Newer
Older
#!/usr/bin/env python3
"""
This module call script 'paperbot_dsn.py' to generate a DSN file
for auto_router. An interface will pop up for the user to confirm wiring design,
if a user does not want to change anything, one can just simply close the window.
Routing information will be stored automatically in the same directory.
The routing information will be read and draw the corresponding line on the dxf file
path information needed:
- dsnwritier(sesreader) dir
- modules library dir
- mechanical design drawing file
"""
dsnwritier_dir='/home/jingyan/Documents/summer_intern_lemur/roco_electrical/dsn_python'
module_libpath='/home/jingyan/Documents/summer_intern_lemur/roco_electrical/libraries/kicad-ESP8266/ESP8266.pretty/'
dwg_path='/home/jingyan/Documents/summer_intern_lemur/roco_electrical/graph-silhouette.dxf'
from roco_ee_dwg_processing import pre_process, post_process
from paperbot_dsn import *
from read_old_paperbot import *
old=read_old_paperbot(dwg_path) #get dwg_w_layer.dxf
ready_for_autorouter=pre_process(old.savename) #get dwg_for_autorouter.dxf
ee_design=brd_design(0,module_libpath,dwgfile='dwg_for_autorouter_temp.dxf') #get paperbot_ee.dsn
subprocess.call(['java','-jar','freeRouting.jar','-de',ee_design.savename+'.dsn','-white','-s'])
wiring_path=find_wire(ee_design.savename) #read ses file
post_process(old.savename,wiring_path,ee_design.pins_at) # draw for fabrication
os.remove(old.savename)
os.remove(ready_for_autorouter.savename)
os.remove(ee_design.savename+'.dsn')
os.remove(ee_design.savename+'.ses')