pyNastran  0.5.0
pyNastran BDF Reader/Writer, OP2 Parser, and GUI
geom4.py
Go to the documentation of this file.
00001 ## GNU Lesser General Public License
00002 ## 
00003 ## Program pyNastran - a python interface to NASTRAN files
00004 ## Copyright (C) 2011-2012  Steven Doyle, Al Danial
00005 ## 
00006 ## Authors and copyright holders of pyNastran
00007 ## Steven Doyle <mesheb82@gmail.com>
00008 ## Al Danial    <al.danial@gmail.com>
00009 ## 
00010 ## This file is part of pyNastran.
00011 ## 
00012 ## pyNastran is free software: you can redistribute it and/or modify
00013 ## it under the terms of the GNU Lesser General Public License as published by
00014 ## the Free Software Foundation, either version 3 of the License, or
00015 ## (at your option) any later version.
00016 ## 
00017 ## pyNastran is distributed in the hope that it will be useful,
00018 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 ## GNU General Public License for more details.
00021 ## 
00022 ## You should have received a copy of the GNU Lesser General Public License
00023 ## along with pyNastran.  If not, see <http://www.gnu.org/licenses/>.
00024 ## 
00025 import sys
00026 from struct import unpack
00027 
00028 #from pyNastran.bdf.cards.constraints import SPC,SPCADD
00029 from pyNastran.bdf.cards.elements.rigid import RBE2
00030 from pyNastran.bdf.cards.constraints import SUPORT, SPCD, SPC
00031 
00032 class Geometry4(object):
00033 
00034     def readTable_Geom4(self):
00035         self.iTableMap = {
00036                          (5561,76,215):   self.readASET,    # record 1  - not done
00037                          (5571,77,216):   self.readASET1,   # record 2  - not done
00038                          (10200,102,473): self.readBNDGRID, # record 3  - not done
00039                          (1510,15,328):   self.readCYAX,    # record 8  - not done
00040                          (5210,52,257):   self.readCYJOIN,  # record 9  - not done
00041                          (1710,17,330):   self.readCYSYM,   # record 11 - not done
00042                          (4901,49,17):    self.readMPC,     # record 16 - not done
00043                          (4891,60,83):    self.readMPCADD,  # record 17 - not done
00044                          (4951,63,92):    self.readOMIT1,   # record 19 - not done
00045                          (610, 6, 316):   self.readQSET1,   # record 21 - not done
00046                          (6601,66,292):   self.readRBAR,    # record 22 - not done
00047                          (6801,68,294):   self.readRBE1,    # record 23 - not done
00048                          (6901,69,295):   self.readRBE2,    # record 24 - buggy
00049                          (7101,71,187):   self.readRBE3,    # record 25 - not done
00050                          (6501,65,291):   self.readRROD,    # record 30 - not done
00051                          (7001,70,186):   self.readRSPLINE, # record 31 - not done
00052                          (7201,72,398):   self.readRSSCON,  # record 32 - not done
00053                          (1210,12,322):   self.readSEQSET1, # record 40 - not done
00054                          (5501,55,16):    self.readSPC,     # record 44 - buggy
00055                          (5481,58,12):    self.readSPC1,    # record 45 - not done
00056                          (5491,59,13):    self.readSPCADD,  # record 46 - not done
00057                          (5110,51,256):   self.readSPCD,    # record 47 - buggy
00058                          (5601,56, 14):   self.readSUPORT,  # record 59 - not done
00059                          (10100,101,472): self.readSUPORT1, # record 60 - not done
00060                         #(4901,49,420017):self.readFake,    # record 
00061                         #(5561,76,0):     self.readFake,    # record 
00062                         #(5110,51,256):   self.readFake,    # record 
00063                         #(610,6,0):       self.readFake,    # record 
00064                         #(5501,55,620016):self.readFake,    # record 
00065 
00066                          }
00067         self.readRecordTable('GEOM4')
00068 
00069     def readTable_Geom4S(self):
00070         self.readTable_Geom4()
00071         #self.iTableMap = {
00072         #                 }
00073         #self.readRecordTable('GEOM4S')
00074 
00075     def readASET(self,data):
00076         """ASET(5561,76,215) - Record 1"""
00077         self.skippedCardsFile.write('skipping ASET in GEOM4\n')
00078 
00079     def readASET1(self,data):
00080         """ASET1(5571,77,216) - Record 2"""
00081         self.skippedCardsFile.write('skipping ASET1 in GEOM4\n')
00082 
00083     def readBNDGRID(self,data):
00084         """BNDGRID(10200,102,473) - Record 3 """
00085         self.skippedCardsFile.write('skipping BNDGRID in GEOM4\n')
00086 
00087 # BSET
00088 # BSET1
00089 # CSET
00090 # CSET1
00091 
00092     def readCYAX(self,data):
00093         """CYAX(1510,15,328) - Record 8 """
00094         self.skippedCardsFile.write('skipping CYAX in GEOM4\n')
00095 
00096     def readCYJOIN(self,data):
00097         """CYJOIN(5210,52,257) - Record 9 """
00098         self.skippedCardsFile.write('skipping CYJOIN in GEOM4\n')
00099 
00100 # CYSUP
00101     def readCYSYM(self,data):
00102         """CYSYM(1710,17,330) - Record 11"""
00103         self.skippedCardsFile.write('skipping CYSYM in GEOM4\n')
00104 
00105 # EGENDT
00106 # GMBC
00107 # GMSPC
00108     def readMPC(self,data):
00109         """MPC(4901,49,17) - Record 16"""
00110         self.skippedCardsFile.write('skipping MPC in GEOM4\n')
00111 
00112     def readMPCADD(self,data):
00113         """MPCADD(4891,60,83) - Record 17"""
00114         self.skippedCardsFile.write('skipping MPCADD in GEOM4\n')
00115 
00116     def readOMIT1(self,data):
00117         """OMIT1(4951,63,92) - Record 19"""
00118         self.skippedCardsFile.write('skipping OMIT1 in GEOM4\n')
00119 
00120     def readQSET1(self,data):
00121         """QSET1(610, 6, 316) - Record 21"""
00122         self.skippedCardsFile.write('skipping QSET1 in GEOM4\n')
00123 
00124     def readRBAR(self,data):
00125         """RBAR(6601,66,292) - Record 22"""
00126         self.skippedCardsFile.write('skipping RBAR in GEOM4\n')
00127 
00128     def readRBE1(self,data):
00129         """RBE1(6801,68,294) - Record 23"""
00130         self.skippedCardsFile.write('skipping RBE1 in GEOM4\n')
00131 
00132     def readRBE2(self,data):
00133         """RBE2(6901,69,295) - Record 24"""
00134         self.skippedCardsFile.write('skipping RBE2 in GEOM4\n')
00135         return
00136         #n=0
00137         #nData = len(data)  # 5*4
00138         if 1:
00139             eData = data[:12]
00140             (eid,gn,cm,gm) = unpack(b'iiii',eData)
00141 
00142             eData = data[12:-4]
00143             nGm = len(eData)//4
00144             iFormat = 'i'*nGm
00145             iFormat = bytes(iFormat)
00146             Gm = list(unpack(iFormat,eData))
00147             alpha, = unpack(b'f',data[-4:])
00148         ###
00149         elem = RBE2(None,[eid,gn,cm,Gm,alpha])
00150         self.addRigidElement(elem)
00151         data = data[-1:]
00152 
00153     def readRBE3(self,data):
00154         """RBE3(7101,71,187) - Record 25"""
00155         self.skippedCardsFile.write('skipping RBE3 in GEOM4\n')
00156 
00157 # RBJOINT
00158 # RBJSTIF
00159 # RELEASE
00160 # RPNOM
00161     def readRROD(self,data):
00162         """RROD(6501,65,291) - Record 30"""
00163         self.skippedCardsFile.write('skipping RROD in GEOM4\n')
00164 
00165     def readRSPLINE(self,data):
00166         """RSPLINE(7001,70,186) - Record 31"""
00167         self.skippedCardsFile.write('skipping RSPLINE in GEOM4\n')
00168 
00169     def readRSSCON(self,data):
00170         """RSSCON(7201,72,398) - Record 32"""
00171         self.skippedCardsFile.write('skipping RSSCON in GEOM4\n')
00172 
00173 # RTRPLT
00174 # RWELD
00175 # SEBSET
00176 # SEBSET1
00177 # SECSET
00178 # SECSET1
00179 # SEQSET
00180 
00181     def readSEQSET1(self,data):
00182         """SEQSET1(1210,12,322) - Record 40"""
00183         self.skippedCardsFile.write('skipping SEQSET1 in GEOM4\n')
00184 
00185 # SESUP
00186 # SEUSET
00187 # SEUSET1
00188 
00189     def readSPC(self,data):
00190         """SPC(5501,55,16) - Record 44"""
00191         #self.skippedCardsFile.write('skipping SPC in GEOM4\n')
00192         n = 0
00193         nEntries = len(data)//20  # 5*4
00194         for i in xrange(nEntries):
00195             eData = data[n:n+20]
00196             (sid,ID,c,xxx,dx) = unpack(b'iiiif',eData)
00197 
00198             constraint = SPC(None,[sid,ID,c,dx])
00199             self.addConstraint_SPC(constraint)
00200             n+=20
00201         ###
00202         data = data[n:]
00203 
00204     def readSPC1(self,data):
00205         """SPC1(5481,58,12) - Record 45"""
00206         self.skippedCardsFile.write('skipping SPC1 in GEOM4\n')
00207         return
00208         n = 0
00209         nEntries = len(data)//20  # 5*4
00210         for i in xrange(nEntries):
00211             eData = data[n:n+20]
00212             (sid,c,thruFlag) = unpack(b'iifii',eData)
00213 
00214             constraint = SPC1(None,[sid,g,f,n1,n2])
00215             self.addConstraint_SPC(constraint)
00216             n+=20
00217         ###
00218         data = data[n:]
00219 
00220     def readSPCADD(self,data):
00221         """SPCADD(5491,59,13) - Record 46"""
00222         self.skippedCardsFile.write('skipping SPCADD in GEOM4\n')
00223 
00224     def readSPCD(self,data):
00225         """SPCD(5110,51,256) - Record 47"""
00226         #self.skippedCardsFile.write('skipping SPCD in GEOM4\n')
00227         n = 0
00228         nEntries = len(data)//20  # 5*4
00229         for i in xrange(nEntries):
00230             eData = data[n:n+20]
00231             (sid,ID,c,xxx,dx) = unpack(b'iiiif',eData)
00232 
00233             constraint = SPCD(None,[sid,ID,c,dx])
00234             self.addConstraint_SPC(constraint)
00235             n+=20
00236         ###
00237         data = data[n:]
00238 
00239     def readSPCDE(self,data):
00240         self.skippedCardsFile.write('skipping SPCDE in GEOM4\n')
00241 
00242     def readSPCDF(self,data):
00243         self.skippedCardsFile.write('skipping SPCDF in GEOM4\n')
00244 
00245     def readSPCDG(self,data):
00246         self.skippedCardsFile.write('skipping SPCDG in GEOM4\n')
00247 
00248     def readSPCE(self,data):
00249         self.skippedCardsFile.write('skipping SPCE in GEOM4\n')
00250 
00251     def readSPCEB(self,data):
00252         self.skippedCardsFile.write('skipping SPCEB in GEOM4\n')
00253 
00254     def readSPCF(self,data):
00255         self.skippedCardsFile.write('skipping SPCF in GEOM4\n')
00256 
00257     def readSPCFB(self,data):
00258         self.skippedCardsFile.write('skipping SPCFB in GEOM4\n')
00259 
00260     def readSPCGB(self,data):
00261         self.skippedCardsFile.write('skipping SPCGB in GEOM4\n')
00262 
00263 # SPCGRID
00264 # SPCOFF
00265 # SPCOFF1
00266 
00267     def readSUPORT(self,data):
00268         """SUPORT(5601,56, 14) - Record 59"""
00269         #self.skippedCardsFile.write('skipping SUPORT in GEOM4\n')
00270         n = 0
00271         nEntries = len(data)//8  # 2*4
00272         for i in xrange(nEntries):
00273             eData = data[n:n+8]
00274             (sid,c) = unpack(b'ii',eData)
00275 
00276             suport = SUPORT(None,[sid,c])
00277             self.addSuport(suport)
00278             n+=8
00279         ###
00280         data = data[n:]
00281 
00282     def readSUPORT1(self,data):
00283         """SUPORT1(10100,101,472) - Record 60"""
00284         self.skippedCardsFile.write('skipping SUPORT1 in GEOM4\n')
00285 
00286 # TEMPBC
00287 
00288     def readUSET(self,data):
00289         self.skippedCardsFile.write('skipping USET in GEOM4\n')
00290 
00291     def readUSET1(self,data):
00292         self.skippedCardsFile.write('skipping USET1 in GEOM4\n')
 All Classes Namespaces Files Functions Variables