Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cd6e90b
Initial apptainer CQ file
adam-urbanczyk Apr 14, 2026
d597816
Initial image workflow
adam-urbanczyk Apr 14, 2026
b1dd114
Update path
adam-urbanczyk Apr 14, 2026
1a57544
Try copying everything
adam-urbanczyk Apr 14, 2026
1478fab
Debugging
adam-urbanczyk Apr 14, 2026
d45fbad
Manipulate the env
adam-urbanczyk Apr 14, 2026
19f191f
Try to install cq
adam-urbanczyk Apr 14, 2026
853b518
Debugging
adam-urbanczyk Apr 14, 2026
bb64dd6
Update env file handling
adam-urbanczyk Apr 15, 2026
7843dae
Test after building
adam-urbanczyk Apr 16, 2026
82a3ada
Add git
adam-urbanczyk Apr 16, 2026
dd92ac7
Remove redundant pytest run
adam-urbanczyk Apr 16, 2026
099dd1a
Try to build docker image too
adam-urbanczyk Apr 21, 2026
fd30d24
Remove prefix
adam-urbanczyk Apr 21, 2026
4e06d0d
Debug build
adam-urbanczyk Apr 21, 2026
e298fc4
Remove head
adam-urbanczyk Apr 21, 2026
0ed819b
More debuggig
adam-urbanczyk Apr 21, 2026
273bec4
More debuggig
adam-urbanczyk Apr 21, 2026
c9b323f
More debuggig
adam-urbanczyk Apr 21, 2026
731e2d0
Try chowning opt
adam-urbanczyk Apr 21, 2026
7f69a9b
Trying to produce a MRE
adam-urbanczyk Apr 22, 2026
416c6a1
Less minimal example
adam-urbanczyk Apr 22, 2026
90c4e37
Turn off chown
adam-urbanczyk Apr 22, 2026
2e7447d
Another variant
adam-urbanczyk Apr 22, 2026
aab9018
Revert debugging changes
adam-urbanczyk Apr 23, 2026
60f8b4e
Back to the original env file
adam-urbanczyk Apr 23, 2026
6dda726
Remove redundant test step
adam-urbanczyk Apr 23, 2026
b895c90
Use tmp
adam-urbanczyk Apr 23, 2026
140a5c3
Add a deploy step
adam-urbanczyk Apr 23, 2026
f2e791c
Diffeent temp name for testing
adam-urbanczyk Apr 23, 2026
2302fc9
Explicit name
adam-urbanczyk Apr 24, 2026
3c99e9a
Push docker too
adam-urbanczyk Apr 24, 2026
d9665ae
Add suggestion from lorenzncode
adam-urbanczyk Apr 25, 2026
9acf6e5
Typo fix
adam-urbanczyk Apr 25, 2026
2894f21
Run tests for docker too
adam-urbanczyk Apr 25, 2026
fef4e74
Typo fix
adam-urbanczyk Apr 25, 2026
d2845f4
Only publish on master
adam-urbanczyk Apr 25, 2026
835544c
Adjust if statements
adam-urbanczyk Apr 25, 2026
43a9fbd
Use newer checkout version
adam-urbanczyk Apr 25, 2026
d5f63e2
Add jupyterlab
adam-urbanczyk Apr 27, 2026
bf54ac8
Seperate install files
adam-urbanczyk Apr 27, 2026
6492811
Updated def
adam-urbanczyk Apr 27, 2026
0b03d7b
Update ci
adam-urbanczyk Apr 27, 2026
9150c0c
Specify exact path
adam-urbanczyk Apr 27, 2026
dd49914
Restructure the def file
adam-urbanczyk Apr 27, 2026
e0eccf5
Line endings
adam-urbanczyk Apr 27, 2026
de8d032
Update dockerfile
adam-urbanczyk Apr 28, 2026
1c2c520
Set MYDIR
adam-urbanczyk Apr 28, 2026
09ac786
Publish under branch name
adam-urbanczyk Apr 28, 2026
2d62098
Use branch name everywhere
adam-urbanczyk Apr 28, 2026
c50d8de
Same for sif upload
adam-urbanczyk Apr 28, 2026
c5b3901
Final version
adam-urbanczyk Apr 28, 2026
97a76c7
Update README
adam-urbanczyk Apr 28, 2026
554f654
Update docs
adam-urbanczyk Apr 29, 2026
b841be5
Fixing code blocks
adam-urbanczyk Apr 29, 2026
778cb52
More docs corrections
adam-urbanczyk Apr 29, 2026
fb455c5
Change dir to opt for docker
adam-urbanczyk May 1, 2026
0e6abc5
Do not install in editable mode
adam-urbanczyk May 1, 2026
9d07e62
Update docs
adam-urbanczyk May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions .github/workflows/apptainer_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build Apptainer and Docker images with CQ using micromamba

on:
pull_request:
push:
branches: master

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
build-test-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

container:
image: ghcr.io/apptainer/apptainer:1.4.1
options: --privileged

name: Build Apptainer
steps:

- name: Check out code for the container builds
uses: actions/checkout@v6

- name: Build Container
run: |
apptainer build cq.sif images/cq.def

