| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -14,7 +14,7 @@ from tqdm import tqdm  # 进度条显示 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from concurrent.futures import ProcessPoolExecutor, as_completed, TimeoutError  # 并行处理 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import logging | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from datetime import datetime | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from brep2sdf.utils.logger import setup_logger | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from brep2sdf.utils.logger import logger | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 导入OpenCASCADE相关库 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -30,11 +30,12 @@ from OCC.Core.BRepBndLib import brepbndlib  # 包围盒计算 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from OCC.Core.Bnd import Bnd_Box  # 包围盒 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from OCC.Core.TopoDS import TopoDS_Shape, topods, TopoDS_Vertex  # 拓扑数据结构 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 设置日志记录器 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					logger = setup_logger('process_brep') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 导入配置 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					from brep2sdf.config.default_config import get_default_config | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					config = get_default_config() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					# 设置最大面数阈值,用于加速处理 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					MAX_FACE = 70 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					MAX_FACE = config.data.max_face | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					def normalize(surfs, edges, corners): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    """ | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -191,9 +192,9 @@ def parse_solid(step_path): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    dict: 包含以下键值对的字典: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        # 几何数据 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'surf_wcs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(M, 3)的float32数组,表示面的点云坐标 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'edge_wcs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(100, 3)的float32数组,表示边的采样点坐标 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'edge_wcs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(num_edge_sample_points, 3)的float32数组,表示边的采样点坐标 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'surf_ncs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(M, 3)的float32数组,表示归一化后的面点云 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'edge_ncs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(100, 3)的float32数组,表示归一化后的边采样点 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'edge_ncs': np.ndarray(dtype=object)     # 形状为(N,)的数组,每个元素是形状为(num_edge_sample_points, 3)的float32数组,表示归一化后的边采样点 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'corner_wcs': np.ndarray(dtype=float32)  # 形状为(num_edges, 2, 3)的数组,表示每条边的两个端点坐标 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        'corner_unique': np.ndarray(dtype=float32)  # 形状为(num_vertices, 3)的数组,表示所有顶点的唯一坐标,num_vertices <= num_edges * 2 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -255,7 +256,7 @@ def parse_solid(step_path): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        face_explorer.Next() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    # Extract edge points | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    num_samples = 100  # 每条边固定100个采样点 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    num_samples = config.model.num_edge_points  # 使用配置中的边采样点数 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    while edge_explorer.More(): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        edge = topods.Edge(edge_explorer.Current()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        curve, first, last = BRep_Tool.Curve(edge) | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -270,7 +271,7 @@ def parse_solid(step_path): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if points: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                points = np.array(points, dtype=np.float32) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if len(points.shape) == 2 and points.shape[1] == 3: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    edge_pnts.append(points)  # 这里points已经是(100, 3)形状 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    edge_pnts.append(points)  # 现在points是(num_edge_points, 3)形状 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    edge_bbox_wcs.append(get_bbox(shape, edge)) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					         | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        edge_explorer.Next() | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |