pyNastran
0.5.0
pyNastran BDF Reader/Writer, OP2 Parser, and GUI
|
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 00026 from __future__ import division, print_function 00027 import sys 00028 from struct import unpack 00029 00030 #from pyNastran.bdf.cards.nodes import GRID 00031 #from pyNastran.bdf.cards.coordinateSystems import CORD1R,CORD2R,CORD2C,CORD3G #CORD1C,CORD1S,CORD2S 00032 00033 00034 class DESTAB(object): 00035 00036 def readDesvar(self,data): 00037 out = unpack(b'ii4s4sfff',data[0:28]) 00038 (idvid,dvid,label1,label2,vmin,vmax,delx) = out 00039 #print "ivid=%s dvid=%s label1=%s label2=%s vmax=%g vmin=%g delx=%g" %(idvid,dvid,label1,label2,vmin,vmax,delx) 00040 #self.readData(8) 00041 00042 def readTable_DesTab(self): 00043 self.tableName = 'DESTAB' 00044 tableName = self.readTableName(rewind=False) # DESTAB 00045 self.tableInit(tableName) 00046 #print "tableName = |%r|" %(tableName) 00047 00048 self.readMarkers([-1,7],'DESTAB') 00049 ints = self.readIntBlock() 00050 #print "*ints = ",ints 00051 00052 self.readMarkers([-2,1,0],'DESTAB') 00053 bufferWords = self.getMarker() 00054 #print "bufferWords = ",bufferWords 00055 word = self.readStringBlock() # DESTAB 00056 #print "word = |%s|" %(word) 00057 00058 iTable = -3 00059 #imax = -244 00060 00061 while bufferWords: # read until bufferWords=0 00062 self.readMarkers([iTable,1,0],'DESTAB') 00063 nOld = self.n 00064 bufferWords = self.getMarker() 00065 #print "bufferWords = ",bufferWords 00066 if bufferWords==0: # maybe read new buffer... 00067 self.goto(nOld) 00068 break 00069 data = self.readBlock() 00070 #print "len(data) = ",len(data) 00071 self.readDesvar(data) 00072 iTable -= 1 00073 00074 self.printSection(80) 00075 00076 #self.op2Debug.write('bufferWords=%s\n' %(str(bufferWords))) 00077 #print "1-bufferWords = ",bufferWords,bufferWords*4 00078 00079 #print self.printSection(300) 00080 #sys.exit('asdf') 00081