- name: Test Container
run: |
apptainer run cq.sif pytest tests/

- name: Store sif
uses: actions/upload-artifact@v6
with:
path: cq.sif

- name: Deploy to GHCR
if: contains( env.BRANCH_NAME, 'master')
run: |
echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
apptainer push cq.sif oras://ghcr.io/cadquery/cadquery-apptainer:${BRANCH_NAME}

build-docker-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

name: Build Docker
steps:

- name: Check out code for the container builds
uses: actions/checkout@v6

- name: Authenticate
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin

- name: Build Container
run: |
docker build -t ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} -f images/dockerfile .

- name: Test
run: |
docker run --rm -v $(pwd):/host -w /host ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME} pytest tests/

- name: Deploy to GHCR
#if: contains(env.BRANCH_NAME, 'master')
run: |
docker push ghcr.io/cadquery/cadquery-docker:${BRANCH_NAME}

85 changes: 41 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,46 +18,46 @@

CadQuery is an intuitive, easy-to-use Python module for building parametric 3D CAD models. Using CadQuery, you can write short, simple scripts that produce high quality CAD models. It is easy to make many different objects using a single script that can be customized.

CadQuery is often compared to [OpenSCAD](http://www.openscad.org/). Like OpenSCAD, CadQuery is an open-source, script based, parametric model generator. However, CadQuery stands out in many ways and has several key advantages:

1. The scripts use a standard programming language, Python, and thus can benefit from the associated infrastructure. This includes many standard libraries and IDEs.
2. CadQuery's CAD kernel Open CASCADE Technology ([OCCT](https://en.wikipedia.org/wiki/Open_Cascade_Technology)) is much more powerful than the [CGAL](https://en.wikipedia.org/wiki/CGAL) used by OpenSCAD. Features supported natively by OCCT include NURBS, splines, surface sewing, STL repair, STEP import/export, and other complex operations, in addition to the standard CSG operations supported by CGAL
3. Ability to import/export [STEP](https://en.wikipedia.org/wiki/ISO_10303) and the ability to begin with a STEP model, created in a CAD package, and then add parametric features. This is possible in OpenSCAD using STL, but STL is a lossy format.
4. CadQuery scripts require less code to create most objects, because it is possible to locate features based on the position of other features, workplanes, vertices, etc.
5. CadQuery scripts can build STL, STEP, AMF and 3MF faster than OpenSCAD.

CadQuery was built to be used as a Python library without any GUI. This makes it great for use cases such as integration into servers, or creating scientific and engineering scripts. Options for visualization are also available including CQ-Editor and JupyterLab.
CadQuery was built to be used as a Python library without any GUI. This makes it great for use cases such as integration into servers, or creating scientific and engineering scripts. However, it includes internal visualization capabilities.
Additionally, other options for visualization are also available including CQ-Editor and JupyterLab.

For those who are interested, the [OCP repository](https://github.com/CadQuery/OCP) contains the current OCCT wrapper used by CQ.

### Key features

* Build 3D models with scripts that are as close as possible to how you would describe the object to a human.
* Create parametric models that can be very easily customized by end users.
* Output high quality (loss-less) CAD formats like STEP and DXF in addition to STL, VRML, AMF and 3MF.
* Provide a non-proprietary, plain text model format that can be edited and executed with only a web browser.
* Offer advanced modeling capabilities such as fillets, curvilinear extrudes, parametric curves and lofts.
* Build nested assemblies out of individual parts and other assemblies.

### Why this fork

The original version of CadQuery was built on the FreeCAD API. This was great because it allowed for fast development and easy cross-platform capability. However, we eventually started reaching the limits of the API for some advanced operations and selectors. This 2.0 version of CadQuery is based directly on a Python wrapper of the OCCT kernel. This gives us a great deal more control and flexibility, at the expense of some simplicity and having to handle the cross-platform aspects of deployment ourselves. We believe this is a worthwhile trade-off to allow CadQuery to continue to grow and expand in the future.

## Getting started

To learn more about designing with CadQuery, visit the [documentation](https://cadquery.readthedocs.io/en/latest/intro.html), [examples](https://cadquery.readthedocs.io/en/latest/examples.html), and [cheatsheet](https://cadquery.readthedocs.io/en/latest/_static/cadquery_cheatsheet.html).

To get started playing around with CadQuery and see its capabilities, take a look at the [CQ-editor GUI](https://github.com/CadQuery/CQ-editor). This easy-to-use IDE is a great way to get started desiging with CadQuery. The CQ-editor installer bundles both CQ-editor and CadQuery (recommended). See the [CQ-editor installation instructions](https://cadquery.readthedocs.io/en/latest/installation.html#adding-a-nicer-gui-via-cq-editor).
To quickly get started you can use apptainer

```
apptainer run oras://ghcr.io/cadquery/cadquery-apptainer:master ipython -i -c"from cadquery.func import *; form cadquery.vis import show; show(box(1,1,1))"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: form caquery.vis -> from cadquery.vis

I confirm the command works for me without any other changes except for the typo and using PR branch name rather than master.

```

or docker/podman.

```
podman run -it -v /tmp:/tmp -e DISPLAY=$DISPLAY -t ghcr.io/cadquery/cadquery-docker:master ipython -i -c"from cadquery.func import *; from cadquery.vis import show; show(box(1,1,1))"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra redundant '-t'.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, the command works for me on linux (with changes):
a. use PR branch name as master is not yet published
b. I need to add: --userns=keep-id --user "$(id -u):$(id -g)"
and: --device /dev/dri
c. For SELinux I need to add: --security-opt label=disable
and more narrow bind also works: -v /tmp/.X11-unix:/tmp/.X11-unix

No changes needed, just for future reference.

```

The CadQuery library (with or without CQ-editor) and its dependencies may be installed using conda, or pip. Note that conda (or the CQ-editor installer) is the better supported option.
The CadQuery library (with or without CQ-editor) and its dependencies may be installed using conda/mamba/micromamba/pixi, or pip.
Note that conda-based installation (or the CQ-editor installer) is the better supported option.

See the documentation for detailed CadQuery [installation instructions](https://cadquery.readthedocs.io/en/latest/installation.html).

### CadQuery Installation Via Conda

To first install the Conda package manager see [Install the Conda Package Manager](https://cadquery.readthedocs.io/en/latest/installation.html#install-the-conda-package-manager), and [Miniforge](https://github.com/conda-forge/miniforge) for a minimal installer.

``mamba install`` is recommended over ``conda install`` for faster and less memory intensive cadquery installation.
``mamba install`` is recommended over ``conda install`` for faster and less memory intensive CadQuery installation.

```
# Set up a new environment
Expand Down Expand Up @@ -91,6 +91,29 @@ It is also possible to install the very latest changes directly from CadQuery's
pip install git+https://github.com/CadQuery/cadquery.git
```

### Built-in visualization

CadQuery has built in visualization capabilities using trame and vtk.

```
from cadquery.func import box, fillet
from cadquery.vis import show

b = box(1,1,1)
show(fillet(b, b.edges("|Z"), 0.1))

```

For non-blocking and persistent view one can use.

```
from cadquery.func import box, fillet
from cadquery.fig import show

b = box(1,1,1)
show(fillet(b, b.edges("|Z"), 0.1))

```

### CQ-editor GUI

Expand Down Expand Up @@ -124,33 +147,10 @@ We also have a [Google Group](https://groups.google.com/forum/#!forum/cadquery)

There is also a [Discord](https://discord.com/invite/Bj9AQPsCfx) server, but the other methods of getting help are much better for newcomers.

## Projects using CadQuery

Here are just a few examples of how CadQuery is being used.

### FxBricks Lego Train System

[FxBricks](https://fxbricks.com/) uses CadQuery in the product development pipeline for their Lego train system. FxBricks has also given back to the community by creating [documentation for their CAD pipeline](https://github.com/fx-bricks/fx-cad-notes). They have also assembled [cq-kit](https://github.com/michaelgale/cq-kit), a library containing utility classes and functions to extend the capabilities of CadQuery. Thanks to @michaelgale and @fx-bricks for this example.

![FxBricks Pipeline Diagram](https://raw.githubusercontent.com/fx-bricks/fx-cad-notes/master/images/model_overview.png)

### Hexidor Board Game Development

Hexidor is an expanded take on the Quoridor board game, and the development process has been chronicled [here](https://bruceisonfire.net/2020/04/23/my-adventure-with-flosscad-the-birth-of-hexidor/). CadQuery was used to generate the game board. Thanks to Bruce for this example.

<img src="https://bruceisonfire.net/wp-content/uploads/2020/04/16-945x709.jpg" alt="Hexidor Board Game" width="400"/>

### Spindle assembly

Thanks to @marcus7070 for this example from [here](https://github.com/marcus7070/spindle-assy-example).

<img src="./doc/_static/assy.png" width="400">

### 3D Printed Resin Mold
## Citing

Thanks to @eddieliberato for sharing [this example](https://jungletools.blogspot.com/2017/06/an-anti-kink-device-for-novel-high-tech.html) of an anti-kink resin mold for a cable.
Please use our Zenodo DOI if you use CadQuery for scientific research: https://doi.org/10.5281/zenodo.3955118.

<img src="https://3.bp.blogspot.com/-2FiHOGUhtxo/WTRsViGdOXI/AAAAAAAAA-E/sb5ehwPVr-EncYC8RM2-v21M3AAmbjUjQCLcB/s1600/Screenshot%2Bfrom%2B2017-06-04%2B22-05-07.png" alt="3D printed resin mold" height="250"/>

## License

Expand Down Expand Up @@ -227,6 +227,3 @@ When filing a bug report [issue](https://github.com/CadQuery/cadquery/issues), p

If you find yourself wishing for a feature that does not exist, you are probably not alone. There are bound to be others out there with similar needs. Open an [issue](https://github.com/CadQuery/cadquery/issues) which describes the feature you would like to see, why you need it, and how it should work.

## Citing

Please use our Zenodo DOI if you use CadQuery for scientific research: https://doi.org/10.5281/zenodo.3955118.
Binary file modified doc/_static/quickstart/002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading