Comments (6)
We added some examples in #2845
let us know if you find further improvements
from gdsfactory.
Fillet is implemented with (D)Polygon.round_corners
https://klayout.de/doc/code/class_DPolygon.html#method57
The reason the offset is not as easy is because imo gdstk uses rather restrictive assumptions for getting the outline.
How do you size? How do you handle sharp corners? How do you handle self-intersecting polygons? And so on.
I think this would be quite hard to define a sane default behavior and generally requires individual adjustments per component.
but generally an outline (of a layer) can happen two ways:
r = gf.kdb.Region(c.shapes(layer_index)))
c.shapes(layer_index).insert(r.sized(outline_in_dbu)-r) # note r.sized vs r.size; the latter will change in place and therefore not work
if it should be non-recursive
if recursive
r = gf.kdb.Region(c.begin_shapes_rec(layer_index)))
c.shapes(layer_index).insert(r.sized(outline_in_dbu)-r)
This is the standard isotropic sizing case. Note this can cause problems with self-intersecting polygons. For safe usage a minkowski sum is most likely necessary.
from gdsfactory.
maybe it would be useful to add functions that are compatible with the old behavior though? and we can add options to customize as necessary?
from gdsfactory.
Yes, I apologize for the documentation not being yet as extensive as it was in version 7.
However, these operations are now much easier due to the enhanced functionality and usability of the Klayout classes.
I can some examples on how to do this
from gdsfactory.
Hello @joamatab @sebastian-goeldi, thanks for the explanations and for adding the examples to the tutorials, I found them pretty useful and they allowed me to do what I wanted. I also understand the concerns about offsetting, but it is very useful to have a simple way to handle non-problematic cases, as shown in the tutorial. Just a couple more questions:
- Is there a possibility to round different corners of a polygon with different radii? I could not find this functionality in
(D)Polygon.round_corners
, I was wondering if there is any possibility to implement it. - It seems to me that booleans and
grid
function do not have the cell decorator anymore, thus they produce unnamed components. Am I missing something? Is this made on purpose?
Thanks a lot in advance!
from gdsfactory.
Hello @Alessio-Zicoschi,
Klayout does support that natively, no. I onlu supports rounding for inner vs outer radii (I think defined as <180°
opening vs bigger).
If you want more rounding options, I am afraid you'll either have to cut out the pieces you want manually or export and afterwards import to something like shapely.
If you absolutely want to stay in KLayout, I guess you could try to create partial paths and then round them and then stitch them back together. But that seems like a lot of work for what other packages can do better most likely
For the @cell
decorated functions, the main reason to remove it is to a) remove "vessel" cells wherever possible (otherwise many pdks will have something like 2/3 vessel functions vs true leaf cells) b) give more flexibility; i.e. you now can inert a boolean directly into existing cells, meaning you don't have this parent/related cell which simply contains the result or is packed over the original.
from gdsfactory.
Related Issues (20)
- Runtime Error when same routing cell are used in multiple subcells HOT 4
- Port.layer returns an integer HOT 4
- Question: Roughness in euler_bend_all_angle HOT 6
- Improper cache hits for some components in v7 HOT 1
- type object 'LAYER' has not attribute 'kcl' HOT 1
- RuntimeError: Cannot write layer numbers larger than 65535 to GDS2 streams HOT 2
- remap_layers does not remap layers HOT 3
- The get_ports_list() function does not work in the reference device. HOT 1
- The port doesn't seem to work HOT 2
- `route_from_single_steps` is missing a straight `ComponentSpec` argument
- get_cells looks at cell decorated functions instead of type annotations
- import gds error: borrowing component from another PDK HOT 4
- Pass list of the components or references to boolean function HOT 1
- Importing gdsfactory changes `yaml.safe_load` behavior HOT 1
- Klayout integration stopped working HOT 1
- ValueError: ref() is deprecated. Use add_ref() instead HOT 1
- Resolve Port Positions Recursively from a Top Component in V8 HOT 5
- Colab examples on docs site no longer run after gf requiring python 3.11 HOT 3
- Consistency of the commands. HOT 2
- .dmove() (and .move()) not compatible with Port or DPoint arguments
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdsfactory.