Commit Graph

93 Commits

Author SHA1 Message Date
Joel Ebel
f2c3de7712 Parametrize outer box holes separately
Default them to a #4 screw major diameter so screws will only bind to
the inner box tabs and not the outer shell.
2018-06-18 23:07:46 -04:00
Joel Ebel
b5fbf0be70 Make language more clear for PCB Feet. 2018-06-18 22:53:27 -04:00
Joel Ebel
ed64f8e680 Make panel features optional, and default off
So that the Thingiverse customizer will not include the demo panel
features, but they are in the code as examples.
2018-05-31 23:51:32 -04:00
Joel Ebel
ee947f39eb Add a preview angle, used by the customizer 2018-05-30 22:13:11 -04:00
Joel Ebel
335407804e Rename main file to something reasonable.
And remove the older version.
2018-05-30 22:11:07 -04:00
Joel Ebel
dc7580f967 Clean up comments and add inline documentation
Major cleanup of commenting for style and completeness.

Also removed TopMargin and replaced it with TopPCBMargin, as nothing was
using TopMargin other than Height.
2018-05-29 00:14:11 -04:00
Joel Ebel
343af4fded Add experimental screwless PCB feet
If Screwless is true, use feet with a peg in them that goes through the
PCB holes. Feet then come down from the top shell to press against the
PCB and hold it in place. These have a hole in the center so the peg
from the bottom shell will insert into it and keep the shells in a
stable position in the X-Y plane. If you combine this with screwless
snap tabs, you can have a fully screwless box.
2018-05-28 22:52:39 -04:00
Joel Ebel
7280687162 Remove all == 1 and just depend on implicit != 0 2018-05-28 16:10:59 -04:00
Joel Ebel
8b0e6c4d67 Remove some debugging accidentally left in. 2018-05-27 23:30:42 -04:00
Joel Ebel
03173ffb87 Add CutoutMargin to foot hole. 2018-05-27 23:22:57 -04:00
Joel Ebel
bb815bcd2f Rework the margins
Change CutoutMargin from a diameter to a radius/single edge (cut it in half)
Change OuterMargin to a more generic part margin for mating parts
Derive PanelGap from CutoutMargin and OuterMargin
2018-05-26 23:32:03 -04:00
Joel Ebel
50733f510c Embiggen the PCB and add examples to back panel.
Make the back margin 0 so the PCB is up against the back panel. Make use
of the variables describing the panel with respect to the PCB to show
how they can be used.
2018-05-26 22:59:08 -04:00
Joel Ebel
38932ba410 Fix spacing in logic expressions 2018-05-26 22:20:29 -04:00
Joel Ebel
b0aa934f10 Move panel management to the top
Break out the panel holes and text into separate modules.

Put those modules at the top of the file so they are easier to find.
This unfortunately puts them before the modules they instantiate, but I
think this is a fair trade-off for readability and findability of things
that should be customized.
2018-05-24 13:11:02 -04:00
Joel Ebel
fcd2f5308c Support experimental snap tabs
Set SnapTabs to 1 and get tabs with buttons and semispherical holes in
the box. This is experimental because I haven't built a box like this
and don't know how well it will work. The thickness of the tab is
probably important since you need it to flex just the right amount to
allow the button to fit. Also, the ScrewHole value is used for the size
of the button, so it should not exceed 2*Thick.
2018-05-23 23:42:36 -04:00
Joel Ebel
f62b2699fe Parametrize tab thickness separate from box. 2018-05-23 22:36:28 -04:00
Joel Ebel
eff539a8dc Rename "leg" to "tab" It makes more sense to me. 2018-05-23 09:27:48 -04:00
Joel Ebel
81192e31eb Support arbitrary legs on top/bottom shell
Add BLLeg, FLLeg, BRLeg, and FRLeg parameters where 0 means put that leg
on the bottom shell, and 1 means put it on the top. Call the legs and
hols modules with a "top" argument where 0 means build the bottom shell
legs/holes, and 1 means build the top. Gate each leg or hole creation
based on logic between XXLeg and top.

