Update reading of materials file to allow comments without double hashes.

这个提交包含在:
Craig Warren
2020-02-07 11:47:17 +00:00
父节点 4dd155dffd
当前提交 3345982a49

查看文件

@@ -78,7 +78,8 @@ def process_geometrycmds(geometry, G):
geofile = tmp[4]
matfile = tmp[5]
# See if material file exists at specified path and if not try input file directory
# See if material file exists at specified path and if not try input
# file directory
if not os.path.isfile(matfile):
matfile = os.path.abspath(os.path.join(G.inputdirectory, matfile))
@@ -87,8 +88,9 @@ def process_geometrycmds(geometry, G):
# Read materials from file
with open(matfile, 'r') as f:
# Strip out any newline characters and comments that must begin with double hashes
materials = [line.rstrip() + '{' + matstr + '}\n' for line in f if(not line.startswith('##') and line.rstrip('\n'))]
# Read any lines that begin with a hash. Strip out any newline
# characters and comments that must begin with double hashes.
materials = [line.rstrip() + '{' + matstr + '}\n' for line in f if(line.startswith('#') and not line.startswith('##') and line.rstrip('\n'))]
# Check validity of command names
singlecmdsimport, multicmdsimport, geometryimport = check_cmd_names(materials, checkessential=False)