예제 #1
0
    def _get_solid_arc( self, center, R, width, alpha_start, alpha_end, n_inner, n_outer ):
        pts = []
#        print(alpha_start/pi, alpha_end/pi, cos( alpha_start ), cos( alpha_end ),
#                         sin(alpha_start), sin(alpha_end))
                         
        if alpha_end > alpha_start:
            alpha_start = alpha_start - 1e-3 
            alpha_end = alpha_end + 1e-3
        else:
            alpha_start = alpha_start + 1e-3
            alpha_end = alpha_end - 1e-3
        
        d_alpha_inner = (alpha_end - alpha_start)/(n_inner - 1)
        d_alpha_outer = -d_alpha_inner
        
        
#        print("Center:", center)
        
        for i in range(0, n_inner):
            alpha = alpha_start + d_alpha_inner*i
            pts.append(center + DPoint(cos(alpha), sin(alpha))*(R - width/2))
        for i in range(0, n_outer):
            alpha = alpha_end + d_alpha_outer*i
            pts.append(center + DPoint(cos(alpha), sin(alpha))*(R + width/2))
#        print("Points:", pts[:n_inner],"\n       ", pts[n_inner:], "\n")
        return DSimplePolygon(pts)
예제 #2
0
 def init_regions(self):
     ext_start = self._r
     ext_end = self._r
     shps = [self._width, ext_start, ext_end]
     kolb = DPath([DPoint(), DPoint() + self._vec], *shps, True)
     self.metal_region.insert(kolb)
     self.connections.extend([DPoint(0, 0), DPoint() + self._vec])
     self.angle_connections.extend([0, 0])
예제 #3
0
 def init_primitives( self ):
         self.cop1 = CPW( self.Z0.width, self.Z0.gap, DPoint(0,0), DPoint( self.L1,0 ) )
         self.arc1 = CPW_arc( self.Z0, self.cop1.end, -self.r, -pi )
         self.cop2 = CPW( self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end - DPoint( self.L2,0 ) )
         self.arc2 = CPW_arc( self.Z0, self.cop2.end, -self.r, pi )
         
         self.connections = [self.cop1.start,self.arc2.end]
         self.angle_connections = [self.cop1.alpha_start,self.arc2.alpha_end]
         self.primitives = {"cop1":self.cop1,"arc1":self.arc1,"cop2":self.cop2,"arc2":self.arc2}
예제 #4
0
 def init_primitives( self ):
     self.arc1 = CPW_arc( self.Z0, DPoint(0,0), self.R1, pi/4 )
     self.cop1 = CPW( self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end + DPoint( sin(pi/4), sin(pi/4) )*self.L1 )
     self.arc2 = CPW_arc( self.Z0, self.cop1.end, self.R2, pi/4, trans_in=DCplxTrans( 1,45,False,0,0 ) )
     self.cop2 = CPW( self.Z0.width, self.Z0.gap,  self.arc2.end, self.arc2.end + DPoint( 0,self.L2 ) )
     
     self.connections = [self.arc1.start,self.cop2.end]
     self.angle_connections = [self.arc1.alpha_start, self.cop2.alpha_end]
     
     self.primitives = {"arc1":self.arc1, "cop1":self.cop1, "arc2":self.arc2, "cop2":self.cop2}
예제 #5
0
    def _update_alpha(self, dCplxTrans):
        if (dCplxTrans is not None):
            dCplxTrans_temp = dCplxTrans.dup()
            dCplxTrans_temp.disp = DPoint(0, 0)

            for i, alpha in enumerate(self.angle_connections):
                poly_temp = DSimplePolygon([DPoint(cos(alpha), sin(alpha))])
                poly_temp.transform(dCplxTrans_temp)
                pt = poly_temp.point(0)
                self.angle_connections[i] = atan2(pt.y, pt.x)
예제 #6
0
class CHIP:
    dx = 10.1e6
    dy = 5.1e6
    L1 = 2466721
    gap = 150e3
    width = 260e3
    b = 2*gap + width
    origin = DPoint( 0,0 )
    box = klayout.db.DBox( origin, origin + DPoint( dx,dy ) )
    # only 4 connections programmed by now
    connections = [box.p1 + DPoint( L1 + b/2,0 ), box.p1 + DPoint( dx - (L1+b/2),0 ), box.p2 - DPoint( L1 + b/2,0 ),  box.p1 + DPoint( L1 + b/2, dy )]
