예제 #1
0
def cart3d_to_nastran_filename(cart3d_filename,
                               bdf_filename,
                               log=None,
                               debug=False):
    """
    Converts a Cart3D file to STL format.

    :param cart3d_filename: path to the input Cart3D file
    :param bdf_filename:    path to the output BDF file
    :param log:             a logger object (or None)
    :param debug:           True/False (used if log is not defined)
    """
    cart3d = Cart3DReader(log=log, debug=debug)
    (nodes, elements, regions, loads) = cart3d.read_cart3d(cart3d_filename)

    #bdf = BDF()
    #bdf.nodes = cart3d.nodes
    #bdf.elements = cart3d.elements
    #bdf.write_bdf(bdf_filename)
    #return
    f = open(bdf_filename, 'wb')
    f.write('CEND\n')
    f.write('BEGIN BULK\n')
    f.write('$Nodes\n')

    i = 0
    nid = 1
    cid = 0
    for node in nodes:
        card = print_card_16(['GRID', nid, cid] + list(node))
        f.write(card)

    eid = 1
    f.write('$Elements\n')
    for (n1, n2, n3), pid in zip(elements, regions):
        card = print_card_8(['CTRIA3', eid, pid, n1, n2, n3])
        f.write(card)
        eid += 1

    t = 0.1
    E = 1e7
    nu = 0.3
    f.write('$Properties\n')
    for pid in unique(regions):
        mid = pid
        card = print_card_8(['PSHELL', pid, mid, t])
        f.write(card)
        card = print_card_8(['MAT1', mid, E, None, nu])
        f.write(card)
    f.write('ENDDATA\n')
    f.close()
예제 #2
0
def cart3d_to_nastran_filename(cart3d_filename, bdf_filename, log=None, debug=False):
    """
    Converts a Cart3D file to STL format.

    :param cart3d_filename: path to the input Cart3D file
    :param bdf_filename:    path to the output BDF file
    :param log:             a logger object (or None)
    :param debug:           True/False (used if log is not defined)
    """
    cart3d = Cart3DReader(log=log, debug=debug)
    (nodes, elements, regions, loads) = cart3d.read_cart3d(cart3d_filename)

    #bdf = BDF()
    #bdf.nodes = cart3d.nodes
    #bdf.elements = cart3d.elements
    #bdf.write_bdf(bdf_filename)
    #return
    f = open(bdf_filename, 'wb')
    f.write('CEND\n')
    f.write('BEGIN BULK\n')
    f.write('$Nodes\n')

    i = 0
    nid = 1
    cid = 0
    for node in nodes:
        card = print_card_16(['GRID', nid, cid] + list(node))
        f.write(card)

    eid = 1
    f.write('$Elements\n')
    for (n1, n2, n3), pid in zip(elements, regions):
        card = print_card_8(['CTRIA3', eid, pid, n1, n2, n3])
        f.write(card)
        eid += 1

    t = 0.1
    E = 1e7
    nu = 0.3
    f.write('$Properties\n')
    for pid in unique(regions):
        mid = pid
        card = print_card_8(['PSHELL', pid, mid, t])
        f.write(card)
        card = print_card_8(['MAT1', mid, E, None, nu])
        f.write(card)
    f.write('ENDDATA\n')
    f.close()
예제 #3
0
파일: cbar.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, offt, pin, wa, wb) in zip(
                self.element_id[i], self.property_id[i], self.node_ids[i],
                self.is_g0[i], self.g0[i], self.x[i],
                self.offt[i],
                self.pin_flags[i], self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]

                offt = set_string8_blank_if_default(offt, 'GGG')
                card = ['CBAR', eid, pid, n[0], n[1], x1, x2, x3, offt,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
예제 #4
0
    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, offt, pin, wa,
                 wb) in zip(self.element_id[i], self.property_id[i],
                            self.node_ids[i], self.is_g0[i], self.g0[i],
                            self.x[i], self.offt[i], self.pin_flags[i],
                            self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]

                offt = set_string8_blank_if_default(offt, 'GGG')
                card = [
                    'CBAR', eid, pid, n[0], n[1], x1, x2, x3, offt, pa, pb,
                    w1a, w2a, w3a, w1b, w2b, w3b
                ]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
