def _create_label(self, item): purpose = RDD.PURPOSE.TEXT[item.purpose.symbol + 'T'] layer = PLayer(item.process, purpose) return Label(position=item.midpoint, text=item.name, orientation=item.orientation, layer=layer)
def EdgeSymmetric(width=1, extend=1, process=None, transformation=None): """ """ layer = PLayer(process=process, purpose=RDD.PURPOSE.PORT.INSIDE_EDGE_DISABLED) shape = shapes.BoxShape(width=width, height=2 * extend, center=Coord(0, extend / 4)) return Edge(shape=shape, layer=layer, transformation=transformation)
def _create_arrow(self, item): layer = PLayer(item.process, RDD.PURPOSE.PORT.DIRECTION) w = 0.05 l = 0.6 arrow_shape = shapes.ArrowShape(width=w, length=l, head=l * 0.2) p = Polygon(shape=arrow_shape, layer=layer) T = transformation_from_vector(item) p.transform(T) return p
def _contact_template(self, item): dw = item.length / 2 dl = item.length / 2 layer = PLayer(process=item.process, purpose=item.purpose) p = Box(width=dw, height=dl, layer=layer) T = transformation_from_vector(item) + Rotation( rotation=-90, rotation_center=item.midpoint) p.transform(T) return p
def create_elements(self, elems): layer = PLayer(process=self.process, purpose=RDD.PURPOSE.PORT.INSIDE_EDGE_DISABLED) elems += Box(alias='InsideEdge', width=self.width, height=self.inward_extend, center=Coord(0, self.inward_extend / 2), layer=layer) layer = PLayer(process=self.process, purpose=RDD.PURPOSE.PORT.OUTSIDE_EDGE_DISABLED) elems += Box(alias='OutsideEdge', width=self.width, height=self.outward_extend, center=Coord(0, -self.outward_extend / 2), layer=layer) return elems
def create_edge(self): dw = self.port.width dl = self.port.length / 10 layer = PLayer(process=self.port.process, purpose=self.port.purpose) p = spira.Box(width=dw, height=dl, layer=layer) # T = transformation_from_vector(self.port) + spira.Rotation(-90) T = transformation_from_vector(self.port) + spira.Rotation( rotation=-90, rotation_center=self.port.midpoint) p.transform(T) return p
def create_arrow(self): layer = PLayer(self.port.process, RDD.PURPOSE.PORT.DIRECTION) # w = self.port.length * 3 w = 0.01 # l = 2 # l = self.port.length * 3 l = 0.2 arrow_shape = shapes.ArrowShape(width=w, length=l, head=l * 0.2) p = spira.Polygon(shape=arrow_shape, layer=layer, enable_edges=False) T = transformation_from_vector(self.port) p.transform(T) return p
def create_label(self): # enabled_purposes = (RDD.PURPOSE.PORT.INSIDE_EDGE_ENABLED, RDD.PURPOSE.PORT.OUTSIDE_EDGE_ENABLED) # disabled_purposes = (RDD.PURPOSE.PORT.INSIDE_EDGE_DISABLED, RDD.PURPOSE.PORT.OUTSIDE_EDGE_DISABLED) # if self.port.purpose in enabled_purposes: # layer = PLayer(self.port.process, RDD.PURPOSE.PORT.TEXT_ENABLED) # elif self.port.purpose is disabled_purposes: # layer = PLayer(self.port.process, RDD.PURPOSE.PORT.TEXT_DISABLED) # else: # layer = PLayer(self.port.process, RDD.PURPOSE.TEXT) purpose = RDD.PURPOSE.TEXT[self.port.purpose.symbol + 'T'] layer = PLayer(self.port.process, purpose) return spira.Label(position=self.port.midpoint, text=self.port.name, orientation=self.port.orientation, layer=layer)
def create_elements(self, elems): xpts = list(self.shape.x_coords) ypts = list(self.shape.y_coords) n = len(xpts) xpts.append(xpts[0]) ypts.append(ypts[0]) clockwise = 0 for i in range(0, n): clockwise += ((xpts[i + 1] - xpts[i]) * (ypts[i + 1] + ypts[i])) if self.layer.name == 'BBOX': bbox = True else: bbox = False for i in range(0, n): name = '{}_e{}'.format(self.layer.name, i) x = np.sign(clockwise) * (xpts[i + 1] - xpts[i]) y = np.sign(clockwise) * (ypts[i] - ypts[i + 1]) orientation = (np.arctan2(x, y) * constants.RAD2DEG) + 90 midpoint = [(xpts[i + 1] + xpts[i]) / 2, (ypts[i + 1] + ypts[i]) / 2] width = np.abs( np.sqrt((xpts[i + 1] - xpts[i])**2 + (ypts[i + 1] - ypts[i])**2)) layer = RDD.GDSII.IMPORT_LAYER_MAP[self.layer] extend = RDD[layer.process.symbol].MIN_SIZE T = Rotation(orientation) + Translation(midpoint) layer = PLayer(process=layer.process, purpose=RDD.PURPOSE.PORT.OUTSIDE_EDGE_DISABLED) shape = shapes.BoxShape(width=width, height=extend) # elems += EdgeSymmetric(width=width, extend=extend, process=layer.process, transformation=T) elems += Edge(shape=shape, layer=layer, width=width, extend=extend, transformation=T) return elems
def create_elements(self, elems): shape = self.shape.remove_straight_angles() shape = shape.reverse_points() for i, s in enumerate(shape.segments()): line_shape = Shape(points=s) L = RDD.GDSII.IMPORT_LAYER_MAP[self.layer] width = RDD[L.process.symbol].MIN_SIZE layer = PLayer(process=L.process, purpose=RDD.PURPOSE.PORT.OUTSIDE_EDGE_DISABLED) elems += Edge(shape=[], line_shape=line_shape, layer=layer, internal_pid=self.internal_pid, width=width, transformation=self.transformation) return elems
def EdgeOutside(width=1, extend=1, process=None, purpose=None): """ """ layer = PLayer(process=process, purpose=RDD.PURPOSE.PORT.OUTSIDE_EDGE_DISABLED)
def layer(self): return PLayer(self.process, self.purpose)