예제 #7
0
 def init_regions(self):
     origin = DPoint(0, 0)
     hor_box = DBox(origin - DPoint(self.l / 2, self.t / 2),
                    DPoint(self.l / 2, self.t / 2))
     vert_box = DBox(origin - DPoint(self.t / 2, self.l / 2),
                     DPoint(self.t / 2, self.l / 2))
     cross = (Region(hor_box) + Region(vert_box)).merge()
     if self.inverse:
         self.empty_region.insert(cross)
     else:
         self.metal_region.insert(cross)
예제 #8
0
 def init_regions(self):
     origin = DPoint(0, 0)
     p1 = origin + DPoint(self.a, 0)
     p2 = p1 + DPoint(0, self.b)
     p3 = p2 + DPoint(-self.a, 0)
     pts_arr = [origin, p1, p2, p3]
     if self.inverse:
         self.empty_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(pts_arr)))
     else:
         self.metal_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(pts_arr)))
예제 #9
0
    def init_primitives(self):
        origin = DPoint(0, 0)
        #erased line params
        Z = CPWParameters(0, self.s / 2)
        shapes = ''
        angles = []
        lengths = []
        # placing circle r_out with dr clearance from ground polygon
        self.empt_circle = Circle(origin,
                                  self.r_out,
                                  n_pts=self.n_pts,
                                  solid=False)
        self.in_circle = Circle(origin,
                                self.r_out - self.dr,
                                n_pts=self.n_pts,
                                solid=True)
        self.empt_circle.empty_region -= self.in_circle.metal_region
        self.primitives["empt_circle"] = self.empt_circle
        self.primitives["in_circle"] = self.in_circle

        self.RL_start = origin + DPoint(-self.in_circle.r, 0)
        shapes += 'LRL'
        angles.extend([self.alpha])
        lengths.extend([self.delta, self.L0])
        #rl_path_start = CPW_RL_Path(self.RL_start, "LRLR", Z, self.r_curve, [self.delta, self.L0], [self.alpha,-self.alpha] )
        #self.primitives["rl_start"] = rl_path_start

        # intermidiate RLRs
        for i in range(self.n_segments):
            if (i % 2 == 1):
                m_x = -1
            else:
                m_x = 1
            shapes += 'RL'
            angles.extend([-2 * m_x * self.alpha])
            lengths.extend([self.L1])
            # prev_path = list(self.primitives.values())[-1]
            # rl_path_p = CPW_RL_Path( prev_path.end, "RLR", Z, self.r_curve, [self.L1], [-m_x*self.alpha,m_x*self.alpha])
            # self.primitives["rl_path_" + str(i)] = rl_path_p
            # ending RLR
        if (self.n_segments % 2 == 1):
            m_x = 1
        else:
            m_x = -1
        shapes += 'RLRL'
        angles.extend([2 * m_x * self.alpha, -m_x * self.alpha])
        lengths.extend([self.L0, self.delta])
        cut = CPW_RL_Path(self.RL_start, shapes, Z, self.r_curve, lengths,
                          angles)
        # prev_path = list(self.primitives.values())[-1]
        # rl_path_end = CPW_RL_Path( prev_path.end, "RLRL", Z, self.r_curve, [self.L0, self.delta], [m_x*self.alpha,-m_x*self.alpha])
        self.primitives["cut"] = cut
예제 #10
0
 def init_primitives( self ):
     name = "coil0"
     setattr(self, name, Coil_air_bridges(self.Z0, DPoint(0,0), self.L_coupling, self.r, self.L1, self.N_air_bridges) )
     self.primitives[name] = getattr( self, name )      
     # coils filling        
     for i in range(self.N):
         name = "coil" + str(i+1)
         setattr( self, name, Coil_air_bridges( self.Z0, DPoint( -self.L1 + self.L_coupling, 
                 -(i+1)*(4*self.r) ), self.L1, self.r, self.L1, self.N_air_bridges) )
         self.primitives[name] = getattr( self, name )
            
     self.connections = [DPoint(0,0), self.primitives["coil" + str(self.N)].end]
     self.angle_connections = [0,self.primitives["coil" + str(self.N)].alpha_end]
