From 17c8087653441584f24449cdb6a642ccc8d7a054 Mon Sep 17 00:00:00 2001 From: johltn Date: Fri, 5 Feb 2021 07:23:48 +0100 Subject: [PATCH 001/289] Test --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5e7d7682..888c985f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ application/static/bimsurfer application/nix application/win application/ifc-pipeline.db +*.ifc From 3f0a88b472c2dfd3b9feedb0367b07163f83595b Mon Sep 17 00:00:00 2001 From: johltn Date: Mon, 8 Feb 2021 14:43:36 +0100 Subject: [PATCH 002/289] No validation --- application/worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/worker.py b/application/worker.py index 3da4db9b..0907f170 100644 --- a/application/worker.py +++ b/application/worker.py @@ -175,7 +175,7 @@ def do_process(id): input_files = [name for name in os.listdir(d) if os.path.isfile(os.path.join(d, name))] tasks = [ - ifc_validation_task, + xml_generation_task, geometry_generation_task, svg_generation_task, From ad8fd4e9e754b28d9d2d578d4d773a7a45dc777c Mon Sep 17 00:00:00 2001 From: johltn Date: Wed, 17 Feb 2021 21:45:52 +0100 Subject: [PATCH 003/289] First multiple loading --- .gitignore | 6 + application/main.py | 118 +++++++++------ application/static/main.css | 28 +++- application/static/validation.css | 57 +++++++ application/templates/progress - Copy.html | 139 ++++++++++++++++++ application/templates/progress.html | 139 ++++++++++++++++-- application/templates/validation_results.html | 72 +++++++++ application/worker.py | 29 ++-- application/wsgi.py | 2 +- 9 files changed, 520 insertions(+), 70 deletions(-) create mode 100644 application/static/validation.css create mode 100644 application/templates/progress - Copy.html create mode 100644 application/templates/validation_results.html diff --git a/.gitignore b/.gitignore index 888c985f..f8b7e8e5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,9 @@ application/nix application/win application/ifc-pipeline.db *.ifc +application/ifc-python-parser +application/ifc-parser +application/bimsurfer_temp/ +application/static/icons/ +application/static/navbar/ +application/static/test.jpg diff --git a/application/main.py b/application/main.py index d234479f..326d23d4 100644 --- a/application/main.py +++ b/application/main.py @@ -114,53 +114,34 @@ def process_upload(filewriter, callback_url=None): def process_upload_multiple(files, callback_url=None): - id = utils.generate_id() - d = utils.storage_dir_for_id(id) - os.makedirs(d) - - file_id = 0 - session = database.Session() - m = database.model(id, '') - session.add(m) - + ids = [] for file in files: fn = file.filename filewriter = lambda fn: file.save(fn) - filewriter(os.path.join(d, id+"_"+str(file_id)+".ifc")) - file_id += 1 - m.files.append(database.file(id, '')) + id = utils.generate_id() + ids.append(id) + d = utils.storage_dir_for_id(id) + os.makedirs(d) - session.commit() - session.close() + filewriter(os.path.join(d, id+".ifc")) + + session = database.Session() + session.add(database.model(id, '')) + session.commit() + session.close() if DEVELOPMENT: - t = threading.Thread(target=lambda: worker.process(id, callback_url)) - t.start() - else: - q.enqueue(worker.process, id, callback_url) - - return id + t = threading.Thread(target=lambda: worker.process(ids, callback_url)) + t.start() + + return ids + @application.route('/', methods=['POST']) def put_main(): - """ - Upload model - --- - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - ifc: - type: string - format: binary - responses: - '200': - description: redirect - """ + ids = [] files = [] @@ -170,7 +151,16 @@ def put_main(): files.append(file) - id = process_upload_multiple(files) + ids = process_upload_multiple(files) + # print("IDdddddddddddddddddddddddddddddddddddddddddddd" , ids) + + # id = '|'.join(ids) + + # id = str(ids[0]) + str(ids[1]) + id = "" + for i in ids: + id += i + url = url_for('check_viewer', id=id) if request.accept_mimetypes.accept_json: @@ -181,19 +171,59 @@ def put_main(): @application.route('/p/', methods=['GET']) def check_viewer(id): - if not utils.validate_id(id): - abort(404) - return render_template('progress.html', id=id) + # if not utils.validate_id(id): + # abort(404) + # print("IDDDDEEEEEEEEEEEEEEEEEEEEEEEEE", id) + # id = id[0] + # print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", id) + + n_files = int(len(id)/32) + + return render_template('progress.html', id=id, n_files=n_files) @application.route('/pp/', methods=['GET']) def get_progress(id): if not utils.validate_id(id): abort(404) - session = database.Session() - model = session.query(database.model).filter(database.model.code == id).all()[0] - session.close() - return jsonify({"progress": model.progress}) + + n_ids = int(len(id)/32) + print("uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu") + print("LEN", len(id)) + print("NID", n_ids) + count = 0 + all_ids = [] + b = 0 + i = 1 + a = 32 + for d in range(n_ids): + token = id[b:a] + all_ids.append(token) + # count += 1 + b = a + i+=1 + a = 32*i + + + print() + + ids = [id[0:32], id[32::]] + # ids = all_ids + + print("NEW ID", all_ids) + print("OLD ID", ids) + ids = all_ids + model_progresses = [] + + for i in ids: + # print("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", i) + session = database.Session() + model = session.query(database.model).filter(database.model.code == i).all()[0] + model_progresses.append(model.progress) + session.close() + + + return jsonify({"progress": model_progresses}) @application.route('/log/.', methods=['GET']) diff --git a/application/static/main.css b/application/static/main.css index 10dbf67b..ce4dc31f 100644 --- a/application/static/main.css +++ b/application/static/main.css @@ -26,13 +26,37 @@ h1.logo { border-radius: 2px; } -.progress .percentage { +table, th, td { + border: 1px solid rgba(161, 161, 161, 0.24); + border-collapse: collapse; + font-family:'Calibri'; + + border-left: none; + border-right: none; + + + } + + + + td{ + padding: 25px; + + } + +#percentage2, .progress .percentage { + position: absolute; + width: 500px; + text-align: center; +} + +#percentage2{ position: absolute; width: 500px; text-align: center; } -.progress .bar { +#bar2, .progress .bar { height: 24px; border-right: solid 1px #aaa; background: #eee; diff --git a/application/static/validation.css b/application/static/validation.css new file mode 100644 index 00000000..1412dff0 --- /dev/null +++ b/application/static/validation.css @@ -0,0 +1,57 @@ +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} + + +table, th, td { + border: 1px solid rgb(29, 29, 29); + border-collapse: collapse; + font-family:'Calibri'; + + /* border-left: none; + border-right: none; */ + + + } + + td{ + padding: 25px; + + } + + #navbar{ + display: flex; + + align-items:center; + justify-content: space-between; + + height: 10vh; + width:100%; + /* background-color:green */ + } + + #main{ + display:flex; + align-items:center; + justify-content:center; + /* background-color: rgb(182, 241, 133); */ + height:600px; + + } \ No newline at end of file diff --git a/application/templates/progress - Copy.html b/application/templates/progress - Copy.html new file mode 100644 index 00000000..4155c7ed --- /dev/null +++ b/application/templates/progress - Copy.html @@ -0,0 +1,139 @@ + + + + + IfcOpenShell viewer + + + + + + + + +
+

IfcOpenShell viewer

+ Conversion in progress... +
+
+
+
+ +
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/application/templates/progress.html b/application/templates/progress.html index fad7b6c2..0204fbbb 100644 --- a/application/templates/progress.html +++ b/application/templates/progress.html @@ -12,6 +12,8 @@ document.write(' @@ -20,20 +22,73 @@

IfcOpenShell viewer

Conversion in progress... -
-
-
-
-
+ + + + + + + + + + + + + {% for i in range(0, n_files) %} + {% set percentageid = "percentage" + i|string %} + {% set barid = "bar" + i|string %} + + + + + + + {% endfor %} +
SchemaMVDbSDDFile format
sss + +
+
+
+
+ +
+ + + + + + + + + diff --git a/application/templates/validation_results.html b/application/templates/validation_results.html new file mode 100644 index 00000000..90f751b5 --- /dev/null +++ b/application/templates/validation_results.html @@ -0,0 +1,72 @@ + + + + + + + Document + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +{% for record in my_list %} + + {% for i in record %} + {% if i == 'valid' or i=='invalid' or i=='warning' %} + + {% else %} + + {% endif %} + {% endfor %} + + +{% endfor %} +
SchemaMVDbSDDFile format
{{i}}
+ +
+ + + \ No newline at end of file diff --git a/application/worker.py b/application/worker.py index 0907f170..1d3f5067 100644 --- a/application/worker.py +++ b/application/worker.py @@ -34,6 +34,7 @@ import operator import shutil +import threading import requests on_windows = platform.system() == 'Windows' @@ -177,10 +178,10 @@ def do_process(id): tasks = [ xml_generation_task, - geometry_generation_task, - svg_generation_task, - glb_optimize_task, - gzip_task + geometry_generation_task + # svg_generation_task, + # glb_optimize_task, + # gzip_task ] tasks_on_aggregate = [] @@ -253,13 +254,15 @@ def run_task(t, args, aggregate_model=False): set_progress(id, elapsed) -def process(id, callback_url): - try: - do_process(id) - status = "success" - except Exception as e: - traceback.print_exc(file=sys.stdout) - status = "failure" +def process(ids, callback_url): + for id in ids: + try: + t = threading.Thread(target=lambda: do_process(id)) + t.start() + status = "success" + except Exception as e: + traceback.print_exc(file=sys.stdout) + status = "failure" - if callback_url is not None: - r = requests.post(callback_url, data={"status": status, "id": id}) + if callback_url is not None: + r = requests.post(callback_url, data={"status": status, "id": id}) diff --git a/application/wsgi.py b/application/wsgi.py index 248797f1..eef83fb5 100644 --- a/application/wsgi.py +++ b/application/wsgi.py @@ -1,4 +1,4 @@ from main import application if __name__ == "__main__": - application.run() + application.run(debug=1) From ac1dcd07beac2698f78d4791171aebb6c7a8f118 Mon Sep 17 00:00:00 2001 From: johltn Date: Wed, 17 Feb 2021 22:01:08 +0100 Subject: [PATCH 004/289] Update CSS --- application/static/main.css | 18 +++++++++++++ application/static/validation.css | 42 +++++++++++++++++++++++------ application/templates/progress.html | 24 ++++++++++++++++- 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/application/static/main.css b/application/static/main.css index ce4dc31f..124c028a 100644 --- a/application/static/main.css +++ b/application/static/main.css @@ -26,6 +26,24 @@ h1.logo { border-radius: 2px; } + + + +#navbar{ + display: flex; + + align-items:center; + justify-content: space-between; + + height: 10vh; + width:100%; + /* background-color:green */ + } + + + + + table, th, td { border: 1px solid rgba(161, 161, 161, 0.24); border-collapse: collapse; diff --git a/application/static/validation.css b/application/static/validation.css index 1412dff0..4ae375cc 100644 --- a/application/static/validation.css +++ b/application/static/validation.css @@ -19,17 +19,43 @@ time, mark, audio, video { vertical-align: baseline; } - table, th, td { - border: 1px solid rgb(29, 29, 29); - border-collapse: collapse; - font-family:'Calibri'; + border: 1px solid rgba(161, 161, 161, 0.24); + border-collapse: collapse; + font-family:'Calibri'; - /* border-left: none; - border-right: none; */ + border-left: none; + border-right: none; - - } + +} + + + +td{ + padding: 25px; + +} + + +#percentage2, .progress .percentage { + position: absolute; + width: 500px; + text-align: center; +} + +#percentage2{ + position: absolute; + width: 500px; + text-align: center; +} + +#bar2, .progress .bar { + height: 24px; + border-right: solid 1px #aaa; + background: #eee; + width: 0px; +} td{ padding: 25px; diff --git a/application/templates/progress.html b/application/templates/progress.html index 0204fbbb..22a29b30 100644 --- a/application/templates/progress.html +++ b/application/templates/progress.html @@ -19,7 +19,24 @@ -
+ + + + +

IfcOpenShell viewer

Conversion in progress... @@ -45,6 +62,9 @@

IfcOpenShell viewer

{% set percentageid = "percentage" + i|string %} {% set barid = "bar" + i|string %} + s + s + s s s s @@ -56,6 +76,8 @@

IfcOpenShell viewer

+ s + s {% endfor %} From 6ec93428ffbbf04137cfd030c7855f5ac4dc2f59 Mon Sep 17 00:00:00 2001 From: johltn Date: Sat, 20 Feb 2021 22:54:37 +0100 Subject: [PATCH 005/289] Table resultzs --- application/main.py | 116 +++++++-- application/static/main.css | 192 ++++---------- application/templates/progress.html | 243 +++++++++--------- application/templates/validation_results.html | 1 - 4 files changed, 275 insertions(+), 277 deletions(-) diff --git a/application/main.py b/application/main.py index 326d23d4..951b6a56 100644 --- a/application/main.py +++ b/application/main.py @@ -97,7 +97,7 @@ def process_upload(filewriter, callback_url=None): filewriter(os.path.join(d, id+".ifc")) session = database.Session() - session.add(database.model(id, '')) + session.add(database.model(id, 'test')) session.commit() session.close() @@ -126,7 +126,7 @@ def process_upload_multiple(files, callback_url=None): filewriter(os.path.join(d, id+".ifc")) session = database.Session() - session.add(database.model(id, '')) + session.add(database.model(id, fn)) session.commit() session.close() @@ -152,11 +152,7 @@ def put_main(): ids = process_upload_multiple(files) - # print("IDdddddddddddddddddddddddddddddddddddddddddddd" , ids) - # id = '|'.join(ids) - - # id = str(ids[0]) + str(ids[1]) id = "" for i in ids: id += i @@ -173,13 +169,39 @@ def put_main(): def check_viewer(id): # if not utils.validate_id(id): # abort(404) - # print("IDDDDEEEEEEEEEEEEEEEEEEEEEEEEE", id) - # id = id[0] - # print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", id) n_files = int(len(id)/32) - return render_template('progress.html', id=id, n_files=n_files) + filenames = [] + + all_ids = [] + b = 0 + i = 1 + a = 32 + for d in range(n_files): + token = id[b:a] + all_ids.append(token) + # count += 1 + b = a + i+=1 + a = 32*i + + + print() + + + ids = all_ids + filenames = [] + + for i in ids: + session = database.Session() + model = session.query(database.model).filter(database.model.code == i).all()[0] + print(model) + filenames.append(model.filename) + print("verif other ..................................", model.filename) + session.close() + + return render_template('progress.html', id=id, n_files=n_files, filenames=filenames) @application.route('/pp/', methods=['GET']) @@ -188,9 +210,7 @@ def get_progress(id): abort(404) n_ids = int(len(id)/32) - print("uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu") - print("LEN", len(id)) - print("NID", n_ids) + count = 0 all_ids = [] b = 0 @@ -207,23 +227,74 @@ def get_progress(id): print() - ids = [id[0:32], id[32::]] - # ids = all_ids - - print("NEW ID", all_ids) - print("OLD ID", ids) + ids = all_ids model_progresses = [] for i in ids: - # print("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww", i) session = database.Session() model = session.query(database.model).filter(database.model.code == i).all()[0] + print(model) model_progresses.append(model.progress) + print("verif other ..................................", model.filename) session.close() + return jsonify({"progress": model_progresses,"filename":model.filename}) + +# @application.route('/info/', methods=['GET']) +# def get_info(id): +# # if not utils.validate_id(id): +# # abort(404) + +# n_ids = int(len(id)/32) + +# count = 0 +# all_ids = [] +# b = 0 +# i = 1 +# a = 32 +# for d in range(n_ids): +# token = id[b:a] +# all_ids.append(token) +# # count += 1 +# b = a +# i+=1 +# a = 32*i + + +# print() + + +# ids = all_ids +# model_progresses = [] + +# for i in ids: +# session = database.Session() +# model = session.query(database.model).filter(database.model.code == i).all()[0] +# print(model) +# model_progresses.append(model.progress) +# print("verif other ..................................", model.filename) +# session.close() + +# return jsonify({"filename":model.filename}) + + + + + + + + + + + + + + + + + - return jsonify({"progress": model_progresses}) @application.route('/log/.', methods=['GET']) @@ -280,6 +351,11 @@ def get_viewer(id): ) +@application.route('/essai') +def essai(): + return jsonify({"Schema": "v", "MVD":"w", "BSdd":"v"}) + + @application.route('/m/', methods=['GET']) def get_model(fn): """ diff --git a/application/static/main.css b/application/static/main.css index 124c028a..4f9af9b0 100644 --- a/application/static/main.css +++ b/application/static/main.css @@ -1,29 +1,22 @@ -html, body, canvas { - display: block; - margin: 0; - padding: 0; - width: 100%; - height: 100%; -} - -form.upload { - padding: 32px; -} - -.container { - padding: 10px; -} - -h1.logo { - margin: 0; - font-weight: normal; -} - -.progress { - width: 500px; - height: 24px; - border: solid 1px gray; - border-radius: 2px; +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } @@ -35,14 +28,22 @@ h1.logo { align-items:center; justify-content: space-between; - height: 10vh; + height: 100px; width:100%; /* background-color:green */ } - + #main{ + display:flex; + align-items:center; + justify-content:center; + /* background-color: rgb(182, 241, 133); */ + /* height:600px; */ + /* height:800px; */ + + } table, th, td { border: 1px solid rgba(161, 161, 161, 0.24); @@ -58,134 +59,45 @@ table, th, td { td{ - padding: 25px; + + text-align: left; + vertical-align: middle; + padding:25px; } -#percentage2, .progress .percentage { - position: absolute; - width: 500px; - text-align: center; -} - -#percentage2{ - position: absolute; - width: 500px; - text-align: center; -} - -#bar2, .progress .bar { - height: 24px; - border-right: solid 1px #aaa; - background: #eee; - width: 0px; -} - -.bimsurfer-static-tree, .bimsurfer-metadata { - overflow: hidden; - overflow-y: scroll; -} - -.bimsurfer-static-tree, .bimsurfer-static-tree * { - user-select: none; - -ms-user-select: none; - -moz-user-select: none; - -webkit-user-select: none; - z-index: 1; -} - -.bimsurfer-static-tree div.item { - border-top: solid 1px #eee; - line-height: 12pt; -} - -.bimsurfer-static-tree > div > div.item { - border: none; -} - -.bimsurfer-static-tree div.bimsurfer-tree-label { - margin-left: -100px; - padding-left: 100px; - width: 1000px; - cursor: pointer; -} - -.bimsurfer-static-tree .bimsurfer-tree-children-with-indent { - padding-left: 10px; -} - -.bimsurfer-static-tree div.selected { - background: #6ae; - color: white; -} - -.bimsurfer-static-tree div.bimsurfer-tree-label:before { - content: "\21b3 "; -} - -.bimsurfer-static-tree div.bimsurfer-tree-eye:before { - content: "\1f441"; -} -.bimsurfer-tree-column { - display: inline-block; - overflow: hidden; -} - -div.bimsurfer-tree-eye-off { - opacity: 0.5; +.progress { + width: 200px; + height: 12px; + border: solid 1px rgba(128, 128, 128, 0.781); + border-radius: 2px; + background-color: rgba(194, 194, 194, 0.041); } -.bimsurfer-metadata h3 { - font-weight: bold; - margin: 0; - padding: 10px 0 0 0; - width: 1000px; -} -.bimsurfer-metadata table { - width: 100%; + .progress .percentage { + position: absolute; + width: 200px; + text-align: center; + } -.bimsurfer-metadata h3:before { - content: "\25b8 "; -} +.percentage{ -.bimsurfer-metadata th, -.bimsurfer-metadata td { - width: 50%; - border-bottom: solid 1px #eee; - text-align: left; + color:rgb(105, 125, 239); + font-weight: bold; } -.bimsurfer-metadata td:nth-child(1), -.bimsurfer-metadata th:nth-child(1) { - width: 30%; -} -.bimsurfer-metadata td:nth-child(2), -.bimsurfer-metadata th:nth-child(2) { - width: 70%; -} -.bimsurfer-metadata, -.bimsurfer-metadata h3, -.bimsurfer-static-tree { - font-size: 10pt; +.progress .bar { + height: 12px; + border-right: solid 1px #aaa; + background: rgb(105, 125, 239); + width: 0px; } -.spinner { - position: fixed; - top: calc(50% - 64px); - left: calc(50% - 64px); - width: 128px; - height: 128px; - border: solid 4px gray; - border-bottom-color: white; - border-radius: 50%; - animation: spin 2s linear infinite; - z-index: 9999; -} @keyframes spin { to { diff --git a/application/templates/progress.html b/application/templates/progress.html index 22a29b30..a9f53c22 100644 --- a/application/templates/progress.html +++ b/application/templates/progress.html @@ -5,17 +5,15 @@ IfcOpenShell viewer - + - + @@ -25,30 +23,15 @@ - + - - - - - - - -

IfcOpenShell viewer

- Conversion in progress... + - +
@@ -56,91 +39,157 @@

IfcOpenShell viewer

- + + {% for i in range(0, n_files) %} - {% set percentageid = "percentage" + i|string %} - {% set barid = "bar" + i|string %} - - - - - - - - - - - - {% endfor %} + {% set percentageid = "percentage" + i|string %} + {% set barid = "bar" + i|string %} + {% set fn = filenames[i]|string %} + {% set format = filenames[i][-3::]|string %} + + + + + + + + + + + + + + + + {% endfor %}
MVD bSDD File formatFile name
ssssss - -
-
-
-
- -
ss
{{fn}} + +
+ +
+
+ +
Stop
+
+ diff --git a/application/templates/validation_results.html b/application/templates/validation_results.html index 90f751b5..e6586c1c 100644 --- a/application/templates/validation_results.html +++ b/application/templates/validation_results.html @@ -13,7 +13,6 @@ -