Skip to content

Commit

Permalink
[Draw Fancy Stackup][Changed] Micro vias drawing
Browse files Browse the repository at this point in the history
To look closer to real world, they only span 2 layers and they
must be stacked to span more layers.
  • Loading branch information
set-soft committed Dec 30, 2024
1 parent d0b3234 commit 90dffee
Show file tree
Hide file tree
Showing 4 changed files with 2,811 additions and 1,174 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Default temporal layer for internal use is now "Margin", instead of "User.9"
- Draw Fancy Stackup:
- Micro vias to look closer to real world, they only span 2 layers and they
must be stacked to span more layers.


## [1.8.2] - 2024-10-28
Expand Down
4 changes: 4 additions & 0 deletions docs/source/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ Changed

- Default temporal layer for internal use is now “Margin”, instead of
“User.9”
- Draw Fancy Stackup:

- Micro vias to look closer to real world, they only span 2 layers
and they must be stacked to span more layers.

[1.8.2] - 2024-10-28
--------------------
Expand Down
21 changes: 12 additions & 9 deletions kibot/pre_draw_fancy_stackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ def draw_normal_buried_via(g, x, y, w, h, tlayer, clearance, hole_size):


def draw_microvia(g, x, y, w, h, tlayer, clearance, via_w, hole_size, via_annular_w, copper_cnt, type):
layer_cnt = GS.board.GetCopperLayerCount()
if type == 'MT' and copper_cnt < layer_cnt/2:
GS.board.GetCopperLayerCount()
if type == 'MT':
left_points = []
left_points.append((int(x+clearance), y))
left_points.append((int(x+w/2-hole_size), y))
Expand All @@ -223,7 +223,7 @@ def draw_microvia(g, x, y, w, h, tlayer, clearance, via_w, hole_size, via_annula
right_filler.append((int(via_annular_w+x-w/2+via_w/4), y+h))
right_filler.append((int(via_annular_w+x), y+h))
draw_poly(g, right_filler, tlayer, filled=True)
elif type == 'MB' and copper_cnt > layer_cnt/2:
elif type == 'MB':
left_points = []
left_points.append((int(x+clearance), y+h))
left_points.append((int(x+w/2-hole_size), y+h))
Expand All @@ -246,7 +246,7 @@ def draw_microvia(g, x, y, w, h, tlayer, clearance, via_w, hole_size, via_annula
right_filler.append((int(via_annular_w+x-w/2+via_w/4), y))
right_filler.append((int(via_annular_w+x), y))
draw_poly(g, right_filler, tlayer, filled=True)
else:
else: # MS
draw_rect(g, int(x+clearance), y, int(w-2*clearance), h, tlayer, filled=True)


Expand Down Expand Up @@ -562,7 +562,7 @@ def update_drawing_group(g, pos_x, pos_y, width, tlayer, ops, gerber, via_layer_
offset = via_annular_w
draw_normal_buried_via(g, x+w-offset/2, int(layer.y + font_w/2), offset, font_w, tlayer, clearance,
via_hole_w)
elif draw == 'MT' or draw == 'MB': # micro-via
elif draw == 'MT' or draw == 'MB' or draw == 'MS': # micro-via
offset = via_annular_w
draw_microvia(g, x+w-offset/2, int(layer.y + font_w/2), offset, font_w, tlayer, clearance, via_w,
microvia_hole_w, via_annular_w, copper_cnt, draw)
Expand Down Expand Up @@ -598,8 +598,11 @@ def update_drawing_group(g, pos_x, pos_y, width, tlayer, ops, gerber, via_layer_
def create_stackup_matrix(stackup, via_layer_pairs, draw_vias):
mat = [] # This will hold the matrix (list of lists)
i = 0 # Track the current layer index
before_core = True

for _ in stackup:
for la in stackup:
if la.type == 'core':
before_core = False
# Create a row with empty strings (instead of zeros or numbers)
if draw_vias:
mat_row = [''] * (len(via_layer_pairs) * 2 + 1)
Expand All @@ -620,21 +623,21 @@ def create_stackup_matrix(stackup, via_layer_pairs, draw_vias):
if via_type in [VIATYPE_THROUGH, VIATYPE_BLIND_BURIED]:
mat_row[2 * j + 1] = 'T'
elif via_type == VIATYPE_MICROVIA:
mat_row[2 * j + 1] = 'MT'
mat_row[2 * j + 1] = 'MT' if before_core else 'MS'

elif i > via_top_layer and i < via_bottom_layer:
# Middle layer of the via
if via_type in [VIATYPE_THROUGH, VIATYPE_BLIND_BURIED]:
mat_row[2 * j + 1] = 'M'
elif via_type == VIATYPE_MICROVIA:
mat_row[2 * j + 1] = 'MM'
mat_row[2 * j + 1] = 'MM' if la.type != 'copper' else ('MT' if before_core else 'MB')

elif i == via_bottom_layer:
# Bottom layer of the via
if via_type in [VIATYPE_THROUGH, VIATYPE_BLIND_BURIED]:
mat_row[2 * j + 1] = 'B'
elif via_type == VIATYPE_MICROVIA:
mat_row[2 * j + 1] = 'MB'
mat_row[2 * j + 1] = 'MS' if before_core else 'MB'

# Move to the next layer in the stackup
i += 1
Expand Down
Loading

0 comments on commit 90dffee

Please sign in to comment.