Skip to main content

Parametric IP66 enclosure generator for 3D printing

Project description

CQ-Enclosure

A parametric IP66-rated enclosure generator for 3D printing, built with CadQuery. This package allows you to easily create customized enclosures with gaskets and various screw mounting options.

All components (box, lid, and gasket) can be exported as STEP files for compatibility with any CAD software and 3D printing workflow.

Features

  • Fully parametric enclosure generation
  • IP66-rated design with gasket
  • Multiple screw mounting options:
    • Inside or outside box mounting
    • Wood screw or machine screw support with countersunk head
    • Configurable corner and middle screw positions
  • Mounting holders for attaching the enclosure
  • Automatic generation of:
    • Main enclosure box
    • Matching lid
    • Gasket for water-tight seal

Installation

Requires python 3.10 or higher.

pip install cq-enclosure

Usage

See the examples directory for complete usage examples.

Examples

box, lid, gasket = Enclosure(
    box_inner_width=31.0,
    box_inner_length=71.0,
    box_inner_height=31.0,
    screw_location=ScrewLocation.INSIDE_BOX,
    middle_length_screws=True,
).build()

Enclosure Example


box, lid, gasket = Enclosure(
    box_inner_width=31.0,
    box_inner_length=71.0,
    box_inner_height=31.0,
    screw_location=ScrewLocation.INSIDE_BOX,
    middle_length_screws=True,
    screw_type=ScrewType.WITH_SQUARE_NUT,
).build()

Enclosure Example


box, lid, gasket = Enclosure(
    box_inner_width=31.0,
    box_inner_length=71.0,
    box_inner_height=31.0,
    screw_location=ScrewLocation.OUTSIDE_BOX,
    middle_width_screws=True,
    corner_screws=False,
    screw_type=ScrewType.WITH_SQUARE_NUT,
).build()

Enclosure Example


box, lid, gasket = Enclosure(
    box_inner_width=31.0,
    box_inner_length=71.0,
    box_inner_height=31.0,
    screw_location=ScrewLocation.OUTSIDE_BOX,
    middle_length_screws=True,
    corner_screws=False,
    screw_type=ScrewType.WITH_SQUARE_NUT,
).build()

Enclosure Example Enclosure Example


box, lid, gasket = Enclosure(
    box_inner_width=50.0,
    box_inner_length=50.0,
    box_inner_height=40.0,
    screw_location=ScrewLocation.OUTSIDE_BOX,
    corner_screws=False,
    middle_width_screws=True,
    middle_length_screws=True,
    screw_type=ScrewType.WOOD_SCREW,
).build()

Enclosure Example


box, lid, gasket = Enclosure(
    box_inner_width=50.0,
    box_inner_length=50.0,
    box_inner_height=40.0,
    screw_location=ScrewLocation.OUTSIDE_BOX,
    corner_screws=False,
    middle_width_screws=True,
    middle_length_screws=True,
    screw_type=ScrewType.WOOD_SCREW,
    mount_holders=False,
).build()

Enclosure Example

Parameters

The Enclosure class accepts the following parameters:

Core Dimensions

  • box_inner_width: Internal width (X) of the enclosure
  • box_inner_length: Internal length (Y) of the enclosure
  • box_inner_height: Internal height (Z) of the enclosure
  • actual_inner_width: Whether to include screw cylinder dimensions in box_inner_width when using inside box screws (default: True)
  • actual_inner_length: Whether to include screw cylinder dimensions in box_inner_length when using inside box screws (default: True)

Split to box and lid

  • cut_top: Height at which the box splits into lid and base (default: 5.0mm)

Screw Configuration

  • screw_location: Location of mounting screws (ScrewLocation.INSIDE_BOX or ScrewLocation.OUTSIDE_BOX, default: OUTSIDE_BOX)
  • screw_type: Type of screws to use (ScrewType.WOOD_SCREW or ScrewType.WITH_SQUARE_NUT, default: WOOD_SCREW)
  • screw_hole_diameter: Diameter of the screw holes (default: 3.3mm including tolerance)
  • screw_head_diameter: Diameter of the screw head (default: 6.0mm)
  • screw_total_length: Total length of the screws (default: 16.0mm)
  • corner_screws: Enable/disable corner mounting points (default: True)
  • middle_length_screws: Enable/disable middle mounting points on length sides (default: False)
  • middle_width_screws: Enable/disable middle mounting points on width sides (default: False)

Square Nut Parameters

  • square_nut_width: Width of square nuts (default: 5.5mm)
  • square_nut_height: Height of square nuts (default: 1.8mm)
  • nut_wa_type: Nut printing workaround type (NutPrintingWA.CUT_RECT_SPACES or NutPrintingWA.ADD_CEILING, default: ADD_CEILING)

Gasket Parameters

  • gasket_height: Height of the gasket (default: 1.6mm)
  • gasket_width: Width of the gasket (default: 1.2mm)
  • gasket_spacing: Spacing around the gasket (default: 0.15mm)
  • gasket_compression: Compression factor for the gasket (default: 0.2mm)

Mount Holders

  • mount_holders: Enable/disable mounting holders (default: True)
  • mount_holder_length: Length of mounting holders (default: 15.0mm)
  • mount_holders_screw_hole_diameter: Diameter of mount holder screw holes (default: 5.0mm)
  • mount_holders_head_screw_diameter: Diameter of mount holder screw heads (default: 9.0mm)
  • mount_holders_fillet: Enable/disable fillets on mount holders (default: True)

3D Printing Parameters

  • layer_height: Layer height for 3D printing, used for square nut printing trick (default: 0.28mm)

Aesthetic Options

  • fillet_bottom: Enable/disable bottom fillets (default: True)
  • fillet_top: Enable/disable top fillets (default: True)

Development

To set up a development environment:

  1. Clone the repository
  2. Install astral uv package manager.
  3. Create and initialize a virtual environment:
     uv sync
    

License

MIT License

Copyright (c) 2025 Szymon Światczyński

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

cq_enclosure-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cq_enclosure-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file cq_enclosure-0.1.0.tar.gz.

File metadata

  • Download URL: cq_enclosure-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.10

File hashes

Hashes for cq_enclosure-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7fc45799f2447ce5c1a8765d468ec2aa742d1d074aedb7ebb4672f116d78befb
MD5 4e80c0029dae577243253d99878f0228
BLAKE2b-256 7cf10c75f7d011cbd1f5cd2fdf222ab541a5dc658326bd7dc796d35e76efeb38

See more details on using hashes here.

File details

Details for the file cq_enclosure-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cq_enclosure-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0c9138d8f7b18993430d0b294b130fd666f9e6596d44cade0fd4770fd7ef400
MD5 c9abbe0bfb40b21e07ea2d78f4981752
BLAKE2b-256 8fdbc9f20e491201839611dc59a61094da9645dbd5320d741696326eecc03675

See more details on using hashes here.

Supported by

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