Python package for using PicoGK and related LEAP 71 geometry libraries from Python.
This is an unofficial community library.
- Official PicoGK project (C++ / C#): https://github.com/leap71/PicoGK
- This Python package repository: https://github.com/ghedo44/PycoGK
The goal is to keep a PicoGK-like API where practical while adapting the workflow to Python, including a vedo-based viewer layer.
This repository currently ships six Python libraries.
| Library | Primary role | Inspired by C# repo | Typical use |
|---|---|---|---|
picogk |
Runtime bridge and core geometry API | PicoGK |
Lattice/voxel/mesh/field creation, IO, viewer orchestration |
shape_kernel |
High-level modeling toolkit | LEAP71_ShapeKernel |
Base shapes, frames/splines, utility functions, composition workflows |
lattice_library |
Beam-lattice workflow framework | LEAP71_LatticeLibrary |
Cell arrays + lattice logic + beam thickness strategy |
implicit_library |
TPMS/implicit construction framework | LEAP71_LatticeLibrary (Implicit Library part) |
Modular implicits, coordinate transforms, split/wall logic |
penrose_pattern |
2D Penrose tiling primitives | LEAP71_QuasiCrystals |
Aperiodic 2D tilings and subdivision logic |
quasi_crystal |
3D quasi-crystal building blocks | LEAP71_QuasiCrystals |
Icosahedral face/tile inflation and quasi-crystal assembly |
Practical dependency picture:
picogkis the runtime-facing foundation.shape_kernelbuilds onpicogk.lattice_libraryandimplicit_librarybuild onpicogk(and interoperate with each other).penrose_patternandquasi_crystalprovide aperiodic tiling/quasi-crystal logic and can be combined withpicogkvisualization/output workflows.
From PyPI:
pip install pycogkFrom this repository:
pip install "git+https://github.com/ghedo44/PycoGK.git"The distribution name is pycogk, while imports are per-library:
import picogk
import shape_kernel
import lattice_library
import implicit_library
import penrose_pattern
import quasi_crystalpycogk loads the PicoGK native runtime using ctypes.
Bundled runtime targets currently include:
win-x64osx-arm64
If your platform is not bundled, set PICOGK_RUNTIME_PATH to a compatible binary.
PowerShell example:
$env:PICOGK_RUNTIME_PATH = "C:\path\to\picogk.1.7.dll"
python your_script.pyfrom picogk import Lattice, Mesh, VedoViewer, Voxels, go
viewer = VedoViewer(title="pycogk Quickstart")
def task() -> None:
with Lattice() as lat:
lat.AddSphere((0.0, 0.0, 0.0), 10.0)
with Voxels.from_lattice(lat) as vox:
with Mesh.from_voxels(vox) as msh:
viewer.Add(msh, nGroupID=1)
viewer.SetViewAngles(30.0, 20.0)
viewer.RequestUpdate()
print("triangles:", msh.nTriangleCount())
go(0.5, task, end_on_task_completion=False, viewer=viewer)Close the viewer window to end the program.
picogk is the low-level runtime API. It wraps the PicoGK native library and exposes core primitives needed by the rest of the stack.
Main capabilities include:
- Runtime lifecycle and viewer orchestration via
Library,go, and viewer interfaces. - Geometry primitives such as
Lattice,Voxels,Mesh, andPolyLine. - Field workflows with
ScalarField,VectorField, metadata, and field utilities. - IO and processing helpers for mesh, image, slice, CSV, CLI, OpenVDB, and utility workflows.
Use picogk when you need direct, explicit control over runtime objects and conversion steps.
shape_kernel is a higher-level modeling toolkit inspired by LEAP 71 ShapeKernel concepts. In the original C# framing, ShapeKernel bridges low-level kernel operations and higher-level engineering design intent.
Main capabilities include:
- Parametric base shapes (
BaseBox,BaseCylinder,BaseSphere,BasePipe,BaseLens, and more). - Frame and spline infrastructure (
LocalFrame,Frames, control splines, tangential splines). - Modulations and geometric composition helpers (
LineModulation,SurfaceModulation,Sh). - Utility classes for measurement, mesh operations, cylindrical utilities, and color/visualization helpers.
Use shape_kernel when you want expressive modeling code with less low-level plumbing.
lattice_library ports the flexible lattice workflow from the C# Lattice Library. The core idea is to keep three concerns independent so they can be recombined:
- Cell array generation (
ICellArrayand concrete arrays). - Lattice connection logic (
ILatticeTypeand concrete lattice types). - Beam thickness strategy (
IBeamThicknessand concrete thickness models).
Representative classes include:
- Cell arrays:
RegularUnitCell,RegularCellArray,ConformalCellArray. - Lattice types:
BodyCentreLattice,OctahedronLattice,RandomSplineLattice. - Thickness models:
ConstantBeamThickness,CellBasedBeamThickness,GlobalFuncBeamThickness,BoundaryBeamThickness.
Use lattice_library when designing beam-based infill/meta-material workflows where topology and thickness rules are customized independently.
implicit_library ports the Implicit Library concepts from the C# Lattice Library project. It focuses on TPMS-style implicits and modular composition logic.
Main capabilities include:
- Coordinate transformations (
ScaleTrafo,RadialTrafo,FunctionalScaleTrafo,CombinedTrafo). - Splitting logic and signed-region control (
FullWallLogic,FullVoidLogic, half-wall and void variants). - Raw TPMS patterns (
RawGyroidTPMSPattern,RawLidinoidTPMSPattern, Schwarz variants, transitions). - Modular implicit assembly (
ImplicitModular) and ready presets inTPMSPresets.
Use implicit_library when constructing procedural implicit materials with tunable wall/void behavior and spatial transforms.
penrose_pattern provides 2D aperiodic tiling primitives inspired by the Penrose workflow from the C# Quasi Crystals repository.
Main capabilities include:
- Penrose pattern generation via tile subdivision logic.
- Tile primitives such as
RhombicTile,LargeRhombicTile, andSmallRhombicTile. - Supporting geometric entities like
RobinsonTriangle.
Use penrose_pattern when you need non-periodic 2D tilings with local order and no translational symmetry.
quasi_crystal provides 3D quasi-crystal building blocks, aligned with the C# quasi-crystal concepts (icosahedral faces, quasi-tiles, and inflation/substitution rules).
Main capabilities include:
- Rhombic-face representation (
IcosehedralFace). - Quasi-tile families (
QuasiTile,QuasiTile_01toQuasiTile_04). - Inflation/subdivision support (
QuasiTileInflation). - Crystal-level assembly utilities (
QuasiCrystal).
Use quasi_crystal when exploring aperiodic 3D structures and rule-driven quasi-tile expansion.
Current long-form docs are available for:
picogkshape_kernel
- Book Home
- Chapter 1: Orientation
- Chapter 2: Installation and Runtime
- Chapter 3: First Project
- Chapter 4: Core Concepts
- Chapter 5: Modeling Workflow
- Chapter 6: Viewer and Interaction
- Chapter 7: Data IO
- Chapter 8: Troubleshooting
- Chapter 9: Production and Publishing
- Book Home
- Chapter 1: Orientation
- Chapter 2: Concept Mapping
- Chapter 3: Frames and Splines
- Chapter 4: Base Shapes
- Chapter 5: Modulations and Utility Functions
- Chapter 6: Visualization and Preview
- Chapter 7: Measurements and Runtime Helpers
- Chapter 8: Migration Guide
For lattice_library, implicit_library, penrose_pattern, and quasi_crystal, use source and tests as the current reference points.
Runnable examples are organized by library focus.
- examples/picogk/basic_usage.py
- examples/picogk/01_lattice_to_mesh.py
- examples/picogk/02_voxel_boolean_filters.py
- examples/picogk/03_scalar_vector_fields.py
- examples/picogk/04_openvdb_io.py
- examples/picogk/05_stl_io_and_mesh_math.py
- examples/picogk/06_slicing_and_cli.py
- examples/picogk/07_images_and_tga.py
- examples/picogk/08_animation_and_csv.py
- examples/picogk/09_polyline_and_viewer.py
- examples/picogk/10_utils_tempfolder_log.py
- examples/picogk/11_viewer_controls_and_timelapse.py
- examples/shape_kernel/example_spline.py
- examples/shape_kernel/ex_base_box_showcase.py
- examples/shape_kernel/ex_base_cylinder_showcase.py
- examples/shape_kernel/ex_base_lens_showcase.py
- examples/shape_kernel/ex_base_pipe_segment_showcase.py
- examples/shape_kernel/ex_base_pipe_showcase.py
- examples/shape_kernel/ex_base_ring_showcase.py
- examples/shape_kernel/ex_base_sphere_showcase.py
- examples/shape_kernel/ex_basic_lattices.py
- examples/shape_kernel/ex_lattice_manifold_showcase.py
- examples/shape_kernel/ex_lattice_pipe_showcase.py
- examples/shape_kernel/migration_sh_preview_equivalents.py
- examples/shape_kernel/migration_visualization_equivalents.py
Integration and behavior checks for additional libraries are currently covered in tests:
tests/lattice_librarytests/implicit_library
pycogk is actively developed and has production-readiness gates, but it is still an unofficial project and not a drop-in official replacement.
For readiness details, see: