Marthee commited on
Commit
e9ed019
·
verified ·
1 Parent(s): ea2f08e

Update dxf__omar3_2.py

Browse files
Files changed (1) hide show
  1. dxf__omar3_2.py +31 -31
dxf__omar3_2.py CHANGED
@@ -1394,37 +1394,37 @@ def get_hatched_areas(datadoc,filename,FinalRatio,rotationangle,SearchArray):
1394
  hatched_areas.append([vertices, area1, perimeter, rgb_color])
1395
 
1396
 
1397
- elif entity.dxftype() == 'SPLINE':
1398
- spline_entity = entity
1399
- vertices = []
1400
- control_points = spline_entity.control_points
1401
- if(len(control_points)>3):
1402
- for i in range(len(control_points)):
1403
- vertices.append([control_points[i][0]* (FinalRatio),control_points[i][1]* (FinalRatio)])
1404
- poly=ShapelyPolygon(vertices)
1405
-
1406
- minx, miny, maxx, maxy = poly.bounds
1407
-
1408
- # Calculate the width and height of the bounding box
1409
- width = maxx - minx
1410
- height = maxy - miny
1411
-
1412
-
1413
- if (poly.area > 0.9 and (height > 0.7 and width > 0.7)):
1414
- area1 = round(poly.area,3)
1415
- perimeter = round (poly.length,3)
1416
- normalized_vertices = normalize_vertices(vertices)
1417
-
1418
- duplicate_found = False
1419
- for existing_vertices, existing_area in unique_shapes:
1420
- if normalized_vertices == existing_vertices or areas_are_similar(area1, existing_area):
1421
- duplicate_found = True
1422
- break
1423
-
1424
- if not duplicate_found:
1425
- rgb_color = get_hatch_color(entity) # Assuming this function exists
1426
- unique_shapes.append((normalized_vertices, area1))
1427
- hatched_areas.append([vertices, area1, perimeter, rgb_color])
1428
 
1429
  sorted_data = sorted(hatched_areas, key=lambda x: x[1])
1430
  return sorted_data,Legendarray
 
1394
  hatched_areas.append([vertices, area1, perimeter, rgb_color])
1395
 
1396
 
1397
+ # elif entity.dxftype() == 'SPLINE':
1398
+ # spline_entity = entity
1399
+ # vertices = []
1400
+ # control_points = spline_entity.control_points
1401
+ # if(len(control_points)>3):
1402
+ # for i in range(len(control_points)):
1403
+ # vertices.append([control_points[i][0]* (FinalRatio),control_points[i][1]* (FinalRatio)])
1404
+ # poly=ShapelyPolygon(vertices)
1405
+
1406
+ # minx, miny, maxx, maxy = poly.bounds
1407
+
1408
+ # # Calculate the width and height of the bounding box
1409
+ # width = maxx - minx
1410
+ # height = maxy - miny
1411
+
1412
+
1413
+ # if (poly.area > 0.9 and (height > 0.7 and width > 0.7)):
1414
+ # area1 = round(poly.area,3)
1415
+ # perimeter = round (poly.length,3)
1416
+ # normalized_vertices = normalize_vertices(vertices)
1417
+
1418
+ # duplicate_found = False
1419
+ # for existing_vertices, existing_area in unique_shapes:
1420
+ # if normalized_vertices == existing_vertices or areas_are_similar(area1, existing_area):
1421
+ # duplicate_found = True
1422
+ # break
1423
+
1424
+ # if not duplicate_found:
1425
+ # rgb_color = get_hatch_color(entity) # Assuming this function exists
1426
+ # unique_shapes.append((normalized_vertices, area1))
1427
+ # hatched_areas.append([vertices, area1, perimeter, rgb_color])
1428
 
1429
  sorted_data = sorted(hatched_areas, key=lambda x: x[1])
1430
  return sorted_data,Legendarray