Skip to content
Merged

Dev #10

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Thumbs.db
*.graffle

# Packages
parts/
/parts/
var/
sdist/
develop-eggs/
Expand Down
28 changes: 18 additions & 10 deletions microfinity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@

script_dir = os.path.dirname(__file__)

from .constants import *
from .gf_obj import GridfinityObject
from .gf_baseplate import (
# Core components
from .core.constants import *
from .core.base import GridfinityObject
from .core.helpers import union_all, quarter_circle, chamf_cyl, chamf_rect
from .core.export import GridfinityExporter, SVGView

# Parts
from .parts.baseplate import (
GridfinityBaseplate,
NotchSpec,
get_notch_spec,
Expand All @@ -31,24 +36,27 @@
NOTCH_BOT_MARGIN_MM,
NOTCH_THROUGH_OVERCUT_MM,
NOTCH_KEEPOUT_TOP_MM, # Deprecated
EdgeMode,
EdgeRole,
EdgeFrameMode,
FillInnerMode,
)
from .gf_box import GridfinityBox, GridfinitySolidBox
from .gf_drawer import GridfinityDrawerSpacer
from .gf_ruggedbox import GridfinityRuggedBox
from .gf_baseplate_layout import (
from .parts.box import GridfinityBox, GridfinitySolidBox
from .parts.drawer import GridfinityDrawerSpacer
from .parts.baseplate_layout import (
GridfinityBaseplateLayout,
GridfinityConnectionClip,
LayoutResult,
PieceSpec,
EdgeMode,
SegmentationMode,
ToleranceMode,
)
from .test_prints import (

# Calibration tools
from .calibration.test_prints import (
generate_fractional_pocket_test,
generate_fractional_pocket_test_set,
generate_clip_clearance_sweep,
generate_clip_test_set,
export_test_prints,
)
from .gf_export import GridfinityExporter, SVGView
16 changes: 16 additions & 0 deletions microfinity/calibration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Calibration tools for Gridfinity printer fit testing.

This subpackage provides tools for generating test prints to calibrate
your 3D printer settings for optimal Gridfinity fit:

- test_prints: Generate fractional pocket tests and clip clearance sweeps
"""

from .test_prints import (
generate_fractional_pocket_test,
generate_fractional_pocket_test_set,
generate_clip_clearance_sweep,
generate_clip_test_set,
export_test_prints,
DEFAULT_CLEARANCE_SWEEP,
)
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def _cut_female_slots_on_edge(
Returns:
Body with through-slots cut into the specified edge
"""
from microfinity.constants import GRU
from microfinity.gf_baseplate import (
from microfinity.core.constants import GRU
from microfinity.parts.baseplate import (
get_notch_spec,
make_notch_cutter_outer_anchored,
get_seam_cut_depth_mm,
Expand Down Expand Up @@ -209,7 +209,7 @@ def generate_fractional_pocket_test(
Returns:
CadQuery Workplane with the test piece
"""
from microfinity.gf_baseplate import GridfinityBaseplate, EdgeRole
from microfinity.parts.baseplate import GridfinityBaseplate, EdgeRole

# Validate fractional size
valid_fractions = [0.25, 0.5, 0.75]
Expand Down Expand Up @@ -313,7 +313,7 @@ def generate_clip_clearance_sweep(
Returns:
Tuple of (workplane with multiple solids, list of clearance values)
"""
from microfinity.gf_baseplate_layout import GridfinityConnectionClip
from microfinity.parts.baseplate_layout import GridfinityConnectionClip

if clearances is None:
clearances = DEFAULT_CLEARANCE_SWEEP.copy()
Expand Down Expand Up @@ -354,7 +354,7 @@ def generate_clip_test_set(
Returns:
CadQuery Workplane with the clips arranged for printing
"""
from microfinity.gf_baseplate_layout import GridfinityConnectionClip
from microfinity.parts.baseplate_layout import GridfinityConnectionClip

clip = GridfinityConnectionClip(clip_clearance_mm=clearance_mm)
w, l, h = clip.dims
Expand Down Expand Up @@ -396,7 +396,7 @@ def export_test_prints(
List of exported file paths
"""
import os
from microfinity.gf_export import GridfinityExporter
from microfinity.core.export import GridfinityExporter

os.makedirs(path, exist_ok=True)
exported_files = []
Expand Down
13 changes: 13 additions & 0 deletions microfinity/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Core components for Gridfinity object generation.

This subpackage contains:
- base: GridfinityObject base class
- constants: Gridfinity geometry constants
- helpers: Utility functions for geometry operations
- export: File export utilities (STEP, STL, SVG)
"""

from .constants import *
from .base import GridfinityObject
from .helpers import union_all, quarter_circle, chamf_cyl, chamf_rect
from .export import GridfinityExporter, SVGView
31 changes: 4 additions & 27 deletions microfinity/gf_obj.py → microfinity/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import cadquery as cq

from microfinity.constants import (
from microfinity.core.constants import (
GRHU,
GRU,
GRU2,
Expand All @@ -45,7 +45,7 @@
GR_WALL,
SQRT2,
)
from microfinity.gf_export import GridfinityExporter, SVGView
from microfinity.core.export import GridfinityExporter, SVGView

# Special test to see which version of CadQuery is installed and
# therefore if any compensation is required for extruded zlen
Expand Down Expand Up @@ -298,7 +298,6 @@ def filename(self, prefix=None, path=None):
GridfinityBaseplate,
GridfinityBox,
GridfinityDrawerSpacer,
GridfinityRuggedBox,
)

if prefix is not None:
Expand All @@ -311,8 +310,6 @@ def filename(self, prefix=None, path=None):
prefix = prefix + "lite_"
elif isinstance(self, GridfinityDrawerSpacer):
prefix = "gf_drawer_"
elif isinstance(self, GridfinityRuggedBox):
prefix = "gf_ribbox_" if self.rib_style else "gf_ruggedbox_"
else:
prefix = ""
fn = ""
Expand Down Expand Up @@ -349,28 +346,6 @@ def filename(self, prefix=None, path=None):
fn = fn + "_scoops"
if self.labels:
fn = fn + "_labels"
elif isinstance(self, GridfinityRuggedBox):
fn = fn + "x%d" % (self.height_u)
if self._obj_label is not None:
fn = fn + "_%s" % (self._obj_label)
if self.front_handle or self.front_label:
fn = fn + "_fr-"
if self.front_handle:
fn = fn + "h"
if self.front_label:
fn = fn + "l"
if self.side_handles or self.side_clasps:
fn = fn + "_sd-"
if self.side_handles:
fn = fn + "h"
if self.side_clasps:
fn = fn + "c"
if self.stackable:
fn = fn + "_stack"
if self.lid_baseplate:
fn = fn + "_lidbp"
if self.lid_window:
fn = fn + "_win"
elif isinstance(self, GridfinityDrawerSpacer):
if self._obj_label is not None:
fn = fn + "_%s" % (self._obj_label)
Expand Down Expand Up @@ -481,6 +456,8 @@ def to_stl_file(cls, length_u, width_u, height_u=None, filename=None, prefix=Non

@staticmethod
def as_obj(cls, length_u=None, width_u=None, height_u=None, **kwargs):
from microfinity import GridfinityBaseplate, GridfinityBox, GridfinityDrawerSpacer

if "GridfinityBox" in cls.__name__:
obj = GridfinityBox(length_u, width_u, height_u, **kwargs)
if "GridfinitySolidBox" in cls.__name__:
Expand Down
73 changes: 0 additions & 73 deletions microfinity/constants.py → microfinity/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,76 +108,3 @@ def micro_pitch(micro_divisions=4):
GR_BOLT_H = 3.6 + GR_HOLE_H
GR_HOLE_DIST = 26 / 2
GR_HOLE_SLICE = 0.25

# Rugged Box constant parameters
GR_RBOX_WALL = 2.5
GR_RBOX_FLOOR = 1.2
GR_RBOX_CWALL = 10.0
GR_RBOX_CORNER_W = 56
GR_RBOX_BACK_L = 66
GR_RBOX_FRONT_L = 56
GR_RBOX_RAD = 3.745
GR_RBOX_CRAD = 14

GR_RBOX_CHAN_W = 20
GR_RBOX_CHAN_D = GR_RBOX_CWALL - GR_RBOX_WALL
GR_RBOX_VCUT_D = 1

GR_CLASP_SLIDE_D = 39
GR_CLASP_SLIDE_W = 4

GR_RIB_W = 2
GR_RIB_L = 5
GR_RIB_GAP = 1
GR_RIB_H = 3.5
GR_RIB_SEP = 4
GR_RIB_CTR = 10

GR_REG_L = 5
GR_REG_W = 2.5
GR_REG_H = 2.5
GR_REG_R0 = 10.75
GR_REG_R1 = 8.25
GR_BREG_R0 = GR_REG_R0 + 0.25
GR_BREG_R1 = GR_REG_R1 - 0.25

GR_HANDLE_L1 = 12
GR_HANDLE_L2 = 28
GR_HANDLE_H = 7.5
GR_HANDLE_W = 5
GR_HANDLE_SEP = 12.5
GR_HANDLE_OFS = 61.5
GR_HANDLE_SZ = 30
GR_HANDLE_TH = 7
GR_HANDLE_RAD = 11

GR_LID_HANDLE_W = 70
GR_SIDE_HANDLE_W = 60

GR_HINGE_SZ = 32
GR_HINGE_D = 3
GR_HINGE_W1 = 5.5
GR_HINGE_H1 = 2.7
GR_HINGE_W2 = 2.1
GR_HINGE_H2 = 9
GR_HINGE_CTR = 30.625
GR_HINGE_W3 = 2
GR_HINGE_SEP = 1
GR_HINGE_OFFS = 2.65
GR_HINGE_SKEW = 0.15
GR_HINGE_RAD = 3.5
GR_HINGE_TOL = 0.4
GR_HEX_H = 3
GR_HEX_W = 4
GR_HEX_D = 1.3
GR_LID_WINDOW_H = 6.5

GR_LABEL_SLOT_TH = 2.5
GR_LABEL_TH = 0.8
GR_LABEL_H = 31

GR_LATCH_L = 32.5
GR_LATCH_W = 19.6
GR_LATCH_H = 7
GR_LATCH_IW = 14.75
GR_LATCH_IL = 5.2
2 changes: 1 addition & 1 deletion microfinity/gf_export.py → microfinity/core/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This module contains ONLY the file-writing logic, not orchestration.

For batch exports of layouts, use GridfinityBaseplateLayout.export_all().
For test print exports, use test_prints.export_test_prints().
For test print exports, use calibration.test_prints.export_test_prints().
"""

from enum import Enum
Expand Down
File renamed without changes.
Loading