mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	 f968c152c2
			
		
	
	
		f968c152c2
		
	
	
	
	
		
			
			Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: Idf0414a43bedcd970811d87b40ee3e2063e4e5c6
		
			
				
	
	
		
			54 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| import os
 | |
| import json
 | |
| 
 | |
| setting_id_used=set()
 | |
| setting_id_all=set()
 | |
| root_dir=os.path.dirname(os.path.abspath(__file__))
 | |
| 
 | |
| 
 | |
| def loadBlackList():
 | |
|     with open(root_dir+'/blacklist.json') as file:
 | |
|         data=json.load(file)
 | |
| 
 | |
|     for key,val in data.items():
 | |
|         for item in val:
 | |
|             setting_id_used.add(item)
 | |
|             setting_id_all.add(item)
 | |
| 
 | |
| def traverse_files(path):
 | |
|     for file in os.listdir(path):
 | |
|         file_path = os.path.join(path, file)
 | |
|         if os.path.isdir(file_path):
 | |
|             traverse_files(file_path)  # 递归遍历子文件夹
 | |
|         elif file_path.endswith('.json'):
 | |
|             # 解析 JSON 文件并提取 setting_id 的值
 | |
|             with open(file_path) as f:
 | |
|                 data = json.load(f)
 | |
|                 if 'setting_id' in data:
 | |
|                     setting_id_all.add(data['setting_id'])
 | |
| 
 | |
| def getUsedId(brand):
 | |
|     with open(root_dir+'/'+brand+'.json')as file:
 | |
|         data=json.load(file)
 | |
| 
 | |
|     key_list=["machine_model_list","machine_list","filament_list","process_list"]
 | |
| 
 | |
|     for key in key_list:
 | |
|           for elem in data[key]:
 | |
|             path=elem['sub_path']
 | |
|             with open(root_dir+'/'+brand+'/'+path) as file:
 | |
|                 file_data=json.load(file)
 | |
|             if 'setting_id' in file_data:
 | |
|                 setting_id_used.add(file_data['setting_id'])
 | |
| 
 | |
| 
 | |
| def getTotalId(brand):
 | |
|     traverse_files(root_dir+'/'+brand)
 | |
| 
 | |
| 
 | |
| loadBlackList()
 | |
| getUsedId('BBL')
 | |
| getTotalId('BBL')
 | |
| 
 | |
| print("unused setting_id :")
 | |
| print(setting_id_all.difference(setting_id_used))
 |