aaron-siegel / puzzlecad

An OpenSCAD library for modeling mechanical puzzles
Other
32 stars 11 forks source link

$box_bevel - does it work? #56

Open crabbedh opened 2 years ago

crabbedh commented 2 years ago

Not sure if this is the right place.. if not direct me .. (using puzzlecad 2.3)

I want to bevel the frame/box much more than "default" rendering.. similar to those 3D puzzles online (ie: https://www.puzzlemaster.ca/search/?q=spiral%20lock). I see in the puzzlecad-boxes.scad source a variable called "$box_bevel" which I'm guessing would do this. However, if I specify "$box_bevel=5;" at the top layer of my puzzle source, nothing happens; nor does it when calling the packing_box routine.

I even edited the puzzlecad.scad default values for $box_bevel (line #56) and no change to box rendering. ($box_bevel = 5;)

Can one change the bevel of the packing box? Again.. sorry if this is the wrong location for this comment.. am just ramping up on scad/puzzlecad and don't see other ways to ask.

aaron-siegel commented 2 years ago

It works for me:

packing_box(["xxxxx|xxxxx|xxxxx|xxxxx|xxxxx", "xxxxx|x...x|x...x|x...x|xxxxx"]);
image

versus

$box_bevel = 3;
packing_box(["xxxxx|xxxxx|xxxxx|xxxxx|xxxxx", "xxxxx|x...x|x...x|x...x|xxxxx"]);
image

Can you post your complete .scad file? Thanks!

crabbedh commented 2 years ago

ahh.. found the issue.. I had a "$burr_bevel_adjustments = " part at the end of the statement and it was over-riding the $box_bevel value. (In learning SCAD, I was doing too much cut/paste).

Screen Shot 2022-05-06 at 2 22 47 PM

Taking that out fixed the issue, but the rendering is not ideal.. You can see it bevels where the top is cut. Ideally when you glue the top, you'd like the bevel to continue on the sides, but not on the top/bottom of the cut.

Screen Shot 2022-05-06 at 2 14 25 PM

Although I haven't tried it thoroughly, can you use the 'connect' statement (on the packing_box routine to create an obstruction on a wall so that it creates a 'glue' point? Adding the obstruction and hoping the auto layout will take care of it doesn't seem to work as shown below.

Screen Shot 2022-05-06 at 2 19 52 PM

If I don't use $auto_layout = true, then it renders without issue. With a nice bevel! My attempt to use "connect" magic here has not worked as I'd also need to use on the top.. but maybe packing_box is not intended to have obstructions inside.

So if obstructions should use burr_plate to create the box.. will the $box_bevel constant work independently of the $burr_bevel? (or will burr_plate even use $box_bevel)?

Screen Shot 2022-05-06 at 2 21 22 PM
aaron-siegel commented 2 years ago

If you don't use $auto_layout, you can fine-tune the beveling. The following is supposed to work, but evidently there's a bug that causes an infinitesimally thin overhang if the z- adjustment is less than 1/2 of the main bevel.

$box_bevel = 3;
packing_box([
    "xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx",
    "x.....x|xxx...x|x.....x|x.....x",
    "x.....x|x.....x|x....xx|x.....x",
    "x.....x|x.....x|x.....x|x.....x",
    "x{connect=mz+}.....x{connect=mz+}|x.....x|x.....x|x{connect=mz+}.....x{connect=mz+}"
], $burr_bevel_adjustments = "z+=0");
image
crabbedh commented 2 years ago

I mighta merged the pull request when I should not have.. but think you’ll see my files on Spiral Lock somewhere on GitHub..

But I’ve attached a zip with scad for SpiralLock and Burr Lock E.. not sure if you’ll get permission to use them so won’t go further until that happens.. If you do.. I can submit through PR and clean up to your publish standard..

Thx

Dave

crabbedh commented 2 years ago

Yes that would work fine, with bug fixed. I also found (when creating mini lock 2) that 4 circles do not preserve lid orientation and user could glue lid backwards. That is critical in the mini lock 2 puzzle. As a suggestion, I’d make one circle a square ( or put circles so layout is not symmetric …. ( I never checked if autolayout actually does that).

crabbedh commented 1 year ago

grin.. you may regret accepting help from me.. being retired my software development experience was mostly pre-github..

I created a fork off puzzlecad.. added my files and thought I did a pull request.. but don’t see it when I look at aaron-siegel/puzzlecad..

Can you see the fork crabbedh/spiral_lock_lohe? All the files are there..

If you can let me know how I PR properly.. just add a few comments and point me in the right direction and I’ll search out the proper steps..

Dave

On May 6, 2022, at 3:04 PM, Aaron Siegel @.***> wrote:

If you don't use $auto_layout, you can fine-tune the beveling. The following is supposed to work, but evidently there's a bug that causes an infinitesimally thin overhang if the z- adjustment is less than 1/2 of the main bevel.

$box_bevel = 3; packing_box([ "xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx", "x.....x|xxx...x|x.....x|x.....x", "x.....x|x.....x|x....xx|x.....x", "x.....x|x.....x|x.....x|x.....x", "x{connect=mz+}.....x{connect=mz+}|x.....x|x.....x|x{connect=mz+}.....x{connect=mz+}" ], $burr_bevel_adjustments = "z+=0"); https://user-images.githubusercontent.com/2014957/167192033-2411b7b2-fe97-481e-a688-937d3d0c7c51.png — Reply to this email directly, view it on GitHub https://github.com/aaron-siegel/puzzlecad/issues/56#issuecomment-1119861343, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSQJCATW7ZAROCR22YSICTVIVNJTANCNFSM5UZ6K7KA. You are receiving this because you authored the thread.