Python ctypes bindings for PicoGK runtime with vedo viewer
Project description
pycogk
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.
Library Summary
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 |
Architecture At A Glance
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.
Install
From PyPI:
pip install pycogk
From this repository:
pip install "git+https://github.com/ghedo44/PycoGK.git"
Import Name
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_crystal
Runtime Notes
pycogk 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.py
Quick Start (picogk)
from 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.
In-Depth: picogk
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.
In-Depth: shape_kernel
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.
In-Depth: lattice_library
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.
In-Depth: implicit_library
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.
In-Depth: penrose_pattern
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.
In-Depth: quasi_crystal
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.
Documentation
Current long-form docs are available for:
picogkshape_kernel
picogk docs
- 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
shape_kernel docs
- 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.
Examples
Runnable examples are organized by library focus.
picogk examples
- 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
shape_kernel examples
- 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
Additional library references
Integration and behavior checks for additional libraries are currently covered in tests:
tests/lattice_librarytests/implicit_library
Status
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:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycogk-0.3.0.tar.gz.
File metadata
- Download URL: pycogk-0.3.0.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85ddda35ae5b56478ae728b782b4b80b2ecec876e82ec061676a86ebb3382e70
|
|
| MD5 |
f3df18a661031b99d5792e3ba624ab58
|
|
| BLAKE2b-256 |
46ec1efb65f91f16cb58c0954e0409f7149db0d6dab73fbba02810c97bb3c340
|
Provenance
The following attestation bundles were made for pycogk-0.3.0.tar.gz:
Publisher:
publish-pypi.yml on ghedo44/PycoGK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycogk-0.3.0.tar.gz -
Subject digest:
85ddda35ae5b56478ae728b782b4b80b2ecec876e82ec061676a86ebb3382e70 - Sigstore transparency entry: 1117514751
- Sigstore integration time:
-
Permalink:
ghedo44/PycoGK@00031388b7d6b889a12bcaa01ac64e67f2a48ffd -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ghedo44
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@00031388b7d6b889a12bcaa01ac64e67f2a48ffd -
Trigger Event:
release
-
Statement type:
File details
Details for the file pycogk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pycogk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bd61695f021c9cb3cd5160143d916518cdaa2217141f6d18e4f345e91eb7db4
|
|
| MD5 |
4ad77ae23e7bc5f07a0a2a716e565338
|
|
| BLAKE2b-256 |
14c6ef91e9fd7da99240dfb897ffb93c6c5df0ddcf3601f55452c84a55295dd5
|
Provenance
The following attestation bundles were made for pycogk-0.3.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on ghedo44/PycoGK
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pycogk-0.3.0-py3-none-any.whl -
Subject digest:
3bd61695f021c9cb3cd5160143d916518cdaa2217141f6d18e4f345e91eb7db4 - Sigstore transparency entry: 1117514799
- Sigstore integration time:
-
Permalink:
ghedo44/PycoGK@00031388b7d6b889a12bcaa01ac64e67f2a48ffd -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/ghedo44
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@00031388b7d6b889a12bcaa01ac64e67f2a48ffd -
Trigger Event:
release
-
Statement type: