now uses msc_tools method to figure out Mentat path

This commit is contained in:
Philip Eisenlohr 2011-11-03 13:16:00 +00:00
parent edb8c0cd1e
commit aba7937845
4 changed files with 16 additions and 97 deletions

View File

@ -1,36 +1,15 @@
#!/usr/bin/env python
import sys, os
import sys, os, msc_tools
from colorsys import *
from optparse import OptionParser
releases = {'2010':['linux64',''],
'2008r1':[''],
'2007r1':[''],
'2005r3':[''],
}
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
try:
from py_mentat import *
except:
print('warning: no valid Mentat release found in %s'%MSCpath)
print('warning: no valid Mentat release found')
# -----------------------------
@ -135,7 +114,9 @@ For symmetric scales use option "-s".
Example colors:
- Non-symmetric scales: 0.167,0.9,0.1 0.167,0.1,0.9
- Symmetric scales: 0,0.2,0.9 0.333,0.2,0.9
""")
""" + string.replace('$Id$','\n','\\n')
)
parser.add_option("-s","--symmetric", action = "store_true",
dest = "symmetric", \

View File

@ -1,36 +1,14 @@
#!/usr/bin/env python
import sys,os,pwd,math,re,string
#import Image,ImageDraw
import sys,os,pwd,math,re,string,msc_tools
from optparse import OptionParser
releases = {'2010':['linux64',''],
'2008r1':[''],
'2007r1':[''],
'2005r3':[''],
}
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
try:
from py_mentat import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
print('error: no valid Mentat release found')
sys.exit(-1)
@ -167,7 +145,7 @@ def servoLink():
parser = OptionParser(usage='%prog [options]', description = """
Set up servo linking to achieve periodic boundary conditions for a regular hexahedral mesh presently opened in MSC.Mentat
""" + string.replace('$Id: spectral_iterationCount 919 2011-06-15 18:14:05Z MPIE\p.eisenlohr $','\n','\\n')
""" + string.replace('$Id$','\n','\\n')
)
parser.add_option("-p", "--port", type="int",\

View File

@ -1,13 +1,8 @@
#!/usr/bin/env python
import os, sys, math, re, threading, time, string
import os, sys, math, re, threading, time, string, msc_tools
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
releases = {'2010':['linux64',''],
'2008r1':[''],
'2007r1':[''],
'2005r3':[''],
}
# ----------------------- FUNCTIONS ----------------------------
@ -256,27 +251,12 @@ parser.set_defaults(homogenization = 1)
(options, args) = parser.parse_args()
try:
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
try:
from py_mentat import *
except:
print('no valid Mentat release found in %s'%MSCpath)
print('no valid Mentat release found')
if options.port != None: sys.exit(-1)
if not os.path.isfile(args[0]):

26
processing/pre/patchFromReconstructedBoundaries Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys,os,math,re,string
import sys,os,math,re,string, msc_tools
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
@ -10,27 +10,7 @@ try: # check for Python Image Lib
except:
ImageCapability = False
try: # check for MSC.Mentat installation location
file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
MSCpath = os.path.normpath(file.readline().strip())
file.close()
except:
MSCpath = '/msc'
releases = {'2010':['linux64',''],
'2008r1':[''],
'2007r1':[''],
'2005r3':[''],
}
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
sys.path.append(msc_tools.MSC_TOOLS().library_paths())
try: # check for MSC.Mentat Python interface
from py_mentat import *
@ -794,7 +774,7 @@ parser = OptionParser(option_class=extendedOption, usage='%prog [options] datafi
Produce image, spectral geometry description, and (auto) Mentat procedure from TSL/OIM
reconstructed boundary file
""" + string.replace('$Id: spectral_iterationCount 919 2011-06-15 18:14:05Z MPIE\p.eisenlohr $','\n','\\n')
""" + string.replace('$Id$','\n','\\n')
)
parser.add_option("-o", "--output", action='extend', dest='output', type='string', \