Comments (5)
Hello @enuinc,
Loading a GDSII file can be done with GdsLibrary
.
If your file has a single top cell, then something like this should work:
import gdspy
lib = gdspy.GdsLibrary(infile='filename.gds')
main_cell = lib.top_cell()[0]
pol_dict = main_cell.get_polygons(by_spec=True)
polygons = pol_dict[(layer, datatype)]
Note that in the last line I assume you know the layer and datatype numbers you're after. If the polygons in the layer you want have different datatypes, you'll have to iterate over therm and append to the polygons
list.
Also note there's no need to flatten
the cell, because get_polygons
already traverses the whole cell hierarchy.
from gdspy.
Hi
I guess it is
main_cell = lib.top_level()[0]
from gdspy.
@egholami Yes, that's the correct command!
import gdspy
lib = gdspy.GdsLibrary(infile='filename.gds')
main_cell = lib.top_level()[0]
pol_dict = main_cell.get_polygons(by_spec=True)
polygons = pol_dict[(layer, datatype)]
from gdspy.
@heitzmann By any chance can we plot these polygons?
from gdspy.
@vandhanasiva Each polygon in the list is simply an array of N vertices (a numpy.ndarray
with shape (N, 2)
), so any drawing library should be capable of drawing it. You can use, for example, matplotlib, or look for something more efficient if you have too many of them.
from gdspy.
Related Issues (20)
- stuck in hierarchically with CellReferences HOT 3
- RobustPath : Unsupported types for -: 'tuple' and 'tuple' HOT 1
- Use scaling to reduce file size HOT 1
- the direction of polygon in the cellreference is wrong HOT 3
- may be it is a bug for GdsLibrary.new_cell() HOT 6
- 'Cell' object has no attribute 'elements' HOT 1
- gdspy installation in python 3.10. HOT 1
- How can I get the information of the instance?
- Use gdspy in Klayout Macro developement (reopened) HOT 1
- How to read a gds file data and export it as PNG? HOT 1
- gdspy.inside only checks for inside the bbox HOT 1
- GdsLibrary object has no attribute 'cells' HOT 2
- Multiple cells with name: FGCCTE in GDSII file HOT 2
- result of get_bounding_box() for a polygon is wrong HOT 2
- conda install gdspy
- overwrite_duplicate not working with (use_current_library = True) HOT 1
- After gdspy boolean OR operation, help HOT 1
- [0.9.46] Python extension build fails when the PYPI tarball is used HOT 1
- Python tests fail HOT 1
- Merging polygons with gdspy boolean vs Klayout merge produces different results
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 gdspy.