ducpy.tessellate.shims¶
CAD and BIM tessellation and capture shims for ducpy.
Matches the exact tessellation and geometry extraction logic used across Scopture and Ducflair runtimes (three-cad-viewer buffer JSON, ifcopenshell triangulation).
Classes¶
Immutable font manifest with sequence, key, and attribute access. |
Functions¶
|
Return whether the current call stack is executing a duc_model module. |
|
Install one execution's model-element sources as a lazy Python package. |
|
Register mounted TTF files with OCCT and expose name-based resolution. |
|
Recursively flatten nested lists/tuples/sets of objects into a flat list. |
|
Collect ocp_vscode animation tracks for the most recently shown assembly. |
|
Tessellate CAD objects and return a compact JSON payload using base64 buffers. |
|
Install a stub for IPython.lib.pretty so build123d can import it. |
|
Patch ifcopenshell.file.write to also write to output_path. |
|
Patch ezdxf.document.Drawing.saveas to also write to output_path. |
|
Find an ifcopenshell or ezdxf object in globals and write it to output_path. |
|
Tessellate an IFC model and return a compact JSON preview payload. |
Module Contents¶
- ducpy.tessellate.shims.scopture_is_model_dependency_call() bool¶
Return whether the current call stack is executing a duc_model module.
- ducpy.tessellate.shims.scopture_install_model_modules(model_modules: list[dict[str, Any]] | None, runtime_globals: dict[str, Any]) None¶
Install one execution’s model-element sources as a lazy Python package.
- class ducpy.tessellate.shims.FontEnum(values: Any)¶
Immutable font manifest with sequence, key, and attribute access.
- _values¶
- _by_name¶
- _by_attribute: dict[str, str]¶
- __iter__()¶
- __len__() int¶
- __getitem__(key: Any) Any¶
- __getattr__(name: str) str¶
- __repr__() str¶
- ducpy.tessellate.shims.scopture_install_fonts(mounted_external_files: dict[str, dict[str, str]]) None¶
Register mounted TTF files with OCCT and expose name-based resolution.
- ducpy.tessellate.shims.scopture_flatten_candidates(*objs: Any) list[Any]¶
Recursively flatten nested lists/tuples/sets of objects into a flat list.
- ducpy.tessellate.shims.scopture_install_animation(module, globals_dict)¶
Collect ocp_vscode animation tracks for the most recently shown assembly.
- ducpy.tessellate.shims.scopture_tessellate_to_buffer_json(*objs: Any, **kwargs: Any) str¶
Tessellate CAD objects and return a compact JSON payload using base64 buffers.
Uses the instanced format {instances, shapes} with numpy_to_buffer_json encoding. The client-side three-cad-viewer renderer handles this format via decodeInstancedFormat().
- ducpy.tessellate.shims.scopture_install_ipython_stub() None¶
Install a stub for IPython.lib.pretty so build123d can import it.
- ducpy.tessellate.shims.scopture_install_ifc_output_capture(output_path: str, sandbox_path: Callable[[str | os.PathLike[str], str | pathlib.Path], pathlib.Path] | None = None) None¶
Patch ifcopenshell.file.write to also write to output_path.
- ducpy.tessellate.shims.scopture_install_dxf_output_capture(output_path: str, sandbox_path: Callable[[str | os.PathLike[str], str | pathlib.Path], pathlib.Path] | None = None) None¶
Patch ezdxf.document.Drawing.saveas to also write to output_path.
- ducpy.tessellate.shims.scopture_collect_model_file(globals_dict: dict[str, Any], fmt: str, output_path: str | pathlib.Path, max_model_file_bytes: int = 0, now_fn: Callable[[], int] | None = None) dict[str, Any]¶
Find an ifcopenshell or ezdxf object in globals and write it to output_path.
- ducpy.tessellate.shims.scopture_collect_ifc_preview(globals_dict: dict[str, Any], output_path: str | pathlib.Path | None = None, max_preview_bytes: int = 0) str | None¶
Tessellate an IFC model and return a compact JSON preview payload.
Searches globals_dict for ifcopenshell.file objects, falls back to reading from output_path. Uses ifcopenshell.geom for triangulation.