예제 #11
0
def test_basic_usage():
    pc = ParamContainer()

    pc.add_param(PCellParameter(name="orange", default=1))
    assert pc.orange == 1

    pc.orange = 2
    assert pc.orange == 2
    pc["orange"] == 2  # it is also accessible as a dictionary

    with pytest.raises(TypeError, match="Cannot set 'orange' to 'blah'"):
        pc.orange = "blah"

    with pytest.raises(
        RuntimeError, match="Unkown parameter type, cannot determine from default."
    ):
        pc.add_param(PCellParameter(name="apple"))
    pc.add_param(PCellParameter(name="apple", type=int))

    with pytest.raises(TypeError, match="Cannot set 'apple' to 'one'"):
        pc.apple = "one"

    pc.add_param(PCellParameter(name="strawberry", default=DPoint(0, 0)))
    assert type(pc.strawberry) == DPoint

    with pytest.raises(TypeError, match="Cannot set 'strawberry' to 'test'"):
        pc.strawberry = "test"
예제 #12
0
 def init_primitives( self ):
         self.cop1 = Air_bridges(self.N_air_bridges, self.Z0.width, self.Z0.gap, DPoint(0,0), DPoint( self.L1,0 ) )
         self.cop2 = Air_bridges(self.N_air_bridges, self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end - DPoint( self.L2,0 ))
         
         self.connections = [self.cop1.start,self.arc2.end]
         self.angle_connections = [self.cop1.alpha_start,self.arc2.alpha_end]
         self.primitives = {"cop1":self.cop1,"arc1":self.arc1,"cop2":self.cop2,"arc2":self.arc2}
예제 #13
0
    def __init__(self, Z0, start, params, gndWidth=-1, trans_in=None):
        if (len(params) != 11):
            raise LookupError
            return None

        self.params = params
        self.L1 = params[0]
        self.L2 = params[1]
        self.L3 = params[2]
        self.L4 = params[3]
        self.L5 = params[4]
        self.R1 = params[5]
        self.R2 = params[6]
        self.R3 = params[7]
        self.R4 = params[8]
        self.gamma1 = params[9]
        self.gamma2 = params[10]
        self.width = Z0.width
        self.gap = Z0.gap
        self.gndWidth = gndWidth
        self.dr = DPoint(
            2 * (self.L1 + self.L2 * cos(self.gamma1) + self.L3 +
                 (self.R1 + self.R2) * sin(self.gamma1) +
                 (self.R3 + self.R4) * sin(self.gamma2) +
                 +self.L4 * cos(self.gamma2) + self.L5 / 2), 0)
        self.L = 2 * (self.L1 + self.L2 + self.L3 +
                      (self.R1 + self.R2) * self.gamma1 +
                      (self.R3 + self.R4) * self.gamma2 + self.L4 +
                      self.L5 / 2)
        super(BranchLine_finger2, self).__init__(start, trans_in)
        self.start = self.connections[0]
        self.end = self.connections[1]
        self.dr = self.end - self.start
        self.alpha_start = self.angle_connections[0]
        self.alpha_end = self.angle_connections[1]
예제 #14
0
    def __init__(self, Z0, start, params, gndWidth=-1, trans_in=None):
        if (len(params) != 6):
            raise LookupError
            return None

        self.params = params
        self.L1 = params[0]
        self.L2 = params[1]
        self.L3 = params[2]
        self.R1 = params[3]
        self.R2 = params[4]
        self.gamma = params[5]
        self.width = Z0.width
        self.gap = Z0.gap
        self.gndWidth = gndWidth
        self.dr = DPoint(
            2 * (self.L1 + self.L2 * cos(self.gamma) + self.L3 / 2 +
                 (self.R1 + self.R2) * sin(self.gamma)), 0)
        self.L = 2 * (self.L1 + self.L2 + self.L3 / 2 +
                      (self.R1 + self.R2) * self.gamma)
        super(BranchLine_finger, self).__init__(start, trans_in)
        self.start = self.connections[0]
        self.end = self.connections[1]
        self.dr = self.end - self.start
        self.alpha_start = self.angle_connections[0]
        self.alpha_end = self.angle_connections[1]
예제 #15
0
 def init_primitives(self):
     origin = DPoint(0, 0)
     total_neck_length =  pi * self.R / 2 + self.neck if not self.no_neck else 0
     meander_length = (self.len - self.cpl_L - 2 * (1 + self.N) * pi * self.R -
                      3 * self.R - total_neck_length - self.extra_neck_length) / (2 * self.N + 3 / 2)
     shape = "LRL" + self.N * "RLRL" + "RL" + ("RL" if not self.no_neck else "")
     segment_lengths = [self.cpl_L, meander_length] + 2 * self.N * [meander_length] + 
                     [meander_length + 3 * self.R + self.extra_neck_length] + ([self.neck] if not self.no_neck else [])
예제 #16
0
    def _get_solid_arc(self, center, R, width, alpha_start, alpha_end, n_inner,
                       n_outer):
        pts = []

        d_alpha_inner = (alpha_end - alpha_start) / (n_inner - 1)
        d_alpha_outer = -(alpha_end - alpha_start) / (n_outer - 1)

        for i in range(0, n_inner):
            alpha = alpha_start + d_alpha_inner * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) *
                       (R - width / 2))
        for i in range(0, n_outer):
            alpha = alpha_end + d_alpha_outer * i
            pts.append(center + DPoint(cos(alpha), sin(alpha)) *
                       (R + width / 2))

        return DSimplePolygon(pts)
예제 #17
0
 def init_primitives( self ):
     
     if self.initial_direction == "down":   
         self.cop1 = CPW( self.Z0.width, self.Z0.gap, DPoint(0,0), DPoint(0, -self.L1 ) )
         self.arc1 = CPW_arc_2( self.Z0, self.cop1.end, -self.r, pi, 0 )
         self.cop2 = CPW( self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end + DPoint( 0, self.L2 ) )
         self.arc2 = CPW_arc_2( self.Z0, self.cop2.end, -self.r, -pi, 0 )
     
     else:
         self.cop1 = CPW( self.Z0.width, self.Z0.gap, DPoint(0,0), DPoint(0, +self.L1 ) )
         self.arc1 = CPW_arc_2( self.Z0, self.cop1.end, -self.r, -pi, 0 )
         self.cop2 = CPW( self.Z0.width, self.Z0.gap, self.arc1.end, self.arc1.end + DPoint( 0,- self.L2 ) )
         self.arc2 = CPW_arc_2( self.Z0, self.cop2.end, -self.r, pi, 0 )
         
     self.connections = [self.cop1.start,self.arc2.end]
     self.angle_connections = [self.cop1.alpha_start,self.arc2.alpha_end]
     self.primitives = {"cop1":self.cop1,"arc1":self.arc1,"cop2":self.cop2,"arc2":self.arc2}
예제 #18
0
def cell_insert_cell(cell: Cell, other_cell: Cell, origin: DPoint,
                     angle: float):
    mag = 1
    rot = angle
    mirrx = False
    u = DPoint(origin)
    trans = kdb.DCplxTrans(mag, rot, mirrx, u)

    cell.insert(kdb.DCellInstArray(other_cell.cell_index(), trans))
    return cell
예제 #19
0
def cell_insert_cell(cell: Type[Cell], other_cell: Type[Cell],
                     origin: Type[DPoint], angle_deg: float) -> Type[Cell]:
    mag = 1
    rot = angle_deg
    mirrx = False
    u = DPoint(origin)
    trans = kdb.DCplxTrans(mag, rot, mirrx, u)

    cell.insert(kdb.DCellInstArray(other_cell.cell_index(), trans))
    return cell
예제 #20
0
    def init_regions(self):
        d_alpha = (self.alpha_end - self.alpha_start) / (self.n_pts - 1)
        alphas = [(self.alpha_start + d_alpha * i)
                  for i in range(0, self.n_pts)]
        dpts_arr = [
            DPoint(self.r * cos(alpha), self.r * sin(alpha))
            for alpha in alphas
        ]
        dpts_arr.append(DPoint(0, 0))

        if (self.solid == True):
            self.metal_region.insert(SimplePolygon().from_dpoly(
                DSimplePolygon(dpts_arr)))
        else:
            self.empty_region.insert(SimplePolygon().from_dpoly(
                DSimplePolygon(dpts_arr)))
        self.connections.extend(
            [self._center, self._center + DVector(0, -self.r)])
        self.angle_connections.extend([0, 0])
예제 #21
0
 def init_primitives(self):
     L = abs(abs(self.dr.y) - abs(self.dr.x))
     r = min(abs(self.dr.y), abs(self.dr.x))
     if(abs(self.dr.y) > abs(self.dr.x)):
         self.arc1 = CPW_arc(self.Z0, DPoint(0, 0), copysign(
             r, self.dr.y), copysign(pi/2, self.dr.x*self.dr.y))
         self.cop1 = CPW(self.Z0.width, self.Z0.gap, self.arc1.end,
                         self.arc1.end + DPoint(0, copysign(L, self.dr.y)))
         self.connections = [self.arc1.start, self.cop1.end]
         self.angle_connections = [self.arc1.alpha_start, self.cop1.alpha_end]
     else:
         self.cop1 = CPW(self.Z0.width, self.Z0.gap, DPoint(
             0, 0), DPoint(0, 0) + DPoint(copysign(L, self.dr.x), 0))
         self.arc1 = CPW_arc(self.Z0, self.cop1.end, copysign(
             r, self.dr.y), copysign(pi/2, self.dr.y*self.dr.x))
         self.connections = [ self.cop1.start, self.arc1.end]
         self.angle_connections = [ self.cop1.alpha_start,self.arc1.alpha_end]
         
     self.primitives = {"arc1": self.arc1, "cop1": self.cop1}
예제 #22
0
 def _make_polygon( self, length, w, d, f, overlapping ):
     polygon = DSimplePolygon
     p1 = DPoint(0,0)
     p2 = p1 + DPoint( length,0 )
     p3 = p2 + DPoint( 0, w )
     p4 = p3 - DPoint( overlapping,0 )
     p5 = p4 - DPoint( 0, d )
     p6 = p5 - DPoint( f,0 )
     p7 = p6 + DPoint( 0, d )
     p8 = p1 + DPoint( 0,w )
     
     polygon = DSimplePolygon( [p1,p2,p3,p4,p5,p6,p7,p8] )
     return polygon
예제 #23
0
 def init_primitives( self ):
     name = "coil0"
     setattr(self, name, Coil_type_1(self.Z0, DPoint(0,0), self.L_coupling, self.r, self.L1) )
     self.primitives[name] = getattr( self, name )      
     # coils filling        
     for i in range(self.N):
         name = "coil" + str(i+1)
         setattr( self, name, Coil_type_1( self.Z0, DPoint( -self.L1 + self.L_coupling, -(i+1)*(4*self.r) ), self.L1, self.r, self.L1 ) )
         self.primitives[name] = getattr( self, name )
         
     # draw the "tail"
     self.arc_tail = CPW_arc( self.Z0, self.primitives["coil" + str(self.N)].end, -self.L1/2, -pi/2 )
     self.cop_tail = CPW( self.Z0.width, self.Z0.gap, self.arc_tail.end, self.arc_tail.end - DPoint( 0,self.L2 ) )
     self.cop_open_end = CPW( 0, self.Z0.b/2, self.cop_tail.end, self.cop_tail.end - DPoint(0,self.Z0.b) )
     self.primitives["arc_tail"] = self.arc_tail
     self.primitives["cop_tail"] = self.cop_tail
     self.primitives["cop_open_end"] = self.cop_open_end
     
     self.connections = [DPoint(0,0), self.cop_tail.end]
     self.angle_connections = [0,self.cop_tail.alpha_end]
예제 #24
0
 def __init__(self, width=None, gap=None, start=DPoint(0,0), end=DPoint(0,0), gndWidth=-1, trans_in=None, cpw_params=None ):
     if( cpw_params  is None ):
         self.width = width
         self.gap = gap
         self.b = 2*gap + width
     else:
         self.width = cpw_params.width
         self.gap = cpw_params.gap
         self.b = 2*self.gap + self.width
         
     self.gndWidth = gndWidth
     self.end = end
     self.start = start
     self.dr = end - start
     super().__init__( start, trans_in )
     self.start = self.connections[0]
     self.end = self.connections[1]
     self.dr = self.end - self.start
     self.alpha_start = self.angle_connections[0]
     self.alpha_end = self.angle_connections[1]
예제 #25
0
    def _init_regions_trans(self):
        self.init_regions()  # must be implemented in every subclass

        dr_origin = DSimplePolygon([DPoint(0, 0)])
        if (self.DCplxTrans_init is not None):
            # constructor trans displacement
            dCplxTrans_temp = DCplxTrans(1, 0, False,
                                         self.DCplxTrans_init.disp)
            self.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)

            # rest of the constructor trans functions
            dCplxTrans_temp = self.DCplxTrans_init.dup()
            dCplxTrans_temp.disp = DPoint(0, 0)
            self.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)

        # translation to the old origin (self.connections are already contain proper values)
        self.make_trans(DCplxTrans(1, 0, False,
                                   self.origin))  # move to the origin
        self.origin += dr_origin.point(0)
