Marthee commited on
Commit
e8ffdbe
·
verified ·
1 Parent(s): 80a27e7

Update Code_2_7.py

Browse files
Files changed (1) hide show
  1. Code_2_7.py +7 -7
Code_2_7.py CHANGED
@@ -616,17 +616,17 @@ def get_hatched_areas(datadoc,filename,FinalRatio,rotationangle,SearchArray):
616
  if(SearchArray):
617
  for i in range(len(SearchArray)):
618
 
619
- if (SearchArray[i][1] and SearchArray[i][2] and SearchArray[i][3]):
620
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
621
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
622
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
623
- if(text.startswith(SearchArray[i][1]) and len(text)==int(SearchArray[i][3])):
624
  position = text_entity.dxf.insert # Extract text position
625
  x, y = position.x, position.y
626
 
627
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
628
  NBS = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
629
- if (NBS.startswith(SearchArray[i][2])):
630
  positionNBS = text_entity.dxf.insert # Extract text position
631
  xNBS, yNBS = positionNBS.x, positionNBS.y
632
 
@@ -673,11 +673,11 @@ def get_hatched_areas(datadoc,filename,FinalRatio,rotationangle,SearchArray):
673
  text_with_positions.append([text, textNBS, (x, y), detected_color])
674
  print("text_with_positions=",text_with_positions)
675
 
676
- elif (SearchArray[i][1] and SearchArray[i][3]):
677
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
678
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
679
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
680
- if(text.startswith(SearchArray[i][1]) and len(text)==int(SearchArray[i][3])):
681
  position = text_entity.dxf.insert # Extract text position
682
  x, y = position.x, position.y
683
  textNBS = None
@@ -715,11 +715,11 @@ def get_hatched_areas(datadoc,filename,FinalRatio,rotationangle,SearchArray):
715
  text_with_positions.append([text, textNBS, (x, y), detected_color])
716
  print("text_with_positions=",text_with_positions)
717
 
718
- elif(SearchArray[i][1]):
719
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
720
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
721
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
722
- if(text.startswith(SearchArray[i][1])):
723
  position = text_entity.dxf.insert # Extract text position
724
  x, y = position.x, position.y
725
  textNBS = None
 
616
  if(SearchArray):
617
  for i in range(len(SearchArray)):
618
 
619
+ if (SearchArray[i][0] and SearchArray[i][1] and SearchArray[i][2]):
620
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
621
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
622
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
623
+ if(text.startswith(SearchArray[i][0]) and len(text)==int(SearchArray[i][2])):
624
  position = text_entity.dxf.insert # Extract text position
625
  x, y = position.x, position.y
626
 
627
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
628
  NBS = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
629
+ if (NBS.startswith(SearchArray[i][1])):
630
  positionNBS = text_entity.dxf.insert # Extract text position
631
  xNBS, yNBS = positionNBS.x, positionNBS.y
632
 
 
673
  text_with_positions.append([text, textNBS, (x, y), detected_color])
674
  print("text_with_positions=",text_with_positions)
675
 
676
+ elif (SearchArray[i][0] and SearchArray[i][2]):
677
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
678
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
679
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
680
+ if(text.startswith(SearchArray[i][0]) and len(text)==int(SearchArray[i][2])):
681
  position = text_entity.dxf.insert # Extract text position
682
  x, y = position.x, position.y
683
  textNBS = None
 
715
  text_with_positions.append([text, textNBS, (x, y), detected_color])
716
  print("text_with_positions=",text_with_positions)
717
 
718
+ elif(SearchArray[i][0]):
719
  for text_entity in doc.modelspace().query('TEXT MTEXT'):
720
  text = text_entity.text.strip() if hasattr(text_entity, 'text') else ""
721
  # if (text.startswith("P") and len(text) == 3) or (text.startswith("I") and len(text) == 3): # Filter for "Wall"
722
+ if(text.startswith(SearchArray[i][0])):
723
  position = text_entity.dxf.insert # Extract text position
724
  x, y = position.x, position.y
725
  textNBS = None