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

update journal and coding for isolation box

parent 1df770c2
Branches
No related merge requests found
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
- Draw isolation boxes and connect one edge with parallel traces without causing open circuit (fail) - Draw isolation boxes and connect one edge with parallel traces without causing open circuit (fail)
- ![](journal_media/iso_trace_connect_fail.png) - ![](journal_media/iso_trace_connect_fail.png)
- TODO: - TODO:
- Connect traces to isoloation box - Connect traces to isolation box
- Merge pre-processing code - Merge pre-processing code
- Demo - Demo
......
No preview for this file type
No preview for this file type
This diff is collapsed.
...@@ -18,8 +18,8 @@ class brd_design(): ...@@ -18,8 +18,8 @@ class brd_design():
] ]
self.netlist=[ self.netlist=[
['3v3',['U1-3','J1-1']], ['3v3',['U1-3','J1-1']],
['VIN',['U1-1','J1-6','J1-4']], ['VIN',['U1-1']],
['NET1',['U1-2','J1-5','U1-4']] ['NET1',['U1-2','J1-5']]
] ]
self.netclass_list=[ self.netclass_list=[
['default',['3v3','VIN','NET1'],'',1000,200] ['default',['3v3','VIN','NET1'],'',1000,200]
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
(via_costs 50) (via_costs 50)
(plane_via_costs 5) (plane_via_costs 5)
(start_ripup_costs 100) (start_ripup_costs 100)
(start_pass_no 126) (start_pass_no 104)
(layer_rule F.Cu (layer_rule F.Cu
(active on) (active on)
(preferred_direction vertical) (preferred_direction vertical)
......
...@@ -37,7 +37,7 @@ class post_process(): ...@@ -37,7 +37,7 @@ class post_process():
# self.draw_wires() # self.draw_wires()
self.parallel_trace(1.5) self.parallel_trace(1.5)
self.draw_cross_cut(1) self.draw_cross_cut(1)
self.isolation_box_bry(1.5)
self.dwg.saveas('dwg_w_circuit.dxf') self.dwg.saveas('dwg_w_circuit.dxf')
print('drawing is ready for you to make a robot...') print('drawing is ready for you to make a robot...')
...@@ -55,132 +55,111 @@ class post_process(): ...@@ -55,132 +55,111 @@ class post_process():
'linetype':'DASHDOT'}) 'linetype':'DASHDOT'})
def parallel_trace(self,width): def parallel_trace(self,width):
for path in self.wiring: # for path in self.wiring:
for i in range(len(path)-1): path=self.wiring[0]
pt1=path[i][0],path[i][1] for i in range(len(path)-1):
pt2=path[i+1][0],path[i+1][1] pt1=path[i][0],path[i][1]
pt2=path[i+1][0],path[i+1][1]
l1=find_line_eq(pt1,pt2)
l1=find_line_eq(pt1,pt2)
if i<len(path)-2: #before last line
pt3=path[i+2][0],path[i+2][1] if i<len(path)-2: #before last line
l2=find_line_eq(pt2,pt3) pt3=path[i+2][0],path[i+2][1]
l2=find_line_eq(pt2,pt3)
#filter bi-sector
_bi=find_angle_bisector(l1,l2)
for sector in _bi:
if if_two_pt_on_diff_side(sector,pt1,pt3):
bi=sector
#filter bi-sector if i==0: # if the first point
_bi=find_angle_bisector(l1,l2) s1,s2=self.find_iso_bry(width,pt1,pt2)
for sector in _bi: offl1_in,offl1_out=find_offset(l1,width)
if if_two_pt_on_diff_side(sector,pt1,pt3): # if l1[2]==0:
bi=sector # s1=[pt1[0]-width/2,pt1[1]]
# s2=[pt1[0]+width/2,pt1[1]]
if i==0: # if the first point # else:
offl1_in,offl1_out=find_offset(l1,width) # s1=[pt1[0],offl1_in[0]*pt1[0]+offl1_in[1]]
if l1[2]==0: # s2=[pt1[0],offl1_out[0]*pt1[0]+offl1_out[1]]
s1=[pt1[0]-width/2,pt1[1]]
s2=[pt1[0]+width/2,pt1[1]]
else:
s1=[pt1[0],offl1_in[0]*pt1[0]+offl1_in[1]]
s2=[pt1[0],offl1_out[0]*pt1[0]+offl1_out[1]]
offl2_in,offl2_out=find_offset(l2,width)
e1=find_intersect(offl1_in,bi) offl2_in,offl2_out=find_offset(l2,width)
e2=find_intersect(offl1_out,bi)
else: e1=find_intersect(offl1_in,bi)
if l1[2]==0: e2=find_intersect(offl1_out,bi)
e1=[pt2[0]-width/2,pt2[1]] else:
e2=[pt2[0]+width/2,pt2[1]] e1,e2=self.find_iso_bry(width,pt2,pt1)
else: # if l1[2]==0:
e1=[pt2[0],offl1_in[0]*pt2[0]+offl1_in[1]] # e1=[pt2[0]-width/2,pt2[1]]
e2=[pt2[0],offl1_out[0]*pt2[0]+offl1_out[1]] # e2=[pt2[0]+width/2,pt2[1]]
# else:
# e1=[pt2[0],offl1_in[0]*pt2[0]+offl1_in[1]]
# e2=[pt2[0],offl1_out[0]*pt2[0]+offl1_out[1]]
self.msp.add_line(s1,e1,dxfattribs={ self.msp.add_line(s1,e1,dxfattribs={
'layer':'Circuit', 'layer':'Circuit',
'linetype':'DASHDOT'}) 'linetype':'DASHDOT'})
self.msp.add_line(s2,e2,dxfattribs={ self.msp.add_line(s2,e2,dxfattribs={
'layer':'Circuit', 'layer':'Circuit',
'linetype':'DASHDOT'}) 'linetype':'DASHDOT'})
if i<len(path)-2: if i<len(path)-2:
if list(e1)==list(find_intersect(offl2_out,bi)): if list(e1)==list(find_intersect(offl2_out,bi)):
offl1_out,offl1_in=find_offset(l2,width) offl1_out,offl1_in=find_offset(l2,width)
else: else:
offl1_in,offl1_out=find_offset(l2,width) offl1_in,offl1_out=find_offset(l2,width)
s1=find_intersect(offl1_in,bi) s1=find_intersect(offl1_in,bi)
s2=find_intersect(offl1_out,bi) s2=find_intersect(offl1_out,bi)
def draw_cross_cut(self,size): def draw_cross_cut(self,size):
for module_pin in self.pin_at: for module_pin in self.pin_at:
cross_cut(self.msp,size,module_pin) cross_cut(self.msp,size,module_pin)
def isolation_box_bry(self,size): def find_iso_bry(self,width,endpoint1,endpoint2):
tolerance=0.03 tolerance=0.05
for path in self.wiring: ept=endpoint1
endpoint=[path[0],path[-1]] l=find_line_eq(endpoint1,endpoint2)
for i in range(len(endpoint)): for module_pin in self.pin_at:
ept=endpoint[i] for pin in module_pin:
for module_pin in self.pin_at: if (sqrt((ept[0]-pin[0])**2+(ept[1]-pin[1])**2)) <= tolerance:
for pt in module_pin: #endpoint 1 is connect to such pin
flag=0 four_l_points=isolation_box_linepts(width,pin)
iso_pts=isolation_box_pts(size,pt) for line_pts in four_l_points:
if (sqrt((ept[0]-pt[0])**2+(ept[1]-pt[1])**2)) <= tolerance: pt1,pt2=line_pts[0],line_pts[1]
#such line is intersect with one of the edge of isolation box iso_line=find_line_eq(pt1,pt2)
if i==0: inter=find_intersect(iso_line,l)
l=find_line_eq(path[0],path[1]) if type(inter)!=type(None):
else: if inter[0]>= pt1[0] and inter[0]<=pt2[0] and inter[1]>=pt1[1] and inter[1] <=pt2[1]:
l=find_line_eq(path[-1],path[-2]) #such edge intersect with the path
draw_pt1=pt1
for j in range(len(iso_pts)): draw_pt2=pt2
draw=0 four_l_points.remove(line_pts)
if j==3: break
k=0 for line_pts in four_l_points:
else: k=j+1 p1,p2=line_pts[0],line_pts[1]
p1=iso_pts[j] self.msp.add_line(p1,p2,dxfattribs={'linetype':'DASHDOT', 'layer':'Cut'})
p2=iso_pts[k]
if p1[0]>p2[0]:
p1=iso_pts[k]
p2=iso_pts[j]
elif p1[0]==p2[0]:
if p1[1]>p2[1]:
p1=iso_pts[k]
p2=iso_pts[j]
if flag==0:
iso_line=find_line_eq(p1,p2)
inter=find_intersect(iso_line,l)
if type(inter)!=type(None):
if inter[0]>=p1[0] and inter[0]<=p2[0]:
if inter[1]>=p1[1] and inter[1]<=p2[1]:
flag=1
else: draw=1
else: draw=1
else: draw=1
else: draw=1
if draw==1:
self.msp.add_line(p1,p2,dxfattribs={'linetype':'DASHDOT', 'layer':'Cut'})
return draw_pt1,draw_pt2
def isolation_box_pts(box_size,pt): def isolation_box_linepts(box_size,pt):
""" """
box_size= lenght of isoloation box box_size= lenght of isoloation box
""" """
tipat=box_size/2 tipat=box_size/2
x=pt[0] x=pt[0]
y=pt[1] y=pt[1]
s1=(x-tipat,y-tipat) a=(x-tipat,y-tipat)
s2=(x-tipat,y+tipat) b=(x-tipat,y+tipat)
e1=(x+tipat,y+tipat) c=(x+tipat,y+tipat)
e2=(x+tipat,y-tipat) d=(x+tipat,y-tipat)
l1=[a,b]
return [s1,s2,e1,e2] l2=[b,c]
l3=[d,c]
l4=[a,d]
return [l1,l2,l3,l4]
def cross_cut(msp,cross_size,pin_loc): def cross_cut(msp,cross_size,pin_loc):
""" """
cross_size= lenght of bounding box of the cross cut cross_size= lenght of bounding box of the cross cut
......
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