Giter VIP home page Giter VIP logo

gdscad's Introduction

gdsCAD -- Simple GDSII design in Python

gdsCAD is a simple, but powerful, Python package for creating, reading, and manipulating GDSII layout files. It's suitable for scripting and interactive use. It excels particularly in generating designs with multiple incrementally adjusted objects. gdsCAD uses matplotlib to visualize everything from individual geometry primitives to the entire layout.

Documentation

Complete documentation can be found at:
http://pythonhosted.org/gdsCAD/#

Download

The package can be downloaded for installation via easy_install at
https://pypi.python.org/pypi/gdsCAD

Gallery

http://pythonhosted.org/gdsCAD/_images/Gallery.png

A Simple Example

Here is a simple example that shows the creation of some text with alignment features. It involves the creation of drawing geometry, Cell and a Layout . The result is saved as a GDSII file, and also displayed to the screen:

import os.path
from gdsCAD import *

# Create some things to draw:
amarks = templates.AlignmentMarks(('A', 'C'), (1,2))
text = shapes.Label('Hello\nworld!', 200, (0, 0))
box = shapes.Box((-500, -400), (1500, 400), 10, layer=2)

# Create a Cell to hold the objects
cell = core.Cell('EXAMPLE')
cell.add([text, box])
cell.add(amarks, origin=(-200, 0))
cell.add(amarks, origin=(1200, 0))

# Create two copies of the Cell
top = core.Cell('TOP')
cell_array = core.CellArray(cell, 1, 2, (0, 850))
top.add(cell_array)

# Add the copied cell to a Layout and save
layout = core.Layout('LIBRARY')
layout.add(top)
layout.save('output.gds')

layout.show()

Recent Changes

  • xxxx,
    • Python3 compatibility
    • Boolean operations (experimental)
    • Major improvements to GdsImport:
      • Refactored GdsImport to properly handle referenced Cells
      • Fixed bug that broke import of Text elements
      • verbosity=2 prints imported records
    • Fixed x_reflection when showing referenced Cells
    • Changed str and repr to give more and less info on core elements.
    • Text objects are included in show() autoscaling
    • Added levels of verbosity to GdsImport
    • Cell and Layout now support created and modified dates
    • Path endcaps and vertices now render correctly with show
    • Introduced laydat tuple combining layer and datatype
    • Introduced object selection methods for Cell
  • v0.4.5 (05.02.15)
    • Added to_path and to_boundary conversion methods
    • Added experimental DXFImport
  • v0.4.4 (12.12.14)
    • Added Ellipse boundary (cjermain)
    • Added missing area method to base classes
    • Fixed bug when objects are defined with integers then translated by float (cjermain)
    • Added missing flatten method
  • v0.4.3 (07.10.14)
    • (bugfix) Boundaries to again accept non-numpy point lists
    • Removed deprecated labels attribute from Cell
    • Reduced internal uses of Cell._references
  • v0.4.2 (15.09.14)
    • (bugfix) Boundaries are now closed as they should be (thanks Phil)
    • gdsImport loads all Boundary points (including final closing point) from file
  • v0.4.1 (05.06.14)
    • Allow Boundaries with unlimited number of points via multiple XY entries
  • v0.4.0 (07.05.14)
    • Several performance improvements: Layout saving, reference selection, and bounding boxes should all be faster
    • Layout save now only uniquifies cell names that are not already unique
  • v0.3.7 (14.02.14)
    • More colors for layer numbers greater than six (Matthias Blaicher)
  • v0.3.6 (12.12.13) bugfix
    • Fixed installation to include missing resource files
  • v0.3.5 (11.12.13 PM) bugfix
    • Introduced automatic version numbering
    • git_version module is now included in distribution (Thanks Matthias)
  • v0.3.2 (11.12.13)
    • CellArray spacing can now be non-orthogonal
    • Block will now take cell spacing information from the attribute cell.spacing
  • v0.3.1 (06.12.13)

gdscad's People

Contributors

cjermain avatar hohlraum avatar mabl avatar philreinhold avatar tom-varga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gdscad's Issues

How to set colors for layers independently from script

I would like to set color independently as I am also using this package for drawing floorplan.

Floorplan will look good with different colors.

Example Code, suppose I want 20 blocks to be placed at different locations.
I am increasing layer by 1 for each block. I want colors of these layer set independently.

layer=layer+1
cell = core.Boundary(points,layer=layer)

Let me know how can I do it?

