#114: Python script for remove offsets from CBAR elements

SOL 106 does not allow offsets in CBAR elements.

print "-------------------------------------"
print "remove_cbush_offsets_v1.0"
print "Vladimir Gantovnik"
print "March 15 2016"
print "-------------------------------------"

#input file
inName='test.bdf'
inFile=open(inName)

#output file
outName='stripped.bdf'
outFile=open(outName,'w')

import string

while 1 :
    line=inFile.readline()
    if not line :
        break
    if line[0:4] == 'CBAR' :
       outFile.write(line)
       line=inFile.readline()
       if not line :
           break
       if line[0:1] == '+' :
          pinflags=line[0:24].lstrip()
          outFile.write(pinflags)
          outFile.write('\n')
       elif line[0:1] == '*' :
          outFile.write(line)
          line=inFile.readline()
          if not line :
              break
          if line[0:1] == '*' :
             pinflags=line[0:40].lstrip()
             outFile.write(pinflags)
             outFile.write('\n')
             line=inFile.readline()
             if not line :
               break
             if line[0:1] == '*' :
                 x=1
             else :
                outFile.write(line)
          else :
             outFile.write(line)
       else :
          outFile.write(line)
             
    else :
       outFile.write(line)


outFile.close()
print "Finished"
print "-------------------------------------"

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading