Skip to content

Commit

Permalink
Merge branch 'main' into add_sidewall_tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecea committed Mar 3, 2023
2 parents 453a543 + a18f327 commit be46e8f
Show file tree
Hide file tree
Showing 18 changed files with 66 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 6.49.2
current_version = 6.49.3
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
@@ -1 +1 @@
FROM joamatab/gdsfactory:6.49.2
FROM joamatab/gdsfactory:6.49.3
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Expand Up @@ -57,9 +57,9 @@ jobs:
with:
fail_on_unmatched_files: false
files: |
conda/gdsfactory-6.49.2-Linux-x86_64.sh
conda/gdsfactory-6.49.2-Windows-x86_64.exe
conda/gdsfactory-6.49.2-MacOSX-x86_64.pkg
conda/gdsfactory-6.49.3-Linux-x86_64.sh
conda/gdsfactory-6.49.3-Windows-x86_64.exe
conda/gdsfactory-6.49.3-MacOSX-x86_64.pkg
release_docker:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
Expand All @@ -78,5 +78,5 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
tags: joamatab/gdsfactory:latest,joamatab/gdsfactory:6.49.2
tags: joamatab/gdsfactory:latest,joamatab/gdsfactory:6.49.3
file: .devcontainer/Dockerfile.dev
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# gdsfactory 6.49.2
# gdsfactory 6.49.3