예제 #26
0
 def init_regions(self):
     self.connections = [DPoint(0, 0), self.dr,- self.R * DPoint( cos(self.alpha_start), sin(self.alpha_start) ) ]
     self.angle_connections = [self.alpha_start, self.alpha_end]
     self.start = DPoint(0, 0)
     self.end = self.dr
     self.center =  self.start - self.R * DPoint( cos(self.alpha_start), sin(self.alpha_start) )
     
     n_inner = 200
     n_outer = 200
     
     metal_arc = self._get_solid_arc(self.center, self.R, self.width, 
                 self.alpha_start , self.alpha_end , n_inner, n_outer)  
     self.connection_edges = [n_inner+n_outer,n_inner]
     
     empty_arc1 = self._get_solid_arc(self.center, self.R - (self.width + self.gap)/2, 
                 self.gap, self.alpha_start, self.alpha_end, n_inner, n_outer)  
     
     empty_arc2 = self._get_solid_arc(self.center, self.R + (self.width + self.gap)/2, 
                 self.gap, self.alpha_start, self.alpha_end, n_inner, n_outer)  
     
     self.metal_region.insert(SimplePolygon().from_dpoly(metal_arc))
     self.empty_region.insert(SimplePolygon().from_dpoly(empty_arc1))
     self.empty_region.insert(SimplePolygon().from_dpoly(empty_arc2))
예제 #27
0
    def __init__(self, Z0, start, R, delta_alpha, gndWidth = -1, trans_in=None ):
        self.R = R
        self.start = start
        self.center = start + DPoint( 0,self.R )
        self.end = self.center + DPoint( sin(delta_alpha), -cos(delta_alpha) )*self.R
        self.dr = self.end - self.start
        
        self.width = Z0.width
        self.gap = Z0.gap
        
        self.delta_alpha = delta_alpha
        self.alpha_start = 0
        self.alpha_end = self.delta_alpha

        super().__init__( start, trans_in )
        self.start = self.connections[0]
        self.end = self.connections[1]
        self.center = self.connections[2]
        
        #print("End coords:", self.dr, self.end)
        
        self.alpha_start = self.angle_connections[0]
        self.alpha_end = self.angle_connections[1]
예제 #28
0
 def init_regions(self):
     dpts_arr = [
         DPoint(self.r * cos(2 * pi * i / self.n_pts + self._offset_angle),
                self.r * sin(2 * pi * i / self.n_pts + self._offset_angle))
         for i in range(0, self.n_pts)
     ]
     if (self.solid == True):
         self.metal_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
     else:
         self.empty_region.insert(SimplePolygon().from_dpoly(
             DSimplePolygon(dpts_arr)))
     self.connections.extend(
         [self.center, self.center + DVector(0, -self.r)])
     self.angle_connections.extend([0, 0])
예제 #29
0
    def init_regions(self):
        origin = DPoint(0, 0)
        w = self.out_a / 2 - self.in_a / 2

        rec1 = Rectangle(origin, w, w)
        p2 = origin + DPoint(self.in_a + w, 0)
        rec2 = Rectangle(p2, w, w)
        p3 = origin + DPoint(self.in_a + w, self.in_a + w)
        rec3 = Rectangle(p3, w, w)
        p4 = origin + DPoint(0, self.in_a + w)
        rec4 = Rectangle(p4, w, w)

        tmp_reg = Region()

        rec1.place(tmp_reg)
        rec2.place(tmp_reg)
        rec3.place(tmp_reg)
        rec4.place(tmp_reg)

        rec = Rectangle(origin, self.out_a, self.out_a)
        rec.place(self.metal_region)

        self.empty_region = tmp_reg
        self.connections = [self.center]
예제 #30
0
    def _init_primitives_trans(self):
        self.init_primitives()  # must be implemented in every subclass
        dr_origin = DSimplePolygon([DPoint(0, 0)])
        if (self.DCplxTrans_init is not None):
            # constructor trans displacement
            dCplxTrans_temp = DCplxTrans(1, 0, False,
                                         self.DCplxTrans_init.disp)
            self.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)

            # rest of the constructor trans functions
            dCplxTrans_temp = self.DCplxTrans_init.dup()
            dCplxTrans_temp.disp = DPoint(0, 0)
            self.make_trans(dCplxTrans_temp)
            dr_origin.transform(dCplxTrans_temp)

        dCplxTrans_temp = DCplxTrans(1, 0, False, self.origin)
        self.make_trans(dCplxTrans_temp)  #move to the origin
        self.origin += dr_origin.point(0)

        # FOLLOWING CYCLE GIVES WRONG INFO ABOUT FILLED AND ERASED AREAS
        for element in self.primitives.values():
            self.metal_region += element.metal_region
            self.empty_region += element.empty_region