예제 #5
0
파일: pbarl.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, property_id=None):
        #print('PBARL.n = %s' % self.n)
        if self.n:
            if property_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.property_id, property_id)
            #print('i = %s' % i)
            #cid = [cid if cid != 0 else '' for cid in self.coord_id]

            #group = set_blank_if_default(self.group, 'MSCBMLO')
            #list_fields = ['PBARL', self.pid, self.Mid(), group, self.Type, None,
            #None, None, None] + self.dim + [self.nsm]

            #self.model.log.debug('*pbarl write pids=%s' % self.property_id)
            for (j, pid, mid, group, Type,
                 nsm) in zip(count(), self.property_id[i], self.material_id[i],
                             self.group[i], self.Type[i], self.nsm[i]):
                dim = self.dim[j]
                sgroup = set_blank_if_default(group, 'MSCBMLO')

                list_fields = [
                    'PBARL', pid, mid, group, Type, None, None, None, None
                ] + dim + [nsm]
                if size == 8:
                    f.write(print_card_8(list_fields))
                else:
                    f.write(print_card_16(list_fields))
예제 #6
0
 def write_bdf(self, size=8, is_double=False):
     card = self.reprFields()
     if size == 8:
         return self.comment() + print_card_8(card)
     elif is_double:
         return self.comment() + print_card_double(card)
     return self.comment() + print_card_16(card)
예제 #7
0
 def write_bdf(self, f, size=8, is_double=False):
     if self.n:
         card = ['GRDSET', None, self.cp, None, None, None, self.cd, self.seid]
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
예제 #8
0
 def write_bdf(self, f, size=8, material_id=None):
     if size == 8:
         for mid, table_id, Type, h, hflag, yf, hr, limit1, limit2 in zip(
                 self.material_id, self.table_id, self.Type, self.h,
                 self.hflag, self.yf, self.hr, self.limit1, self.limit2):
             if not hflag:
                 h = None
             if limit2 is None:
                 card = ['MATS1', mid, table_id, Type, h, yf, hr, limit1]
             else:
                 card = [
                     'MATS1', mid, table_id, Type, h, yf, hr, limit1, limit2
                 ]
             f.write(print_card_8(card))
     else:
         for mid, table_id, Type, h, hflag, yf, hr, limit1, limit2 in zip(
                 self.material_id, self.table_id, self.Type, self.h,
                 self.hflag, self.yf, self.hr, self.limit1, self.limit2):
             if not hflag:
                 h = None
             if limit2 is None:
                 card = ['MATS1', mid, table_id, Type, h, yf, hr, limit1]
             else:
                 card = [
                     'MATS1', mid, table_id, Type, h, yf, hr, limit1, limit2
                 ]
             f.write(print_card_16(card))
예제 #9
0
파일: cbeam.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            for (eid, pid, n, is_g0, g0, x, is_offt, offt, bit, pin, wa, wb, sa, sb) in zip(
                    self.element_id[i], self.property_id[i], self.node_ids[i],
                    self.is_g0[i], self.g0[i], self.x[i],
                    self.is_offt[i], self.offt[i], self.bit[i],
                    self.pin_flags[i], self.wa[i], self.wb[i], self.sa[i], self.sb[i]):

                x1 = g0 if is_g0 else x[0]
                x2 = 0 if is_g0 else x[1]
                x3 = 0 if is_g0 else x[2]
                offt_bit = offt if is_offt else bit
                #print('is_offt=%s offt=%s bit=%s offt_bit=%s' % (is_offt, offt, bit, offt_bit))

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)

                sa = set_blank_if_default(sa, 0)
                sb = set_blank_if_default(sb, 0)
                card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt_bit,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b,
                        sa, sb]
                f.write(print_card_8(card))
예제 #10
0
파일: spoint.py 프로젝트: umvarma/pynastran
 def write_bdf(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))
예제 #11
0
파일: spcadd.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     card = ['SPCADD', self.spc_id] + self.spc_ids
     #print "card = ", card
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
예제 #12
0
 def write_bdf(self, size=8, is_double=False):
     card = self.reprFields()
     if size == 8:
         return self.comment() + print_card_8(card)
     elif is_double:
         return self.comment() + print_card_double(card)
     return self.comment() + print_card_16(card)
예제 #13
0
파일: spc1.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     for comp, nodes in iteritems(self.components):
         card = ['SPC1', self.constraint_id, comp] + list(nodes)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
예제 #14
0
파일: pbarl.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, property_id=None):
        #print('PBARL.n = %s' % self.n)
        if self.n:
            if property_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.property_id, property_id)
            #print('i = %s' % i)
            #cid = [cid if cid != 0 else '' for cid in self.coord_id]

            #group = set_blank_if_default(self.group, 'MSCBMLO')
            #list_fields = ['PBARL', self.pid, self.Mid(), group, self.Type, None,
                           #None, None, None] + self.dim + [self.nsm]

            #self.model.log.debug('*pbarl write pids=%s' % self.property_id)
            for (j, pid, mid, group, Type, nsm) in zip(count(), self.property_id[i], self.material_id[i],
                        self.group[i], self.Type[i], self.nsm[i]):
                dim = self.dim[j]
                sgroup = set_blank_if_default(group, 'MSCBMLO')

                list_fields = ['PBARL', pid, mid, group, Type, None,
                               None, None, None] + dim + [nsm]
                if size == 8:
                    f.write(print_card_8(list_fields))
                else:
                    f.write(print_card_16(list_fields))
예제 #15
0
파일: rbe3.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size, is_double):
     if self.n:
         if size == 8:
             for j, eid, alpha in zip(count(), self.element_id, self.alpha):
                 salpha = set_blank_if_default(alpha, 0.)
                 list_fields = ['RBE2', eid] + [salpha]
                 f.write(print_card_8(list_fields))
예제 #16
0
    def write_bdf(self, f, size=8, element_ids=None):
        if self.n:
            if element_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, self.element_id)

            offt = 0
            ga = None
            gb = None
            x1 = None
            x2 = None
            x3 = None
            for (eid, pid, n, pin, wa, wb) in zip(self.element_id[i], self.property_id[i], self.node_ids[i],
                    self.pin_flags[i], self.wa[i], self.wb[i]):

                pa = set_blank_if_default(pin[0], 0)
                pb = set_blank_if_default(pin[1], 0)

                w1a = set_blank_if_default(wa[0], 0.0)
                w2a = set_blank_if_default(wa[1], 0.0)
                w3a = set_blank_if_default(wa[2], 0.0)
                w1b = set_blank_if_default(wb[0], 0.0)
                w2b = set_blank_if_default(wb[1], 0.0)
                w3b = set_blank_if_default(wb[2], 0.0)
                #(x1, x2, x3) = self.getX_G0_defaults()
                #offt = set_blank_if_default(offt, 'GGG')
                #list_fields = ['CBAR', self.eid, self.Pid(), self.Ga(), self.Gb(), x1, x2,
                #          x3, offt, pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                card = ['CBEAM', eid, pid, n[0], n[1], x1, x2, x3, offt,
                        pa, pb, w1a, w2a, w3a, w1b, w2b, w3b]
                f.write(print_card_8(card))
예제 #17
0
파일: coord.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size, is_double, coord_id=None):
        assert size in [8, 16], size
        assert is_double in [True, False], is_double

        if self.n:
            #if coord_id is None:
            i = arange(self.n)
            #else:
                #assert len(unique(coord_id))==len(coord_id), unique(coord_id)
                #i = searchsorted(self.coord_id, coord_id)

            if size == 8:
                for cid, coord in iteritems(self.coords):
                    if cid > 0:
                        list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                        f.write(print_card_8(list_fields))
            else:
                if is_double:
                    for cid, coord in iteritems(self.coords):
                        if cid > 0:
                            list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                            f.write(print_card_16(list_fields))
                else:
                    for cid, coord in iteritems(self.coords):
                        if cid > 0:
                            list_fields = [coord.type, cid, coord.rid] + list(coord.e1) + list(coord.e2) + list(coord.e3)
                            f.write(print_card_double(list_fields))
예제 #18
0
파일: nlpci.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     card = ['NLPCI', self.nlpci_id, self.Type, self.minalr,
             self.maxalr, self.scale, None, self.desiter, self.mxinc]
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
예제 #19
0
파일: spoint.py 프로젝트: umvarma/pynastran
 def write_bdf(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))
예제 #20
0
 def write_bdf(self, f, size=8):
     for comp, nodes in iteritems(self.components):
         card = ['SPC1', self.constraint_id, comp] + list(nodes)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
예제 #21
0
파일: epoint.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8, is_double=False):
     #..todo:: collapse the IDs
     if self.n:
         card = ['EPOINT'] + list(self.epoint)
         if size == 8:
             f.write(print_card_8(card))
         else:
             f.write(print_card_16(card))
예제 #22
0
 def write_bdf(self, f, size=8, property_id=None):
     if self.n:
         #print "PSOLID.property_id =", self.property_id
         for (pid, mid, stress) in zip(
              self.property_id, self.material_id, self.stress_strain):
             stress_strain = set_blank_if_default(stress_strain, 'GRID')
             card = ['PLSOLID', pid, mid, stress_strain]
             f.write(print_card_8(card))
예제 #23
0
    def test_print_card_8(self):
        self.assertEqual(print_card_8(['GRID',1]),'GRID           1\n')
        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None, 1]),
                         'GRID           1\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None, 1]))

        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     1, None]),
                         'GRID           1\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     1, None]))

        self.assertEqual(print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     None,None,None,None,None,None,None,None,
                                     1, None]),
                         'GRID           1\n+\n               1\n',
                         print_card_8(['GRID', 1, None, None, None, None, None,
                                     None, None,
                                     None,None,None,None,None,None,None,None,
                                     1, None]))
예제 #24
0
 def write_bdf(self, f, size=8, element_ids=None):
     if self.n:
         if element_ids is None:
             i = arange(self.n)
         else:
             i = searchsorted(self.element_id, element_ids)
         for (eid, pid, n) in zip(self.element_id[i], self.property_id[i], self.node_ids[i, :]):
             card = ['CPENTA', eid, pid, n[0], n[1], n[2], n[3], n[4], n[5]]
             f.write(print_card_8(card))
예제 #25
0
파일: nlpci.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     card = [
         'NLPCI', self.nlpci_id, self.Type, self.minalr, self.maxalr,
         self.scale, None, self.desiter, self.mxinc
     ]
     if size == 8:
         f.write(print_card_8(card))
     else:
         f.write(print_card_16(card))
예제 #26
0
 def write_bdf(self, f, size=8, is_double=False):
     if self.n:
         f.write('$POINTAX\n')
         for (nid, rid, phi) in zip(self.point_id, self.ring_id, self.phi):
             card = ['POINTAX', rid, phi]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #27
0
파일: temp.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     if self.n:
         n = 0
         for lid, t in zip(self.load_id, self.temperature_default):
             card = ['TEMPD', lid, t]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #28
0
파일: aeros.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size, is_double):
        for acsid, rcsid, c, b, S, symXZ, symXY in zip(self.acsid,
            self.rcsid, self.cRef, self.bRef, self.SRef, self.symXZ, self.symXY):

            #symXZ = set_blank_if_default(self.symXZ, 0)
            #symXY = set_blank_if_default(self.symXY, 0)
            list_fields = ['AEROS', acsid, rcsid, c,
                  b, S, symXZ, symXY]
            f.write(print_card_8(list_fields))
