UNDER DEVELOPMENT This project, Refactoring CAD POC, is designed to showcase a proof of concept (POC) for refactoring CAD models using CadQuery. It includes a library for CAD model refactoring, example scripts, and a Jupyter Notebook environment for interactive exploration.
MIT License
This project, Refactoring CAD POC, is designed to showcase a proof of concept (POC) for refactoring CAD models using CadQuery. It includes a library for CAD model refactoring, example scripts, and a Jupyter Notebook environment for interactive exploration.
The project is organized as follows:
data/
: Contains sample data used by the CAD models.
ci/
: Continuos Intergration tests
docker_tests.sh
: Tests if docker container loads properly.doc/
: Documentation related to the project.notebooks/
: This directory contains Jupyter Notebooks that provide interactive demonstrations and exploratory interfaces for the project. Notebooks are an excellent tool for:src/
: Source code for the CAD refactoring library.
__init__.py
: Marks the directory as a Python package.refactoring.py
: Core logic for CAD model refactoring.examples/
: Example scripts demonstrating how to use the library.
simple_refactor_example.py
: A simple script showing a basic refactoring process.tests/
: Test suite for the library.
__init__.py
: Marks the directory as a Python package.test_refactoring.py
: Test cases for refactoring functionalities.notebooks/
: Jupyter Notebooks for interactive demonstrations and exploration.Dockerfile
: Defines the setup for a Docker container that encapsulates your project's environment. It ensures that anyone can replicate your development setup and run your project with minimal setup, regardless of their operating system or local Python environment. The Dockerfile includes:
LICENCE
: The license file for the project.requirements.txt
: A list of Python package dependencies.README.md
: This file, providing an overview and instructions for the project.refactoring_cad_poc/
│
├── ci/
│ └── docker_tests.sh # Script for Docker build and run tests
│
├── data/
│ ├── processed/
│ ├── raw/
│ └── temp/
│
├── doc/
│
│
├── notebooks/ # Jupyter notebooks which can be runned usign Docker
│
├── src/ # Source code for your CAD refactoring library
│ ├── __init__.py # Makes this directory a Python package
│ └── refactoring.py # Core logic for CAD model refactoring
│
├── examples/ # Example scripts showing how to use your library
│ └── simple_refactor_example.py
│
├── tests/
│ ├── __init__.py
│ └── test_refactoring.py
│
├── Dockerfile
├── LICENCE
├── requirements.txt
└── README.md
These instructions will cover the setup required to run the Jupyter-CadQuery environment using Docker. This approach ensures that all necessary dependencies are correctly installed and configured.
Ensure you have Docker installed on your system to use the Jupyter-CadQuery environment for exploring the project interactively. For installation instructions, see Docker's official documentation.
git clone https://your-repository-url/refactoring_cad_poc.git
cd refactoring_cad_poc
Build the Docker image:
Navigate to the project directory and run:
docker build -t my_jupyter_cadquery .
This command builds a Docker image named my_jupyter_cadquery based on the instructions in your Dockerfile.
As recommended on jupyter-cadquery, Dockerfile uses the recommended Jupyter-CadQuery image as the base (bwalter42/jupyter_cadquery:3.5.2
)
Run the Docker Container Run a container from your image with the necessary port mapping and volume mounting:
docker run -it --rm -p 8888:8888 -v $(pwd):/home/cq my_jupyter_cadquery
This command does the following:
Accessing JupyterLab After starting the container, JupyterLab will be accessible via your web browser. Open the following URL:
Check the URL matches the one provided in your terminal
JupyterLab should load, presenting an environment where you can create, edit, and run Jupyter notebooks.
See the examples/ directory for scripts demonstrating how to use the library. You can run these scripts directly or explore them in the JupyterLab environment.
Navigate to the notebooks/ directory in the JupyterLab interface to find interactive notebooks. These notebooks provide a hands-on way to explore CAD model refactoring processes.
To ensure the Docker environment for our project is correctly set up and operational, we provide a bash script (docker_tests.sh
) that automates the testing process. This script performs the following actions:
notebooks/
folder inside the container to verify successful volume mounting.Ensure Docker is installed and running on your system, then execute the following command from the project root directory:
./ci/docker_tests.sh
Note: If you encounter a permission denied error, you may need to make the script executable. You can do so with the following command:
chmod +x ci/docker_tests.sh
Contributions to the Refactoring CAD POC project are welcome. Please read CONTRIBUTING.md for guidelines on how to contribute.
This project is licensed under the MIT Licence.
Thanks to the CadQuery community for providing the tools and support for CAD modeling in Python.