Skip to content

Commit cddc222

Browse files
committed
fix issue 13 -o outputFile argument to geomPipeline.py
1 parent 945b9f0 commit cddc222

5 files changed

Lines changed: 19 additions & 12 deletions

File tree

.github/workflows/docker-ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ jobs:
7777
make 2>&1 | tee clang_tidy_build_results.log
7878
make package
7979
ls *.${{ matrix.package_suffix }}
80+
if hash dpkg 2>/dev/null; then dpkg -i *.${{ matrix.package_suffix }}; fi
81+
if hash rpm 2>/dev/null; then rpm -Uhv *.${{ matrix.package_suffix }}; fi
8082
# copy the package to $GITHUB_WORKSPACE, pointer to host path, is not possible, while upload from ${{ github.workspace }} is fine
8183
mv *.${{ matrix.package_suffix }} ${{ env.PROJECT_NAME }}-${{ env.PROJECT_VERSION }}_${{ matrix.os }}.${{ matrix.package_suffix }}
8284
85+
8386
################### testing ##########################
8487
- name: Run unit tests
8588
working-directory: ${{ github.workspace }}/build

scripts/run_all_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ then
4242
fi
4343
geomPipeline.py detect ../data/test_geometry/test_geometry.stp --verbosity WARNING
4444
# run `geomPipeline.py` to generate a config.json file for test_*.py below
45-
geomPipeline.py ../data/test_geometry/test_geometry.stp --verbosity WARNING
45+
geomPipeline.py ../data/test_geometry/test_geometry.stp -o test_geometry_result.brep
4646
# test manifest.json input file type
4747
geomPipeline.py check ../data/test_geometry/test_geometry_manifest.json --verbosity WARNING
4848
if [ ! $? -eq 0 ] ; then echo "Error during geometry test" ; exit 1 ; fi

src/python/geomPipeline.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __str__(self):
6767

6868
def geom_add_argument(parser):
6969
parser.add_argument(
70-
"--metadata", nargs=1, help="input metadata file, only for brep input geometry"
70+
"--metadata", help="input metadata file, only for brep input geometry"
7171
)
7272

7373
# set the global parameters
@@ -112,21 +112,26 @@ def geom_add_argument(parser):
112112
outputFile = case_name + "_processed.brep" # saved to case output folder
113113
if args.outputFile:
114114
outputFile = args.outputFile
115+
print("args.outputFile = ", args.outputFile)
116+
117+
# output metadata filename
118+
outputMetadataFile = outputFile[: outputFile.rfind(".")] + "_metadata.json"
115119

116120
################################ geom arg ##############################
117-
hasInputMetadataFile = True
121+
hasInputMetadataFile = False
118122
if args.metadata:
119123
if os.path.exists(args.metadata):
120124
inputMetadataFile = args.metadata
125+
hasInputMetadataFile = True
121126
else:
122127
raise IOError("input metadata file does not exist: ", args.metadata)
123128
else:
124129
if inputFile.find(".brep") > 0 or inputFile.find(".brp"):
125130
inputMetadataFile = inputFile[: inputFile.rfind(".")] + "_metadata.json"
126-
else:
127-
hasInputMetadataFile = False
131+
if os.path.exists(inputMetadataFile):
132+
hasInputMetadataFile = True
128133

129-
globalTolerance = 0.001
134+
globalTolerance = 0.001 # length unit is mm
130135
if args.tolerance:
131136
globalTolerance = args.tolerance
132137

@@ -138,8 +143,6 @@ def geom_add_argument(parser):
138143
if args.ignore_failed != None and args.ignore_failed:
139144
ignoreFailed = True
140145

141-
# output metadata filename
142-
outputMetadataFile = case_name + "_processed" + "_metadata.json"
143146

144147
if debugging > 0:
145148
print("action on the geometry is ", args.action)

src/python/pppPipelineController.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ def ppp_add_argument(parser):
4747

4848
# optional arguments
4949
parser.add_argument(
50-
"-o", "--outputFile", nargs=1, help="output file name (without folder path)"
50+
"-o", "--outputFile", help="output file name (without folder path)"
5151
)
52+
# do not use "nargs=1" it will return args.outputFile as a list instead of string
5253
parser.add_argument(
53-
"--workingDir", nargs=1, help="working folder path, by default pwd"
54+
"--workingDir", help="working folder path, by default pwd"
5455
)
5556
parser.add_argument(
5657
"--outputDir",
57-
nargs=1,
5858
help="output folder path, by default a subfolder in workingDir",
5959
)
6060

@@ -250,6 +250,7 @@ def __init__(self):
250250
pass
251251

252252
def config(self):
253+
# this must be override by derived class
253254

254255
parser = argparse.ArgumentParser(usage=USAGE)
255256
parser = ppp_add_argument(parser)

src/python/pppStartPipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def ppp_start_pipeline(config_file_name):
5151
p.process()
5252
else:
5353
import subprocess
54-
result = subprocess.check_output([ppp_executable, config_file_name])
54+
result = subprocess.check_output([ppp_geom_executable, config_file_name])
5555
print(result)
5656

5757

0 commit comments

Comments
 (0)