diff options
| author | bozokopic <bozo.kopic@gmail.com> | 2018-04-12 14:14:39 +0200 |
|---|---|---|
| committer | bozokopic <bozo.kopic@gmail.com> | 2018-04-12 14:14:39 +0200 |
| commit | 2b6b2b429376d05931b67cd2009dd5aa93cc841f (patch) | |
| tree | 119943b64bf1f7ad05ff7e8c960b68c79d4b649a /playground | |
| parent | e6974a745be9aef7982fb3788485550918ea2b75 (diff) | |
main.py
Diffstat (limited to 'playground')
| -rw-r--r-- | playground/calculate/.gitignore | 2 | ||||
| -rw-r--r-- | playground/calculate/params.yaml | 12 | ||||
| -rwxr-xr-x | playground/calculate/run.sh | 4 | ||||
| -rw-r--r-- | playground/csp/.gitignore | 1 | ||||
| -rw-r--r-- | playground/csp/main.py | 43 |
5 files changed, 18 insertions, 44 deletions
diff --git a/playground/calculate/.gitignore b/playground/calculate/.gitignore new file mode 100644 index 0000000..7f98a9c --- /dev/null +++ b/playground/calculate/.gitignore @@ -0,0 +1,2 @@ +/result.yaml +/output.pdf diff --git a/playground/calculate/params.yaml b/playground/calculate/params.yaml new file mode 100644 index 0000000..605acec --- /dev/null +++ b/playground/calculate/params.yaml @@ -0,0 +1,12 @@ +--- +cut_width: 1 +panels: + p1: + width: 50 + height: 50 +items: + i1: + width: 5 + height: 5 + can_rotate: true +... diff --git a/playground/calculate/run.sh b/playground/calculate/run.sh new file mode 100755 index 0000000..b62fc9e --- /dev/null +++ b/playground/calculate/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export PYTHONPATH=../../src_py +python -m opcut.main calculate --params params.yaml --result result.yaml --output-pdf output.pdf $* diff --git a/playground/csp/.gitignore b/playground/csp/.gitignore deleted file mode 100644 index 61d48f9..0000000 --- a/playground/csp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/output.pdf diff --git a/playground/csp/main.py b/playground/csp/main.py deleted file mode 100644 index 8aed531..0000000 --- a/playground/csp/main.py +++ /dev/null @@ -1,43 +0,0 @@ -import sys -sys.path += ['../../src_py'] - -from opcut import common -from opcut import csp -from opcut import output - - -def main(): - panels = [ - common.Panel(id='p1', width=100, height=65) - ] - items = [ - common.Item(id='i1', width=10, height=10, can_rotate=True), - common.Item(id='i2', width=10, height=9, can_rotate=True), - common.Item(id='i3', width=20, height=8, can_rotate=True), - common.Item(id='i4', width=10, height=20, can_rotate=True), - common.Item(id='i5', width=30, height=19, can_rotate=True), - common.Item(id='i6', width=10, height=18, can_rotate=False), - common.Item(id='i7', width=10, height=17, can_rotate=True), - common.Item(id='i8', width=20, height=16, can_rotate=True), - common.Item(id='i9', width=10, height=15, can_rotate=True), - common.Item(id='i10', width=30, height=14, can_rotate=True), - common.Item(id='i11', width=10, height=20, can_rotate=True), - common.Item(id='i12', width=19, height=30, can_rotate=False), - common.Item(id='i13', width=10, height=18, can_rotate=True), - common.Item(id='i14', width=10, height=17, can_rotate=True), - common.Item(id='i15', width=20, height=16, can_rotate=True), - common.Item(id='i16', width=10, height=15, can_rotate=True), - common.Item(id='i17', width=30, height=14, can_rotate=True), - common.Item(id='i18', width=10, height=20, can_rotate=True), - common.Item(id='i19', width=30, height=19, can_rotate=True), - ] - cut_width = 0.4 - method = common.Method.FORWARD_GREEDY - result = csp.calculate(panels, items, cut_width, method) - pdf_bytes = output.generate_pdf(result) - with open('output.pdf', 'wb') as f: - f.write(pdf_bytes) - - -if __name__ == '__main__': - sys.exit(main()) |
