Update app.py
Browse files
app.py
CHANGED
|
@@ -481,12 +481,12 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0,pdf_content=0):
|
|
| 481 |
|
| 482 |
if pdf_content:
|
| 483 |
if section.startswith('3.3'):
|
| 484 |
-
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas =deploying_3_3.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray, pdfpath,result[0],pdf_content)
|
| 485 |
else:
|
| 486 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas, bax_pretty_xml, column_xml=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray, pdfpath,result[0],pdf_content)
|
| 487 |
else:
|
| 488 |
if section.startswith('3.3'):
|
| 489 |
-
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas =deploying_3_3.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray,pdfpath,result[0])
|
| 490 |
else:
|
| 491 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas, bax_pretty_xml, column_xml=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray,pdfpath,result[0])
|
| 492 |
global colorsused
|
|
@@ -500,16 +500,16 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0,pdf_content=0):
|
|
| 500 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=nameofpdf)
|
| 501 |
|
| 502 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 503 |
-
if section.startswith('3.3'):
|
| 504 |
-
|
| 505 |
-
else:
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
################################# 2.7- #################################
|
| 514 |
elif section.startswith('2.7') : #section value - 2.7 floor finishes
|
| 515 |
print('code of 2.7')
|
|
@@ -525,9 +525,9 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0,pdf_content=0):
|
|
| 525 |
print("SearchArray = ",SearchArray)
|
| 526 |
global hatched_areas2_7
|
| 527 |
if pdf_content:
|
| 528 |
-
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas=Code_2_7.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4],SearchArray,Thickness, pdfpath,result[0],pdf_content)
|
| 529 |
else:
|
| 530 |
-
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas=Code_2_7.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4],SearchArray,Thickness, pdfpath,result[0])
|
| 531 |
# global colorsused
|
| 532 |
hatched_areas2_7=hatched_areas
|
| 533 |
colorsused=list(SimilarAreaDictionary['Color'])
|
|
@@ -540,7 +540,13 @@ def measureproject(result,dataDoc=0,img=0,dxffile=0,pdf_content=0):
|
|
| 540 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=nameofpdf) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 541 |
|
| 542 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 543 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 544 |
# arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]#,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 545 |
################################# -2.8- #################################
|
| 546 |
elif section.startswith('2.8') or section.startswith('2.6'): #section value - 2.8 floor finishes
|
|
|
|
| 481 |
|
| 482 |
if pdf_content:
|
| 483 |
if section.startswith('3.3'):
|
| 484 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas , bax_pretty_xml, column_xml=deploying_3_3.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray, pdfpath,result[0],pdf_content)
|
| 485 |
else:
|
| 486 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas, bax_pretty_xml, column_xml=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray, pdfpath,result[0],pdf_content)
|
| 487 |
else:
|
| 488 |
if section.startswith('3.3'):
|
| 489 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas , bax_pretty_xml, column_xml=deploying_3_3.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray,pdfpath,result[0])
|
| 490 |
else:
|
| 491 |
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas, bax_pretty_xml, column_xml=dxf__omar3_2.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4] ,SearchArray,pdfpath,result[0])
|
| 492 |
global colorsused
|
|
|
|
| 500 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=nameofpdf)
|
| 501 |
|
| 502 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 503 |
+
# if section.startswith('3.3'):
|
| 504 |
+
# arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]#,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 505 |
+
# else:
|
| 506 |
+
bax_b64 = base64.b64encode(bax_pretty_xml.encode("utf-8")).decode("ascii") #base64.b64encode(bax_pretty_xml).decode("ascii")
|
| 507 |
+
xml_b64 = base64.b64encode(column_xml.encode("utf-8")).decode("ascii")
|
| 508 |
+
|
| 509 |
+
bax_link= tsadropboxretrieval.upload_string_file(content_str=bax_pretty_xml,filename="baxfile.bax",path=dbPath)
|
| 510 |
+
xml_link= tsadropboxretrieval.upload_string_file(content_str=column_xml,filename="customCols.xml",path=dbPath)
|
| 511 |
+
|
| 512 |
+
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr ,bax_b64,xml_b64, bax_link,xml_link]
|
| 513 |
################################# 2.7- #################################
|
| 514 |
elif section.startswith('2.7') : #section value - 2.7 floor finishes
|
| 515 |
print('code of 2.7')
|
|
|
|
| 525 |
print("SearchArray = ",SearchArray)
|
| 526 |
global hatched_areas2_7
|
| 527 |
if pdf_content:
|
| 528 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas,bax_pretty_xml,column_xml=Code_2_7.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4],SearchArray,Thickness, pdfpath,result[0],pdf_content)
|
| 529 |
else:
|
| 530 |
+
doc,outputimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas,bax_pretty_xml,column_xml=Code_2_7.mainFunctionDrawImgPdf(dataDoc,temp_filename,result[4],SearchArray,Thickness, pdfpath,result[0])
|
| 531 |
# global colorsused
|
| 532 |
hatched_areas2_7=hatched_areas
|
| 533 |
colorsused=list(SimilarAreaDictionary['Color'])
|
|
|
|
| 540 |
pdflink= tsadropboxretrieval.uploadanyFile(doc=doc,path=dbPath,pdfname=nameofpdf) #doc=doc,pdfname=path,pdfpath=pdfpath+'Measured Plan/'
|
| 541 |
|
| 542 |
_, buffer = cv2.imencode('.png', outputimg)
|
| 543 |
+
bax_b64 = base64.b64encode(bax_pretty_xml.encode("utf-8")).decode("ascii") #base64.b64encode(bax_pretty_xml).decode("ascii")
|
| 544 |
+
xml_b64 = base64.b64encode(column_xml.encode("utf-8")).decode("ascii")
|
| 545 |
+
|
| 546 |
+
bax_link= tsadropboxretrieval.upload_string_file(content_str=bax_pretty_xml,filename="baxfile.bax",path=dbPath)
|
| 547 |
+
xml_link= tsadropboxretrieval.upload_string_file(content_str=column_xml,filename="customCols.xml",path=dbPath)
|
| 548 |
+
|
| 549 |
+
arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,[],namepathArr,bax_b64,xml_b64, bax_link,xml_link]#,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 550 |
# arr=[ base64.b64encode(buffer).decode('utf-8'),SimilarAreaDictionary.to_dict(), spreadsheet_url,spreadsheetId,[],list1.to_dict(),pdflink,hatched_areas,namepathArr]#,hatched_areas,namepathArr]# , spreadsheetId, spreadsheet_url , list1.to_dict()]
|
| 551 |
################################# -2.8- #################################
|
| 552 |
elif section.startswith('2.8') or section.startswith('2.6'): #section value - 2.8 floor finishes
|