[![docs](https://github.com/gdsfactory/gdsfactory/actions/workflows/pages.yml/badge.svg)](https://gdsfactory.github.io/gdsfactory/)
[![PyPI](https://img.shields.io/pypi/v/gdsfactory)](https://pypi.org/project/gdsfactory/)
Expand Down
2 changes: 1 addition & 1 deletion conda/construct.yaml
@@ -1,5 +1,5 @@
name: gdsfactory
version: 6.49.2
version: 6.49.3
installer_type: all

channels:
Expand Down
2 changes: 1 addition & 1 deletion conda/install.bat
Expand Up @@ -6,7 +6,7 @@ call conda activate

call pip install sax jax sklearn
call pip install "jaxlib[cuda111]" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
call pip install gdsfactory[full,gmsh,tidy3d,devsim,meow,ray,database]==6.49.2
call pip install gdsfactory[full,gmsh,tidy3d,devsim,meow,ray,database]==6.49.3
call gf tool install

call conda install -c conda-forge slepc4py=*=complex* -y
Expand Down
2 changes: 1 addition & 1 deletion conda/install.sh
@@ -1,7 +1,7 @@
#!/bin/bash

conda install -c conda-forge slepc4py=*=complex* -y
pip install sklearn gdsfactory[full,gmsh,tidy3d,devsim,meow,sax,ray,database,femwell]==6.49.2
pip install sklearn gdsfactory[full,gmsh,tidy3d,devsim,meow,sax,ray,database,femwell]==6.49.3
gf tool install

[ ! -d $HOME/Desktop/gdsfactory ] && git clone https://github.com/gdsfactory/gdsfactory.git $HOME/Desktop/gdsfactory
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/08_pdk.py
Expand Up @@ -290,7 +290,7 @@ class Config:
#
# gdsfactory is **not** backwards compatible, which means that the package will keep improving and evolving.
#
# 1. To make your work stable you should install a specific version and [pin the version](https://martin-thoma.com/python-requirements/) in your `requirements.txt` or `pyproject.toml` as `gdsfactory==6.49.2` replacing `6.49.2` by whatever version you end up using.
# 1. To make your work stable you should install a specific version and [pin the version](https://martin-thoma.com/python-requirements/) in your `requirements.txt` or `pyproject.toml` as `gdsfactory==6.49.3` replacing `6.49.3` by whatever version you end up using.
# 2. Before you upgrade gdsfactory to a newer version make sure your tests pass to make sure that things behave as expected
#
#
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/__init__.py
Expand Up @@ -143,4 +143,4 @@ def __getattr__(name):
"write_cells",
"PATH",
)
__version__ = "6.49.2"
__version__ = "6.49.3"
2 changes: 1 addition & 1 deletion gdsfactory/cli.py
Expand Up @@ -16,7 +16,7 @@
from gdsfactory.typings import PathType
from gdsfactory.write_cells import write_cells as write_cells_to_separate_gds

VERSION = "6.49.2"
VERSION = "6.49.3"
LAYER_LABEL = LAYER.LABEL


Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/component.py
Expand Up @@ -1891,7 +1891,7 @@ def to_yaml(self, **kwargs) -> str:
with_cells: write cells recursively.
with_ports: write port information.
"""
return OmegaConf.to_yaml(self.to_dict(**kwargs))
return OmegaConf.to_yaml(clean_dict(self.to_dict(**kwargs)))

def to_dict_polygons(self) -> Dict[str, Any]:
"""Returns a dict representation of the flattened component."""
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/config.py
Expand Up @@ -28,7 +28,7 @@
from loguru import logger
from omegaconf import OmegaConf

__version__ = "6.49.2"
__version__ = "6.49.3"
PathType = Union[str, pathlib.Path]

home = pathlib.Path.home()
Expand Down
74 changes: 47 additions & 27 deletions gdsfactory/export/to_stl.py
Expand Up @@ -4,32 +4,35 @@
from typing import Optional, Tuple

from gdsfactory.component import Component
from gdsfactory.technology import LayerStack, LayerViews
from gdsfactory.technology import LayerStack
from gdsfactory.typings import Layer


def to_stl(
component: Component,
filepath: str,
layer_views: Optional[LayerViews] = None,
layer_stack: Optional[LayerStack] = None,
exclude_layers: Optional[Tuple[Layer, ...]] = None,
use_layer_name: bool = False,
hull_invalid_polygons: bool = True,
scale: Optional[float] = None,
) -> None:
"""Exports a Component into STL.
Args:
component: to export.
filepath: to write STL to.
layer_views: layer colors from Klayout Layer Properties file.
layer_stack: contains thickness and zmin for each layer.
exclude_layers: layers to exclude.
use_layer_name: If True, uses LayerLevel names in output filenames rather than gds_layer and gds_datatype.
hull_invalid_polygons: If True, replaces invalid polygons (determined by shapely.Polygon.is_valid) with its convex hull.
scale: Optional factor by which to scale meshes before writing.
"""
import shapely
from trimesh.creation import extrude_polygon
from gdsfactory.pdk import get_layer_views, get_layer_stack
import trimesh.creation
from gdsfactory.pdk import get_layer_stack

layer_views = layer_views or get_layer_views()
layer_stack = layer_stack or get_layer_stack()

layer_to_thickness = layer_stack.get_layer_to_thickness()
Expand All @@ -39,30 +42,47 @@ def to_stl(

component_with_booleans = layer_stack.get_component_with_derived_layers(component)
component_layers = component_with_booleans.get_layers()

layer_names = list(layer_stack.layers.keys())
layer_tuples = list(layer_stack.layers.values())
for layer, polygons in component_with_booleans.get_polygons(by_spec=True).items():
if (
layer not in exclude_layers
and layer in layer_to_thickness
and layer in layer_to_zmin
and layer in component_layers
layer in exclude_layers
or layer not in layer_to_thickness
or layer not in layer_to_zmin
or layer not in component_layers
):
height = layer_to_thickness[layer]
zmin = layer_to_zmin[layer]
filepath_layer = (
filepath.parent
/ f"{filepath.stem}_{layer[0]}_{layer[1]}{filepath.suffix}"
)
print(f"Write {filepath_layer.absolute()!r}")
for polygon in polygons:
p = shapely.geometry.Polygon(polygon)
mesh = extrude_polygon(p, height=height)
mesh.apply_translation((0, 0, zmin))
mesh.visual.face_colors = (
*layer_views.get_from_tuple(layer).fill_color.as_rgb_tuple(),
0.5,
)
mesh.export(filepath_layer)
continue

height = layer_to_thickness[layer]
zmin = layer_to_zmin[layer]

layer_name = (
layer_names[layer_tuples.index(layer)]
if use_layer_name
else f"{layer[0]}_{layer[1]}"
)

filepath_layer = (
filepath.parent / f"{filepath.stem}_{layer_name}{filepath.suffix}"
)
print(f"Write {filepath_layer.absolute()!r}")
meshes = []
for polygon in polygons:
p = shapely.geometry.Polygon(polygon)

if hull_invalid_polygons and not p.is_valid:
p = p.convex_hull

mesh = trimesh.creation.extrude_polygon(p, height=height)
mesh.apply_translation((0, 0, zmin))
meshes.append(mesh)

layer_mesh = trimesh.util.concatenate(meshes)

if scale:
layer_mesh.apply_scale(scale)

layer_mesh.export(filepath_layer)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/generic_tech/klayout/grain.xml
Expand Up @@ -3,7 +3,7 @@
<name>gdsfactory</name>
<token/>
<hidden>false</hidden>
<version>6.49.2</version>
<version>6.49.3</version>
<api-version/>
<title>gdsfactory</title>
<doc>EDA tool to layout integrated circuits</doc>
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/generic_tech/klayout/pymacros/klive.lym
Expand Up @@ -146,7 +146,7 @@ class MyServer(pya.QTcpServer):
# Start the server
server = MyServer()
path = pathlib.Path(__file__).parent.absolute()
print("klive 6.49.2 is running from {} inside klayout {} with python {}".format(str(path), klayout_version, sys.version))
print("klive 6.49.3 is running from {} inside klayout {} with python {}".format(str(path), klayout_version, sys.version))

</text>
</klayout-macro>
2 changes: 1 addition & 1 deletion gdsfactory/generic_tech/klayout/pymacros/set_menus.lym
Expand Up @@ -17,7 +17,7 @@
<text>
import pya

__version__ = "6.49.2"
__version__ = "6.49.3"


def set_menu():
Expand Down
1 change: 0 additions & 1 deletion gdsfactory/install.py
Expand Up @@ -31,7 +31,6 @@ def make_link(src, dest, overwrite: bool = True) -> None:
print(" Error: ", err)
if sys.platform == "win32":
# https://stackoverflow.com/questions/32877260/privlege-error-trying-to-create-symlink-using-python-on-windows-10
print("Trying to create a junction instead of a symlink...")
shutil.copy(src, dest)
print("Symlink made:")
print(f"From: {src}")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -14,7 +14,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
]
version = "6.49.2"
version = "6.49.3"
authors = [
{name = "gdsfactory community", email = "contact@gdsfactory.com"},
]
Expand Down

0 comments on commit be46e8f

Please sign in to comment.