Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirroring cross-sections #1049

Closed
simbilod opened this issue Dec 28, 2022 · 3 comments
Closed

Mirroring cross-sections #1049

simbilod opened this issue Dec 28, 2022 · 3 comments
Labels
enhancement New feature or request no-issue-activity

Comments

@simbilod
Copy link
Collaborator

simbilod commented Dec 28, 2022

In #1048 I added an argument to flip the offsets of all sections in the pn cross-section

What would be the best place to add such a feature to generic cross-sections? Say, an argument in CrossSection that, if True, flips the signs of offset, all section offsets, all cladding_offsets, and all bbox_offsets?

CrossSection does not have a constructor where we could do this (it currently uses the BaseModel one). We could override that init and add the preprocessing there. Alternatively, if path.extrude is always called on cross-sections, maybe we could put it here. Does that cover all cases?

@simbilod simbilod added the enhancement New feature or request label Dec 28, 2022
@joamatab
Copy link
Contributor

joamatab commented Dec 28, 2022

yes, that would be a great addition

This is on fixme/fixed/route_pin.py

"""FIXME.

- bends in routes flip the polarity in some cases.

"""

import gdsfactory as gf


if __name__ == "__main__":
    c = gf.Component()

    length = 50
    s1 = c << gf.components.straight_pin(length=length)
    s2 = c << gf.components.straight_pin(length=length)

    s2.move((100, 50))

    route = gf.routing.get_route(
        s1.ports["o2"], s2.ports["o1"], cross_section=gf.cross_section.pin
    )
    c.add(route.references)

    c.show(show_ports=True)

image

@simbilod
Copy link
Collaborator Author

#1050 extends the mirroring to all cross-sections

To fix the routing polarity issues: I think we can add a new argument in component.mirror and componentReference.mirror that, if True, makes it so the returned Component or Reference is the base component but with all its ComponentSpec arguments having mirror=True.

Then, when appropriate we can use this flag, for instance in the manhattan function if x_reflection is true.

@github-actions
Copy link

This issue is stale because it has been inactive for 60 days. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no-issue-activity
Projects
None yet
Development

No branches or pull requests

2 participants