|
7 | 7 | # First, assume we have a GDS file (here we write a small one with gdstk): |
8 | 8 |
|
9 | 9 | # %% |
10 | | -from typing import List |
| 10 | + |
11 | 11 | import gdstk |
12 | | -from meshwell.import_gds import read_gds_layers |
| 12 | +import matplotlib.pyplot as plt |
13 | 13 | import shapely |
14 | 14 | import shapely.geometry as sg |
15 | | -from meshwell.visualization import colors |
16 | | -from meshwell.polysurface import PolySurface |
17 | | -import matplotlib.pyplot as plt |
18 | | -from meshwell.visualization import plot2D |
| 15 | + |
19 | 16 | from meshwell.cad import cad |
| 17 | +from meshwell.import_gds import read_gds_layers |
20 | 18 | from meshwell.mesh import mesh |
| 19 | +from meshwell.polysurface import PolySurface |
| 20 | +from meshwell.visualization import colors, plot2D |
21 | 21 |
|
22 | 22 | lib = gdstk.Library() |
23 | 23 | cell = lib.new_cell("TOP") |
|
50 | 50 | # Add all shapes to cell |
51 | 51 | shapes = [rect1a, poly1b, poly1c, rect2a, poly2b, poly2c, circle1, circle2, circle3] |
52 | 52 | for shape in shapes: |
53 | | - if isinstance(shape, List): |
| 53 | + if isinstance(shape, list): |
54 | 54 | for subshape in shape: |
55 | 55 | cell.add(subshape) |
56 | 56 | else: |
|
64 | 64 | ymax = float("-inf") |
65 | 65 |
|
66 | 66 | for shape in shapes: |
67 | | - if isinstance(shape, List): |
68 | | - shape_list = shape |
69 | | - else: |
70 | | - shape_list = [shape] |
| 67 | + shape_list = shape if isinstance(shape, list) else [shape] |
71 | 68 |
|
72 | 69 | for s in shape_list: |
73 | 70 | bbox = s.bounding_box() |
|
236 | 233 | # %% |
237 | 234 | # Helper function to plot shapely geometries |
238 | 235 | def plot_geometry(geometry, title=None, color="blue", alpha=0.5, show_layer4=True): |
239 | | - fig, ax = plt.subplots(figsize=(8, 8)) |
| 236 | + _fig, ax = plt.subplots(figsize=(8, 8)) |
240 | 237 |
|
241 | 238 | # Plot the main geometry |
242 | 239 | if isinstance(geometry, sg.MultiPolygon): |
|
0 commit comments