Skip to content

Commit fe8c85a

Browse files
sawenzelclaude
andcommitted
Report progress of the surface and CSG phases
This adds a progress line to the two remaining silent phases of o2-cad-to-tgeo. - Exact-surface extraction reports how many leaf solids are done, with an ETA. - The CSG cascade prefixes each part with its position in the run. - On the ALICE 3 stave the CSG cascade is now the slowest phase, at about 20 s of 24 s; it is still serial. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 7d14123 commit fe8c85a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

‎Detectors/CADSupport/tools/O2_CADtoTGeo.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4546,7 +4546,10 @@ def emit_root_macro(
45464546
brep_files: Dict[str, str] = {} # def_lid -> absolute path of brep_*.brep (--dump-brep)
45474547
failures: Dict[str, List[str]] = {} # def_lid -> unsupported-face reasons
45484548
extracted: Dict[str, int] = {} # def_lid -> number of surface records written
4549-
for lid, shape in def_shapes.items():
4549+
t_extract = time.time()
4550+
extract_label = f"Extracting exact surfaces from {len(def_shapes)} leaf solid(s)"
4551+
for i_leaf, (lid, shape) in enumerate(def_shapes.items()):
4552+
_print_progress(extract_label, i_leaf + 1, len(def_shapes), t_extract)
45504553
surfaces, reasons, n_model_edges = extract_surfaces_for_shape(
45514554
shape, scale_to_cm, recognize_surfaces=recognize_flag, recognition=recognition,
45524555
lid=lid)

‎Detectors/CADSupport/tools/cadsupport/hook.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ def recognise_and_emit(def_shapes, def_names, scale_to_cm, out_folder, sanitize_
6868
csg_files = {}
6969
flat_files = {}
7070
records = []
71-
for lid, shape in def_shapes.items():
71+
n_parts = len(def_shapes)
72+
for i_part, (lid, shape) in enumerate(def_shapes.items()):
7273
display = def_names.get(lid, "")
74+
if verbose:
75+
print(f" [{i_part + 1}/{n_parts}]", end=" ", flush=True)
7376
volname = sanitize_filename(display) if display else "vol"
7477
suffix = f"{volname}_{sanitize_filename(lid)}"
7578
solid = scaled[lid] if scaled and lid in scaled else scaled_to_cm(shape, scale_to_cm)

0 commit comments

Comments
 (0)