diff --git a/__pycache__/compute_print_net.cpython-312.pyc b/__pycache__/compute_print_net.cpython-312.pyc index 39441c7..9c4e1e4 100644 Binary files a/__pycache__/compute_print_net.cpython-312.pyc and b/__pycache__/compute_print_net.cpython-312.pyc differ diff --git a/__pycache__/download_print.cpython-312.pyc b/__pycache__/download_print.cpython-312.pyc index 2c2b0ee..2c69d08 100644 Binary files a/__pycache__/download_print.cpython-312.pyc and b/__pycache__/download_print.cpython-312.pyc differ diff --git a/__pycache__/point_cloud_layout.cpython-312.pyc b/__pycache__/point_cloud_layout.cpython-312.pyc index a189c63..35baa52 100644 Binary files a/__pycache__/point_cloud_layout.cpython-312.pyc and b/__pycache__/point_cloud_layout.cpython-312.pyc differ diff --git a/__pycache__/print_factory_type_setting_obj_run.cpython-312.pyc b/__pycache__/print_factory_type_setting_obj_run.cpython-312.pyc index c0da2a1..8aad927 100644 Binary files a/__pycache__/print_factory_type_setting_obj_run.cpython-312.pyc and b/__pycache__/print_factory_type_setting_obj_run.cpython-312.pyc differ diff --git a/__pycache__/test_load_json.cpython-312.pyc b/__pycache__/test_load_json.cpython-312.pyc index fe36fd2..a143cc8 100644 Binary files a/__pycache__/test_load_json.cpython-312.pyc and b/__pycache__/test_load_json.cpython-312.pyc differ diff --git a/clound_print.py b/clound_print.py index 56a7472..d50e4f6 100644 --- a/clound_print.py +++ b/clound_print.py @@ -263,16 +263,6 @@ def process_clound_print(data): # 如果不是 JSON,返回原始字符串作为值 print("error!") - print(f"print_ids={print_ids}") - - # print_ids2 = [115988, 118411] - - # api_addr_pre = "https://mp.api.suwa3d.com" - # test = True - # if test: - # api_addr_pre = "http://127.0.0.1:8199" - # url = f"{api_addr_pre}/api/printOrder/getInfoByPrintIds?print_ids={print_ids}" - url = f"https://mp.api.suwa3d.com/api/printOrder/getInfoByPrintIds?print_ids={print_ids}" res = requests.get(url) diff --git a/compute_print_net.py b/compute_print_net.py index d8c7ca3..469b1ce 100644 --- a/compute_print_net.py +++ b/compute_print_net.py @@ -23,7 +23,7 @@ compute_bbox_out """ def compute_bbox_out(mesh_obj): - return compute_bbox(mesh_obj) + return compute_bbox_ext(mesh_obj) # -------------------------- 结束:获取bbox数据 -------------------------- @@ -423,12 +423,12 @@ def compute_bbox_all(dict_mesh_obj,is_downsample): obj_name = key mesh_obj = value - total_matrix, min_bound, max_bound, pcd_fix, ply_name = compute_bbox(mesh_obj,obj_name,is_downsample) + total_matrix, pcd_fix, ply_name = compute_bbox(mesh_obj,obj_name,is_downsample) dict_total_matrix[obj_name] = total_matrix dict_pcd_fix[ply_name] = pcd_fix - print(f"compute_bbox {obj_name} time={time.time()-start_time}") + print(f"compute_bbox {obj_name} pcd_fix={pcd_fix} time={time.time()-start_time}") # dict_mesh_obj.clear() # del dict_mesh_obj @@ -437,7 +437,26 @@ def compute_bbox_all(dict_mesh_obj,is_downsample): return dict_total_matrix,all_models + def compute_bbox(mesh_obj, obj_name="", is_downsample=True): + # return compute_bbox_ext(mesh_obj, obj_name, is_downsample) + + mesh_obj_origin = copy.deepcopy(mesh_obj) + total_matrix, z_max, min_bound, max_bound, ply_name = compute_bbox_ext(mesh_obj, obj_name, is_downsample) + + transformed_vertices = mesh_transform_by_matrix(np.asarray(mesh_obj_origin.vertices), total_matrix) + + pcd = o3d.geometry.PointCloud() + pcd.points = o3d.utility.Vector3dVector(transformed_vertices) + if is_downsample: + pcd_downsampled = down_sample(pcd, voxel_size, False) + pcd_fix = pcd_downsampled + else: + pcd_fix = pcd + + return total_matrix, pcd_fix, ply_name + +def compute_bbox_ext(mesh_obj, obj_name="", is_downsample=True): total_matrix = np.eye(4) total_matrix, z_max= get_lowest_position_of_center_ext(mesh_obj, total_matrix) @@ -451,12 +470,13 @@ def compute_bbox(mesh_obj, obj_name="", is_downsample=True): # 将点云摆正和X轴平衡 obj_transformed_second,total_matrix = arrange_box_correctly(obj_transformed,voxel_size,total_matrix) - total_matrix, min_bound, max_bound, pcd_fix, ply_name = get_new_bbox(obj_transformed_second,obj_name,voxel_size,is_downsample,total_matrix) + total_matrix, min_bound, max_bound, ply_name, pcd_fix = get_new_bbox(obj_transformed_second,obj_name,voxel_size,is_downsample,total_matrix) del obj_transformed del obj_transformed_second - return total_matrix, z_max, min_bound, max_bound, pcd_fix, ply_name + # return total_matrix, z_max, min_bound, max_bound, ply_name, pcd_fix + return total_matrix, z_max, min_bound, max_bound, ply_name def arrange_box_correctly(obj_transformed, voxel_size,total_matrix): @@ -570,7 +590,7 @@ def get_new_bbox(obj_transformed_second,obj_name,voxel_size,is_downsample,total_ else: ply_name = "" - return total_matrix, min_bound, max_bound, pcd_fix, ply_name + return total_matrix, min_bound, max_bound, ply_name, pcd_fix class Platform: def __init__(self, width, depth, height): diff --git a/download_print.py b/download_print.py index 5ebf13e..ef3c0a0 100644 --- a/download_print.py +++ b/download_print.py @@ -16,6 +16,7 @@ import argparse from config import print_factory_type_dir from general import is_use_debug_oss +from general import transform_save_o3d CameraModel = collections.namedtuple( "CameraModel", ["model_id", "model_name", "num_params"] diff --git a/test_load_json.py b/test_load_json.py index de25b40..52b9939 100644 --- a/test_load_json.py +++ b/test_load_json.py @@ -94,8 +94,8 @@ def load_and_transform_models(base_path, dict_origin, json_name): print(f"已加载并变换: {index} {os.path.basename(obj_path)}") index = index + 1 - #if (index > 100): - # break + if (index > 80): + break add_plank = True if add_plank: