Marthee commited on
Commit
6135a02
·
verified ·
1 Parent(s): e38dc64

Update dxf__omar3_2.py

Browse files
Files changed (1) hide show
  1. 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(file_path)
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(pdfpath,dxfpath):
151
 
152
- width,height,paper_size = analyze_pdf (pdfpath)
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,pdfpath):
415
 
416
- FinalRatio= RetriveRatio(pdfpath,dxfpath)
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(pdfpath,dxfpath)
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,pdfpath)
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