|
@@ -5,6 +5,8 @@ import redis
|
|
|
import random
|
|
|
import json
|
|
|
import os
|
|
|
+import json
|
|
|
+import re
|
|
|
#https://medium.com/@emerico/convert-pdf-to-image-using-python-flask-2864fb655e01
|
|
|
|
|
|
|
|
@@ -25,7 +27,7 @@ def convert_pdf_img(filename):
|
|
|
|
|
|
def extract_all(uuid, filename, db):
|
|
|
#order_bounding_boxes_in_each_block.main(uuid, UPLOAD_FOLDER + "/" + filename)
|
|
|
- subprocess.call(['python3','/home/bscheibel/PycharmProjects/dxf_reader/main.py', str(uuid),UPLOAD_FOLDER + "/" + filename,db])
|
|
|
+ subprocess.call(['python3','/home/bscheibel/PycharmProjects/dxf_reader/main.py', str(uuid),UPLOAD_FOLDER + "/" + filename, db, str(1)])
|
|
|
|
|
|
@app.route('/', methods=['GET', 'POST'])
|
|
|
def upload_file():
|
|
@@ -57,17 +59,20 @@ def uploaded_file(filename, uuid):
|
|
|
db = redis.Redis("localhost")
|
|
|
#isos = db.get(uuid+"dims")
|
|
|
#print(iso)
|
|
|
- isos = json.loads(db.get(uuid+"isos"))
|
|
|
- dims = json.loads(db.get(uuid+"dims"))
|
|
|
+ isos = json.loads(db.get(str(uuid)+"isos"))
|
|
|
+ dims = json.loads(db.get(str(uuid)+"dims"))
|
|
|
html_code = ""
|
|
|
- # dims = eval(dims)
|
|
|
+ reg = r"(-?\d{1,}\.?\d*)"
|
|
|
for dim in dims:
|
|
|
html_code += '''<td><h4>''' + dim + '''</h4></td>'''
|
|
|
for d in dims[dim]:
|
|
|
- html_code += "<tr><td style='text-align:center'> <input type='checkbox' name='relevant." + d + "' value='checked' onchange='submit()'> </td>" + \
|
|
|
+ number = re.search(reg, d)
|
|
|
+ number = number.group(1)
|
|
|
+ coords = ",".join(str(e) for e in dims[dim][d])
|
|
|
+ html_code += "<tr><td style='text-align:center'> <input type='checkbox' name='relevant." + d + "' value='checked'> </td>" + \
|
|
|
"<td style='text-align:center'>" + d + "</td>" + \
|
|
|
- "<td style='text-align:center'> <input type='number' name='" + d + "' value='" + d + "' size='10' onchange='submit()'> </td></tr>"
|
|
|
- print(html_code)
|
|
|
+ "<td style='text-align:center'> <input type='number' step=0.01 data-coords='" + coords + "' name='" + d + "' value='" + number + "' size='10'> </td></tr>"
|
|
|
+ #print(html_code)
|
|
|
return render_template('show_image.html', filename=file_out, isos=isos, dims=dims, text=html_code)
|
|
|
|
|
|
else:
|
|
@@ -98,11 +103,11 @@ def generate(name):
|
|
|
except:
|
|
|
return"Sorry file not found"
|
|
|
|
|
|
-@app.route('/show_results')
|
|
|
+"""@app.route('/show_results')
|
|
|
def form_post():
|
|
|
text = []
|
|
|
db = redis.Redis('localhost')
|
|
|
for key in request.form:
|
|
|
db.set(key, request.form[key])
|
|
|
- return render_template('display_results.html')
|
|
|
+ return render_template('display_results.html'"""
|
|
|
|