Example #1
0
 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))
Example #2
0
 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))
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
    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
Example #6
0
    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
Example #7
0
 def raw_fields(self):
     list_fields = ['SESET', self.seid] + collapse_thru(self.ids)
     return list_fields
Example #8
0
 def SetIDs(self, collapse=True):
     """gets the IDs of the SETx"""
     if collapse:
         return collapse_thru(self.ids, nthru=1)
     else:
         return self.ids
Example #9
0
 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
Example #10
0
 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
Example #11
0
 def raw_fields(self):
     return ['SESET', self.seid] + collapse_thru(self.ids)
Example #12
0
 def SetIDs(self, collapse=True):
     """gets the IDs of the SETx"""
     if collapse:
         return collapse_thru(self.ids, nthru=1)
     else:
         return self.IDs
Example #13
0
 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
Example #14
0
 def raw_fields(self):
     return ['SESET', self.seid] + collapse_thru(self.ids)
Example #15
0
 def SetIDs(self):
     """gets the IDs of the SETx"""
     return collapse_thru(self.ids)