This also required making the top shell using mirror() rather than
rotate, since that kept the same leg/hole in the same position when
flipped to the top.
2018-05-23 01:08:27 -04:00
Joel Ebel
99e1611383 Make decorations optional 2018-05-23 00:03:15 -04:00
Joel Ebel
c4cc362d79 Put top shell and bottom shell in separate modules
Make the Coque module generic, adding specific changes to a separate
TopShell and BottomShell module. The color() function is moved to Coque
to prevent coloring the PCB model. I left the legs and holes in the
separate modules to prepare for more customization of them for top and
bottom.
2018-05-22 23:56:59 -04:00
Joel Ebel
ec4ccde941 Remove arguments from foot module.
There's very little reason to have them, and it's consistent with the
rest of the code to not have them.
2018-05-21 23:52:24 -04:00
Joel Ebel
f3ac692891 Move common leg translation/rotation into module 2018-05-21 23:43:58 -04:00
Joel Ebel
cc44b9dabd Produce fixation leg in separate module 2018-05-21 23:31:27 -04:00
Joel Ebel
f424cccd04 Scale foot filet with foot height 2018-05-19 15:48:55 -04:00
Joel Ebel
791720c361 Scale interior filet to keep concentric corners
If the filet is more than double the thickness, scale the interior
filets so that the walls have a constant thickness around the corners
and the interior and exterior filets have a common center axis. If the
filets are smaller, then keep the old behavior, making the corners
mostly square.
2018-05-19 15:42:22 -04:00
Joel Ebel
526a6b01f0 Move the box color into the Coque module 2018-05-18 20:36:19 -04:00
Joel Ebel
ffb35824ec Form panel and cutouts in 2D then extrude
Panel and Holes are all in 2D. Leave the LinearExtrude to the PanL
modules just before adding text. Perform all translating in the PanL
modules, rather than the top level code.
2018-05-18 20:26:17 -04:00
Joel Ebel
0a8234aafa Do not rename FootFilet to Filet. 2018-05-18 01:37:45 -04:00
Joel Ebel
cc471eecaf Extrude the whole foot at once
Generate a cross-section of the foot in 2D, then rotate/extrude the
whole thing at once. This is a little easier to reason about than
working in 3D. You can use debug view to see just the cross section with
more ease. It save a line of code, too.
2018-05-18 01:35:16 -04:00
Joel Ebel
7d85d60ca4 Separate decorations into LeftDecorations
Mirror LeftDecorations to get the right decorations.
2018-05-18 01:17:04 -04:00
Joel Ebel
9ddb6d7516 Simplify Decorations module
split a single decoration into its own module, and give it a most
generic translation. This makes the Decorations module cleaner and
easier to understand, because you can easily see exactly how much you
are translating each decoration.

Rather than translating the decoration to make it fit the other side of
the box, rotate it. It makes the translation cleaner, and it's a little
easier to understand. The decorations are the same on each side, just
rotated 180 degrees from one another.

I might still make all the left side decorations and rotate that 180
degrees for the right side.
2018-05-18 00:55:11 -04:00
Joel Ebel
3754009a43 Make RoundBox smarter to reduce code duplication
RoundBox now takes an xshrink and yzshrink argument, which tell it how
much to shrink the box from the Length, Width, and Height parameters.
They defaul to 0. The removes the need to translate the calls to
RoundBox or to repeatedly provide adjustments to its arguments that are
very similar. As a result, the MainBox module is now much simpler and
easier to understand.
2018-05-18 00:24:54 -04:00
Joel Ebel
300029c3d2 Split up the man box code into modules
The Coque module is now very simple and self-commenting about what it
does. The complexity is in the referenced modules, which are much
shorter and easier to read. I'll split things up just a bit more, but
wanted to check this in first.
2018-05-17 23:59:55 -04:00
Joel Ebel
d6f26ae90d Parametrize the box fixation tabs
This is the last part to make the box fully scalable. Now if you double
every parameter, the box doubles in all dimensions. The panel features
are not changed, however. That's up to you to fix.

The tab cutouts are now scaled off of the screw hole size, since that
fixes the diameter of the tab.

I've also added an OuterMargin which adjusts the spacing you need
between the tab and the box wall. This is a property of your printer,
and shouldn't be changed when you scale other aspects of the box. I
might base other dimensions, like the panel gap on this value as well.
2018-05-16 16:08:05 -04:00
Joel Ebel
f911138c93 Rename 'm' to PanelGap for readability 2018-05-16 14:57:15 -04:00
Joel Ebel
5e2f400758 Make it go to 11. Also fix the CText angles. 2018-05-16 14:55:01 -04:00
Joel Ebel
4ec9e798e3 Simplify top shell rotation 2018-05-16 13:41:05 -04:00
Joel Ebel
e15258361c Adjust holes based on wall thickness
Rather than fixed at 20mm, these are now sized based on wall thickness,
supporting arbitrary wall thickness, and making debug views more
appealing.
2018-05-16 13:28:14 -04:00
Joel Ebel
4855a03729 Position mounting tabs/holes relative to parameters
Make the tab size relative to the screw hole size.
Position the tabs based on Thick, PanelThick, and the tab size.
The are now scaled properly as you increase the related parameters.
2018-05-16 13:19:51 -04:00
Joel Ebel
d9312ae7a8 Improve subtraction on interior rails
There was some artifacting and errors resulting from the inner rails not
producing a valid 2-manifold object. Make the rails larger so they
interect the box, and make the subtraction the full height and width of
the box so the boundary isn't indeterminate.
2018-05-16 00:27:45 -04:00
Joel Ebel
fb647fbd18 Add a small amount to vent thickness to ensure it goes through the wall 2018-05-15 23:47:58 -04:00
Joel Ebel
2ffdd54ce8 Use "offset" instead of minkowski with a circle
The last change didn't work if Filet is 0. minkowski didn't work well
with a 2D null argument either. This is a better solution, plus it saves
a line.

The preview works fine, but there's still an issue with the full render.
2018-05-15 23:21:01 -04:00
Joel Ebel
85c85ff905 Re-work panel, roundbox, and SquareHole
Do the minkowski in 2D so that if Filet is 0, and half the minkowski is
null, you don't have to fix the height. Then translate, extrude, and
rotate it.
2018-05-15 22:06:09 -04:00
Joel Ebel
43f87b8e70 Make it clear Filet is a radius
Update the comment at the top, which described Filet as a diameter,
which was incorrect for most of the file.

Make it clear that the circle used in foot creation is a radius. It
already was, but provide r= in the argument so it's unambiguous.

SquareHole was treating its filet as a diameter, rather than a radius.
Switch it to treat Filet as a radius. This does make the example square
holes rounder.
2018-05-15 16:31:11 -04:00
Joel Ebel
d46a492d0b Re-work of vent/decoration holes
Make all vent holes Thick + Filet thick so they extend to the end of the
rounded corner, particularly for large filets, but not too far in for
small filets.

Make all decorations Thick/2 so they scale with the thickness.

Separate the vents by a square Thick x Thick pillar.

Generate the position of the first vent/decoration based on the panel
thickness, wall thickness, margin, and vent spacing so that there is one
pillar's width beteween the interior edge and the first vent.

Bring the decoration/vent in from 1mm outside the box both horizontally
and vertically to prevent artifacts. This does result in vents reaching
under the box farther than previously, but I think the aesthetic is
pleasing, and it handles strange cases better, such as thick walls and
tiny filets.
2018-05-15 00:25:39 -04:00
Joel Ebel
6b91772037 reorder font arguments on PCB to match others 2018-05-14 15:58:34 -04:00
Joel Ebel
7e4e1ab121 Use debug modifier on PCB parent
Rather than debug both the text and the PCB, just debug the parent of
both. This requires that the text be 3, so go ahead and extrude it by
FontThick.
2018-05-14 15:55:09 -04:00
Joel Ebel
27785d60d8 fix ridiculous font thickness used in testing 2018-05-14 15:28:55 -04:00
Joel Ebel
e02a276c6b Support VAlign for LText
Add new argument that defaults to baseline.
Update comments to describe the new option.
Update some HAlign documentation with more details.
2018-05-14 15:21:14 -04:00
Joel Ebel
f2e0268a6c Unify text() arguments.
Re-order arguments to match docs and be consistent.
Remove valign from CText, as baseline was the default value.
Remove an unnecessary space.
2018-05-14 15:08:09 -04:00