flatten() method fails due to lack of get_polygons method

Greetings! I'm trying to use the flatten() method on a Cell but it's returning:
AttributeError: 'Cell' object has no attribute 'get_polygons'
Looks like this may have been incompletely ported from the gdspy codebase? Just curious if I'm missing something obvious!

Thanks so much for your time,
Graham

example error 'TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')'

I'm trying to start the example script:

import os.path
from gdsCAD import *

# Create some things to draw:
amarks = templates.AlignmentMarks(('A', 'C'), (1,2))
text = shapes.Label('Hello\nworld!', 200, (0, 0))
box = shapes.Box((-500, -400), (1500, 400), 10, layer=2)

# Create a Cell to hold the objects
cell = core.Cell('EXAMPLE')
cell.add([text, box])
cell.add(amarks, origin=(-200, 0))
cell.add(amarks, origin=(1200, 0))

# Create two copies of the Cell
top = core.Cell('TOP')
cell_array = core.CellArray(cell, 1, 2, (0, 850))
top.add(cell_array)

# Add the copied cell to a Layout and save
layout = core.Layout('LIBRARY')
layout.add(top)
layout.save('output.gds')

layout.show()

And getting this error:

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

Viewing area is not rescaled to text in shifted references

Matplotlib's autoscale does not take artists added by add_artist into account when calculating dataLim. f27da5b introduces an ugly hack to explicitly add text objects to the datalim. It more or less works for cells, but not for references that have been subjected to transformations.

For instance in the code below c.show() works as expected, but top.show() does not.

t1 = core.Text('one', (-10,0), layer=8)
t2 = core.Text('two', (0,5))
t3 = core.Text('three', (-20,5))
t4 = core.Text('four', (10,0))

c = core.Cell('cell')
c.add([t1, t2, t3, t4])

ref = core.CellReference(c, origin=(10,10))

top = core.Cell('top')
top.add(ref)

core.GdsImport(mygds) error with texttype

I cannot import my own gds. It seems to be some incompatibility with the record texttype. The traceback is:
Traceback (most recent call last):
File "gds_tests.py", line 9, in
amarks = core.GdsImport(myfile)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD/core.py", line 1968, in GdsImport
cell.add(create_element(**kwargs))
File "/usr/local/lib/python2.7/dist-packages/gdsCAD/core.py", line 2172, in _create_text
return Text(**kwargs)
TypeError: init() got an unexpected keyword argument 'texttype'

gdsImport does not support hierarchy

It appears that gdsImport as implemented in gdsCAD doesn't support reading in a gds with hierarchy.
In gdspy where it works, I can see that self._incomplete is defined and used within the gdsImport class 4 times.
However in gdsCAD, it is defined in the gdsImport function but is attempted to be accessed in two other functions which results in the following error:
NameError: global name '_incomplete' is not defined

As a testcase, please try the following slightly edited userguide-20.py example.
It simply saves the gds file with hierarchy and then attempts to read it back in.

I'm trying to figure out how to fix the issue, but haven't had luck yet.
I hope that somebody could take a look at this further.
Thanks,
-Tom

from gdsCAD import *

one = shapes.Box((-10,-10), (10,10), 0.5)
two = shapes.Rectangle((-10,-10), (0,0), layer=2)
three = shapes.Disk((5,5), 5, layer=3)

cell = core.Cell('DEVICE')

cell.add(one)
cell.add(two)
cell.add(three)

top = core.Cell('TOP')

ref1 = core.CellReference(cell)
top.add(ref1)

Translate

ref2 = core.CellReference(cell, origin=(40,0))
top.add(ref2)

Scale and Translate

ref3 = core.CellReference(cell, origin=(0, 40), magnification=1.5)
top.add(ref3)

Rotate and Translate

ref4 = core.CellReference(cell, origin=(40,40), rotation=45)
top.add(ref4)

top.show()

Add the copied cell to a Layout and save

layout = core.Layout('LIBRARY')
layout.add(top)
layout.save('userguide-20.gds')

Read the gds with hierarchy back in

layout2 = core.GdsImport('userguide-20.gds')

layout.show() error

When running the sample code below I get the following error:

The Code:

import os.path
from gdsCAD import *

# Create some things to draw:
amarks = templates.AlignmentMarks(('A', 'C'), (1,2))
text = shapes.Label('Hello\nworld!', 200, (0, 0))
box = shapes.Box((-500, -400), (1500, 400), 10, layer=2)

