diff --git a/src/ifcclash/README.md b/src/ifcclash/README.md index e9c38e3756..406131efb4 100644 --- a/src/ifcclash/README.md +++ b/src/ifcclash/README.md @@ -21,6 +21,13 @@ If you want something more Unix-like ... $ alias ifcclash='python -m ifcclash' ``` +Alternatively, you can package it as a distributable. + +``` +$ python make.py +$ ./dist/ifcclash +``` + ## Usage Instructions on what clashes to perform are structured in terms of clash sets. diff --git a/src/ifcclash/bootstrap.py b/src/ifcclash/bootstrap.py new file mode 100644 index 0000000000..8ad42c5195 --- /dev/null +++ b/src/ifcclash/bootstrap.py @@ -0,0 +1 @@ +import ifcclash.__main__ diff --git a/src/ifcclash/clashsets.json b/src/ifcclash/clashsets.json deleted file mode 100644 index 0826317114..0000000000 --- a/src/ifcclash/clashsets.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "name": "Clashset foo", - "tolerance": 0.01, - "a": [ - { "file": "/home/dion/one.ifc" } - ], - "b": [ - { - "file": "/home/dion/two.ifc", - "selector": ".IfcProduct", - "mode": "i" - } - ] - } -] - diff --git a/src/ifcclash/ifcclash/__init__.py b/src/ifcclash/ifcclash/__init__.py deleted file mode 100644 index da77a5d72d..0000000000 --- a/src/ifcclash/ifcclash/__init__.py +++ /dev/null @@ -1,31 +0,0 @@ -import sys -import json -import logging -import argparse -from .ifcclash import Clasher, ClashSettings - - -def main(): - parser = argparse.ArgumentParser(description="Clashes geometry between two IFC files") - parser.add_argument("input", type=str, help="A JSON dataset describing a series of clashsets") - parser.add_argument( - "-o", "--output", type=str, help="The JSON diff file to output. Defaults to output.json", default="output.json" - ) - args = parser.parse_args() - - settings = ClashSettings() - settings.output = args.output - settings.logger = logging.getLogger("Clash") - settings.logger.setLevel(logging.DEBUG) - handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.DEBUG) - settings.logger.addHandler(handler) - ifc_clasher = Clasher(settings) - with open(args.input, "r") as clash_sets_file: - ifc_clasher.clash_sets = json.loads(clash_sets_file.read()) - ifc_clasher.clash() - ifc_clasher.export() - - -if __name__ == "__main__": - main() diff --git a/src/ifcclash/ifcclash/__main__.py b/src/ifcclash/ifcclash/__main__.py index 0923453d15..047eabd822 100644 --- a/src/ifcclash/ifcclash/__main__.py +++ b/src/ifcclash/ifcclash/__main__.py @@ -1,4 +1,26 @@ #!/usr/bin/env python3 -import ifcclash +import sys +import json +import logging +import argparse +from .ifcclash import Clasher, ClashSettings -ifcclash.main() +parser = argparse.ArgumentParser(description="Clashes geometry between two IFC files") +parser.add_argument("input", type=str, help="A JSON dataset describing a series of clashsets") +parser.add_argument( + "-o", "--output", type=str, help="The JSON diff file to output. Defaults to output.json", default="output.json" +) +args = parser.parse_args() + +settings = ClashSettings() +settings.output = args.output +settings.logger = logging.getLogger("Clash") +settings.logger.setLevel(logging.DEBUG) +handler = logging.StreamHandler(sys.stdout) +handler.setLevel(logging.DEBUG) +settings.logger.addHandler(handler) +ifc_clasher = Clasher(settings) +with open(args.input, "r") as clash_sets_file: + ifc_clasher.clash_sets = json.loads(clash_sets_file.read()) +ifc_clasher.clash() +ifc_clasher.export() diff --git a/src/ifcclash/make.py b/src/ifcclash/make.py new file mode 100644 index 0000000000..1c766da8d6 --- /dev/null +++ b/src/ifcclash/make.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +import os +import subprocess + + +cmd = "pyinstaller ./bootstrap.py --name ifcclash --onefile --clean" +subprocess.check_output(cmd, shell=True)