def write_card(self, f, size=8, is_double=False): #.. todo:: collapse the IDs if self.n: spoint = list(self.spoint) spoint.sort() card = ['SPOINT'] + collapse_thru(spoint) f.write(print_card_8(card))
def write_card(self, bdf_file, size=8, is_double=False): #.. todo:: collapse the IDs if self.n: spoint = list(self.spoint) spoint.sort() card = ['SPOINT'] + collapse_thru(spoint) bdf_file.write(print_card_8(card))
def __repr__(self): thru_fields = collapse_thru(self.ids) #list_fields = ['SESET', self.seid] cards = [] while 'THRU' in thru_fields: ithru = thru_fields.index('THRU') card = print_card_8(['SESET', self.seid] + thru_fields[ithru - 1:ithru + 2]) cards.append(card) thru_fields = thru_fields[0:ithru - 1] + thru_fields[ithru + 2:] if thru_fields: card = print_card_8(['SESET', self.seid] + thru_fields) cards.append(card) return ''.join(cards)
def __repr__(self): thru_fields = collapse_thru(self.ids) #list_fields = ['SESET', self.seid] cards = [] while 'THRU' in thru_fields: ithru = thru_fields.index('THRU') card = print_card_8(['SESET', self.seid] + thru_fields[ithru - 1:ithru + 2]) cards.append(card) thru_fields = thru_fields[0:ithru - 1]+thru_fields[ithru + 2:] if thru_fields: card = print_card_8(['SESET', self.seid] + thru_fields) cards.append(card) return ''.join(cards)
def __repr__(self): #fields_blocks = [ #'SET3', #[[self.sid, self.desc], False], # these are not all integers #[self.SetIDs(), True], # these are all integers #] #print(fields_blocks) #return self.comment + print_int_card_blocks(fields_blocks) msg = self.comment self.ids.sort() ids = self.ids packs = condense(ids) if len(packs) == 1: singles, doubles = build_thru_packs(packs, max_dv=1) packs = collapse_thru(ids) for pack in doubles: msg += print_card_8(['SET3', self.sid, self.desc] + pack) if singles: msg += print_card_8(['SET3', self.sid, self.desc] + singles) else: msg += print_card_8(['SET3', self.sid, self.desc] + ids) return msg
def __repr__(self): #fields_blocks = [ #'SET3', #[[self.sid, self.desc], False], # these are not all integers #[self.SetIDs(), True], # these are all integers #] #print(fields_blocks) #return self.comment + print_int_card_blocks(fields_blocks) msg = self.comment self.ids.sort() ids = self.get_ids() packs = condense(ids) if len(packs) == 1: singles, doubles = build_thru_packs(packs, max_dv=1) packs = collapse_thru(ids) for pack in doubles: msg += print_card_8(['SET3', self.sid, self.desc] + pack) if singles: msg += print_card_8(['SET3', self.sid, self.desc] + singles) else: msg += print_card_8(['SET3', self.sid, self.desc] + ids) return msg
def raw_fields(self): list_fields = ['SESET', self.seid] + collapse_thru(self.ids) return list_fields
def SetIDs(self, collapse=True): """gets the IDs of the SETx""" if collapse: return collapse_thru(self.ids, nthru=1) else: return self.ids
def raw_fields(self): """gets the "raw" card without any processing as a list for printing""" list_fields = ['CSET1', self.components] + collapse_thru(self.ids) return list_fields
def raw_fields(self): """gets the "raw" card without any processing as a list for printing""" list_fields = [self.type, self.seid, self.components] + collapse_thru( self.node_ids) return list_fields
def raw_fields(self): return ['SESET', self.seid] + collapse_thru(self.ids)
def SetIDs(self, collapse=True): """gets the IDs of the SETx""" if collapse: return collapse_thru(self.ids, nthru=1) else: return self.IDs
def raw_fields(self): """gets the "raw" card without any processing as a list for printing""" list_fields = ['CSET1', self.components] + collapse_thru(self.node_ids) return list_fields
def raw_fields(self): return ['SESET', self.seid] + collapse_thru(self.ids)
def SetIDs(self): """gets the IDs of the SETx""" return collapse_thru(self.ids)