# Create a Cell to hold the objects
cell = core.Cell('EXAMPLE')
cell.add([text, box])
cell.add(amarks, origin=(-200, 0))
cell.add(amarks, origin=(1200, 0))

# Create two copies of the Cell
top = core.Cell('TOP')
cell_array = core.CellArray(cell, 1, 2, (0, 850))
top.add(cell_array)

# Add the copied cell to a Layout and save
layout = core.Layout('LIBRARY')
layout.add(top)
layout.save('output.gds')

layout.show()

The Error:

Writing the following cells
TOP: Cell ("TOP", 0 elements, 1 references)
EXAMPLE: Cell ("EXAMPLE", 2 elements, 2 references)
CONT_ALGN: Cell ("CONT_ALGN", 9 elements, 0 references)
Traceback (most recent call last):

.... [removed]

File "C:\Python27\lib\site-packages\gdsCAD\core.py", line 105, in _layer_properties
colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

The Fix?

It appears line 105 in core.py is trying to combine a numpy array with a regular Python list. If I change line 105 to:

colors += list(matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15)))

Things run normally.

ValueError: LineStrings must have at least 2 coordinate tuples

import sys
import os.path
import numpy as np
from gdsCAD import *
import matplotlib.pyplot as plt

l = core.GdsImport(os.path.abspath("my.GDS"), verbose=True)
l.show()

yields:

Traceback (most recent call last):
  File "model.py", line 8, in <module>
    l.show()
  File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.4.5_57_gc9594b8-py2.7.egg/gdsCAD/core.py", line 91, in _show
    artists=self.artist()
  File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.4.5_57_gc9594b8-py2.7.egg/gdsCAD/core.py", line 1374, in artist
    artists += c.artist()
  File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.4.5_57_gc9594b8-py2.7.egg/gdsCAD/core.py", line 1692, in artist
    art+=e.artist()
  File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.4.5_57_gc9594b8-py2.7.egg/gdsCAD/core.py", line 612, in artist
    lines = shapely.geometry.LineString(points)
  File "/usr/local/lib/python2.7/dist-packages/shapely/geometry/linestring.py", line 48, in __init__
    self._set_coords(coordinates)
  File "/usr/local/lib/python2.7/dist-packages/shapely/geometry/linestring.py", line 97, in _set_coords
    ret = geos_linestring_from_py(coordinates)
  File "shapely/speedups/_speedups.pyx", line 152, in shapely.speedups._speedups.geos_linestring_from_py
ValueError: LineStrings must have at least 2 coordinate tuples

the GDS loads fine in klayout and was sent to FAB without apparent issue.

gdsImport does not work for hierarchical gds

gdsImport seems to work for a flat gds, but not for the same design when it's a hierarchical version which includes other subcells.
the error is:
Traceback (most recent call last):
File "gds_tests.py", line 11, in
amarks = core.GdsImport(myfile)#, verbose=2)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 2388, in GdsImport
layout.add(c)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1241, in add
names=[c.name for c in self.get_dependencies()]
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1260, in get_dependencies
dependencies |= set(cell.get_dependencies())
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1678, in get_dependencies
dependencies += reference.get_dependencies(include_elements)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1784, in get_dependencies
return [self.ref_cell]+self.ref_cell.get_dependencies(include_elements)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1678, in get_dependencies
dependencies += reference.get_dependencies(include_elements)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1784, in get_dependencies
return [self.ref_cell]+self.ref_cell.get_dependencies(include_elements)
AttributeError: 'str' object has no attribute 'get_dependencies'

No module named git_version

The current setup.py uses a module called git_version. Which does not exist, at least on the the computers I tried.

-> % pip install --upgrade gdsCAD
Downloading/unpacking gdsCAD from https://pypi.python.org/packages/source/g/gdsCAD/gdsCAD-0.3.2.tar.gz#md5=45b2ce5f686c54cc6eac07df1f81eac8
  Downloading gdsCAD-0.3.2.tar.gz (447kB): 447kB downloaded
  Running setup.py egg_info for package gdsCAD
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/mnt/lin_hdd/home/mabl/Studium/Masterarbeit/PycharmProjects/devenv/build/gdsCAD/setup.py", line 9, in <module>
        from git_version import get_git_version
    ImportError: No module named git_version
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/mnt/lin_hdd/home/mabl/Studium/Masterarbeit/PycharmProjects/devenv/build/gdsCAD/setup.py", line 9, in <module>

    from git_version import get_git_version

