bmsleight / lasercut

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

lasercutoutBox positions circle cutouts incorrectly. #28

Open myklemykle opened 2 years ago

myklemykle commented 2 years ago

Correct me if i'm wrong, but it appears that cutouts passed to lasercutoutBox() in the "circle_cutouts_a" argument are displaced by one box thickness from where they are supposed to be. All the cutouts on a given face are shifted by the same amount, I believe in the positive direction of whatever coord they lie on.

I'm seeing this in OpenSCAD version 2021.01

This example should create a box with holes in the corners. The radius of the hole is the same as the inset from the corner, so the holes should be evenly nested in the corners, with two edges of each hole touching two edges of its face. In parametric mode you can see that the error grows with the box thickness.

include <lasercut/lasercut.scad>; 

thickness = 10;

dim = 100;
x=dim;
y=dim; 
z=dim;

sides=4;

hole_radius = 10;
hole_inset = 10;

front_holes = [
    [hole_radius, hole_inset, hole_inset],
    [hole_radius, hole_inset, z - hole_inset],
    [hole_radius, x - hole_inset, hole_inset],
    [hole_radius, x - hole_inset, z - hole_inset],
];

top_holes = [
    [hole_radius, hole_inset, hole_inset],
    [hole_radius, hole_inset, y - hole_inset],
    [hole_radius, x - hole_inset, hole_inset],
    [hole_radius, x - hole_inset, y - hole_inset],
];

        lasercutoutBox(thickness = thickness, x=x, y=y, z=z, 
            sides=sides, 
            num_fingers=3,
            circles_remove_a = 
                [ front_holes, top_holes, front_holes, top_holes, [], [] ]  
        );

Here's a screenshot of what I get. There are some artifacts due to the holes intersecting the fingers, but the holes are clearly not where they were declared to be.

Screen Shot 2022-03-29 at 9 39 03 PM
myklemykle commented 2 years ago

I believe you can also see this problem on the main examples page if you look closely:

Screen Shot 2022-03-29 at 9 49 10 PM
bmsleight commented 1 year ago

Not sure why I not reviewed this..

bmsleight commented 1 year ago

This show it better - its related to how I build the box..

include <lasercut.scad>; 

thickness = 10;

dim = 100;
x=dim;
y=dim; 
z=dim;

sides=4;

hole_radius = 10;
hole_inset = 10;

front_holes = [
    [dim/2, dim/2, dim/2],
];

front_holes_offset = [
    [dim/2, dim/2, dim/2-thickness],
];

lasercutoutBox(thickness = thickness, x=x, y=y, z=z, 
            sides=sides, 
            num_fingers=3,
            circles_remove_a = 
                [ [], front_holes ]  
        );

translate([dim*1.5, 0, 0]) lasercutoutSquare(thickness=thickness, x=x, y=y,
    circles_remove = [
            [dim/2, x/2, y/2],
        ]

    );

translate([dim*3, 0, 0])  lasercutoutBox(thickness = thickness, x=x, y=y, z=z, 
            sides=sides, 
            num_fingers=3,
            circles_remove_a = 
                [ [], front_holes_offset ]  
        );
bmsleight commented 1 year ago

Untitled3