예제 #29
0
파일: temp.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     if self.n:
         n = 0
         for lid, t in zip(self.load_id, self.temperature_default):
             card = ['TEMPD', lid, t]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #30
0
 def write_bdf(self, f, size=8, element_ids=None):
     if self.n:
         if element_ids is None:
             i = arange(self.n)
         else:
             assert len(unique(element_ids))==len(element_ids), unique(element_ids)
             i = searchsorted(self.element_id, element_ids)
         for (eid, pid, n) in izip(self.element_id[i], self.property_id[i], self.node_ids[i]):
             card = ['CTRIA3', eid, pid, n[0], n[1], n[2]]
             f.write(print_card_8(card))
예제 #31
0
파일: aeros.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size, is_double):
        for acsid, rcsid, c, b, S, symXZ, symXY in zip(self.acsid, self.rcsid,
                                                       self.cRef, self.bRef,
                                                       self.SRef, self.symXZ,
                                                       self.symXY):

            #symXZ = set_blank_if_default(self.symXZ, 0)
            #symXY = set_blank_if_default(self.symXY, 0)
            list_fields = ['AEROS', acsid, rcsid, c, b, S, symXZ, symXY]
            f.write(print_card_8(list_fields))
예제 #32
0
 def write_bdf(self, f, size=8):
     if self.n:
         for dof, node_ids in sorted(iteritems(self.components)):
             card = ['SPC', self.constraint_id]
             for node_id in node_ids:
                 card += [node_id, dof, 0.0]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #33
0
파일: grav.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, lids=None):
        if self.n:
            for (lid, cid, scale, N, mb) in zip(
                 self.load_id, self.coord_id, self.scale, self.N, self.mb):

                card = ['GRAV', lid, cid, scale, N[0], N[1], n[2], mb]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
예제 #34
0
파일: spc.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     if self.n:
         for dof, node_ids in sorted(iteritems(self.components)):
             card = ['SPC', self.constraint_id]
             for node_id in node_ids:
                 card += [node_id, dof, 0.0]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #35
0
파일: moment.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, lids=None):
        if self.n:
            for (lid, nid, cid, mag, xyz) in zip(
                 self.load_id, self.node_id, self.coord_id, self.mag, self.xyz):

                card = ['MOMENT', lid, nid, cid, mag, xyz[0], xyz[1], xyz[2] ]
                if size == 8:
                    f.write(print_card_8(card))
                else:
                    f.write(print_card_16(card))
예제 #36
0
 def write_bdf(self, f, size=8, element_ids=None):
     if self.n:
         if element_ids is None:
             i = arange(self.n)
         else:
             i = searchsorted(self.element_id, element_ids)
         for (eid, pid, n) in zip(self.element_id[i], self.property_id[i], self.node_ids[i, :]):
             card = ['CHEXA', eid, pid, n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9],
                     n[10], n[11], n[12], n[13], n[14]]
             f.write(print_card_8(card))
예제 #37
0
 def write_bdf(self, f, size=8, element_id=None):
     if self.n:
         if element_id is None:
             i = arange(self.n)
         else:
             i = searchsorted(self.element_id, element_id)
         for (eid, pid, n) in zip(self.element_id[i], self.property_id[i], self.node_ids[i, :]):
             n = [ni if ni != 0 else None for ni in n]
             card = ['CTETRA', eid, pid, n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8], n[9]]
             f.write(print_card_8(card))
예제 #38
0
    def write_bdf(self, f, size=8, property_ids=None):
        if self.n:
            for (pid, mid, cordm, integ, stress, isop,
                 fctn) in zip(self.property_id, self.material_id, self.cordm,
                              self.integ, self.stress, self.isop, self.fctn):

                cordm = set_blank_if_default(cordm, 0)
                fctn = set_blank_if_default(self.fctn, 'SMECH')
                card = ['PSOLID', pid, mid, cordm, integ, stress, isop, fctn]
                f.write(print_card_8(card))
