How to use the klayout.db.DPoint.new function in klayout

To help you get started, we’ve selected a few klayout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonpry / Pill / runtime.py View on Github external
inst = rodsByName[s[0]]
     dbox = None
     got_shape=False
     for e in s:
        e = cmap[e]
        cell = e['_shapes'][0]
        if isinstance(cell,db.Instance):
           cmap = rod_map[cell.cell.basic_name()]
           tx.append(cell.dtrans)
        else:
           got_shape=True
        dbox = e['_shapes'][0].dbbox()
     #accumulate the transforms
     if not got_shape:
        print(dbox)
        dbox.p1 = db.DPoint.new(0,0) #If only have a cell, then all stuff relative to origin
        dbox.p2 = dbox.p1
     total = db.DTrans()
     for t in tx:
        total = total * t
     if not dbox:
        write()
        exit()
     dbox = total.trans(dbox)
     obj = createObj(dbox=dbox)
     obj['_slaves'].append(inst)
     inst['_masters'].append(obj)
     obj['_transform'] = total
     rodsByName[i] = obj
     return obj
   write()
   assert(False)
github jonpry / Pill / runtime.py View on Github external
def dbCreatePolygon(cv,layer,pts):
   print("dbCreatePolygon: \"" + str(cv) + "\", " + str(layer))
   l1 = maplayer(layer)
   assert(l1 >= 0)  
   dpts = []
   for p in pts:
      dpts.append(db.DPoint.new(p[0],p[1]))  
   r = db.DPolygon.new(dpts)
   r = top.shapes(l1).insert(r)
github jonpry / Pill / runtime.py View on Github external
def rodCreatePath(layer,width,pts,termIOType=None,termName=None,pin=None,subRect=None,name="",justification="center"):
  subs = []
  print("createPath: " + str(pts) + ", layer: " + str(layer) + ", sub: " + str(subRect) + ", just: " + justification)

  r = None
  if (layer[0],layer[1]) in layermap:
      l1 = maplayer(layer)
      assert(l1 >= 0)
      dpts = []
      for p in pts:
        dpts.append(db.DPoint.new(p[0],p[1]))  
      r = geom.Path(dpts,width,justification)
      r = top.shapes(l1).insert(r)
      subs.append(r)

  if subRect:
    assert(len(pts) == 2)

    assert(env['distributeSingleSubRect'])
    assert(len(subRect)==1)
    for s in subRect:
       n,space = maxNinN(width+s['beginOffset']+s['endOffset'],width,s['space'])
       s['elementsX'] = n
       s['spaceX'] = space
       #s['pin'] = pin
       sub = rodCreateRect(**s)
       if n==1: