def parse_pin(self, pin): """ Extract a pin of a body. """ pin_number = pin.get('pin_number') p1 = self.parse_point(pin.get('p1')) p2 = self.parse_point(pin.get('p2')) parsed_pin = Pin(pin_number, p1, p2) if pin.get('label') is not None: parsed_pin.label = self.parse_label(pin.get('label')) parsed_pin.styles = pin.get('styles') or {} return parsed_pin
def parse_pin(self, pin): """ Extract a pin of a body. """ pin_number = pin.get("pin_number") p1 = self.parse_point(pin.get("p1")) p2 = self.parse_point(pin.get("p2")) parsed_pin = Pin(pin_number, p1, p2) if pin.get("label") is not None: parsed_pin.label = self.parse_label(pin.get("label")) parsed_pin.styles = pin.get("styles") or {} return parsed_pin
def parse_pin(self, args): """ Returns a parsed pin. """ # Pin declaration, seems to only be done once per pin pid, x1, y1, x0, y0, _rot, _side, _inv = [int(a) for a in args.split()] # _rot and _side are not needed, because the x-y data tells us what we # need to know. _inv is used to draw the little inverted signal cirles. thispin = Pin(pid, (x0, y0), (x1, y1)) subdata = self.sub_nodes(['L']) if len(subdata['label']) > 0: # I suppose if there's more than one label, just go with the first thispin.label = subdata['label'][0] return ('pin', thispin)
def parse_pin(self, args): """ Returns a parsed pin. """ # Pin declaration, seems to only be done once per pin pid, xe, ye, xb, yb, rot, side, inv = [int(a) for a in args.split()] thispin = Pin(pid, (xb, yb), (xe, ye)) subdata = defaultdict(list) for phrase in self.stream: cmd, _sep, args = phrase.partition(' ') if cmd not in ('L'): self.stream.push(phrase) break k, v = self.parsenode(cmd)(args) subdata[k].append(v) if len(subdata['label']) > 0: # I suppose if there's more than one label, just go with the first thispin.label = subdata['label'][0] return ('pin', thispin)