-
Notifications
You must be signed in to change notification settings - Fork 1
Every worker copies the whole ifc file into memory #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -484,7 +484,7 @@ def build_ifc(self): | |
| self.ifc_path = tk.StringVar() | ||
| ctk.CTkLabel(f, textvariable=self.ifc_path).grid(row=2, column=1, sticky="w") | ||
|
|
||
| ctk.CTkLabel(f, text="Processes (blank=auto)").grid(row=3, column=0, sticky='w') | ||
| ctk.CTkLabel(f, text="IFC workers (blank=auto)").grid(row=3, column=0, sticky='w') | ||
| self.ifc_proc = tk.StringVar() | ||
| ctk.CTkEntry(f, textvariable=self.ifc_proc, width=120).grid(row=3, column=1, sticky='w') | ||
|
|
||
|
|
@@ -512,7 +512,11 @@ def do_ifc_convert(self): | |
| if not mesh_out: | ||
| return | ||
| self.cfg["local_initialdir"] = os.path.dirname(mesh_out) | ||
| proc = int(self.ifc_proc.get()) if self.ifc_proc.get().strip() else None | ||
| try: | ||
| proc = int(self.ifc_proc.get()) if self.ifc_proc.get().strip() else None | ||
| except ValueError: | ||
| messagebox.showerror("Error", "IFC workers must be a whole number") | ||
| return | ||
|
|
||
| types = list_element_types(infile) | ||
|
|
||
|
|
@@ -521,28 +525,40 @@ def do_ifc_convert(self): | |
| vars = {} | ||
| for i, t in enumerate(sorted(types.keys())): | ||
| var = tk.BooleanVar(value=True) | ||
| tk.Checkbutton(sel, text=t, variable=var).grid(row=i, column=0, sticky="w") | ||
| tk.Checkbutton(sel, text=f"{t} ({types[t]})", variable=var).grid( | ||
| row=i, column=0, sticky="w" | ||
| ) | ||
| vars[t] = var | ||
|
Comment on lines
525
to
531
|
||
| def on_ok(): | ||
| sel.include = [t for t, v in vars.items() if v.get()] | ||
| sel.destroy() | ||
| tk.Button(sel, text="OK", command=on_ok).grid(row=len(vars), column=0) | ||
| sel.wait_window() | ||
| include = getattr(sel, 'include', None) | ||
| if not hasattr(sel, 'include'): | ||
| return | ||
| include = sel.include | ||
| if not include: | ||
| messagebox.showerror("Error", "No IFC element types selected") | ||
| return | ||
|
|
||
| if not confirm_overwrite_gui(mesh_out): | ||
| return | ||
|
|
||
| self.log_text.delete("1.0", tk.END) | ||
|
|
||
| def worker(): | ||
| try: | ||
| with contextlib.redirect_stdout(self.stdout_redirector): | ||
| ifc_to_mesh( | ||
| mesh = ifc_to_mesh( | ||
| infile, | ||
| mesh_out, | ||
| show_result=self.ifc_show.get(), | ||
| num_processes=proc, | ||
| include_types=include, | ||
| confirm_func=confirm_overwrite_gui, | ||
| confirm_func=lambda _: True, | ||
| ) | ||
| if mesh is None: | ||
| raise RuntimeError("IFC conversion did not produce a mesh") | ||
| def done(): | ||
| self.add_recent_file(mesh_out) | ||
| messagebox.showinfo("Done", "Mesh generated") | ||
|
|
@@ -832,17 +848,35 @@ def task(prev): | |
| vars = {} | ||
| for i, t in enumerate(sorted(types.keys())): | ||
| var = tk.BooleanVar(value=True) | ||
| tk.Checkbutton(sel, text=t, variable=var).grid(row=i, column=0, sticky="w") | ||
| tk.Checkbutton(sel, text=f"{t} ({types[t]})", variable=var).grid( | ||
| row=i, column=0, sticky="w" | ||
| ) | ||
| vars[t] = var | ||
|
Comment on lines
848
to
854
|
||
| def on_ok(): | ||
| sel.include = [t for t, v in vars.items() if v.get()] | ||
| sel.destroy() | ||
| tk.Button(sel, text="OK", command=on_ok).grid(row=len(vars), column=0) | ||
| sel.wait_window() | ||
| include = getattr(sel, 'include', None) | ||
| if not hasattr(sel, 'include'): | ||
| return | ||
| include = sel.include | ||
| if not include: | ||
| messagebox.showerror("Error", "No IFC element types selected") | ||
| return | ||
|
|
||
| if not confirm_overwrite_gui(out): | ||
| return | ||
|
|
||
| def task(prev): | ||
| ifc_to_mesh(ifc, out, show_result=False, include_types=include, confirm_func=confirm_overwrite_gui) | ||
| mesh = ifc_to_mesh( | ||
| ifc, | ||
| out, | ||
| show_result=False, | ||
| include_types=include, | ||
| confirm_func=lambda _: True, | ||
| ) | ||
| if mesh is None: | ||
| raise RuntimeError("IFC conversion did not produce a mesh") | ||
| return out | ||
| desc = f"IFC->Mesh {os.path.basename(ifc)}" | ||
| elif op == "Downsample PCD": | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~/mapsin a Compose volume typically isn’t expanded by Docker Compose (it’s not a shell), so this mount may fail or create a literal~directory depending on environment. Prefer${HOME}/maps:/app/data:rw(or a relative path) to make the mapping reliable across setups.