ImportError: No module named git_version

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /mnt/lin_hdd/home/mabl/Studium/Masterarbeit/PycharmProjects/devenv/build/gdsCAD
Storing complete log in /home/mabl/.pip/pip.log

shapes.Box lower left corner not rectangular

If a box is drawn, the lower left corner ist not rectangular. There is a quadrat with edge length of half the width missing.

Fixed it in shapes.Box

added -0.5*width

points = np.array([[point1[0], point1[1]-0.5_width], [point1[0], point2[1]], [point2[0], point2[1]], [point2[0], point1[1]], [point1[0]-0.5_width, point1[1]]])

Greetings

Flo

DXF Import

Hi,
I am trying to import some dxf and convert it to gds.
But always the same error message pops up:

I use just this code
dxf=core.DxfImport('jcsample.dxf', scale=1.0)

runfile('C:/Users/np/Documents/Python Scripts/untitled0.py', wdir='C:/Users/np/Documents/Python Scripts')
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Users/np/Documents/Python Scripts/untitled0.py', wdir='C:/Users/np/Documents/Python Scripts')

File "C:\Program Files\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
execfile(filename, namespace)

File "C:\Program Files\Anaconda2\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 74, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)

File "C:/Users/np/Documents/Python Scripts/untitled0.py", line 17, in
if isinstance(e, dxfgrabber.entities.LWPolyline):

AttributeError: 'module' object has no attribute 'entities'

I am using Anaconda2 (Pyhton 2.4)

Thanks for the help
Flo

GDS Cad integration error

from gdsCAD.core import Layout
from gdsCAD.Class_Wafer_Style import Wafer_Style_4_inch

from gdsCAD import Cell38

list = []
list.append(Cell38)

Wafer_GridStyle = Wafer_Style_4_inch('Wafer_GridStyle', list)
layout_wafer_1 = Layout('layout_wafer_final')
layout_wafer_1.add(Wafer_GridStyle)
layout_wafer_1.save('mask_final_revised_2.gds')

Output Screen:
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
If 2700 is not equal to 2700 there will be a rounding (machine accuracy) problem with the triangles.
Writing the following cells
('cell_38:', <gdsCAD.core.Cell object at 0x110ba3450>)

TypeError Traceback (most recent call last)
in ()
14
15
---> 16 Wafer_GridStyle = Wafer_Style_4_inch('Wafer_GridStyle', list)
17
18 layout_wafer_1 = Layout('layout_wafer_final')

/usr/local/lib/python2.7/site-packages/gdsCAD/Class_Wafer_Style.pyc in init(self, name, cells, block_gap, *args, **kwargs)
43 'LOWER LEFT':(-3.05e4,-2.2e4), 'LOWER RIGHT':(3.025e4,-2.15e4)}
44
---> 45 Wafer_GridStyle.init(self, name, cells, block_gap, *args, **kwargs)
46
47 self._place_blocks()

/usr/local/lib/python2.7/site-packages/gdsCAD/templates.pyc in init(self, name, cells, block_gap)
54 #self.cells = Cell
55 self.cells = cells
---> 56 self.cell_layers=self._cell_layers()
57 self._label=None
58

/usr/local/lib/python2.7/site-packages/gdsCAD/templates.pyc in _cell_layers(self)
68 cell_layers |= set(c.get_layers())
69 else:
---> 70 for s in c:
71 cell_layers |= set(s.get_layers())
72 return list(cell_layers)

TypeError: 'module' object is not iterable

Unique name in def

Some programs can´t open cells with characters ?$ in the cellname. So i just replaced it with ab. In core.py line 2213

Should work now.

Greetings
Flo

def _compact_id(obj):
"""
Return the id of the object as an ascii string.

This is guaranteed to be unique, and uses only characters that are permitted
in valid GDSII names.
"""

i=bin(id(obj))[2:]
#chars=string.ascii_uppercase+string.ascii_lowercase+string.digits+'?$'
chars=string.ascii_uppercase+string.ascii_lowercase+string.digits+'ab'
out=''
while len(i):
    s=int(i[-6:], base=2)
    out+=chars[s]
    i=i[:-6]
    
return out[::-1]

layout.show() error

Hello,

I am trying to run the first script on the documentation page:

