@@ -29,18 +29,16 @@ def random_rgb() -> tuple[int, int, int]:
2929)
3030@click .argument ("input-file" , type = click .Path (exists = True , dir_okay = False ))
3131@click .option (
32- "--output-dir " ,
33- default = ". " ,
34- type = click .Path (exists = True , file_okay = False ),
35- help = "Directory to save output mesh files " ,
32+ "--output-path " ,
33+ default = "output.obj " ,
34+ type = click .Path (dir_okay = False ),
35+ help = "Output file path with extension " ,
3636)
3737@click .option (
38- "--output-format" , default = "obj" , help = "File extension for saving part meshes"
39- )
40- @click .option (
41- "--output-combined" ,
42- default = True ,
43- help = "Output a single mesh file with multiple internal objects" ,
38+ "--output-split" ,
39+ default = False ,
40+ is_flag = True ,
41+ help = "Output separate mesh files for each convex part" ,
4442)
4543@click .option (
4644 "--threshold" ,
@@ -68,16 +66,15 @@ def random_rgb() -> tuple[int, int, int]:
6866)
6967@click .option (
7068 "--seed" ,
71- default = 42 ,
69+ default = 0 ,
7270 type = click .IntRange (min = 0 ),
7371 help = "Random generator seed for deterministic output" ,
7472)
7573@click .version_option ()
7674def main (
7775 input_file : str ,
78- output_format : str ,
79- output_combined : bool ,
80- output_dir : str ,
76+ output_path : str ,
77+ output_split : bool ,
8178 threshold : float ,
8279 mcts_depth : int ,
8380 mcts_iterations : int ,
@@ -113,14 +110,12 @@ def main(
113110 ]
114111
115112 # Output a single file of multiple objects or multiple files.
116- output_stem = Path (input_file ).stem + "_convex"
117- if output_combined :
118- output_path = Path (output_dir ) / f"{ output_stem } .{ output_format } "
119- trimesh .Scene (output_parts ).export (output_path )
120- else :
113+ output_path = Path (output_path )
114+ if output_split :
121115 for i , part in enumerate (output_parts ):
122- output_path = Path (output_dir ) / f"{ output_stem } _{ i } .{ output_format } "
123- part .export (output_path )
116+ part .export (output_path .with_stem (output_path .stem + f"_{ i } " ))
117+ else :
118+ trimesh .Scene (output_parts ).export (output_path )
124119
125120
126121if __name__ == "__main__" :
0 commit comments