- Activate your virtual environment. Instructions for
direnv.
echo 'layout pyenv 3.12.5' > .envrc
direnv allow- Install dependencies.
scrollcaseis installed as an editable package.
pip install -r requirements.txt- Install the
OCP CAD ViewerVSCode estension to view BRep models displayed withshow().
src/: scrollcase source codescripts/: select example scripts
Within src/:
case.py: Case construction withbuild123dmesh.py: Mesh processingalignment.py: Smallest enclosing cylindersmallest_circle.py: Helper utilities for Welzl's algorithm
See scripts/ directory.
Simple case generation example at scripts/example_basic_case.ipynb.
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)See example scripts/example_mesh_processing.ipynb.
Mesh processing involves the following steps:
- Optionally scale mesh to target size (for unscaled meshes)
- Simplify (decimate) mesh to a target error
- 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) - (Optional) Optimize rotation about the cylinder axis
- (Optional) Smooth mesh
- Offset by 2mm
- Split along YZ plane
- Remove overhangs
Denoise smoothing. Configure the gamma parameter to vary smoothing amount.
Smooth convexities/concavities by first shrinking/expanding the mesh and then expanding/shrinking back to the original value.
Shown here with 2 mm offset:
Case as viewed in the OCP CAD Viewer:
Enabling transparency to check clearances etc.:
The case is customized using the ScrollCase class:
Can be generated with scratch/02-05_scroll-sizes.ipynb.
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'