|
@@ -27,6 +27,8 @@ def check_grid_upright(model_list, grid_data_dict):
|
|
|
print(model_list)
|
|
|
return True
|
|
|
|
|
|
+# def process_location(grids):
|
|
|
+# for name, location in grids.
|
|
|
|
|
|
def insert_group(group, model_id, calc_dict):
|
|
|
# 如果第一次往group里添加元素, 直接添加
|
|
@@ -42,14 +44,8 @@ def insert_group(group, model_id, calc_dict):
|
|
|
for single_group in group:
|
|
|
conflict = False
|
|
|
base_data = calc_dict.get(model_id)
|
|
|
- if isinstance(base_data, str):
|
|
|
- base_data = dict(base_data)
|
|
|
- calc_dict[model_id] = base_data
|
|
|
for compare_model_id in single_group:
|
|
|
compare_data = calc_dict.get(compare_model_id)
|
|
|
- if isinstance(compare_data, str):
|
|
|
- compare_data = dict(compare_data)
|
|
|
- calc_dict[compare_model_id] = compare_data
|
|
|
if has_conflict(base_data, compare_data):
|
|
|
conflict = True
|
|
|
break
|
|
@@ -62,9 +58,14 @@ def insert_group(group, model_id, calc_dict):
|
|
|
# 返回False是没冲突, True是有冲突
|
|
|
def has_conflict(base, compare):
|
|
|
for name, location in base.items():
|
|
|
+ if isinstance(location, str):
|
|
|
+ location = json.loads(location)
|
|
|
if name in compare:
|
|
|
type1 = location.get('Type')
|
|
|
- type2 = compare.get(name).get('Type')
|
|
|
+ location2 = compare.get(name)
|
|
|
+ if isinstance(location2, str):
|
|
|
+ location2 = dict(location2)
|
|
|
+ type2 = location2.get('Type')
|
|
|
if type1 in type2:
|
|
|
if 'Line' in type1:
|
|
|
if not is_same_line(location.get('Points'), compare.get(name).get('Points')):
|