Skip to content
Snippets Groups Projects
Commit d5219005 authored by Jingyan Ling's avatar Jingyan Ling
Browse files

add width option, diagnal helper cut, issue report

parent 59572213
Branches
No related merge requests found
Showing with 14093 additions and 1525 deletions
## ENGINEERING JOURNAL
### Jingyan Ling
###08/20/2019
- Add multiple cut to parallel traces, get outer and inner helper diagonal cut so the isolation will work well
- Making prototype cut from the output of software
- Issue reported:
- Footprint size and actual cut size not consistent
### 08/19/2019
- Remove the endpoint of a path if the last segment is inside the isolation box
......@@ -16,6 +23,11 @@
- Changed function does bi-sector in post-processing so it can fits the way we do `line to path` successfully
- Whole process and pipeline works well now
- Building high-level functions
- Edit `sesreader` again and add a filter that removes redundant points
- TODO:
- put new drawings on dxf version >=12
- so the width of drawing lines can be changed
- Isolation box and parallel traces requires multiple parallel cut, changing width makes drawing easier to see
### 08/16/2019
......
No preview for this file type
......@@ -57,5 +57,17 @@ def find_wire(file_path):
flag=True
merged_path_list.append(merged_path)
for path in merged_path_list:
if len(path)>=3:
path_cp=copy.deepcopy(path)
for i in range(len(path_cp)-2):
pt1=path_cp[i]
pt2=path_cp[i+1]
pt3=path_cp[i+2]
x1,x2,x3=pt1[0],pt2[0],pt3[0]
y1,y2,y3=pt1[1],pt2[1],pt3[1]
if x1==x2 and x2==x3:
path.remove(pt2)
elif y1==y2 and y2==y3:
path.remove(pt2)
return merged_path_list
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed.
This diff is collapsed.
......@@ -18,7 +18,7 @@ class pre_process():
self.savename='dwg_for_autorouter.dxf'
self.create_layer('Circuit_Cut',6)
self.create_layer('Circuit_Etc',1)
self.create_layer('Circuit_Etc',8)
self.keep_cut_layer_only()
self.line_to_path()
......@@ -131,7 +131,7 @@ class pre_process():
class post_process():
def __init__(self,dxf_file,wiring_path,pin_at):
def __init__(self,dxf_file,wiring_path,pin_at,trace_width,iso_size,cross_size):
print('wiring path loaded, generating final drawing...')
if not dxf_file.endswith('.dxf'):
dxf_file+='.dxf'
......@@ -142,19 +142,42 @@ class post_process():
self.dwg=ezdxf.readfile(dxf_file)
self.msp=self.dwg.modelspace()
self.connected_pins=[]
self.trace_width=trace_width #mm
self.iso_size=iso_size #mm
self.cross_cut_size=cross_size#mm
self.trace_cut_width=0.25 #mm
self.convert_unitfrom_ses()
# self.draw_wires()
self.trace_width=2
self.iso_size=2
self.cross_cut_size=1
self.parallel_trace(self.trace_width,self.iso_size)
self.draw_cross_cut(self.cross_cut_size)
self.draw_rest_iso(self.iso_size)
if not self.cross_cut_size==0:
self.draw_cross_cut(self.cross_cut_size)
if trace_width==0:
self.draw_wires()
if self.iso_size!=0:
self.draw_rest_iso(self.iso_size,self.trace_cut_width)
else:
if self.iso_size==0:
raise Exception ('Isolation box size is required as long as trace width is not equal to zero')
else:
self.draw_complete_traces()
self.draw_rest_iso(self.iso_size,self.trace_cut_width)
self.dwg.saveas('dwg_w_circuit.dxf')
print('drawing is ready for you to make a robot...')
def draw_complete_traces(self):
outer_helper=self.parallel_trace(self.trace_width,self.iso_size,'Circuit_Cut')
trace_width=self.trace_width-self.trace_cut_width
iso_size=self.iso_size-self.trace_cut_width
self.parallel_trace(trace_width,iso_size,'Circuit_Etc')
trace_width-=self.trace_cut_width
iso_size-=self.trace_cut_width
inner_helper=self.parallel_trace(trace_width,iso_size,'Circuit_Cut')
for i in range(len(outer_helper)):
self.msp.add_line(outer_helper[i],inner_helper[i],dxfattribs={
'layer':'Circuit_Cut',
'linetype':'DASHDOT'})
def convert_unitfrom_ses(self):
for path in self._wiring:
p=np.array(path)/unit_convert
......@@ -167,8 +190,10 @@ class post_process():
'layer':'Circuit_Etc',
'linetype':'DASHDOT'})
def parallel_trace(self,width,iso_size):
for path in self.wiring:
def parallel_trace(self,width,iso_size,draw_layer):
wiring=copy.deepcopy(self.wiring)
helper_cut_list=[]
for path in wiring:
constrain_s,constrain_e=True,True
if distance_between_pts(path[0],path[1])<(iso_size/2)*sqrt(2):
path.pop(0)
......@@ -196,22 +221,25 @@ class post_process():
bi=_bi[0]
if i==0:
s1,s2=self.find_iso_bry(pt1,pt2,iso_size,width,constrain_s)
s1,s2,helper_pt=self.find_iso_bry(pt1,pt2,iso_size,width,draw_layer,constrain_s)
offl1_in,offl1_out=find_offset(l1,width)
helper_cut_list.append(helper_pt)
offl2_in,offl2_out=find_offset(l2,width)
e1=find_intersect(offl1_in,bi)
e2=find_intersect(offl1_out,bi)
else:
if len(path)==2:
s1,s2=self.find_iso_bry(pt1,pt2,iso_size,width,constrain_s)
e1,e2=self.find_iso_bry(pt2,pt1,iso_size,width,constrain_e)
s1,s2,helper_pt=self.find_iso_bry(pt1,pt2,iso_size,width,draw_layer,constrain_s)
helper_cut_list.append(helper_pt)
e1,e2,helper_pt=self.find_iso_bry(pt2,pt1,iso_size,width,draw_layer,constrain_e)
helper_cut_list.append(helper_pt)
self.msp.add_line(s1,e1,dxfattribs={
'layer':'Circuit_Cut',
'layer':draw_layer,
'linetype':'DASHDOT'})
self.msp.add_line(s2,e2,dxfattribs={
'layer':'Circuit_Cut',
'layer':draw_layer,
'linetype':'DASHDOT'})
if i<len(path)-2:
if list(e1)==list(find_intersect(offl2_out,bi)):
......@@ -220,11 +248,11 @@ class post_process():
offl1_in,offl1_out=find_offset(l2,width)
s1=find_intersect(offl1_in,bi)
s2=find_intersect(offl1_out,bi)
return helper_cut_list
def draw_cross_cut(self,size):
for module_pin in self.pin_at:
cross_cut(self.msp,size,module_pin)
def find_iso_bry(self,contact_ept,further_ept,size,width,constrain=True):
def find_iso_bry(self,contact_ept,further_ept,size,width,draw_layer,constrain=True):
tolerance=(size/2)*sqrt(2)
for module_pin in self.pin_at:
for pin in module_pin:
......@@ -235,6 +263,13 @@ class post_process():
parallel_traces=find_offset(l,width)
four_l_points=isolation_box_linepts(size,pin)
iso_points=isolation_box_linepts(size,pin,False)
#diagnal eatching helper cut
dis=[]
for point in iso_points:
dis_=distance_between_pts(further_ept,point)
dis.append(dis_)
diag_helper_cut_pt=iso_points[np.argmax(dis)]
######
contact_list=[]
for pl in parallel_traces:
contact=find_contact_iso_trace(pl,four_l_points,further_ept,constrain)
......@@ -262,18 +297,36 @@ class post_process():
draw_list.append(draw_temp)
draw_list.append(contact_list[1])
for i in range(len(draw_list)-1):
self.msp.add_line(draw_list[i],draw_list[i+1],dxfattribs={'linetype':'DASHDOT', 'layer':'Circuit_Cut'})
self.msp.add_line(draw_list[i],draw_list[i+1],dxfattribs={'linetype':'DASHDOT', 'layer':draw_layer})
return contact_list[0],contact_list[1]
def draw_rest_iso(self,iso_size):
return contact_list[0],contact_list[1],diag_helper_cut_pt
def draw_rest_iso(self,iso_size,cut_width):
for module_pin in self.pin_at:
for pin in module_pin:
if not pin in self.connected_pins:
lines=isolation_box_linepts(iso_size,pin)
for l in lines:
self.msp.add_line(l[0],l[1],dxfattribs={'linetype':'DASHDOT', 'layer':'Circuit_Cut'})
outer_helper=[lines[0][1],lines[-1][-1]]
lines=isolation_box_linepts(iso_size-cut_width,pin)
for l in lines:
self.msp.add_line(l[0],l[1],dxfattribs={'linetype':'DASHDOT', 'layer':'Circuit_Etc'})
lines=isolation_box_linepts(iso_size,pin)
lines=isolation_box_linepts(iso_size-(cut_width*2),pin)
for l in lines:
self.msp.add_line(l[0],l[1],dxfattribs={'linetype':'DASHDOT', 'layer':'Circuit_Cut'})
inner_helper=[lines[0][1],lines[-1][-1]]
for i in range(len(outer_helper)):
self.msp.add_line(outer_helper[i],inner_helper[i],dxfattribs={
'layer':'Circuit_Cut',
'linetype':'DASHDOT'})
def find_contact_iso_trace(trace_line,iso_l_pts,further_ept,constrain=True):
inter_temp=[]
for l_pts in iso_l_pts:
......
......@@ -14,8 +14,8 @@ class read_old_paperbot():
self.create_layer('Cut',5)
self.create_layer('Fold',4)
# self.create_layer('Pin_temp',6)
# self.create_layer('Circuit_Cut',6)
# self.create_layer('Circuit_Etc',1)
self.create_layer('Circuit_Cut',6)
self.create_layer('Circuit_Etc',8)
self.layer_rearrange() ## reagrrange cut and fold lines to corresponding layers
self.remove_wheels() ##remove wheel drawings for this design, no need to call for other designs
......
#!/usr/bin/env python3
def roco_add_ee(me_drawing,netlist_csv,module_libpath,dsnwritier_dir):
def roco_add_ee(me_drawing,netlist_csv,module_libpath,dsnwritier_dir,
trace_width=2,iso_size=2,cross_size=0.66):
"""
This module call script 'roco_dsn.py' to generate a DSN file for auto_router.
An interface will pop up for the user to confirm wiring design,
......@@ -32,7 +33,7 @@ def roco_add_ee(me_drawing,netlist_csv,module_libpath,dsnwritier_dir):
ee_design=brd_design(ready_for_autorouter.bry_ind,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(me_drawing,wiring_path,ee_design.pins_at) # draw for fabrication
post_process(me_drawing,wiring_path,ee_design.pins_at,trace_width,iso_size,cross_size) # draw for fabrication
os.remove(ready_for_autorouter.savename)
os.remove(ee_design.savename+'.dsn')
......
......@@ -27,11 +27,11 @@ 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(ready_for_autorouter.bry_ind,module_libpath) #get paperbot_ee.dsn
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(old.savename)
os.remove(ready_for_autorouter.savename)
os.remove(ee_design.savename+'.dsn')
os.remove(ee_design.savename+'.ses')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment