Skip to main content

pycork provides a fully compiled interface to the cork boolean library

Project description

https://github.com/drlukeparry/pycork/actions/workflows/pythonpublish.yml/badge.svg https://badge.fury.io/py/pycork.svg https://static.pepy.tech/personalized-badge/pycork?period=total&units=international_system&left_color=black&right_color=orange&left_text=Downloads

Pycork is a Python library offering the functionality of the Cork boolean CSG library in a compiler friendly form suitable across all platforms. The library includes the dependencies for the Multi-Precision Integer and Rationals (MPIR) 3.0 built-in used by the Cork libary. The package aims to provide a simpler route for compiling the package for individuals and in addition, generating python bindings for use across other projects. Refactoring has been authored to tidy up the existing codebase so that it can be built across multiple platforms, in particular Windows, using the CMake build-system. At this stage, no further optimisations or improvements will be made specifically to the cork library, inclusive of its algorithms.

The python bindings are simple and offer access to the core functionality offered by the Cork library to perform boolean operations on watertight meshes. Additionally, it removes the awkward step of generatig .off files that are used in the command-line interface of the Cork library. The user may pass triangular meshes (vertices, tri-faces indices) as numpy arrays to each function.

For further information, see the latest release notes.

Installation

Installation is currently supported on Windows. No special requiremnets are necessary for using pycork, except having the numpy library available. It is recommend to also install the trimesh library to provide an interface to processing meshes as input for pycork.

conda install -c numpy
pip install trimesh

Installation of pycork can then be performed using pre-built python packages using the PyPi repository.

pip install pycork

Alternatively, pycork may be compiled directly from source. Currently the prerequisites are the a compliant c++ build environment, include CMake build system. Currently the package has been tested on Windows 10, using VS2019.

git clone https://github.com/drlukeparry/pycork.git && cd ./pycork
git submodule update --init --recursive

python setup.py install

Usage

The Cork CSG library, by design, has a simple interface for is functionality. Further detailed description of the function is therefore not necessary.

import numpy as np
import trimesh

import pycork

# Note any manifold, watertight mesh can be used in conjuction with the Trimesh library
meshA = trimesh.load_mesh('meshA.off')
meshB = trimesh.load_mesh('meshB.off')

# Extra list of vertices and triangular faces from the meshes
vertsA = meshA.vertices
trisA = meshA.faces

vertsB = meshB.vertices
trisB = meshB.faces

pycork.isSolid(vertsA, trisA)
pycork.isSolid(vertsB, trisB)

#Perform the boolean opertions directly with Cork library
vertsC, trisC = pycork.union(vertsA, trisA,
                             vertsB, trisB)

vertsD, trisD = pycork.intersection(vertsA, trisA,
                                    vertsB, trisB)


meshC = trimesh.Trimesh(vertices=vertsC, faces=trisC, process=True)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pycork-0.1.1-cp39-cp39-win_amd64.whl (220.8 kB view details)

Uploaded CPython 3.9Windows x86-64

pycork-0.1.1-cp38-cp38-win_amd64.whl (221.6 kB view details)

Uploaded CPython 3.8Windows x86-64

pycork-0.1.1-cp37-cp37m-win_amd64.whl (221.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

pycork-0.1.1-cp36-cp36m-win_amd64.whl (221.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

pycork-0.1.1-cp35-cp35m-win_amd64.whl (221.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

File details

Details for the file pycork-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pycork-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 220.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for pycork-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e305a1230c9ee74ea2032521e4d45da098c01c1280e4c227301a184b68f88178
MD5 c684201bc100de6ea6dd82059e7e73e7
BLAKE2b-256 5c2bd9e5c4802d0402ddbd4bbc72fbd19479f7c364bfb56df250d8cd4eaaed07

See more details on using hashes here.

File details

Details for the file pycork-0.1.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pycork-0.1.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 221.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for pycork-0.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 85d2f289e5858c46abfde8cbda21921ceef07f069a88d13b5d4c622a38aaac8f
MD5 b93e34fc7433b66b7659d1e47a53bf8f
BLAKE2b-256 5b56cb1a6d3864e46d4cb58be5747e658c961df2b6550ebaa2e6b6354e4678ce

See more details on using hashes here.

File details

Details for the file pycork-0.1.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pycork-0.1.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 221.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for pycork-0.1.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c3c1144c4de511b71d94810b8c8d0899ebe2035c6c93eacec06fddea6417fe46
MD5 e05940444b5cd40b7babf872e572c32a
BLAKE2b-256 5e9d7aefba3c8028e199067e9eeb9582688b94cff1c519f1d41df7930a9bbfec

See more details on using hashes here.

File details

Details for the file pycork-0.1.1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: pycork-0.1.1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 221.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for pycork-0.1.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 539f067c9398e35ac838414ef858c45944d60786bf11b65c3c6fdec8de68819d
MD5 bd6093f3981e000c5ef26f24ac5eca85
BLAKE2b-256 81214bb6dd609b6edcc76237a17008da8b0c1bcfa16a07acf6909e4110cfd8d1

See more details on using hashes here.

File details

Details for the file pycork-0.1.1-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: pycork-0.1.1-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 221.6 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.5.4

File hashes

Hashes for pycork-0.1.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 b5ec33304eadb690092ae54141ec64b88d8ae1be883cf31495f79392359dda7b
MD5 5e3ce0062b0dbd357580d5ae5eed37ab
BLAKE2b-256 516c7bb7e890c9fd5907ee57aac6b296b4afacd708079abb2511677fc48dd3cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page