@@ -1074,6 +1074,10 @@ def rows_to_symbol(
10741074 # after the properties are added below.
10751075 unit_sexps = []
10761076
1077+ # Store the coords of the top-left corner for each unit so we can place the
1078+ # properties where they won't run into any of the different-sized units.
1079+ unit_top_left_corner = []
1080+
10771081 # Create the Sexp for each unit and add it to the symbol Sexp.
10781082 for unit_id , unit in units .items ():
10791083
@@ -1168,6 +1172,9 @@ def rows_to_symbol(
11681172 # Add the rectangle to the unit Sexp
11691173 unit_sexp .append (rect_sexp )
11701174
1175+ # Store the top-left corner of the unit for placing properties later.
1176+ unit_top_left_corner .append ((x0 , y1 ))
1177+
11711178 if debug :
11721179 # For debugging, show the boxes that contain the pins on each side.
11731180 lr_box = create_rectangle_outline (
@@ -1298,14 +1305,17 @@ def rows_to_symbol(
12981305
12991306 unit_sexps .append (unit_sexp )
13001307
1301- # Add completed set of properties to the symbol Sexp
1308+ # Add completed set of properties to the symbol Sexp at the top-left corner
1309+ # such that it doesn't overlap any of the different-sized units.
1310+ tl_x = min (unit_top_left_corner , key = lambda c : c [0 ])[0 ]
1311+ tl_y = max (unit_top_left_corner , key = lambda c : c [1 ])[1 ]
13021312 for name , [value , x_offset , y_offset , justify , hide ] in properties .items ():
13031313 symbol_sexp .append (
13041314 [
13051315 "property" ,
13061316 name ,
13071317 value ,
1308- ["at" , x0 + x_offset , y1 + y_offset , 0 ],
1318+ ["at" , tl_x + x_offset , tl_y + y_offset , 0 ],
13091319 [
13101320 "effects" ,
13111321 ["font" , ["size" , FONT_SIZE , FONT_SIZE ]],
0 commit comments