Skip to main content

Hierarchical and deeply parametric models using cadquery

Project description

https://fragmuffin.github.io/cqparts/media/logo/dark.svg

What is cqparts?

cqparts is CAD for Python programmers, short for “cadquery parts”.

Using cqparts you can wrap geometry made with cadquery to build complex and deeply parametric models.

Full documentation at: https://fragmuffin.github.io/cqparts

Installing

Pre-requisites

You’ll need to fulfill the requirements of cadquery, the simplest way to do that is to install cadquery first by following the instructions here:

http://dcowden.github.io/cadquery/installation.html

PyPI

Once cadquery is installed, install cqparts with:

pip install cqparts

cqparts_* Content Libraries

You can also install content libraries with a similar pip install command.

List available libraries with:

pip search cqparts_

For example, to install the cqparts_bearings content library, run:

pip install cqparts_bearings

Example Usage

Here is just one of the simplest examples to give you an idea of what this library does.

More detailed examples found in the official documentation for cqparts.

Wrapping a Cube

https://fragmuffin.github.io/cqparts/media/img/unit-cube.png

A simple cube defined with cadquery alone:

# create unit cube solid
import cadquery
size = 10
cube = cadquery.Workplane('XY').box(size, size, size)

# display cube (optional)
from Helpers import show
show(cube)

Wrapping this in a cqparts.Part object can be done like this:

# create unit cube as cqparts.Part
import cadquery
import cqparts
from cqparts.params import PositiveFloat

class MyCube(cqparts.Part):
    size = PositiveFloat(1, doc="cube size")
    def make(self):
        return cadquery.Workplane('XY').box(self.size, self.size, self.size)

# create cube instance
cube = MyCube(size=10)

# display cube (optional)
from cqparts.display import display
display(cube)

You can see that under the bonnet (in the make function) the geometry is created with cadquery, but the resulting MyCube class is instantiated more intuitively, and more object orientated.

Creating a Hierarchy

cqparts can also be used to create a deep hierarchy of parts and assemblies to build something deeply complicated and entirely parametric.

A simple example of this is the toy car tutorial.

https://fragmuffin.github.io/cqparts/media/img/toy-car.png

cqparts Capabilities

The work done in cqparts_fasteners is a good example of how useful cqparts wrapping can be; read about the Fastener class, how it works, and what can be done with it in the cqparts_fasteners docs

https://fragmuffin.github.io/cqparts/media/img/nut-bolt-fastener.png

Contributing

Issues, and Pull Requests are encouraged, and happily received, please read CONTRIBUTING.md for guidance on how to contribute.

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

cqparts-0.2.1.tar.gz (210.2 kB view details)

Uploaded Source

Built Distribution

cqparts-0.2.1-py2.py3-none-any.whl (228.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cqparts-0.2.1.tar.gz.

File metadata

  • Download URL: cqparts-0.2.1.tar.gz
  • Upload date:
  • Size: 210.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cqparts-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dbb9fba045497aeeea53bfe7e2b9e975ce34053aca2d5ea1f659528144d18316
MD5 3f73637f617f3e286a4927d0b5d2eb24
BLAKE2b-256 b2d140fac5099d9303e17a1ae9512a5cc96ef5e410570741bd0f034ff36fd68e

See more details on using hashes here.

File details

Details for the file cqparts-0.2.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cqparts-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 277e67a1c9ee80d52ae4c827375e0e9d1d00302379beb30117f4049034faf412
MD5 d1db3f2400ce8ad3c6baff92f9691527
BLAKE2b-256 4449fefa7ddbbd2b349362600779afb2756d31ea77d3ac6a2c6f504b4b46f351

See more details on using hashes here.

Supported by

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