예제 #39
0
파일: mpc.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     if self.n:
         for constraint in self.constraints:
             card = ['MPC', self.constraint_id]
             for (G, C, A) in constraint:
                 card += [G, C, A]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #40
0
파일: mpc.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8):
     if self.n:
         for constraint in self.constraints:
             card = ['MPC', self.constraint_id]
             for (G, C, A) in constraint:
                 card += [G, C, A]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #41
0
    def write_bdf(self, size, card_writer):
        skin = []
        if self.isSkin:
            skin = ['SKIN']

        return self.comment() + print_card_8(['SET1', self.sid] + skin + self.IDs)

        field_packs = []
        singles, doubles = collapse_thru_packs(self.IDs)
        if singles:
            field_packs.append(['SET1', self.sid] + skin + singles)
        if doubles:
            for pack in doubles:
                field_packs.append(['SET1', self.sid] + skin + pack)

        msg = []
        for field_pack in field_packs:
            msg.append(print_card_8(field_pack))
        return ''.join(msg)
예제 #42
0
파일: aero.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size, is_double):
        #card = self.repr_fields()
        #symXZ = set_blank_if_default(self.symXZ, 0)
        #symXY = set_blank_if_default(self.symXY, 0)
        if self.n:
            for acsid, V, c, rho, xz, xy in zip(self.acsid, self.velocity, self.cRef,
                      self.rhoRef, self.symXZ, self.symXY):

                list_fields = ['AERO', acsid, V, c, rho, xz, xy]
                f.write(print_card_8(list_fields ))
예제 #43
0
파일: pload4.py 프로젝트: umvarma/pynastran
    def write_bdf(self, f, size=8, load_ids=None):
        if self.n:
            if load_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(load_ids, self.load_id)

            for (load_id, element_id, p) in zip(self.load_id[i], self.element_id[i], self.pressures[i]):
                card = ['PLOAD4', load_id, element_id, p]
                f.write(print_card_8(card))
예제 #44
0
    def write_bdf(self, f, size=8, material_id=None):
        if self.n:
            if material_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.material_id, material_id)

            assert material_id is None
            #self.model.log.debug"n = %s" % self.n)
            #self.model.log.debug"mids MAT1 %s" % self.material_id)
            Rho = ['' if rhoi == 0.0 else rhoi for rhoi in self.rho[i]]
            A = ['' if ai == 0.0 else ai for ai in self.a[i]]
            TRef = ['' if trefi == 0.0 else trefi for trefi in self.TRef[i]]
            ge = ['' if gei == 0.0 else gei for gei in self.ge[i]]

            St = ['' if st == 0.0 else st for st in self.St[i]]
            Sc = ['' if sc == 0.0 else sc for sc in self.Sc[i]]
            Ss = ['' if ss == 0.0 else ss for ss in self.Ss[i]]

            card = ['$MAT1', 'mid', 'E', 'G', 'nu', 'rho', 'a', 'TRef', 'ge']
            f.write(print_card_8(card))
            card = ['$', 'st', 'sc', 'ss', 'mcsid']
            f.write(print_card_8(card))
            for (mid, E, G, nu, rho, a, TRef, ge, st, sc, ss,
                 mcsid) in zip(self.material_id[i], self.E[i], self.G[i],
                               self.nu[i], Rho, A, TRef, ge, St, Sc, Ss,
                               self.mcsid[i]):

                #Gdefault = self.getG_default()
                Gdefault = self._G_default(E, G, nu)
                G = set_blank_if_default(G, Gdefault)
                #rho = set_blank_if_default(rho, 0.)
                #a = set_blank_if_default(a, 0.)
                #TRef = set_blank_if_default(TRef, 0.)
                #ge = set_blank_if_default(ge, 0.)
                #st = set_blank_if_default(st, 0.)
                #sc = set_blank_if_default(sc, 0.)
                #ss = set_blank_if_default(ss, 0.)
                mcsid = set_blank_if_default(mcsid, 0)
                card = [
                    'MAT1', mid, E, G, nu, rho, a, TRef, ge, st, sc, ss, mcsid
                ]
                f.write(print_card_8(card))