The Code:
`from gdsCAD import *

cell=core.Cell('TOP')

for l in (3,6,10):
box=shapes.Box((-l,-l), (l,l), width=0.2, layer=2)
cell.add(box)

layout = core.Layout('LIBRARY')
layout.add(cell)

layout.save('output.gds')
layout.show()
`

I am getting the following error:
Writing the following cells
TOP: Cell ("TOP", 3 elements, 0 references)
Traceback (most recent call last):
File "p1.py", line 18, in
layout.show()
File "/Users/Prabudhya/anaconda2/lib/python2.7/site-packages/gdsCAD-0.4.5-py2.7.egg/gdsCAD/core.py", line 82, in _show
artists=self.artist()
File "/Users/Prabudhya/anaconda2/lib/python2.7/site-packages/gdsCAD-0.4.5-py2.7.egg/gdsCAD/core.py", line 1132, in artist
artists += c.artist()
File "/Users/Prabudhya/anaconda2/lib/python2.7/site-packages/gdsCAD-0.4.5-py2.7.egg/gdsCAD/core.py", line 1389, in artist
art+=e.artist()
File "/Users/Prabudhya/anaconda2/lib/python2.7/site-packages/gdsCAD-0.4.5-py2.7.egg/gdsCAD/core.py", line 477, in artist
return [descartes.PolygonPatch(poly, lw=0, **self._layer_properties(self.layer))]
File "/Users/Prabudhya/anaconda2/lib/python2.7/site-packages/gdsCAD-0.4.5-py2.7.egg/gdsCAD/core.py", line 105, in _layer_properties
colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

I am not sure how to solve this problem. Thanks for you help.

Pra

Installation with Python 3.8.3. Error with get_version()

Hi, I was able to install the gdsCAD with python 3 on my Linux machine. I was able to checkout to the 2and3 branch and run the python setup.py install command.

But when I try to install the package using the same command on Windows I am getting value error in the function get_version(). I am pasting the error message below. Also, I am unable to find any _version.py file in the gdsCAD directory.

Traceback (most recent call last):
File "setup.py", line 10, in
version = get_version(),
File "E:\myenv3\gdsCAD-2and3\git_version.py", line 101, in get_version
raise ValueError("Cannot find the version number!")
ValueError: Cannot find the version number!

Can someone please help me with the installation on Python 3. Currently, I am trying to upgrade my software tool to Python 3 and I need gdsCAD for that.

Some issue with color mapping is preventing show from working correctly

Trying to show any GDSfile, even the example provided on the website fails with the following error;

File "C:\Users\me\Anaconda2\lib\site-packages\gdsCAD\core.py", line 105, in _layer_properties
colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

core.Layout.save(layout,outfile) not working

After importing the layout, when trying to save the same file to an output file, it will give the following error:
imported correctly
Writing the following cells
IGA_SQ_AI_124_A: Cell ("IGA_SQ_AI_124_A", 1911170 elements, 0 references)
Traceback (most recent call last):
File "gds_tests.py", line 13, in
core.Layout.save(amarks, myoutfile)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1325, in save
outfile.write(cell.to_gds(self.unit / self.precision, duplicates))
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1491, in to_gds
data += element.to_gds(multiplier)
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 736, in to_gds
return data + struct.pack('>2h2l2h', 12, 0x1003, int(round(self.points[0] * multiplier)), int(round(self.points[1] * multiplier)), 4 + len(text), 0x1906) + text.encode('ascii') + struct.pack('>2h', 4, 0x1100)
struct.error: 'l' format requires -2147483648 <= number <= 2147483647

is it a float problem in the original gds?

Question: circle with voids

Hi,

I'd like to design a circle (Disk) with a matrix of voids (Circles?) inside (as in the attached
circle_with_voids
image).

Is it possible using gsdCAD 0.4.5? Should I try the development version, which supports boolean operators?

Thanks.

Python v3.x support

From the last commits, looks like you guys were already thinking about this, but v3 support would be nice. Dunno about the core, but the installer seems to need some tweaks to make it compatible (in git_version.py, for example, there is a print call that breaks in v3)

Changing Resolution of Layout

How do you change the resolution of the output gds file? I know the default is 1nm, but would like to modify it. Sorry if its not the right forum for this question, but there isn't really community I know of for gdsCAD to discuss such things.

TypeError: 'numpy.ndarray' object is not callable

Hello guys,
I have started using this package recently.
I was trying to get the bounding_box for my layout using following lines of code

