question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

improve A* router

See original GitHub issue
import gdsfactory as gf

c = gf.Component("get_route_astar")
w = gf.components.straight()
left = c << w
right = c << w
right.move((100, 80))

obstacle = gf.components.rectangle(size=(100, 10))
obstacle1 = c << obstacle
obstacle2 = c << obstacle
obstacle1.ymin = 40
obstacle2.xmin = 25

port1 = left.ports["o2"]
port2 = right.ports["o2"]

routes = gf.routing.get_route_astar(
    component=c,
    port1=port1,
    port2=port2,
)
c.add(routes.references)
c.show()

image

import gdsfactory as gf

cross_section = "metal1"

c = gf.Component("get_route_astar")
w = gf.components.straight(cross_section=cross_section)

left = c << w
right = c << w
right.move((100, 80))

obstacle = gf.components.rectangle(size=(100, 10), layer="M1")
obstacle1 = c << obstacle
obstacle2 = c << obstacle
obstacle1.ymin = 40
obstacle2.xmin = 25

port1 = left.ports["e2"]
port2 = right.ports["e2"]

routes = gf.routing.get_route_astar(
    component=c, port1=port1, port2=port2, cross_section="metal1", resolution=5
)
c.add(routes.references)
c.show()
"""FIXME.

We need to add an option to avoid specific layers
"""

if __name__ == "__main__":
    import gdsfactory as gf

    c = gf.Component()

    rect1 = c << gf.components.rectangle()
    rect2 = c << gf.components.rectangle()
    rect3 = c << gf.components.rectangle((2, 2), layer=(2, 0))
    rect2.move(destination=(8, 4))
    rect3.move(destination=(5.5, 1.5))

    port1 = gf.Port(
        "o1", 0, rect1.center + (0, 3), cross_section=gf.get_cross_section("strip")
    )
    port2 = port1.copy("o2")
    port2.orientation = 180
    port2.center = rect2.center + (0, -3)
    c.add_ports([port1, port2])
    route = gf.routing.get_route_astar(c, port1, port2, radius=0.5, width=0.5)
    c.add(route.references)

    c.show(show_ports=True)

image

@SkandanC

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
joamatabcommented, Sep 9, 2022

nice 🎉

looks great Skandan

1reaction
joamatabcommented, Sep 9, 2022

nice, this looks much better, looking forward to your PR

it would be nice to add an optional avoid_layers: List[LayerSpec] of layers that it needs to avoid, for example,

metal1 only needs to avoid shapes in metal1 , and does not need to avoid waveguide layer

i would use c.get_polygons(layers) so we only compute the bbox for the important layers that we need to avoid

also you could also include an optional distance:float parameter that avoids being too close to obstacles in the picture above

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to boost your Wi-Fi router's performance: 10 handy tricks
10 easy ways to boost your router's performance while working at home · When in doubt, reboot · Location, location, location · Check...
Read more >
11 Ways to Upgrade Your Wi-Fi and Make Your Internet Faster
1. Move Your Router. That router in the closet? · 2. Use an Ethernet Cable. ethernet cable · 3. Change the Channel or...
Read more >
10 Ways to Improve Your Wi-Fi Router Speed - MakeUseOf
10 Ways to Improve Your Wi-Fi Router Speed · 1. Automate a Reboot Schedule · 2. Make Your Router Faster With a New...
Read more >
10 Ways to Boost Your Wi-Fi Signal | PCMag
10 Ways to Boost Your Wi-Fi Signal · 1. Check Your Wired Internet Connection · 2. Update Your Router Firmware · 3. Achieve...
Read more >
15 ways to boost your WiFi performance in 2022 - NetSpot
Best WiFi Extenders. The job of a WiFi extender is to extend your WiFi network beyond what your WiFi router is able to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found