Skip to content

Commit

Permalink
Merge pull request #2198 from gdsfactory/add_bbox
Browse files Browse the repository at this point in the history
Add bbox
  • Loading branch information
joamatab committed Oct 19, 2023
2 parents 2c7dca9 + e1f937a commit 07fbd3f
Show file tree
Hide file tree
Showing 16 changed files with 144 additions and 20 deletions.
20 changes: 1 addition & 19 deletions Makefile
Expand Up @@ -65,9 +65,6 @@ release:
git push
git push origin --tags

lintdocs:
flake8 --select RST

autopep8:
autopep8 --in-place --aggressive --aggressive **/*.py

Expand All @@ -80,22 +77,7 @@ docs:
git-rm-merged:
git branch -D `git branch --merged | grep -v \* | xargs`

constructor:
conda install constructor -y
constructor conda

notebooks:
jupytext gdsfactory/samples/notebooks/*.md --to ipynb notebooks/

jupytext:
jupytext **/*.ipynb --to py

jupytext-clean:
jupytext docs/**/*.py --to py

notebooks:
# jupytext docs/notebooks/*.py --to ipynb
# jupytext docs/notebooks/*.ipynb --to to
jupytext --pipe black docs/notebooks/*.py
jupytext docs/notebooks/*.py --to ipynb

.PHONY: gdsdiff build conda gdslib docs doc
3 changes: 3 additions & 0 deletions gdsfactory/components/coupler_ring.py
Expand Up @@ -26,6 +26,7 @@ def coupler_ring(
cross_section: CrossSectionSpec = "xs_sc",
cross_section_bend: CrossSectionSpec | None = None,
length_extension: float = 3,
add_bbox: callable | None = None,
) -> Component:
r"""Coupler for ring.
Expand Down Expand Up @@ -103,6 +104,8 @@ def coupler_ring(
c.add_ports(cbl.get_ports_list(port_type="electrical"), prefix="cbl")
c.add_ports(cbr.get_ports_list(port_type="electrical"), prefix="cbr")
c.auto_rename_ports()
if add_bbox:
add_bbox(c)
xs.add_pins(c)
return c

Expand Down
6 changes: 5 additions & 1 deletion gdsfactory/components/ring_single.py
Expand Up @@ -15,6 +15,8 @@ def ring_single(
length_y: float = 0.6,
coupler_ring: ComponentFactory = coupler_ring_function,
bend: ComponentFactory = bend_euler,
bend_coupler: ComponentFactory | None = bend_euler,
straight: ComponentFactory = straight,
cross_section: CrossSectionSpec = "xs_sc",
**kwargs,
) -> gf.Component:
Expand Down Expand Up @@ -49,9 +51,11 @@ def ring_single(
radius = radius or xs.radius
cross_section = xs.copy(radius=radius, **kwargs)

bend_coupler = bend_coupler or bend

c = gf.Component()
cb = c << coupler_ring(
bend=bend,
bend=bend_coupler,
gap=gap,
radius=radius,
length_x=length_x,
Expand Down
3 changes: 3 additions & 0 deletions gdsfactory/components/straight.py
Expand Up @@ -14,6 +14,7 @@ def straight(
width: float | None = None,
add_pins: bool = True,
cross_section: CrossSectionSpec = "xs_sc",
add_bbox: callable | None = None,
) -> Component:
"""Returns a Straight waveguide.
Expand Down Expand Up @@ -41,6 +42,8 @@ def straight(
ref = c << path
c.add_ports(ref.ports)

if add_bbox:
add_bbox(c)
x.add_bbox(c, right=0, left=0)
if add_pins:
x.add_pins(c)
Expand Down
Expand Up @@ -63,13 +63,15 @@ settings:
width_wide: null
child: null
default:
add_bbox: null
add_pins: true
cross_section: xs_sc
layer: null
length: 10.0
npoints: 2
width: null
full:
add_bbox: null
add_pins: true
cross_section:
add_pins_function_module: gdsfactory.samples.pdk.fab_c
Expand Down

0 comments on commit 07fbd3f

Please sign in to comment.