@@ -235,7 +235,7 @@ def _(
235235 gc = import_gds (gc_path , cellname = gc_cell , rename_duplicated_cells = True )
236236 add_ports_from_markers_center (gc , pin_layer = (1 , 10 ), port_layer = (1 , 0 ))
237237 auto_rename_ports_orientation (gc )
238- gc .remove_layers (layers = [(68 , 0 )], recursive = True )
238+ gc .remove_layers (layers = [(1 , 10 ), ( 68 , 0 )], recursive = True )
239239 gc .name = f"{ gc_cell } _gc"
240240
241241 mzi = gf .components .mzi (
@@ -366,7 +366,34 @@ def _(c, mo):
366366 mo .md ("No layout available yet." )
367367 )
368368
369- # PinRec markers are provided by the grating coupler cells.
369+ pin_layer = (1 , 10 )
370+ pin_w = 2.0
371+ pin_h = 1.0
372+ ports = c .ports
373+ port_list = list (ports .values ()) if hasattr (ports , "values" ) else list (ports )
374+ for port in port_list :
375+ cx , cy = port .center
376+ c .add_polygon (
377+ [
378+ (cx - pin_w / 2 , cy - pin_h / 2 ),
379+ (cx + pin_w / 2 , cy - pin_h / 2 ),
380+ (cx + pin_w / 2 , cy + pin_h / 2 ),
381+ (cx - pin_w / 2 , cy + pin_h / 2 ),
382+ ],
383+ layer = pin_layer ,
384+ )
385+ # Add a small Si stub so PinRec overlaps waveguide material for DRC.
386+ stub_w = max (float (getattr (port , "width" , 0.5 )), 0.5 )
387+ stub_l = 2.0
388+ c .add_polygon (
389+ [
390+ (cx - stub_l / 2 , cy - stub_w / 2 ),
391+ (cx + stub_l / 2 , cy - stub_w / 2 ),
392+ (cx + stub_l / 2 , cy + stub_w / 2 ),
393+ (cx - stub_l / 2 , cy + stub_w / 2 ),
394+ ],
395+ layer = (1 , 0 ),
396+ )
370397
371398 layout_bbox = c .bbox () if callable (getattr (c , "bbox" , None )) else c .bbox
372399 if hasattr (layout_bbox , "left" ):
0 commit comments