def make_charge_line(self): """Creates the charge line if the user has charge line option to TRUE. """ # Grab option values name = 'Charge_Line' p = self.p cl_arm = draw.box(0, 0, -p.cl_width, p.cl_length) cl_cpw = draw.box(0, 0, -8 * p.cl_width, p.cl_width) cl_metal = draw.cascaded_union([cl_arm, cl_cpw]) cl_etcher = draw.buffer(cl_metal, p.cl_gap) port_line = draw.LineString([(-8 * p.cl_width, 0), (-8 * p.cl_width, p.cl_width)]) polys = [cl_metal, cl_etcher, port_line] # Move the charge line to the side user requested cl_rotate = 0 if (abs(p.cl_pocket_edge) > 135) or (abs(p.cl_pocket_edge) < 45): polys = draw.translate( polys, -(p.pocket_width / 2 + p.cl_ground_gap + p.cl_gap), p.cl_off_center) if (abs(p.cl_pocket_edge) > 135): cl_rotate = 180 else: polys = draw.translate( polys, -(p.pocket_height / 2 + p.cl_ground_gap + p.cl_gap), p.cl_off_center) cl_rotate = 90 if (p.cl_pocket_edge < 0): cl_rotate = -90 # Rotate it to the pockets orientation polys = draw.rotate(polys, p.orientation + cl_rotate, origin=(0, 0)) # Move to the final position polys = draw.translate(polys, p.pos_x, p.pos_y) [cl_metal, cl_etcher, port_line] = polys # Generating pins points = list(draw.shapely.geometry.shape(port_line).coords) self.add_pin(name, points, p.cl_width) # Adding to qgeometry table self.add_qgeometry('poly', dict(cl_metal=cl_metal)) self.add_qgeometry('poly', dict(cl_etcher=cl_etcher), subtract=True)
def make(self): """Build the component.""" p = self.p # p for parsed parameters. Access to the parsed options. port_line = draw.LineString([(0, -p.width / 2), (0, p.width / 2)]) open_termination = draw.box(0, -(p.width / 2 + p.gap), p.termination_gap, (p.width / 2 + p.gap)) # Rotates and translates the connector polygons (and temporary port_line) polys = [open_termination, port_line] polys = draw.rotate(polys, p.orientation, origin=(0, 0)) polys = draw.translate(polys, p.pos_x, p.pos_y) [open_termination, port_line] = polys # Subtracts out ground plane on the layer its on self.add_qgeometry('poly', {'open_to_ground': open_termination}, subtract=True, layer=p.layer) # Generates the pins self.add_pin('open', port_line.coords, p.width)
def make_connection_pad(self, name: str): """Makes individual connector pad. Args: name (str) : Name of the connector pad """ # self.p allows us to directly access parsed values (string -> numbers) form the user option p = self.p cross_width = p.cross_width cross_length = p.cross_length cross_gap = p.cross_gap # access to chip name chip = p.chip pc = self.p.connection_pads[name] # parser on connector options c_g = pc.claw_gap c_l = pc.claw_length c_w = pc.claw_width g_s = pc.ground_spacing con_loc = pc.connector_location claw_cpw = draw.box(0, -c_w / 2, -4 * c_w, c_w / 2) if pc.connector_type == 0: # Claw connector t_claw_height = 2*c_g + 2 * c_w + 2*g_s + \ 2*cross_gap + cross_width # temp value claw_base = draw.box(-c_w, -(t_claw_height) / 2, c_l, t_claw_height / 2) claw_subtract = draw.box(0, -t_claw_height / 2 + c_w, c_l, t_claw_height / 2 - c_w) claw_base = claw_base.difference(claw_subtract) connector_arm = draw.shapely.ops.unary_union([claw_base, claw_cpw]) connector_etcher = draw.buffer(connector_arm, c_g) else: connector_arm = claw_cpw connector_etcher = draw.buffer(connector_arm, c_g) # Making the pin for tracking (for easy connect functions). # Done here so as to have the same translations and rotations as the connector. Could # extract from the connector later, but since allowing different connector types, # this seems more straightforward. port_line = draw.LineString([(-4 * c_w, -c_w / 2), (-4 * c_w, c_w / 2)]) claw_rotate = 0 if con_loc > 135: claw_rotate = 180 elif con_loc > 45: claw_rotate = -90 # Rotates and translates the connector polygons (and temporary port_line) polys = [connector_arm, connector_etcher, port_line] polys = draw.translate(polys, -(cross_length + cross_gap + g_s + c_g), 0) polys = draw.rotate(polys, claw_rotate, origin=(0, 0)) polys = draw.rotate(polys, p.orientation, origin=(0, 0)) polys = draw.translate(polys, p.pos_x, p.pos_y) [connector_arm, connector_etcher, port_line] = polys # Generates qgeometry for the connector pads self.add_qgeometry('poly', {f'{name}_connector_arm': connector_arm}, chip=chip) self.add_qgeometry('poly', {f'{name}_connector_etcher': connector_etcher}, subtract=True, chip=chip) self.add_pin(name, port_line.coords, c_w)