IfcClash is now able to be built as an isolated Python binary. Hooray!

This commit is contained in:
Dion Moult
2021-08-03 22:44:46 +10:00
parent 7403d14001
commit ecfe8c3799
6 changed files with 39 additions and 50 deletions
+7
View File
@@ -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.
+1
View File
@@ -0,0 +1 @@
import ifcclash.__main__
-17
View File
@@ -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"
}
]
}
]
-31
View File
@@ -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()
+24 -2
View File
@@ -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()
+7
View File
@@ -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)