mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
IfcClash is now able to be built as an isolated Python binary. Hooray!
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
import ifcclash.__main__
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -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()
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user