Comments (4)
@egholami I'm not sure I understand what you're trying to do, but probably cell.get_polygons(by_spec=True)
should help.
If you can post a minimal example, it might be easier to help you.
from gdspy.
This is the Trim method that I add to Cell class:**
def Trim (self,
mash):
poly_dic = self.get_polygons(True)
self.elements = []
for ld in poly_dic.keys():
if ld[0]==mash:
self.add(PolygonSet( poly_dic[ld],ld[0], verbose=False))
return self
It is working for Cell layer isolation and for the Boolean cell Operation I am using Get_polygons in the following way but it is very slow:
layli=['EBL','Trenches','Mesa']
for i in range(1,4):
globals()['sepLayer%s'%i]=Ref_cell.copy('{}'.format(layli[i-1]), deep_copy=True)
globals()['sepLayer%s'%i].Trim(mash=i)
globals()['sepLayer%s'%i]=gdspy.fast_boolean(globals()['sepLayer%s'%i].get_polygons(False, None),Iqub0m,'not',layer=i)
re_cellmodified.add(globals()['sepLayer%s'%i])
for one of my layers that have a lot of points and elements it is very slow but it is working
**Now I have tried what you suggested **
for i in range(1,4):
globals()['sepLayer%s'%i]=flatten.copy('{}'.format(layli[i-1]), deep_copy=True)
globals()['sepLayer%s'%i].Trim(mash=i)
globals()['sepLayer%s'%i]=gdspy.fast_boolean(globals()['sepLayer%s'%i].get_polygons(by_spec=True),Iqub0m,'not',layer=i)
re_cellmodified.add(globals()['sepLayer%s'%i])
print(i)
It is giving me this error!
Traceback (most recent call last):
File "C:\Users\ehgh\AppData\Local\Continuum\anaconda3\lib\site-packages\gdspy_init_.py", line 4274, in fast_boolean
result = clipper.clip(polyA, polyB, operation, 1 / precision)
TypeError: 'numpy.int32' object does not support indexing
Is there any way to make Boolean Cell operation fast?
from gdspy.
@egholami get_polygons(by_spec=True)
returns a dictionary, so you're a missing the key (similar to what you do with poly_dic
. ALso, you probably don't need to use flatten()
or copy()
.
In any case, boolean operations are slow. The only way around it is to use fewer points... I find people often overshoot the precision they need in curved geometries. Another option would be to try to avoid using boolean operations at all by drawing your geometry some other way.
Unrelated to the issue: it's quite dangerous to be abusing globals()
like that. Global variables are in general a bad design choice, let alone using globals
. You'd be better of using your own dictionary.
from gdspy.
Thanks a lot! It was a pseudo code and you are right that using the globals() is a bad design choice I would keep it in mind. Using the way that you have explained there would be no need for hard copy.
Unfortunately we deal with some special kind of text and we could not use regular text so I need my own designed text with opening. Because for some chemistry reasons some letters like "O" or "B" could not be used in closed form and need some opening.
from gdspy.
Related Issues (20)
- 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
- [Documentation] What does "intersect, but not cross" mean? HOT 1
- Error with boolean operations between cells or polygonsets
- referencing cells imported from a GDS file HOT 1
- show layer names in the layout viewer
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.