Add new bbox routine for pin enclosures

This commit is contained in:
Matt Guthaus 2018-11-19 09:28:29 -08:00
parent 4630f52de2
commit 6a7d721562
2 changed files with 25 additions and 4 deletions

View File

@ -62,6 +62,26 @@ class pin_layout:
else:
return False
def bbox(self, pin_list):
"""
Given a list of layout pins, create a bounding box layout.
"""
(ll, ur) = self.rect
min_x = ll.x
max_x = ur.x
min_y = ll.y
max_y = ur.y
filtered_list = [x for x in pin_list if x != None]
debug.check(len(filtered_list)>0,"Cannot find bbox of empty list.")
for pin in filtered_list:
min_x = min(min_x, pin.ll().x)
max_x = max(max_x, pin.ur().x)
min_y = min(min_y, pin.ll().y)
max_y = max(max_y, pin.ur().y)
self.rect = [vector(min_x,min_y),vector(max_x,max_y)]
def inflate(self, spacing=None):
"""
Inflate the rectangle by the spacing (or other rule)

View File

@ -464,14 +464,15 @@ class pin_group:
# If it is contained, it won't need a connector
if pin.contained_by_any(self.enclosures):
continue
left_connector = self.find_left_connector(pin, self.enclosures)
right_connector = self.find_right_connector(pin, self.enclosures)
above_connector = self.find_above_connector(pin, self.enclosures)
below_connector = self.find_below_connector(pin, self.enclosures)
for connector in [left_connector, right_connector, above_connector, below_connector]:
if connector:
self.enclosures.append(connector)
import copy
bbox_connector = copy.copy(pin)
bbox_connector.bbox([left_connector, right_connector, above_connector, below_connector])
self.enclosures.append(bbox_connector)
# Now, make sure each pin touches an enclosure. If not, add a connector.
# This could only happen when there was no enclosure in any cardinal direction from a pin