Spaces:
Sleeping
Sleeping
Update dxf__omar3_2.py
Browse files- dxf__omar3_2.py +7 -7
dxf__omar3_2.py
CHANGED
|
@@ -92,7 +92,7 @@ def get_paper_size_in_inches(width, height):
|
|
| 92 |
|
| 93 |
def analyze_pdf(file_path):
|
| 94 |
# Open the PDF file
|
| 95 |
-
pdf_document = fitz.open(
|
| 96 |
|
| 97 |
# Iterate through pages and print their sizes
|
| 98 |
for page_number in range(len(pdf_document)):
|
|
@@ -147,9 +147,9 @@ def switch_case(argument):
|
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
-
def RetriveRatio(
|
| 151 |
|
| 152 |
-
width,height,paper_size = analyze_pdf (
|
| 153 |
|
| 154 |
if(width > height ):
|
| 155 |
bigger=width
|
|
@@ -411,9 +411,9 @@ def generate_color_array(length):
|
|
| 411 |
colorRanges.append((r, g, b))
|
| 412 |
return colorRanges
|
| 413 |
|
| 414 |
-
def Create_DF(dxfpath,
|
| 415 |
|
| 416 |
-
FinalRatio= RetriveRatio(
|
| 417 |
|
| 418 |
hatched_areas = get_hatched_areas(dxfpath,FinalRatio)
|
| 419 |
# SimilarAreaDictionary= pd.DataFrame(columns=['Area', 'Total Area', 'Perimeter', 'Total Perimeter', 'Occurences', 'Color'])
|
|
@@ -456,7 +456,7 @@ def Create_DF(dxfpath,pdfpath):
|
|
| 456 |
"""### Draw on Image and PDF"""
|
| 457 |
|
| 458 |
def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,pdfpath,pdfname):
|
| 459 |
-
FinalRatio= RetriveRatio(
|
| 460 |
hatched_areas = get_hatched_areas(dxfpath,FinalRatio)
|
| 461 |
img=pdftoimg(datadoc)
|
| 462 |
flipped_horizontal=flip(img)
|
|
@@ -480,7 +480,7 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,pdfpath,pdfname):
|
|
| 480 |
allshapes=[]
|
| 481 |
# Iterate through each polygon in metric units
|
| 482 |
NewColors = []
|
| 483 |
-
SimilarAreaDictionary=Create_DF(dxfpath,
|
| 484 |
i=0
|
| 485 |
|
| 486 |
|
|
|
|
| 92 |
|
| 93 |
def analyze_pdf(file_path):
|
| 94 |
# Open the PDF file
|
| 95 |
+
pdf_document = fitz.open('pdf',datadoc)
|
| 96 |
|
| 97 |
# Iterate through pages and print their sizes
|
| 98 |
for page_number in range(len(pdf_document)):
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
+
def RetriveRatio(datadoc,dxfpath):
|
| 151 |
|
| 152 |
+
width,height,paper_size = analyze_pdf (datadoc)
|
| 153 |
|
| 154 |
if(width > height ):
|
| 155 |
bigger=width
|
|
|
|
| 411 |
colorRanges.append((r, g, b))
|
| 412 |
return colorRanges
|
| 413 |
|
| 414 |
+
def Create_DF(dxfpath,datadoc):
|
| 415 |
|
| 416 |
+
FinalRatio= RetriveRatio(datadoc,dxfpath)
|
| 417 |
|
| 418 |
hatched_areas = get_hatched_areas(dxfpath,FinalRatio)
|
| 419 |
# SimilarAreaDictionary= pd.DataFrame(columns=['Area', 'Total Area', 'Perimeter', 'Total Perimeter', 'Occurences', 'Color'])
|
|
|
|
| 456 |
"""### Draw on Image and PDF"""
|
| 457 |
|
| 458 |
def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,pdfpath,pdfname):
|
| 459 |
+
FinalRatio= RetriveRatio(datadoc,dxfpath)
|
| 460 |
hatched_areas = get_hatched_areas(dxfpath,FinalRatio)
|
| 461 |
img=pdftoimg(datadoc)
|
| 462 |
flipped_horizontal=flip(img)
|
|
|
|
| 480 |
allshapes=[]
|
| 481 |
# Iterate through each polygon in metric units
|
| 482 |
NewColors = []
|
| 483 |
+
SimilarAreaDictionary=Create_DF(dxfpath,datadoc)
|
| 484 |
i=0
|
| 485 |
|
| 486 |
|