How gitzhcode/zspace_3dpslicer works
Project Type and Purpose
• This is a C++-based CAD toolkit/library (zSpace 3DPSlicer) embedded within the proprietary zSpace ALICE visualization platform.
• It provides SDF-based mesh slicing capabilities for large-scale 3D concrete printing workflows.
• The project is not a web app or microservice suite—it’s a native library plus a desktop visualization/demo executable.
High‐Level Component Breakdown
a. Core Library (zTsSDFSlicer)
• JSON I/O module: parses input meshes (half-edge structures via JSON) and writes slicing results back to JSON.
• Geometry engine: employs half-edge mesh data structures, weighted plane interpolations, geodesics, Boolean operations and SDF computations.
• Print‐block generator: assembles cross-section profiles into continuous print paths, supports thickness/infill patterns, cable slots.
b. ALICE Viewer Front-End (zspace_alice)
• Graphics Layer: OpenGL (via freeglut, GLEW) + gl2ps for on-screen rendering and printing to PostScript/PDF.
• Controller: wires UI events to the slicer library API (calls setFromJSON(), computePrintBlocks(), exportJSON()).
c. Data and Dependencies
• Sample Data: JSON files, demonstration meshes in “documentation/Assets”
• External Libraries: Eigen (linear algebra), OpenNURBS, nlohmann/json, SQLite, polyClipper, freeglut, GLEW, gl2ps, libGizmo.
Interactions and Data Flow
1. User loads a mesh in the ALICE Viewer front-end.
2. Viewer serializes mesh to JSON → passes JSON to zTsSDFSlicer.
3. Slicer core:
– Builds half-edge mesh → computes SDF and cross-sections → refines with Booleans → generates print blocks.
– Outputs slicing data → JSON.
4. Viewer reads JSON output → renders slices, print paths; optional export to files/SQL.
5. gl2ps can capture printouts; SQLite may store run metadata if enabled.
Architectural Patterns & Design Principles
• Modular library + host application separation.
• Clear Model (mesh,SDF) – View (OpenGL) – Controller (event wiring) layering in ALICE Viewer.
• Data-oriented design: JSON as interchange format between modules.
• Plugin‐style dependency injection: Slicer core does not depend on UI/GL components.
Essential Elements
• Clear, unambiguous component names matching file structure (e.g., zTsSDFSlicer, ALICE Viewer).
• Notes on configuration/build: point out Premake script under zspace_alice/Alice/premake5.lua and Visual Studio solution.