bmsleight / lasercut

Module for openscad, allowing 3d models to be created from 2d lasercut parts
BSD 2-Clause "Simplified" License
318 stars 54 forks source link

laserCutBox cubes are translated to correctly fit their dimensions from 0, laserCutSquare pieces aren't #24

Open Inhibit opened 3 years ago

Inhibit commented 3 years ago

I'm unsure if this is intentional or not but it threw me for a loop when I was coding up a parametric assembly.

The behavior of boxes is to fit their dimensions precisely including the tab cutouts. The square sheets don't. They're offset by a sheet thickness in two dimensions from 0 rather than translated to compensate. Personally I'd prefer all the functions to have the behavior of the box and once created have the 0 offset; but either case being consistent would do for regular behavior.

I realize this might be intentional for some reason but felt I should point it out to prevent someone having a similar head-scratching moment as their assembly is subtly off :). I can submit a patch if you'd like but it'd probably take me a while.

Thanks for sharing this library by the way. It's a nice time saver.

in example:

$fn=60;

include <lasercut.scad>;

thickness = 3.0;
cabx = 185;
caby = 320;
cabz = 220; 

// Our laserCutSquare sheet
color("aqua", 0.75)
translate([0, 0, 0])
lasercutoutSquare(thickness=thickness, x=cabx-thickness, y=caby-(2*thickness),
bumpy_finger_joints=[
        [UP, 1, 4],
        [DOWN, 0, 4],
        [LEFT, 1, 6]
    ]
);

// a cube for easy reference
color("green", 0.75)
translate([cabx, 0, 0])
cube([cabx, caby, thickness]);

// a cube for easy reference
color("green", 0.75)
translate([0, caby, 0])
cube([cabx, caby, thickness]);

// our laserCutBox
color("red",0.6)
translate([cabx, caby, 0])
lasercutoutBox(thickness = thickness, x=cabx, y=caby, z=cabz, 
sides=5, num_fingers=4);
Inhibit commented 3 years ago

I had a few minutes and figured it'd be easier to make the change prior to creating my design.

Added a pull request with the way I'd implement it after looking at the code.

25

bmsleight commented 3 years ago

Long day at work, yet bug and patch submitted. :) Cool - try at look at this at weekend.

Inhibit commented 3 years ago

By then I might have it fixed. Shortly after posting I noticed it was a little too simplistic.

I think the method is sound but I need to follow the logic of the program a little more and clean up where the jiggering happens. I should be able to follow up with a correctly working patch!