Skip to content

Latest commit

 

History

History
109 lines (64 loc) · 3.01 KB

README.md

File metadata and controls

109 lines (64 loc) · 3.01 KB

Installation

  1. Activate your virtual environment. Instructions for direnv.
echo 'layout pyenv 3.12.5' > .envrc 
direnv allow
  1. Install dependencies. scrollcase is installed as an editable package.
pip install -r requirements.txt
  1. Install the OCP CAD Viewer VSCode estension to view BRep models displayed with show().

Project structure

  • src/: scrollcase source code
  • scripts/: select example scripts

Within src/:

  • case.py: Case construction with build123d
  • mesh.py: Mesh processing
  • alignment.py: Smallest enclosing cylinder
  • smallest_circle.py: Helper utilities for Welzl's algorithm

Usage

Examples

See scripts/ directory.

Simple case generation example at scripts/example_basic_case.ipynb.

Enable logging

scrollcase uses the logging package for logs. Enable with:

logging.basicConfig()  # Required in Jupyter to correctly set output stream
logging.getLogger("scrollcase").setLevel(logging.DEBUG)

Mesh processing

See example scripts/example_mesh_processing.ipynb.

Mesh processing involves the following steps:

  1. Optionally scale mesh to target size (for unscaled meshes)
  2. Simplify (decimate) mesh to a target error
  3. Fit the minimum bounding cylinder, or use the given cylinder_axis (e.g. along the umbilicus of a squashed scroll, where the smallest cylinder runs the wrong way)
  4. (Optional) Optimize rotation about the cylinder axis
  5. (Optional) Smooth mesh
  6. Offset by 2mm
  7. Split along YZ plane
  8. Remove overhangs

Mesh smoothing

mesh_smooth_denoise

Denoise smoothing. Configure the gamma parameter to vary smoothing amount.

image

mesh_smooth_shrink_expand

Smooth convexities/concavities by first shrinking/expanding the mesh and then expanding/shrinking back to the original value.

Shown here with 2 mm offset:

image

Case construction

Case as viewed in the OCP CAD Viewer:

image

Enabling transparency to check clearances etc.:

image

Customizing the case

The case is customized using the ScrollCase class:

image

Distribution of case sizes

Can be generated with scratch/02-05_scroll-sizes.ipynb.

image

Other notes

Avoid pushing meshes in Jupyter notebooks

git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'