예제 #45
0
    def write_bdf(self, f, size=8, property_ids=None):
        if self.n:
            for (pid, mid, cordm, integ, stress, isop, fctn) in zip(
                 self.property_id, self.material_id, self.cordm,
                 self.integ, self.stress, self.isop, self.fctn):

                cordm = set_blank_if_default(cordm, 0)
                fctn = set_blank_if_default(self.fctn, 'SMECH')
                card = ['PSOLID', pid, mid, cordm, integ,
                        stress, isop, fctn]
                f.write(print_card_8(card))
예제 #46
0
    def write_bdf(self, f, size=8, element_id=None):
        if self.n:
            if element_id is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.element_id, element_id)

            for (eid, pid, n) in zip(self.element_id[i], self.property_id[i],
                                     self.node_ids[i, :]):
                card = ['CTETRA', eid, pid, n[0], n[1], n[2], n[3]]
                f.write(print_card_8(card))
예제 #47
0
    def write_bdf(self, f, size=8, property_ids=None):
        if self.n:
            if property_ids is None:
                i = arange(self.n)
            else:
                i = searchsorted(self.property_id, property_ids)

            for (pid, mid, area, I1, I2, J) in zip(self.property_id[i], self.material_id[i],
                    self.area[i], self.I1[i], self.I2[i], self.J[i]):
                card = ['PBAR', pid, mid, area, I1, I2, J]
                f.write(print_card_8(card))
예제 #48
0
파일: load.py 프로젝트: umvarma/pynastran
 def write_bdf(self, f, size=8, is_double=False, load_id=None):
     if load_id is None:
         load_id = self.load_id
     load_id = asarray(load_id)
     list_fields = ['LOAD', self.load_id, self.scale]
     for (scaleFactor, lid) in zip(self.scale_factors, self.load_ids):
         list_fields += [scaleFactor, lid]
         if size == 8:
             f.write(print_card_8(list_fields))
         else:
             f.write(print_card_16(list_fields))
예제 #49
0
 def write_bdf(self, f, size=8, load_ids=None):
     if self.n:
         i = self.get_index(load_ids)
         for (lid, eid, p, n,
              theta) in zip(self.load_id[i], self.element_id[i], self.p[i],
                            self.node_ids[i], self.theta[i]):
             card = ['PLOADX1', lid, eid, p[0], p[1], n[0], n[1], theta]
             if size == 8:
                 f.write(print_card_8(card))
             else:
                 f.write(print_card_16(card))
예제 #50
0
 def write_bdf(self, f, size=8, is_double=False, load_id=None):
     if load_id is None:
         load_id = self.load_id
     load_id = asarray(load_id)
     list_fields = ['LOAD', self.load_id, self.scale]
     for (scaleFactor, lid) in zip(self.scale_factors, self.load_ids):
         list_fields += [scaleFactor, lid]
         if size == 8:
             f.write(print_card_8(list_fields))
         else:
             f.write(print_card_16(list_fields))
예제 #51
0
    def write_bdf(self, size, card_writer):
        skin = []
        if self.isSkin:
            skin = ['SKIN']

        return self.comment() + print_card_8(['SET1', self.sid] + skin +
                                             self.IDs)

        field_packs = []
        singles, doubles = collapse_thru_packs(self.IDs)
        if singles:
            field_packs.append(['SET1', self.sid] + skin + singles)
        if doubles:
            for pack in doubles:
                field_packs.append(['SET1', self.sid] + skin + pack)

        msg = []
        for field_pack in field_packs:
            msg.append(print_card_8(field_pack))
        return ''.join(msg)