Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #854 from gdsfactory/fix_add_port_from_labels
Fix add port from labels
- Loading branch information
Showing
6 changed files
with
91 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""fixme.""" | ||
|
||
import numpy as np | ||
import gdstk | ||
|
||
path = gdstk.FlexPath(width=0.5, points=[(-0.1, 0), (+0.1, 0)]) | ||
# print(path.points) | ||
# AttributeError: 'gdstk.FlexPath' object has no attribute 'points' | ||
|
||
|
||
polygons = path.to_polygons() | ||
polygon = polygons[0] | ||
p = polygon.points | ||
center = np.sum(p, 0) / 2 | ||
|
||
p1 = np.sum(p[:2], 0) / 2 | ||
p2 = np.sum(p[2:], 0) / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
gdsfactory/tests/test_add_ports/test_add_ports_from_pins.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: straight_1514d1a3 | ||
ports: | ||
o1: | ||
center: | ||
- 0.0 | ||
- 0.0 | ||
layer: PORT | ||
name: o1 | ||
orientation: 180 | ||
port_type: optical | ||
width: 0.5 | ||
o2: | ||
center: | ||
- 10.0 | ||
- 0.0 | ||
layer: PORT | ||
name: o2 | ||
orientation: 0 | ||
port_type: optical | ||
width: 0.5 | ||
settings: {} |
3 changes: 3 additions & 0 deletions
3
gdsfactory/tests/test_add_ports/test_add_ports_from_pins_siepic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: straight_0c623a86 | ||
ports: {} | ||
settings: {} |