cell_info = core.GdsImport("/home/ubuntu/GDSCAD_PACKAGE/gdsCAD-0.4.5/bitcell_t1.gds")
cell_points = cell_info.bounding_box()

This gives me the following error:
Traceback (most recent call last):
File "checkGDS.py", line 24, in
cell_points = cell_info.bounding_box()
TypeError: 'numpy.ndarray' object is not callable

Plz suggest how to fix this.

error when using .show after a GdsImport

amarks = core.GdsImport(myfile)
print "import correctly"
amarks.show()
the import apparently works, although the .show has an error. I attach traceback:
import correctly
Traceback (most recent call last):
File "gds_tests.py", line 11, in
amarks.show()
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 91, in _show
artists=self.artist()
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1374, in artist
artists += c.artist()
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 1692, in artist
art+=e.artist()
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 471, in artist
return [matplotlib.patches.Polygon(self.points, closed=True, lw=0, **self._layer_properties(self.layer))]
File "/usr/local/lib/python2.7/dist-packages/gdsCAD-0.5.0-py2.7.egg/gdsCAD/core.py", line 183, in _layer_properties
colors += matplotlib.cm.gist_ncar(np.linspace(0.98, 0, 15))
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S32') dtype('S32') dtype('S32')

gdsImport ignores last point of Boundary

The import scheme should load the last (closing) point of a boundary. The closing point is now added explicitly on Boundary creation, so all _points lists include the closing point. The import function should do the same.

GdsImport does not support texttype

Is it correct that GdsImport does not currently support texttype?
I see in the code some commented out lines that refer to texttype.
The texttype is used in all chip layouts.
Would supporting texttype be something relatively easy to add?
Thanks,
-Tom

shapely.MultiPolygon does not support overlapping geometry

This is an issue since MultiPolygon is used to represent Elements as shapely objects.

>>>d1 = shapes.Disk((10,0), 15)
>>>d2 = shapes.Disk((-10,0), 15)
>>>d1.shape.is_valid
True
>>>e = core.Elements([d1,d2])
>>>e.shape.is_valid
False

Further boolean operations on e will fail.

Installtion problem in py38 enviroment with git: get_version()

Hello Developers, I met a problem when I want to install gdsCAD in py38 environment. Here is the error I got, can you help me sort it out? Thanks a lot for your time.

(base) C:\Users\87490\Downloads\gdsCAD-master>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from git_version import sdist, get_version
  File "C:\Users\87490\Downloads\gdsCAD-master\git_version.py", line 107
    print get_version()
          ^
SyntaxError: invalid syntax

global name '_incomplete' is not defined

in gdsCAD version 0.4.5, in core.py I get an error when using GdsImport on a particular .gds file.

NameError: global name '_incomplete' is not defined

here is the code where the error occurrs (around line 2174):

def _create_reference(**kwargs):
    kwargs['origin'] = kwargs.pop('xy')
    ref = CellReference(**kwargs)
    if not isinstance(ref.ref_cell, Cell):
        _incomplete.append(ref)
    return ref

_incomplete is initialized in GdsImport as an empty list [] but it's outside the scope of where _create_reference is defined. It is also used in _create_array, and would probably generate the same error when executed.

I have tried out-commenting the if block in _create_reference but then I get errors later on because ref.ref_cell is a string instead of a Cell object.

edit:
I fixed this to some extent by declaring _incomplete as a global variable in the core.py module. However now when GdsImprt tries to resolve the references, it looks up the string value of ref.ref_cell in cell_dict, which again is not defined (around line 2041).

When I am installing this, it is showing error.

Here is the log of my system. please someone help. I am new in Linux.

hegder@hegder-Inspiron-3543:/Downloads/gdsCAD-master$ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 10, in
version = get_version(),
File "/home/hegder/Downloads/gdsCAD-master/git_version.py", line 100, in get_version
raise ValueError("Cannot find the version number!")
ValueError: Cannot find the version number!
hegder@hegder-Inspiron-3543:
/Downloads/gdsCAD-master$

Performance issue with Python 3.8

I was using gdsCAD to generate layouts for lithography. There will be typically hundreds of thousands of GDS elements in one layout. When I was using gdaCAD for Python2 I never had any trouble creating layouts with up to million elements(I also use cellArray feature and translate feature to reduce number of elements whenever possible). It used to take about 5 minutes to write a layout with approx 1 million elements.

But now, even with a few hundred thousand elements, the system seems to hang and never recover and it never produces the final gds file. Has anyone come across this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.