nophead / NopSCADlib

Library of parts modelled in OpenSCAD and a framework for making projects
GNU General Public License v3.0
1.17k stars 155 forks source link

[Feature Request] Specify extrusion slot count #247

Open mysmartbus opened 1 year ago

mysmartbus commented 1 year ago

Working on a project that uses 1020 and 2020 t-slot profiles (called "extrusions" in NopSCADlib). The 1020 profiles render correctly for my design but the 2020 does not.

My source for t-slot profiles is 8020.net and they have 2020 profiles that have 2 slots on each side. See part number 2020-s . The picture below shows the type of 2020 t-slot profile I'd like to be able to use. 2020-s_photo

I've been going through the code in vitamins/extrusion.scad and short of doing a complete rewrite, I have not been able to get it to generate the design I'd like to use.

8020.net uses series to make it easy to determine the width of the profile. I.E. 10-series is 1" wide, 15-series is 1-1/2" wide, 20-series is 20mm wide, 25-series is 25mm wide, etc. The height and width specified in vitamins/extrusions.scad would need to evenly divisible by the series value.

Ideas I'm testing:

Adding another argument to module extrusion() in vitamins/extrusion.scad.

Usage examples:
A) extrusion(E2020, series=10). This would render an E2020 extrusion with 2 slots on each side.
B) extrusion(E2020). This would render an E2020 extrusion with 1 slot on each side.

This method would have the most flexibility as you would not need to duplicate settings in vitamins/extrusions.scad to add another t-slot profile design. But you would have add another item to each of the lists to specify the default series (10-series, 15-series, etc) to use.

Adding an item to the lists in vitamins/extrusions.scad to specify the series to use.

If the series is set to 10, an E2020 extrusion would render as four E1010 extrusions grouped together in a square measuring 2" x 2". This would give 2 slots per side.

If the series is set to 20, an E2020 extrusion would render as one E2020 extrusion measuring 20mm x 20mm with 1 slot per side.

If the series is set to 15, an E2020 extrusion would not render because 20 cannot be evenly divided by 15.

The problem with this idea is that it could result in a lot of duplicated settings and code.

// Current list format
//                  W    H    d1     d2   sq  cw  cwi  t   st  f  recess
E2020  = [ "E2020", 20,  20,  -4.2,  -3,  8,  6,  12,  2,  2,  1, false ];

// With the series item added
//                      W    H    d1     d2   sq  cw  cwi  t   st  f  recess  series
E102020  = [ "E102020", 20,  20,  -4.2,  -3,  8,  6,  12,  2,  2,  1, false,  10 ];
E202020  = [ "E202020", 20,  20,  -4.2,  -3,  8,  6,  12,  2,  2,  1, false,  20 ];
nophead commented 1 year ago

Extrusions are all metric outside the US. E2020 is 20mm by 20mm not 2" by 2". Having a series property makes sense but you would also need a duplicate set of definitions with imperial dimensions. I don't think having it as a parameter is the way to go.

nophead commented 1 year ago

Rather than a series number it might be better to have say E1010 so the code has a way to find the dimensions of the smaller slots, etc.