From 1179dcd203f358fd04a61dfa0f5f1a8411c2c9c2 Mon Sep 17 00:00:00 2001 From: jsconan Date: Thu, 6 Jan 2022 22:22:37 +0100 Subject: [PATCH 01/33] chore: add gitignore file --- .gitignore | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..34fd461 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Logs +*.log + +# Results +output +dist +*.csg +*.csv + +# Runtime data +*.pid +*.seed + +# System files +*~ +.DS_Store + +# Projects +nbproject/ +.idea +.settings +.project + +# Generated files +*.stl + From 2045652186b617a8207e90be98ce2310754e2924 Mon Sep 17 00:00:00 2001 From: jsconan Date: Thu, 6 Jan 2022 22:28:14 +0100 Subject: [PATCH 02/33] chore: add submodule to include the library camelSCAD --- .gitmodules | 3 +++ lib/camelSCAD | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 lib/camelSCAD diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e58a9cf --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/camelSCAD"] + path = lib/camelSCAD + url = git@github.com:jsconan/camelSCAD.git diff --git a/lib/camelSCAD b/lib/camelSCAD new file mode 160000 index 0000000..85ef885 --- /dev/null +++ b/lib/camelSCAD @@ -0,0 +1 @@ +Subproject commit 85ef885b56a354786b6008ed41116f874bc0c7dc From df7facfaee3f808954d89e0f93d3d8fff0d7d144 Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:06:58 +0100 Subject: [PATCH 03/33] chore: bootstrap the RC track project --- rcmodels/tracks/config/config.scad | 48 +++++++++++++++++++++++++++++ rcmodels/tracks/shapes/common.scad | 31 +++++++++++++++++++ rcmodels/tracks/util/functions.scad | 44 ++++++++++++++++++++++++++ rcmodels/tracks/util/setup.scad | 40 ++++++++++++++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 rcmodels/tracks/config/config.scad create mode 100644 rcmodels/tracks/shapes/common.scad create mode 100644 rcmodels/tracks/util/functions.scad create mode 100644 rcmodels/tracks/util/setup.scad diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad new file mode 100644 index 0000000..463cc87 --- /dev/null +++ b/rcmodels/tracks/config/config.scad @@ -0,0 +1,48 @@ +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Defines the config. + * + * @author jsconan + * @version 0.1.0 + */ + +// We will render the object using the specifications of this mode +renderMode = MODE_PROD; + +// Defines the constraints of the print. +printResolution = 0.2; // the target layer height +nozzle = 0.4; // the size of the print nozzle +wallDistance = 0.1; // the distance between the walls of two objects + +// The dimensions of a track chunk +chunkLength = 200; + +// The constraints of the track border +borderHeight = 50; +borderSheetThickness = 3 * printResolution; +borderClipThickness = 1; +borderMountEdge = 2; +borderMountSlotDepth = 6; diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/common.scad new file mode 100644 index 0000000..5ab977c --- /dev/null +++ b/rcmodels/tracks/shapes/common.scad @@ -0,0 +1,31 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Defines some shared shapes. + * + * @author jsconan + * @version 0.1.0 + */ diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad new file mode 100644 index 0000000..9477b3f --- /dev/null +++ b/rcmodels/tracks/util/functions.scad @@ -0,0 +1,44 @@ +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Defines some functions. + * + * @author jsconan + * @version 0.1.0 + */ + +/** + * Ajust a height with respect to the target layer height + * @param Number height + * @returns Number + */ +function adjustToLayer(height) = roundBy(height, printResolution); + +/** + * Ajust a width with respect to the target nozzle size + * @param Number width + * @returns Number + */ +function adjustToNozzle(width) = roundBy(width, nozzle); diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad new file mode 100644 index 0000000..c001ae9 --- /dev/null +++ b/rcmodels/tracks/util/setup.scad @@ -0,0 +1,40 @@ +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Setup the context. + * + * @author jsconan + * @version 0.1.0 + */ + +// As we need to use some shapes, use the right entry point of the library. +include <../../../lib/camelSCAD/shapes.scad> + +// Then we need the config for the project, as well as the related functions +include <../config/config.scad> +include + +// Finally, include the shapes +include <../shapes/common.scad> From 681c32159fa10d8a228771b01bcf7fc2dc4f2f87 Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:25:02 +0100 Subject: [PATCH 04/33] refactor: better naming in config --- rcmodels/tracks/config/config.scad | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 463cc87..f080282 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -42,7 +42,7 @@ chunkLength = 200; // The constraints of the track border borderHeight = 50; -borderSheetThickness = 3 * printResolution; -borderClipThickness = 1; -borderMountEdge = 2; -borderMountSlotDepth = 6; +borderThickness = 3 * printResolution; +borderTopEdge = 1; +borderBottomEdge = 2; +borderSlotDepth = 6; From 7e916053bc48f5a4907c9f1fb804995e61dfc85f Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:25:31 +0100 Subject: [PATCH 05/33] feat: add the bottom profile --- rcmodels/tracks/shapes/common.scad | 39 ++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 44 ++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 rcmodels/tracks/test/wip.scad diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/common.scad index 5ab977c..c50ca28 100644 --- a/rcmodels/tracks/shapes/common.scad +++ b/rcmodels/tracks/shapes/common.scad @@ -29,3 +29,42 @@ * @author jsconan * @version 0.1.0 */ + +/** + * Computes the points defining the profile of the bottom border mount. + * @param Number slotWidth - The width of the slot that will hold the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @returns Vector[] + */ +function getBorderBottomProfile(slotWidth, slotDepth, edge) = + let( + width = edge * 4 + slotWidth + ) + path([ + ["P", -width / 2, 0], + ["V", edge], + ["L", edge, slotDepth], + ["H", edge], + ["V", -slotDepth], + ["H", slotWidth], + ["V", slotDepth], + ["H", edge], + ["L", edge, -slotDepth], + ["V", -edge] + ]) +; + +/** + * Draws the shape of a the bottom border mount. + * @param Number slotWidth - The width of the slot that will hold the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + */ +module drawBorderBottomShape(slotWidth, slotDepth, edge) { + polygon(getBorderBottomProfile( + slotWidth = slotWidth, + slotDepth = slotDepth, + edge = edge + )); +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad new file mode 100644 index 0000000..2100f4d --- /dev/null +++ b/rcmodels/tracks/test/wip.scad @@ -0,0 +1,44 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Work in progress. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include <../util/setup.scad> + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // test the bottom shape profile + drawBorderBottomShape( + slotWidth = borderThickness, + slotDepth = borderSlotDepth, + edge = borderBottomEdge + ); +} From 505d9c1d462c498f24af779719d70469979887b9 Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:31:01 +0100 Subject: [PATCH 06/33] feat: add tolerance on the border mount --- rcmodels/tracks/test/wip.scad | 2 +- rcmodels/tracks/util/functions.scad | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 2100f4d..3a64dfb 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -37,7 +37,7 @@ include <../util/setup.scad> applyMode(mode=renderMode) { // test the bottom shape profile drawBorderBottomShape( - slotWidth = borderThickness, + slotWidth = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge ); diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 9477b3f..cb62b1b 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -42,3 +42,9 @@ function adjustToLayer(height) = roundBy(height, printResolution); * @returns Number */ function adjustToNozzle(width) = roundBy(width, nozzle); + +/** + * Gets the width of the slot that will hold the border sheet. + * @returns Number + */ +function getSlotWidth() = borderThickness + wallDistance; From 5a135049dff9e711dd4abff00517bd52cf51a283 Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:35:44 +0100 Subject: [PATCH 07/33] feat: add the top profile --- rcmodels/tracks/shapes/common.scad | 38 ++++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 6 +++++ 2 files changed, 44 insertions(+) diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/common.scad index c50ca28..c16c314 100644 --- a/rcmodels/tracks/shapes/common.scad +++ b/rcmodels/tracks/shapes/common.scad @@ -55,6 +55,30 @@ function getBorderBottomProfile(slotWidth, slotDepth, edge) = ]) ; +/** + * Computes the points defining the profile of the top border mount. + * @param Number slotWidth - The width of the slot that will hold the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @returns Vector[] + */ +function getBorderTopProfile(slotWidth, slotDepth, edge) = + let( + width = edge * 2 + slotWidth, + height = edge + slotDepth + ) + path([ + ["P", -width / 2, 0], + ["V", height], + ["H", edge], + ["V", -slotDepth], + ["H", slotWidth], + ["V", slotDepth], + ["H", edge], + ["V", -height] + ]) +; + /** * Draws the shape of a the bottom border mount. * @param Number slotWidth - The width of the slot that will hold the border sheet. @@ -68,3 +92,17 @@ module drawBorderBottomShape(slotWidth, slotDepth, edge) { edge = edge )); } + +/** + * Draws the shape of a the top border mount. + * @param Number slotWidth - The width of the slot that will hold the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + */ +module drawBorderTopShape(slotWidth, slotDepth, edge) { + polygon(getBorderTopProfile( + slotWidth = slotWidth, + slotDepth = slotDepth, + edge = edge + )); +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 3a64dfb..8c7cdfd 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -41,4 +41,10 @@ applyMode(mode=renderMode) { slotDepth = borderSlotDepth, edge = borderBottomEdge ); + // test the top shape profile + %drawBorderTopShape( + slotWidth = getSlotWidth(), + slotDepth = borderSlotDepth, + edge = borderTopEdge + ); } From f5e14945178755171f22b47fb379ab730d7c70e9 Mon Sep 17 00:00:00 2001 From: jsconan Date: Wed, 22 Jan 2020 22:44:53 +0100 Subject: [PATCH 08/33] refactor: better naming for the functions and modules --- rcmodels/tracks/shapes/common.scad | 16 ++++++++-------- rcmodels/tracks/test/wip.scad | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/common.scad index c16c314..a33b186 100644 --- a/rcmodels/tracks/shapes/common.scad +++ b/rcmodels/tracks/shapes/common.scad @@ -37,7 +37,7 @@ * @param Number edge - The width of each edge of the border mount. * @returns Vector[] */ -function getBorderBottomProfile(slotWidth, slotDepth, edge) = +function getBorderBottomPoints(slotWidth, slotDepth, edge) = let( width = edge * 4 + slotWidth ) @@ -62,7 +62,7 @@ function getBorderBottomProfile(slotWidth, slotDepth, edge) = * @param Number edge - The width of each edge of the border mount. * @returns Vector[] */ -function getBorderTopProfile(slotWidth, slotDepth, edge) = +function getBorderTopPoints(slotWidth, slotDepth, edge) = let( width = edge * 2 + slotWidth, height = edge + slotDepth @@ -80,13 +80,13 @@ function getBorderTopProfile(slotWidth, slotDepth, edge) = ; /** - * Draws the shape of a the bottom border mount. + * Draws the profile of the bottom border mount. * @param Number slotWidth - The width of the slot that will hold the border sheet. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number edge - The width of each edge of the border mount. */ -module drawBorderBottomShape(slotWidth, slotDepth, edge) { - polygon(getBorderBottomProfile( +module borderBottomProfile(slotWidth, slotDepth, edge) { + polygon(getBorderBottomPoints( slotWidth = slotWidth, slotDepth = slotDepth, edge = edge @@ -94,13 +94,13 @@ module drawBorderBottomShape(slotWidth, slotDepth, edge) { } /** - * Draws the shape of a the top border mount. + * Draws the profile of the top border mount. * @param Number slotWidth - The width of the slot that will hold the border sheet. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number edge - The width of each edge of the border mount. */ -module drawBorderTopShape(slotWidth, slotDepth, edge) { - polygon(getBorderTopProfile( +module borderTopProfile(slotWidth, slotDepth, edge) { + polygon(getBorderTopPoints( slotWidth = slotWidth, slotDepth = slotDepth, edge = edge diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 8c7cdfd..c2182d6 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -35,14 +35,14 @@ include <../util/setup.scad> // Sets the minimum facet angle and size using the defined render mode. applyMode(mode=renderMode) { - // test the bottom shape profile - drawBorderBottomShape( + // test the bottom border profile + borderBottomProfile( slotWidth = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge ); - // test the top shape profile - %drawBorderTopShape( + // test the top border profile + %borderTopProfile( slotWidth = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderTopEdge From b221b7dbc595bf2a8855818031e864fb8ae1f6e9 Mon Sep 17 00:00:00 2001 From: jsconan Date: Thu, 23 Jan 2020 21:04:41 +0100 Subject: [PATCH 09/33] feat: add the tooth profile --- rcmodels/tracks/shapes/common.scad | 39 ++++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 17 +++++++++++-- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/common.scad index a33b186..8d46d23 100644 --- a/rcmodels/tracks/shapes/common.scad +++ b/rcmodels/tracks/shapes/common.scad @@ -79,6 +79,29 @@ function getBorderTopPoints(slotWidth, slotDepth, edge) = ]) ; +/** + * Computes the points defining the profile of a border mount tooth. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Number [direction] - The direction of the shape (1: right, -1: left) + * @param Boolean [negative] - The shape will be used in a difference operation + * @returns Vector[] + */ +function getBorderToothPoints(slotDepth, edge, direction=1, negative=false) = + let( + start = negative ? 1 : 0, + direction = direction >= 0 ? 1 : -1, + width = edge * 2 + ) + path([ + ["P", direction * -start, slotDepth], + ["H", direction * (edge + start)], + ["L", direction * edge, -slotDepth], + ["V", -start], + ["H", direction * -(width + start)] + ]) +; + /** * Draws the profile of the bottom border mount. * @param Number slotWidth - The width of the slot that will hold the border sheet. @@ -106,3 +129,19 @@ module borderTopProfile(slotWidth, slotDepth, edge) { edge = edge )); } + +/** + * Draws the profile of a border mount tooth. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Number [direction] - The direction of the shape (1: right, -1: left) + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module borderToothProfile(slotDepth, edge, direction=1, negative=false) { + polygon(getBorderToothPoints( + slotDepth = slotDepth, + edge = edge, + direction = direction, + negative = negative + )); +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index c2182d6..b01131c 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -36,15 +36,28 @@ include <../util/setup.scad> // Sets the minimum facet angle and size using the defined render mode. applyMode(mode=renderMode) { // test the bottom border profile - borderBottomProfile( + *borderBottomProfile( slotWidth = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge ); // test the top border profile - %borderTopProfile( + *borderTopProfile( slotWidth = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderTopEdge ); + // test the border tooth profile + borderToothProfile( + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + direction = -1, + negative = true + ); + borderToothProfile( + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + direction = 1, + negative = true + ); } From ec5d56d0d7f66409015187d72f3c1ae07d744a85 Mon Sep 17 00:00:00 2001 From: jsconan Date: Thu, 23 Jan 2020 21:05:43 +0100 Subject: [PATCH 10/33] refactor: rename common.scad to profiles.scad --- rcmodels/tracks/shapes/{common.scad => profiles.scad} | 2 +- rcmodels/tracks/util/setup.scad | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename rcmodels/tracks/shapes/{common.scad => profiles.scad} (96%) diff --git a/rcmodels/tracks/shapes/common.scad b/rcmodels/tracks/shapes/profiles.scad similarity index 96% rename from rcmodels/tracks/shapes/common.scad rename to rcmodels/tracks/shapes/profiles.scad index 8d46d23..da91fd4 100644 --- a/rcmodels/tracks/shapes/common.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -24,7 +24,7 @@ /** * A 1/24 RC track system. * - * Defines some shared shapes. + * Defines some profile shapes. * * @author jsconan * @version 0.1.0 diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index c001ae9..c560878 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -37,4 +37,4 @@ include <../config/config.scad> include // Finally, include the shapes -include <../shapes/common.scad> +include <../shapes/profiles.scad> From ba92e5e44423fe1126fad54e46bdfd83a13add6f Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 09:42:09 +0100 Subject: [PATCH 11/33] feat: add profiles for teeth sets --- rcmodels/tracks/shapes/profiles.scad | 42 ++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 18 ++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/rcmodels/tracks/shapes/profiles.scad b/rcmodels/tracks/shapes/profiles.scad index da91fd4..148ef33 100644 --- a/rcmodels/tracks/shapes/profiles.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -145,3 +145,45 @@ module borderToothProfile(slotDepth, edge, direction=1, negative=false) { negative = negative )); } + +/** + * Draws the profile of a set of border mount teeth. + * @param Number length - The length of the set + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module borderTeethProfile(length, slotDepth, edge, negative=false) { + borderToothProfile( + slotDepth = slotDepth, + edge = edge, + direction = 1, + negative = negative + ); + translateX(length) { + borderToothProfile( + slotDepth = slotDepth, + edge = edge, + direction = -1, + negative = negative + ); + } +} + +/** + * Draws the profile of border mount teeth for a complete chunk. + * @param Number length - The length of the chunk + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module borderTeethChunkProfile(length, slotDepth, edge, negative=false) { + repeatMirror() { + borderTeethProfile( + length = chunkLength / 2, + slotDepth = slotDepth, + edge = edge, + negative = negative + ); + } +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index b01131c..e3a0b65 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -48,16 +48,30 @@ applyMode(mode=renderMode) { edge = borderTopEdge ); // test the border tooth profile - borderToothProfile( + *borderToothProfile( slotDepth = borderSlotDepth, edge = borderBottomEdge, direction = -1, negative = true ); - borderToothProfile( + *borderToothProfile( slotDepth = borderSlotDepth, edge = borderBottomEdge, direction = 1, negative = true ); + // test the border teeth profile + *borderTeethProfile( + length = chunkLength / 2, + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + negative = true + ); + // test the border teeth profile for a complete chunk + borderTeethChunkProfile( + length = chunkLength, + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + negative = true + ); } From 42d2c444f47fe622346a682a78e9413237b61f15 Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 10:07:31 +0100 Subject: [PATCH 12/33] feat: add shape for the bottom border mount of a straight chunk --- rcmodels/tracks/shapes/straight.scad | 82 ++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 18 +++++- rcmodels/tracks/util/setup.scad | 1 + 3 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 rcmodels/tracks/shapes/straight.scad diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad new file mode 100644 index 0000000..9576c7c --- /dev/null +++ b/rcmodels/tracks/shapes/straight.scad @@ -0,0 +1,82 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Defines some straight chunk shapes. + * + * @author jsconan + * @version 0.1.0 + */ + +/** + * Draws the extrusion of border mount teeth for a complete chunk. + * @param Number length - The length of the chunk + * @param Number thickness - The thickness of the extrusion + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Boolean [negative] - The shape will be used in a difference operation + * @param Boolean [center] - The shape is centered vertically + */ +module borderTeethChunk(length, thickness, slotDepth, edge, negative=false, center=false) { + negativeExtrude(height=thickness, center=center) { + borderTeethChunkProfile( + length = length / 2, + slotDepth = slotDepth, + edge = edge, + negative = negative + ); + } +} + +/** + * Draws the bottom border mount for a straight chunk + * @param Number length - The length of the chunk + * @param Number sheetThickness - The thickness of the sheet the border mount will hold. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + */ +module straightBorderBottom(length, sheetThickness, slotDepth, edge) { + rotate([90, 0, 90]) { + negativeExtrude(height=length, center=true) { + borderBottomProfile( + slotWidth = sheetThickness, + slotDepth = slotDepth, + edge = edge + ); + } + } + translateZ(edge) { + rotateX(90) { + borderTeethChunk( + length = length, + thickness = sheetThickness * 2, + slotDepth = slotDepth, + edge = edge, + negative = false, + center = true + ); + } + } +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index e3a0b65..86ccfae 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -68,10 +68,26 @@ applyMode(mode=renderMode) { negative = true ); // test the border teeth profile for a complete chunk - borderTeethChunkProfile( + *borderTeethChunkProfile( length = chunkLength, slotDepth = borderSlotDepth, edge = borderBottomEdge, negative = true ); + // test the border teeth extrusion for a complete chunk + *borderTeethChunk( + length = chunkLength, + thickness = borderThickness * 2, + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + negative = true, + center = true + ); + // test the bottom border mount shape for a straight chunk + straightBorderBottom( + length = chunkLength, + sheetThickness = borderThickness, + slotDepth = borderSlotDepth, + edge = borderBottomEdge + ); } diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index c560878..c97454a 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -38,3 +38,4 @@ include // Finally, include the shapes include <../shapes/profiles.scad> +include <../shapes/straight.scad> From f57e959f017f256f2310b2eaf37ecaed8b413484 Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 17:16:33 +0100 Subject: [PATCH 13/33] feat: add shape for the top border mount of a straight chunk --- rcmodels/tracks/config/config.scad | 1 + rcmodels/tracks/shapes/straight.scad | 43 ++++++++++++++++++++++++---- rcmodels/tracks/test/wip.scad | 13 +++++++-- 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index f080282..3c264d2 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -44,5 +44,6 @@ chunkLength = 200; borderHeight = 50; borderThickness = 3 * printResolution; borderTopEdge = 1; +borderToothEdge = 2; borderBottomEdge = 2; borderSlotDepth = 6; diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index 9576c7c..3aee1f1 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -55,25 +55,58 @@ module borderTeethChunk(length, thickness, slotDepth, edge, negative=false, cent * @param Number length - The length of the chunk * @param Number sheetThickness - The thickness of the sheet the border mount will hold. * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number borderEdge - The width of each edge of the border mount. + * @param Number toothEdge - The width of a tooth edge. */ -module straightBorderBottom(length, sheetThickness, slotDepth, edge) { +module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdge) { rotate([90, 0, 90]) { negativeExtrude(height=length, center=true) { borderBottomProfile( slotWidth = sheetThickness, slotDepth = slotDepth, - edge = edge + edge = borderEdge + ); + } + } + translateZ(borderEdge) { + rotateX(90) { + borderTeethChunk( + length = length, + thickness = sheetThickness * 2, + slotDepth = slotDepth, + edge = toothEdge, + negative = false, + center = true + ); + } + } +} + +/** + * Draws the top border mount for a straight chunk + * @param Number length - The length of the chunk + * @param Number sheetThickness - The thickness of the sheet the border mount will hold. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number borderEdge - The width of each edge of the border mount. + * @param Number toothEdge - The width of a tooth edge. + */ +module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdge) { + rotate([90, 0, 90]) { + negativeExtrude(height=length, center=true) { + borderTopProfile( + slotWidth = sheetThickness, + slotDepth = slotDepth, + edge = borderEdge ); } } - translateZ(edge) { + translateZ(borderEdge) { rotateX(90) { borderTeethChunk( length = length, thickness = sheetThickness * 2, slotDepth = slotDepth, - edge = edge, + edge = toothEdge, negative = false, center = true ); diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 86ccfae..644ffb0 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -84,10 +84,19 @@ applyMode(mode=renderMode) { center = true ); // test the bottom border mount shape for a straight chunk - straightBorderBottom( + *straightBorderBottom( length = chunkLength, sheetThickness = borderThickness, slotDepth = borderSlotDepth, - edge = borderBottomEdge + borderEdge = borderBottomEdge, + toothEdge = borderToothEdge + ); + // test the top border mount shape for a straight chunk + straightBorderTop( + length = chunkLength, + sheetThickness = borderThickness, + slotDepth = borderSlotDepth, + borderEdge = borderTopEdge, + toothEdge = borderToothEdge ); } From 45479b45e8d92438fd3799368a885163c49dd145 Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 19:26:24 +0100 Subject: [PATCH 14/33] feat: rework the profile and the shapes --- rcmodels/tracks/shapes/profiles.scad | 18 ------------- rcmodels/tracks/shapes/straight.scad | 38 ++++++++++++++++++++++------ rcmodels/tracks/test/wip.scad | 16 +++++++----- 3 files changed, 39 insertions(+), 33 deletions(-) diff --git a/rcmodels/tracks/shapes/profiles.scad b/rcmodels/tracks/shapes/profiles.scad index 148ef33..534d3af 100644 --- a/rcmodels/tracks/shapes/profiles.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -169,21 +169,3 @@ module borderTeethProfile(length, slotDepth, edge, negative=false) { ); } } - -/** - * Draws the profile of border mount teeth for a complete chunk. - * @param Number length - The length of the chunk - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. - * @param Boolean [negative] - The shape will be used in a difference operation - */ -module borderTeethChunkProfile(length, slotDepth, edge, negative=false) { - repeatMirror() { - borderTeethProfile( - length = chunkLength / 2, - slotDepth = slotDepth, - edge = edge, - negative = negative - ); - } -} diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index 3aee1f1..1e6b759 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -31,7 +31,7 @@ */ /** - * Draws the extrusion of border mount teeth for a complete chunk. + * Draws the extrusion of border mount teeth. * @param Number length - The length of the chunk * @param Number thickness - The thickness of the extrusion * @param Number slotDepth - The depth of the slot that will hold the border sheet. @@ -39,10 +39,10 @@ * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderTeethChunk(length, thickness, slotDepth, edge, negative=false, center=false) { +module borderTeeth(length, thickness, slotDepth, edge, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - borderTeethChunkProfile( - length = length / 2, + borderTeethProfile( + length = length, slotDepth = slotDepth, edge = edge, negative = negative @@ -50,6 +50,28 @@ module borderTeethChunk(length, thickness, slotDepth, edge, negative=false, cent } } +/** + * Draws the extrusion of border mount teeth for a complete chunk. + * @param Number length - The length of the chunk + * @param Number thickness - The thickness of the extrusion + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Boolean [negative] - The shape will be used in a difference operation + * @param Boolean [center] - The shape is centered vertically + */ +module borderTeethComplete(length, thickness, slotDepth, edge, negative=false, center=false) { + repeatMirror() { + borderTeeth( + length = length / 2, + thickness = thickness, + slotDepth = slotDepth, + edge = edge, + negative = negative, + center = center + ); + } +} + /** * Draws the bottom border mount for a straight chunk * @param Number length - The length of the chunk @@ -70,9 +92,9 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, tooth } translateZ(borderEdge) { rotateX(90) { - borderTeethChunk( + borderTeethComplete( length = length, - thickness = sheetThickness * 2, + thickness = sheetThickness, slotDepth = slotDepth, edge = toothEdge, negative = false, @@ -102,9 +124,9 @@ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdg } translateZ(borderEdge) { rotateX(90) { - borderTeethChunk( + borderTeethComplete( length = length, - thickness = sheetThickness * 2, + thickness = sheetThickness, slotDepth = slotDepth, edge = toothEdge, negative = false, diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 644ffb0..d131909 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -67,17 +67,19 @@ applyMode(mode=renderMode) { edge = borderBottomEdge, negative = true ); - // test the border teeth profile for a complete chunk - *borderTeethChunkProfile( + // test the border teeth extrusion + *borderTeeth( length = chunkLength, + thickness = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge, - negative = true + negative = true, + center = true ); // test the border teeth extrusion for a complete chunk - *borderTeethChunk( + *borderTeethComplete( length = chunkLength, - thickness = borderThickness * 2, + thickness = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge, negative = true, @@ -86,7 +88,7 @@ applyMode(mode=renderMode) { // test the bottom border mount shape for a straight chunk *straightBorderBottom( length = chunkLength, - sheetThickness = borderThickness, + sheetThickness = getSlotWidth(), slotDepth = borderSlotDepth, borderEdge = borderBottomEdge, toothEdge = borderToothEdge @@ -94,7 +96,7 @@ applyMode(mode=renderMode) { // test the top border mount shape for a straight chunk straightBorderTop( length = chunkLength, - sheetThickness = borderThickness, + sheetThickness = getSlotWidth(), slotDepth = borderSlotDepth, borderEdge = borderTopEdge, toothEdge = borderToothEdge From 66f8b59cb0ffe87d54b38d3b19658967be499297 Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 19:29:34 +0100 Subject: [PATCH 15/33] feat: add border sheet shapes for straight chunks --- rcmodels/tracks/shapes/straight.scad | 56 ++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 18 ++++++++- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index 1e6b759..1ebf4da 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -135,3 +135,59 @@ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdg } } } + +/** + * Draws the border sheet for a straight chunk + * @param Number length - The length of the chunk + * @param Number height - The height of the chunk + * @param Number thickness - The thickness of the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number toothEdge - The width of a tooth edge. + */ +module borderSheet(length, height, thickness, slotDepth, toothEdge) { + difference() { + box(size = [length, height, thickness], center = true); + + repeatMirror(axis=[0, 1, 0]) { + translateY(-height / 2) { + translateX(-length / 2) { + borderTeeth( + length = length, + thickness = thickness + 1, + slotDepth = slotDepth, + edge = toothEdge, + negative = true, + center = true + ); + } + } + } + } +} + +/** + * Draws the complete border sheet for a straight chunk + * @param Number length - The length of the chunk + * @param Number height - The height of the chunk + * @param Number thickness - The thickness of the border sheet. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number toothEdge - The width of a tooth edge. + */ +module borderSheetComplete(length, height, thickness, slotDepth, toothEdge) { + difference() { + box(size = [length, height, thickness], center = true); + + repeatMirror(axis=[0, 1, 0]) { + translateY(-height / 2) { + borderTeethComplete( + length = length, + thickness = thickness + 1, + slotDepth = slotDepth, + edge = toothEdge, + negative = true, + center = true + ); + } + } + } +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index d131909..9a3a059 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -94,11 +94,27 @@ applyMode(mode=renderMode) { toothEdge = borderToothEdge ); // test the top border mount shape for a straight chunk - straightBorderTop( + *straightBorderTop( length = chunkLength, sheetThickness = getSlotWidth(), slotDepth = borderSlotDepth, borderEdge = borderTopEdge, toothEdge = borderToothEdge ); + // test the border sheet shape for a straight chunk + *borderSheet( + length = chunkLength / 2, + height = borderHeight, + thickness = borderThickness, + slotDepth = borderSlotDepth, + toothEdge = borderToothEdge + ); + // test the complete border sheet shape for a straight chunk + borderSheetComplete( + length = chunkLength, + height = borderHeight, + thickness = borderThickness, + slotDepth = borderSlotDepth, + toothEdge = borderToothEdge + ); } From a483f56292bc76e38151fe102c89013a2b4cf853 Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 24 Jan 2020 22:28:22 +0100 Subject: [PATCH 16/33] feat: add shape for the single tooth --- rcmodels/tracks/shapes/straight.scad | 20 ++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 11 ++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index 1ebf4da..a113a61 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -30,6 +30,26 @@ * @version 0.1.0 */ +/** + * Draws the extrusion of border mount tooth. + * @param Number thickness - The thickness of the extrusion + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Number [direction] - The direction of the shape (1: right, -1: left) + * @param Boolean [negative] - The shape will be used in a difference operation + * @param Boolean [center] - The shape is centered vertically + */ +module borderTooth(thickness, slotDepth, edge, direction=1, negative=false, center=false) { + negativeExtrude(height=thickness, center=center) { + polygon(getBorderToothPoints( + slotDepth = slotDepth, + edge = edge, + direction = direction, + negative = negative + )); + } +} + /** * Draws the extrusion of border mount teeth. * @param Number length - The length of the chunk diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 9a3a059..d2a569d 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -67,6 +67,15 @@ applyMode(mode=renderMode) { edge = borderBottomEdge, negative = true ); + // test the border tooth extrusion + borderTooth( + thickness = getSlotWidth(), + slotDepth = borderSlotDepth, + edge = borderBottomEdge, + direction = -1, + negative = true, + center = true + ); // test the border teeth extrusion *borderTeeth( length = chunkLength, @@ -110,7 +119,7 @@ applyMode(mode=renderMode) { toothEdge = borderToothEdge ); // test the complete border sheet shape for a straight chunk - borderSheetComplete( + *borderSheetComplete( length = chunkLength, height = borderHeight, thickness = borderThickness, From a1e9a93d61f29b86d20d19ff4ec7c7c414bdfa91 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 13:45:56 +0100 Subject: [PATCH 17/33] feat: add shapes for the border mounts of a curved chunk --- rcmodels/tracks/shapes/curve.scad | 192 ++++++++++++++++++++++++++++++ rcmodels/tracks/test/wip.scad | 29 ++++- rcmodels/tracks/util/setup.scad | 1 + 3 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 rcmodels/tracks/shapes/curve.scad diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad new file mode 100644 index 0000000..abe6195 --- /dev/null +++ b/rcmodels/tracks/shapes/curve.scad @@ -0,0 +1,192 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * Defines some curved chunk shapes. + * + * @author jsconan + * @version 0.1.0 + */ + +/** + * Draws the shape of a curved border mount tooth. + * @param Number radius - The radius of the curve. + * @param Number thickness - The thickness of the shape + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Number [direction] - The direction of the shape (1: right, -1: left) + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module curveBorderTooth(radius, thickness, slotDepth, edge, direction=1, negative=false) { + start = negative ? 1 : 0; + direction = direction >= 0 ? 1 : -1; + length = edge * 2; + angle = getArcAngle(radius = radius, length = length); + chord = getChordLength(radius = radius, angle = angle / 2); + + difference() { + translateZ(-start) { + pipeSegment( + r = radius + thickness / 2, + h = slotDepth + start, + w = thickness, + a1 = -direction * getArcAngle(radius = radius, length = start), + a2 = direction * angle + ); + } + + rotateZ(direction * angle) { + translateX(radius) { + rotate([90, 0, 270]) { + negativeExtrude(height = thickness + 1, center = true) { + polygon([ + [0, 0], + [direction * chord, slotDepth], + [direction * chord, slotDepth + 1], + [direction * -1, slotDepth + 1], + [direction * -1, 0], + ]); + } + } + } + } + } +} + +/** + * Draws the shape of a curved border mount teeth for a complete chunk. + * @param Number radius - The radius of the curve. + * @param Number length - The length of a chunk + * @param Number angle - The angle of the curve + * @param Number thickness - The thickness of the shape + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number edge - The width of each edge of the border mount. + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module curveBorderTeeth(radius, length, angle, thickness, slotDepth, edge, negative=false) { + rotateZ(angle) { + repeatMirror(axis=[0, 1, 0]) { + rotateZ(-angle) { + curveBorderTooth( + radius = radius, + thickness = thickness, + slotDepth = slotDepth, + edge = edge, + direction = 1, + negative = negative + ); + rotateZ(getArcAngle(radius = radius, length = length / 2)) { + repeatMirror(axis=[0, 1, 0]) { + curveBorderTooth( + radius = radius, + thickness = thickness, + slotDepth = slotDepth, + edge = edge, + direction = -1, + negative = negative + ); + } + } + } + } + } +} + +/** + * Draws the bottom border mount for a curved chunk + * @param Number length - The length of a chunk + * @param Number sheetThickness - The thickness of the sheet the border mount will hold. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number borderEdge - The width of each edge of the border mount. + * @param Number toothEdge - The width of a tooth edge. + * @param Number ratio - The ratio of the chunk + */ +module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdge, ratio = 1) { + radius = length * ratio; + defaultAngle = 90; + angle = defaultAngle / ratio; + + rotateZ((defaultAngle - angle) / 2) { + rotate_extrude(angle=angle, convexity=10) { + translateX(radius) { + borderBottomProfile( + slotWidth = sheetThickness, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + + translateZ(borderEdge) { + curveBorderTeeth( + radius = radius, + length = length, + angle = angle / 2, + thickness = borderEdge, + slotDepth = slotDepth, + edge = toothEdge, + negative=false + ); + } + } +} +/** + * Draws the top border mount for a curved chunk + * @param Number length - The length of a chunk + * @param Number sheetThickness - The thickness of the sheet the border mount will hold. + * @param Number slotDepth - The depth of the slot that will hold the border sheet. + * @param Number borderEdge - The width of each edge of the border mount. + * @param Number toothEdge - The width of a tooth edge. + * @param Number ratio - The ratio of the chunk + */ +module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdge, ratio = 1) { + radius = length * ratio; + defaultAngle = 90; + angle = defaultAngle / ratio; + + rotateZ((defaultAngle - angle) / 2) { + rotate_extrude(angle=angle, convexity=10) { + translateX(radius) { + borderTopProfile( + slotWidth = sheetThickness, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + + translateZ(borderEdge) { + curveBorderTeeth( + radius = radius, + length = length, + angle = angle / 2, + thickness = borderEdge, + slotDepth = slotDepth, + edge = toothEdge, + negative=false + ); + } + } +} diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index d2a569d..c12e58d 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -68,7 +68,7 @@ applyMode(mode=renderMode) { negative = true ); // test the border tooth extrusion - borderTooth( + *borderTooth( thickness = getSlotWidth(), slotDepth = borderSlotDepth, edge = borderBottomEdge, @@ -110,6 +110,33 @@ applyMode(mode=renderMode) { borderEdge = borderTopEdge, toothEdge = borderToothEdge ); + // test the curved border tooth + *curveBorderTooth( + radius = chunkLength, + thickness = getSlotWidth(), + slotDepth = borderSlotDepth, + edge = borderToothEdge, + direction = 1, + negative = true + ); + // test the bottom border mount shape for a curved chunk + curveBorderBottom( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderBottomEdge, + toothEdge = borderToothEdge, + ratio = 1 + ); + // test the top border mount shape for a curved chunk + *curveBorderTop( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderTopEdge, + toothEdge = borderToothEdge, + ratio = 1 + ); // test the border sheet shape for a straight chunk *borderSheet( length = chunkLength / 2, diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index c97454a..d15c993 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -39,3 +39,4 @@ include // Finally, include the shapes include <../shapes/profiles.scad> include <../shapes/straight.scad> +include <../shapes/curve.scad> From 6ba15ba2a6dc9c8c29d5c76a52f90bc888d2380d Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 13:54:38 +0100 Subject: [PATCH 18/33] feat: add util functions, check constraints on bootstrap --- rcmodels/tracks/config/config.scad | 5 ++- rcmodels/tracks/test/wip.scad | 2 +- rcmodels/tracks/util/functions.scad | 58 ++++++++++++++++++++++++++++- rcmodels/tracks/util/setup.scad | 20 ++++++++++ 4 files changed, 82 insertions(+), 3 deletions(-) diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 3c264d2..6e2a5af 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -35,7 +35,10 @@ renderMode = MODE_PROD; // Defines the constraints of the print. printResolution = 0.2; // the target layer height nozzle = 0.4; // the size of the print nozzle -wallDistance = 0.1; // the distance between the walls of two objects +printTolerance = 0.1; // the print tolerance when pieces need to be assembled + +// Defines options +heightWithFasteners = true; // Should the height be with or without the fastener elements? // The dimensions of a track chunk chunkLength = 200; diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index c12e58d..ac85404 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -139,7 +139,7 @@ applyMode(mode=renderMode) { ); // test the border sheet shape for a straight chunk *borderSheet( - length = chunkLength / 2, + length = getCurveRemainingLength(chunkLength), height = borderHeight, thickness = borderThickness, slotDepth = borderSlotDepth, diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index cb62b1b..03f1645 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -47,4 +47,60 @@ function adjustToNozzle(width) = roundBy(width, nozzle); * Gets the width of the slot that will hold the border sheet. * @returns Number */ -function getSlotWidth() = borderThickness + wallDistance; +function getSlotWidth() = borderThickness + printTolerance; + +/** + * Gets the length of a curved chunk (the length of the arc of the curve). + * @param Number chunkLength - The length of a straight chunk + * @returns Number + */ +function getCurveLength(chunkLength) = getArcLength(radius = chunkLength, angle = 90); + +/** + * Gets the difference between the length of a curved chunk and a regular straight chunk + * @param Number chunkLength - The length of a straight chunk + * @returns Number + */ +function getCurveRemainingLength(chunkLength) = getCurveLength(chunkLength) - chunkLength; + +/** + * Gets the height of the border sheet, depending on the option heightWithFasteners + * @returns Number + */ +function getSheetHeight() = + let( + correction = heightWithFasteners + ?-(borderBottomEdge + borderTopEdge) + :borderSlotDepth * 2 + ) + borderHeight + correction +; + +/** + * Gets the height of the assembled border, depending on the option heightWithFasteners + * @returns Number + */ +function getBorderHeight() = + let( + correction = heightWithFasteners ? 0 : borderBottomEdge + borderTopEdge + borderSlotDepth * 2 + ) + borderHeight + correction +; + +/** + * Gets the minimal length for a simple sheet (a sheet that should fit between 2 border teeth) + * @returns Number + */ +function getMinSheetLength() = 5 * borderToothEdge; + +/** + * Gets the minimal length for a complete straight sheet + * @returns Number + */ +function getMinStraightLength() = 2 * getMinSheetLength(); + +/** + * Gets the minimal length for a complete curved sheet + * @returns Number + */ +function getMinCurveLength() = 3 * getMinSheetLength(); diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index d15c993..fdcfb4f 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -40,3 +40,23 @@ include include <../shapes/profiles.scad> include <../shapes/straight.scad> include <../shapes/curve.scad> + +// Validate the critical constraints +assert( + chunkLength >= getMinStraightLength(), + str( + "The length for a track chunk is too small! The minimum length for a straight element is ", + getMinStraightLength(), + ". The current value is ", + chunkLength + ) +); +assert( + getArcLength(radius = chunkLength, angle = 90) >= getMinCurveLength(), + str( + "The length for a track chunk is too small! The minimum arc length for a curved element is ", + getMinCurveLength(), + ". The current value is ", + getArcLength(radius = chunkLength, angle = 90) + ) +); From cfdadbc6d7530392b17b24bbca244df9164b9431 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 14:17:11 +0100 Subject: [PATCH 19/33] fix: rename and typo fix --- rcmodels/tracks/shapes/curve.scad | 2 +- rcmodels/tracks/shapes/straight.scad | 24 ++++++++++++------------ rcmodels/tracks/test/wip.scad | 12 ++++++------ rcmodels/tracks/util/functions.scad | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index abe6195..d0cfe00 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -76,7 +76,7 @@ module curveBorderTooth(radius, thickness, slotDepth, edge, direction=1, negativ } /** - * Draws the shape of a curved border mount teeth for a complete chunk. + * Draws the shape of a curved border mount teeth for a full chunk. * @param Number radius - The radius of the curve. * @param Number length - The length of a chunk * @param Number angle - The angle of the curve diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index a113a61..f9070b2 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -31,8 +31,8 @@ */ /** - * Draws the extrusion of border mount tooth. - * @param Number thickness - The thickness of the extrusion + * Draws the shape of border mount tooth. + * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number edge - The width of each edge of the border mount. * @param Number [direction] - The direction of the shape (1: right, -1: left) @@ -51,9 +51,9 @@ module borderTooth(thickness, slotDepth, edge, direction=1, negative=false, cent } /** - * Draws the extrusion of border mount teeth. + * Draws the shape of border mount teeth. * @param Number length - The length of the chunk - * @param Number thickness - The thickness of the extrusion + * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number edge - The width of each edge of the border mount. * @param Boolean [negative] - The shape will be used in a difference operation @@ -71,15 +71,15 @@ module borderTeeth(length, thickness, slotDepth, edge, negative=false, center=fa } /** - * Draws the extrusion of border mount teeth for a complete chunk. + * Draws the shape of border mount teeth for a full chunk. * @param Number length - The length of the chunk - * @param Number thickness - The thickness of the extrusion + * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number edge - The width of each edge of the border mount. * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderTeethComplete(length, thickness, slotDepth, edge, negative=false, center=false) { +module borderTeethFull(length, thickness, slotDepth, edge, negative=false, center=false) { repeatMirror() { borderTeeth( length = length / 2, @@ -112,7 +112,7 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, tooth } translateZ(borderEdge) { rotateX(90) { - borderTeethComplete( + borderTeethFull( length = length, thickness = sheetThickness, slotDepth = slotDepth, @@ -144,7 +144,7 @@ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdg } translateZ(borderEdge) { rotateX(90) { - borderTeethComplete( + borderTeethFull( length = length, thickness = sheetThickness, slotDepth = slotDepth, @@ -186,20 +186,20 @@ module borderSheet(length, height, thickness, slotDepth, toothEdge) { } /** - * Draws the complete border sheet for a straight chunk + * Draws the full border sheet for a straight chunk * @param Number length - The length of the chunk * @param Number height - The height of the chunk * @param Number thickness - The thickness of the border sheet. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number toothEdge - The width of a tooth edge. */ -module borderSheetComplete(length, height, thickness, slotDepth, toothEdge) { +module borderSheetFull(length, height, thickness, slotDepth, toothEdge) { difference() { box(size = [length, height, thickness], center = true); repeatMirror(axis=[0, 1, 0]) { translateY(-height / 2) { - borderTeethComplete( + borderTeethFull( length = length, thickness = thickness + 1, slotDepth = slotDepth, diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index ac85404..f978591 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -67,7 +67,7 @@ applyMode(mode=renderMode) { edge = borderBottomEdge, negative = true ); - // test the border tooth extrusion + // test the border tooth shape *borderTooth( thickness = getSlotWidth(), slotDepth = borderSlotDepth, @@ -76,7 +76,7 @@ applyMode(mode=renderMode) { negative = true, center = true ); - // test the border teeth extrusion + // test the border teeth shape *borderTeeth( length = chunkLength, thickness = getSlotWidth(), @@ -85,8 +85,8 @@ applyMode(mode=renderMode) { negative = true, center = true ); - // test the border teeth extrusion for a complete chunk - *borderTeethComplete( + // test the border teeth shape for a full chunk + *borderTeethFull( length = chunkLength, thickness = getSlotWidth(), slotDepth = borderSlotDepth, @@ -145,8 +145,8 @@ applyMode(mode=renderMode) { slotDepth = borderSlotDepth, toothEdge = borderToothEdge ); - // test the complete border sheet shape for a straight chunk - *borderSheetComplete( + // test the full border sheet shape for a straight chunk + *borderSheetFull( length = chunkLength, height = borderHeight, thickness = borderThickness, diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 03f1645..74fac44 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -94,13 +94,13 @@ function getBorderHeight() = function getMinSheetLength() = 5 * borderToothEdge; /** - * Gets the minimal length for a complete straight sheet + * Gets the minimal length for a straight chunk * @returns Number */ function getMinStraightLength() = 2 * getMinSheetLength(); /** - * Gets the minimal length for a complete curved sheet + * Gets the minimal arc length for a curved chunk * @returns Number */ function getMinCurveLength() = 3 * getMinSheetLength(); From 05683f54f9b32e838dcd852b17bca3c8335487c3 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 14:19:34 +0100 Subject: [PATCH 20/33] feat: add straight chunk elements --- rcmodels/tracks/border-sheet-full.scad | 47 +++++++++++++++++++++ rcmodels/tracks/bottom-border-straight.scad | 47 +++++++++++++++++++++ rcmodels/tracks/top-border-straight.scad | 47 +++++++++++++++++++++ 3 files changed, 141 insertions(+) create mode 100644 rcmodels/tracks/border-sheet-full.scad create mode 100644 rcmodels/tracks/bottom-border-straight.scad create mode 100644 rcmodels/tracks/top-border-straight.scad diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad new file mode 100644 index 0000000..f289194 --- /dev/null +++ b/rcmodels/tracks/border-sheet-full.scad @@ -0,0 +1,47 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * A full border sheet for a straight track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + borderSheetFull( + length = chunkLength, + height = getSheetHeight(), + thickness = borderThickness, + slotDepth = borderSlotDepth, + toothEdge = borderToothEdge + ); +} diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad new file mode 100644 index 0000000..9c807db --- /dev/null +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -0,0 +1,47 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * A bottom border mount for a straight track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + straightBorderBottom( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderBottomEdge, + toothEdge = borderToothEdge + ); +} diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad new file mode 100644 index 0000000..4a2b999 --- /dev/null +++ b/rcmodels/tracks/top-border-straight.scad @@ -0,0 +1,47 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * A top border mount for a straight track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + straightBorderTop( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderTopEdge, + toothEdge = borderToothEdge + ); +} From 52e46d954324d5d7ca25b56d2d85f7a209997cf8 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 14:19:55 +0100 Subject: [PATCH 21/33] feat: add curved chunk elements --- rcmodels/tracks/border-sheet-curve.scad | 47 ++++++++++++++++++++++ rcmodels/tracks/bottom-border-curved.scad | 48 +++++++++++++++++++++++ rcmodels/tracks/top-border-curved.scad | 48 +++++++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 rcmodels/tracks/border-sheet-curve.scad create mode 100644 rcmodels/tracks/bottom-border-curved.scad create mode 100644 rcmodels/tracks/top-border-curved.scad diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad new file mode 100644 index 0000000..923fb78 --- /dev/null +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -0,0 +1,47 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * An additional border sheet for a curved track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + borderSheet( + length = getCurveRemainingLength(chunkLength), + height = getSheetHeight(), + thickness = borderThickness, + slotDepth = borderSlotDepth, + toothEdge = borderToothEdge + ); +} diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad new file mode 100644 index 0000000..ff5155f --- /dev/null +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -0,0 +1,48 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * A bottom border mount for a curved track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + curveBorderBottom( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderBottomEdge, + toothEdge = borderToothEdge, + ratio = 1 + ); +} diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad new file mode 100644 index 0000000..931fe49 --- /dev/null +++ b/rcmodels/tracks/top-border-curved.scad @@ -0,0 +1,48 @@ + +/** + * @license + * GPLv3 License + * + * Copyright (c) 2020 Jean-Sebastien CONAN + * + * This file is part of jsconan/things. + * + * jsconan/things is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * jsconan/things is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with jsconan/things. If not, see . + */ + +/** + * A 1/24 RC track system. + * + * A top border mount for a curved track chunk. + * + * @author jsconan + * @version 0.1.0 + */ + +// Import the project's setup. +include + +// Sets the minimum facet angle and size using the defined render mode. +applyMode(mode=renderMode) { + // Uncomment the next line to cut a sample from the object + //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) + curveBorderTop( + length = chunkLength, + sheetThickness = getSlotWidth(), + slotDepth = borderSlotDepth, + borderEdge = borderTopEdge, + toothEdge = borderToothEdge, + ratio = 1 + ); +} From bb17befd5c3c2366fe3e2aff19afec7846bd2855 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 14:38:09 +0100 Subject: [PATCH 22/33] feat: add render script --- rcmodels/tracks/render.sh | 91 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 rcmodels/tracks/render.sh diff --git a/rcmodels/tracks/render.sh b/rcmodels/tracks/render.sh new file mode 100755 index 0000000..50dd898 --- /dev/null +++ b/rcmodels/tracks/render.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# GPLv3 License +# +# Copyright (c) 2020 Jean-Sebastien CONAN +# +# This file is part of jsconan/things. +# +# jsconan/things is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# jsconan/things is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with jsconan/things. If not, see . +# + +# +# Generates the STL files for the 1/24 RC track system. +# +# @author jsconan +# + +# application params +heightWithFasteners=1 +chunkLength=200 +borderHeight=50 + +# script config +scriptpath=$(dirname $0) +project=$(pwd) +srcpath=${project} +dstpath=${project}/output + +source "${scriptpath}/../../lib/camelSCAD/scripts/utils.sh" + +# load parameters +while (( "$#" )); do + case $1 in + "-l"|"--chunkLength") + chunkLength=$2 + shift + ;; + "-w"|"--borderHeight") + borderHeight=$2 + shift + ;; + "-i"|"--innerHeight") + heightWithFasteners=0 + ;; + "-o"|"--outerHeight") + heightWithFasteners=1 + ;; + "-h"|"--help") + echo -e "${C_INF}Renders OpenSCAD files${C_RST}" + echo -e " ${C_INF}Usage:${C_RST}" + echo -e "${C_CTX}\t$0 [-h|--help] [-o|--option value] files${C_RST}" + echo + echo -e "${C_MSG} -h, --help ${C_RST}Show this help" + echo -e "${C_MSG} -l, --chunkLength ${C_RST}Set the length of a track chunk (default: ${chunkLength}" + echo -e "${C_MSG} -w --borderHeight ${C_RST}Set the height of the track border (default: ${borderHeight}" + echo -e "${C_MSG} -i, --innerHeight ${C_RST}The height of the border does not contains the size of the mount fasteners" + echo -e "${C_MSG} -o, --outerHeight ${C_RST}The height of the border contains the size of the mount fasteners" + echo + exit 0 + ;; + *) + ls $1 >/dev/null 2>&1 + if [ "$?" == "0" ]; then + srcpath=$1 + else + printerror "Unknown parameter ${1}" + fi + ;; + esac + shift +done + +# check OpenSCAD +scadcheck + +# render the files, if exist +scadtostlall "${srcpath}" "${dstpath}" "" \ + "chunkLength=${chunkLength}" \ + "borderHeight=${borderHeight}" \ + "heightWithFasteners=${heightWithFasteners}" From 99c736f15a69bab8cfdc6bb9d67b1e62a09adaae Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 14:41:02 +0100 Subject: [PATCH 23/33] fix: code style --- rcmodels/tracks/shapes/curve.scad | 1 + 1 file changed, 1 insertion(+) diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index d0cfe00..2b339a7 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -152,6 +152,7 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdg } } } + /** * Draws the top border mount for a curved chunk * @param Number length - The length of a chunk From 5e8955d2e6b89752f92944492638c2fba2b7573e Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 18:52:24 +0100 Subject: [PATCH 24/33] feat: add functions to apply printer constraints --- rcmodels/tracks/border-sheet-curve.scad | 8 +- rcmodels/tracks/border-sheet-full.scad | 8 +- rcmodels/tracks/bottom-border-curved.scad | 8 +- rcmodels/tracks/bottom-border-straight.scad | 8 +- rcmodels/tracks/config/config.scad | 4 +- rcmodels/tracks/test/wip.scad | 102 +++++++++----------- rcmodels/tracks/top-border-curved.scad | 8 +- rcmodels/tracks/top-border-straight.scad | 8 +- rcmodels/tracks/util/functions.scad | 42 +++++++- 9 files changed, 113 insertions(+), 83 deletions(-) diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad index 923fb78..b901f95 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -38,10 +38,10 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) borderSheet( - length = getCurveRemainingLength(chunkLength), + length = getCurveRemainingLength(getChunkLength()), height = getSheetHeight(), - thickness = borderThickness, - slotDepth = borderSlotDepth, - toothEdge = borderToothEdge + thickness = getSheetThickness(), + slotDepth = getSlotDepth(), + toothEdge = getToothEdge() ); } diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad index f289194..0d05585 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/border-sheet-full.scad @@ -38,10 +38,10 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) borderSheetFull( - length = chunkLength, + length = getChunkLength(), height = getSheetHeight(), - thickness = borderThickness, - slotDepth = borderSlotDepth, - toothEdge = borderToothEdge + thickness = getSheetThickness(), + slotDepth = getSlotDepth(), + toothEdge = getToothEdge() ); } diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad index ff5155f..168a461 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -38,11 +38,11 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) curveBorderBottom( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderBottomEdge, - toothEdge = borderToothEdge, + slotDepth = getSlotDepth(), + borderEdge = getBottomEdge(), + toothEdge = getToothEdge(), ratio = 1 ); } diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad index 9c807db..ca2a5ac 100644 --- a/rcmodels/tracks/bottom-border-straight.scad +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -38,10 +38,10 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) straightBorderBottom( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderBottomEdge, - toothEdge = borderToothEdge + slotDepth = getSlotDepth(), + borderEdge = getBottomEdge(), + toothEdge = getToothEdge() ); } diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 6e2a5af..32f258e 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -34,7 +34,7 @@ renderMode = MODE_PROD; // Defines the constraints of the print. printResolution = 0.2; // the target layer height -nozzle = 0.4; // the size of the print nozzle +nozzleWidth = 0.4; // the size of the print nozzle printTolerance = 0.1; // the print tolerance when pieces need to be assembled // Defines options @@ -45,7 +45,7 @@ chunkLength = 200; // The constraints of the track border borderHeight = 50; -borderThickness = 3 * printResolution; +borderThickness = 0.6; borderTopEdge = 1; borderToothEdge = 2; borderBottomEdge = 2; diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index f978591..8d34856 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -38,119 +38,113 @@ applyMode(mode=renderMode) { // test the bottom border profile *borderBottomProfile( slotWidth = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderBottomEdge + slotDepth = getSlotDepth(), + edge = getBottomEdge() ); // test the top border profile *borderTopProfile( slotWidth = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderTopEdge + slotDepth = getSlotDepth(), + edge = getTopEdge() ); // test the border tooth profile *borderToothProfile( - slotDepth = borderSlotDepth, - edge = borderBottomEdge, + slotDepth = getSlotDepth(), + edge = getBottomEdge(), direction = -1, negative = true ); - *borderToothProfile( - slotDepth = borderSlotDepth, - edge = borderBottomEdge, - direction = 1, - negative = true - ); // test the border teeth profile *borderTeethProfile( - length = chunkLength / 2, - slotDepth = borderSlotDepth, - edge = borderBottomEdge, + length = getChunkLength() / 2, + slotDepth = getSlotDepth(), + edge = getBottomEdge(), negative = true ); // test the border tooth shape *borderTooth( thickness = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderBottomEdge, + slotDepth = getSlotDepth(), + edge = getBottomEdge(), direction = -1, negative = true, center = true ); // test the border teeth shape *borderTeeth( - length = chunkLength, + length = getChunkLength(), thickness = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderBottomEdge, + slotDepth = getSlotDepth(), + edge = getBottomEdge(), negative = true, center = true ); // test the border teeth shape for a full chunk *borderTeethFull( - length = chunkLength, + length = getChunkLength(), thickness = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderBottomEdge, + slotDepth = getSlotDepth(), + edge = getBottomEdge(), negative = true, center = true ); // test the bottom border mount shape for a straight chunk *straightBorderBottom( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderBottomEdge, - toothEdge = borderToothEdge + slotDepth = getSlotDepth(), + borderEdge = getBottomEdge(), + toothEdge = getToothEdge() ); // test the top border mount shape for a straight chunk *straightBorderTop( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderTopEdge, - toothEdge = borderToothEdge + slotDepth = getSlotDepth(), + borderEdge = getTopEdge(), + toothEdge = getToothEdge() ); // test the curved border tooth *curveBorderTooth( - radius = chunkLength, + radius = getChunkLength(), thickness = getSlotWidth(), - slotDepth = borderSlotDepth, - edge = borderToothEdge, + slotDepth = getSlotDepth(), + edge = getToothEdge(), direction = 1, negative = true ); // test the bottom border mount shape for a curved chunk - curveBorderBottom( - length = chunkLength, + *curveBorderBottom( + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderBottomEdge, - toothEdge = borderToothEdge, + slotDepth = getSlotDepth(), + borderEdge = getBottomEdge(), + toothEdge = getToothEdge(), ratio = 1 ); // test the top border mount shape for a curved chunk *curveBorderTop( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderTopEdge, - toothEdge = borderToothEdge, + slotDepth = getSlotDepth(), + borderEdge = getTopEdge(), + toothEdge = getToothEdge(), ratio = 1 ); // test the border sheet shape for a straight chunk *borderSheet( - length = getCurveRemainingLength(chunkLength), - height = borderHeight, - thickness = borderThickness, - slotDepth = borderSlotDepth, - toothEdge = borderToothEdge + length = getCurveRemainingLength(getChunkLength()), + height = getSheetHeight(), + thickness = getSheetThickness(), + slotDepth = getSlotDepth(), + toothEdge = getToothEdge() ); // test the full border sheet shape for a straight chunk - *borderSheetFull( - length = chunkLength, - height = borderHeight, - thickness = borderThickness, - slotDepth = borderSlotDepth, - toothEdge = borderToothEdge + borderSheetFull( + length = getChunkLength(), + height = getSheetHeight(), + thickness = getSheetThickness(), + slotDepth = getSlotDepth(), + toothEdge = getToothEdge() ); } diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad index 931fe49..f1904a1 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/top-border-curved.scad @@ -38,11 +38,11 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) curveBorderTop( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderTopEdge, - toothEdge = borderToothEdge, + slotDepth = getSlotDepth(), + borderEdge = getTopEdge(), + toothEdge = getToothEdge(), ratio = 1 ); } diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad index 4a2b999..77f5b78 100644 --- a/rcmodels/tracks/top-border-straight.scad +++ b/rcmodels/tracks/top-border-straight.scad @@ -38,10 +38,10 @@ applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) straightBorderTop( - length = chunkLength, + length = getChunkLength(), sheetThickness = getSlotWidth(), - slotDepth = borderSlotDepth, - borderEdge = borderTopEdge, - toothEdge = borderToothEdge + slotDepth = getSlotDepth(), + borderEdge = getTopEdge(), + toothEdge = getToothEdge() ); } diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 74fac44..19e0045 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -41,13 +41,49 @@ function adjustToLayer(height) = roundBy(height, printResolution); * @param Number width * @returns Number */ -function adjustToNozzle(width) = roundBy(width, nozzle); +function adjustToNozzle(width) = roundBy(width, nozzleWidth); + +/** + * Gets the thickness of the border sheet, adjusted to better fit the printer. + * @returns Number + */ +function getSheetThickness() = adjustToLayer(borderThickness); + +/** + * Gets the width of the bottom border edge, adjusted to better fit the printer. + * @returns Number + */ +function getBottomEdge() = adjustToNozzle(borderBottomEdge); + +/** + * Gets the width of the top border edge, adjusted to better fit the printer. + * @returns Number + */ +function getTopEdge() = adjustToNozzle(borderTopEdge); + +/** + * Gets the width of the border tooth edge, adjusted to better fit the printer. + * @returns Number + */ +function getToothEdge() = adjustToNozzle(borderToothEdge); /** * Gets the width of the slot that will hold the border sheet. * @returns Number */ -function getSlotWidth() = borderThickness + printTolerance; +function getSlotWidth() = getSheetThickness() + printTolerance; + +/** + * Gets the depth of the slot that will hold the border sheet. + * @returns Number + */ +function getSlotDepth() = adjustToLayer(borderSlotDepth); + +/** + * Gets the length of a track chunk. + * @returns Number + */ +function getChunkLength() = chunkLength; /** * Gets the length of a curved chunk (the length of the arc of the curve). @@ -91,7 +127,7 @@ function getBorderHeight() = * Gets the minimal length for a simple sheet (a sheet that should fit between 2 border teeth) * @returns Number */ -function getMinSheetLength() = 5 * borderToothEdge; +function getMinSheetLength() = 5 * getToothEdge(); /** * Gets the minimal length for a straight chunk From 8b034c905d9caef0431233ea55df693690ac8dfd Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 19:37:31 +0100 Subject: [PATCH 25/33] refactor: use borderToothProfile() instead of getBorderToothPoints() in borderTooth() --- rcmodels/tracks/shapes/straight.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index f9070b2..dbf0f4d 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -41,12 +41,12 @@ */ module borderTooth(thickness, slotDepth, edge, direction=1, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - polygon(getBorderToothPoints( + borderToothProfile( slotDepth = slotDepth, edge = edge, direction = direction, negative = negative - )); + ); } } From f01d4b4925868e873d60419c22f0f9ed066bfd50 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 20:37:30 +0100 Subject: [PATCH 26/33] feat: remove default values from the render script --- rcmodels/tracks/render.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rcmodels/tracks/render.sh b/rcmodels/tracks/render.sh index 50dd898..ce7922b 100755 --- a/rcmodels/tracks/render.sh +++ b/rcmodels/tracks/render.sh @@ -27,9 +27,9 @@ # # application params -heightWithFasteners=1 -chunkLength=200 -borderHeight=50 +heightWithFasteners= +chunkLength= +borderHeight= # script config scriptpath=$(dirname $0) @@ -62,8 +62,8 @@ while (( "$#" )); do echo -e "${C_CTX}\t$0 [-h|--help] [-o|--option value] files${C_RST}" echo echo -e "${C_MSG} -h, --help ${C_RST}Show this help" - echo -e "${C_MSG} -l, --chunkLength ${C_RST}Set the length of a track chunk (default: ${chunkLength}" - echo -e "${C_MSG} -w --borderHeight ${C_RST}Set the height of the track border (default: ${borderHeight}" + echo -e "${C_MSG} -l, --chunkLength ${C_RST}Set the length of a track chunk" + echo -e "${C_MSG} -w --borderHeight ${C_RST}Set the height of the track border" echo -e "${C_MSG} -i, --innerHeight ${C_RST}The height of the border does not contains the size of the mount fasteners" echo -e "${C_MSG} -o, --outerHeight ${C_RST}The height of the border contains the size of the mount fasteners" echo @@ -86,6 +86,6 @@ scadcheck # render the files, if exist scadtostlall "${srcpath}" "${dstpath}" "" \ - "chunkLength=${chunkLength}" \ - "borderHeight=${borderHeight}" \ - "heightWithFasteners=${heightWithFasteners}" + "$(varif "chunkLength" ${chunkLength})" \ + "$(varif "borderHeight" ${borderHeight})" \ + "$(varif "heightWithFasteners" ${heightWithFasteners})" From 1e106d31b3529b0d572b86ec97832812100aedb6 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 20:51:21 +0100 Subject: [PATCH 27/33] refactor: tweak the fit tolerance --- rcmodels/tracks/border-sheet-curve.scad | 2 +- rcmodels/tracks/border-sheet-full.scad | 2 +- rcmodels/tracks/bottom-border-curved.scad | 2 +- rcmodels/tracks/bottom-border-straight.scad | 2 +- rcmodels/tracks/test/wip.scad | 12 ++++++------ rcmodels/tracks/top-border-curved.scad | 2 +- rcmodels/tracks/top-border-straight.scad | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad index b901f95..b40c64c 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() + printTolerance ); } diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad index 0d05585..75bb5b4 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/border-sheet-full.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() + printTolerance ); } diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad index 168a461..0dae807 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge(), + toothEdge = getToothEdge() - printTolerance, ratio = 1 ); } diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad index ca2a5ac..36b8ecf 100644 --- a/rcmodels/tracks/bottom-border-straight.scad +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() - printTolerance ); } diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 8d34856..472afc9 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -94,7 +94,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() - printTolerance ); // test the top border mount shape for a straight chunk *straightBorderTop( @@ -102,7 +102,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() - printTolerance ); // test the curved border tooth *curveBorderTooth( @@ -119,7 +119,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge(), + toothEdge = getToothEdge() - printTolerance, ratio = 1 ); // test the top border mount shape for a curved chunk @@ -128,7 +128,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge(), + toothEdge = getToothEdge() - printTolerance, ratio = 1 ); // test the border sheet shape for a straight chunk @@ -137,7 +137,7 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() + printTolerance ); // test the full border sheet shape for a straight chunk borderSheetFull( @@ -145,6 +145,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() + printTolerance ); } diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad index f1904a1..d7e649e 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/top-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge(), + toothEdge = getToothEdge() - printTolerance, ratio = 1 ); } diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad index 77f5b78..9cd675b 100644 --- a/rcmodels/tracks/top-border-straight.scad +++ b/rcmodels/tracks/top-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() + toothEdge = getToothEdge() - printTolerance ); } From a18ab85d50239f7115b8213dd886489cb2a93ce1 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sat, 25 Jan 2020 21:39:13 +0100 Subject: [PATCH 28/33] refactor: tweak the config --- rcmodels/tracks/config/config.scad | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 32f258e..f895c38 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -44,9 +44,9 @@ heightWithFasteners = true; // Should the height be with or without the faste chunkLength = 200; // The constraints of the track border -borderHeight = 50; +borderHeight = 40; borderThickness = 0.6; borderTopEdge = 1; -borderToothEdge = 2; +borderToothEdge = 1; borderBottomEdge = 2; -borderSlotDepth = 6; +borderSlotDepth = 8; From 7d1aa1c0240f3ae91cef727cbdf50091f6b3b676 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sun, 26 Jan 2020 14:17:08 +0100 Subject: [PATCH 29/33] refactor: use better name (notch instead of tooth) --- rcmodels/tracks/border-sheet-curve.scad | 2 +- rcmodels/tracks/border-sheet-full.scad | 2 +- rcmodels/tracks/bottom-border-curved.scad | 2 +- rcmodels/tracks/bottom-border-straight.scad | 2 +- rcmodels/tracks/config/config.scad | 2 +- rcmodels/tracks/shapes/curve.scad | 32 ++++++------ rcmodels/tracks/shapes/profiles.scad | 24 ++++----- rcmodels/tracks/shapes/straight.scad | 56 ++++++++++----------- rcmodels/tracks/test/wip.scad | 48 +++++++++--------- rcmodels/tracks/top-border-curved.scad | 2 +- rcmodels/tracks/top-border-straight.scad | 2 +- rcmodels/tracks/util/functions.scad | 8 +-- 12 files changed, 91 insertions(+), 91 deletions(-) diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad index b40c64c..35b9cbf 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + printTolerance + notchEdge = getNotchEdge() + printTolerance ); } diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad index 75bb5b4..7a2c79a 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/border-sheet-full.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + printTolerance + notchEdge = getNotchEdge() + printTolerance ); } diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad index 0dae807..77b908d 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() - printTolerance, + notchEdge = getNotchEdge() - printTolerance, ratio = 1 ); } diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad index 36b8ecf..41c6880 100644 --- a/rcmodels/tracks/bottom-border-straight.scad +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() - printTolerance + notchEdge = getNotchEdge() - printTolerance ); } diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index f895c38..19341d8 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -47,6 +47,6 @@ chunkLength = 200; borderHeight = 40; borderThickness = 0.6; borderTopEdge = 1; -borderToothEdge = 1; +borderNotchEdge = 1; borderBottomEdge = 2; borderSlotDepth = 8; diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index 2b339a7..d50a9ce 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -31,15 +31,15 @@ */ /** - * Draws the shape of a curved border mount tooth. + * Draws the shape of a curved border mount notch. * @param Number radius - The radius of the curve. * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation */ -module curveBorderTooth(radius, thickness, slotDepth, edge, direction=1, negative=false) { +module curveBorderNotch(radius, thickness, slotDepth, edge, direction=1, negative=false) { start = negative ? 1 : 0; direction = direction >= 0 ? 1 : -1; length = edge * 2; @@ -76,20 +76,20 @@ module curveBorderTooth(radius, thickness, slotDepth, edge, direction=1, negativ } /** - * Draws the shape of a curved border mount teeth for a full chunk. + * Draws the shape of a curved border mount notches for a full chunk. * @param Number radius - The radius of the curve. * @param Number length - The length of a chunk * @param Number angle - The angle of the curve * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Boolean [negative] - The shape will be used in a difference operation */ -module curveBorderTeeth(radius, length, angle, thickness, slotDepth, edge, negative=false) { +module curveBorderNotches(radius, length, angle, thickness, slotDepth, edge, negative=false) { rotateZ(angle) { repeatMirror(axis=[0, 1, 0]) { rotateZ(-angle) { - curveBorderTooth( + curveBorderNotch( radius = radius, thickness = thickness, slotDepth = slotDepth, @@ -99,7 +99,7 @@ module curveBorderTeeth(radius, length, angle, thickness, slotDepth, edge, negat ); rotateZ(getArcAngle(radius = radius, length = length / 2)) { repeatMirror(axis=[0, 1, 0]) { - curveBorderTooth( + curveBorderNotch( radius = radius, thickness = thickness, slotDepth = slotDepth, @@ -120,10 +120,10 @@ module curveBorderTeeth(radius, length, angle, thickness, slotDepth, edge, negat * @param Number sheetThickness - The thickness of the sheet the border mount will hold. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number borderEdge - The width of each edge of the border mount. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. * @param Number ratio - The ratio of the chunk */ -module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdge, ratio = 1) { +module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdge, ratio = 1) { radius = length * ratio; defaultAngle = 90; angle = defaultAngle / ratio; @@ -140,13 +140,13 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdg } translateZ(borderEdge) { - curveBorderTeeth( + curveBorderNotches( radius = radius, length = length, angle = angle / 2, thickness = borderEdge, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative=false ); } @@ -159,10 +159,10 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdg * @param Number sheetThickness - The thickness of the sheet the border mount will hold. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number borderEdge - The width of each edge of the border mount. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. * @param Number ratio - The ratio of the chunk */ -module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdge, ratio = 1) { +module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge, ratio = 1) { radius = length * ratio; defaultAngle = 90; angle = defaultAngle / ratio; @@ -179,13 +179,13 @@ module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdge, } translateZ(borderEdge) { - curveBorderTeeth( + curveBorderNotches( radius = radius, length = length, angle = angle / 2, thickness = borderEdge, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative=false ); } diff --git a/rcmodels/tracks/shapes/profiles.scad b/rcmodels/tracks/shapes/profiles.scad index 534d3af..f77c47b 100644 --- a/rcmodels/tracks/shapes/profiles.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -80,14 +80,14 @@ function getBorderTopPoints(slotWidth, slotDepth, edge) = ; /** - * Computes the points defining the profile of a border mount tooth. + * Computes the points defining the profile of a border mount notch. * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation * @returns Vector[] */ -function getBorderToothPoints(slotDepth, edge, direction=1, negative=false) = +function getBorderNotchPoints(slotDepth, edge, direction=1, negative=false) = let( start = negative ? 1 : 0, direction = direction >= 0 ? 1 : -1, @@ -131,14 +131,14 @@ module borderTopProfile(slotWidth, slotDepth, edge) { } /** - * Draws the profile of a border mount tooth. + * Draws the profile of a border mount notch. * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation */ -module borderToothProfile(slotDepth, edge, direction=1, negative=false) { - polygon(getBorderToothPoints( +module borderNotchProfile(slotDepth, edge, direction=1, negative=false) { + polygon(getBorderNotchPoints( slotDepth = slotDepth, edge = edge, direction = direction, @@ -147,21 +147,21 @@ module borderToothProfile(slotDepth, edge, direction=1, negative=false) { } /** - * Draws the profile of a set of border mount teeth. + * Draws the profile of a set of border mount notches. * @param Number length - The length of the set * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Boolean [negative] - The shape will be used in a difference operation */ -module borderTeethProfile(length, slotDepth, edge, negative=false) { - borderToothProfile( +module borderNotchesProfile(length, slotDepth, edge, negative=false) { + borderNotchProfile( slotDepth = slotDepth, edge = edge, direction = 1, negative = negative ); translateX(length) { - borderToothProfile( + borderNotchProfile( slotDepth = slotDepth, edge = edge, direction = -1, diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index dbf0f4d..fd168c6 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -31,17 +31,17 @@ */ /** - * Draws the shape of border mount tooth. + * Draws the shape of border mount notch. * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderTooth(thickness, slotDepth, edge, direction=1, negative=false, center=false) { +module borderNotch(thickness, slotDepth, edge, direction=1, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - borderToothProfile( + borderNotchProfile( slotDepth = slotDepth, edge = edge, direction = direction, @@ -51,17 +51,17 @@ module borderTooth(thickness, slotDepth, edge, direction=1, negative=false, cent } /** - * Draws the shape of border mount teeth. + * Draws the shape of border mount notches. * @param Number length - The length of the chunk * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderTeeth(length, thickness, slotDepth, edge, negative=false, center=false) { +module borderNotches(length, thickness, slotDepth, edge, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - borderTeethProfile( + borderNotchesProfile( length = length, slotDepth = slotDepth, edge = edge, @@ -71,17 +71,17 @@ module borderTeeth(length, thickness, slotDepth, edge, negative=false, center=fa } /** - * Draws the shape of border mount teeth for a full chunk. + * Draws the shape of border mount notches for a full chunk. * @param Number length - The length of the chunk * @param Number thickness - The thickness of the shape * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * @param Number edge - The width of each edge of the notch. * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderTeethFull(length, thickness, slotDepth, edge, negative=false, center=false) { +module borderNotchesFull(length, thickness, slotDepth, edge, negative=false, center=false) { repeatMirror() { - borderTeeth( + borderNotches( length = length / 2, thickness = thickness, slotDepth = slotDepth, @@ -98,9 +98,9 @@ module borderTeethFull(length, thickness, slotDepth, edge, negative=false, cente * @param Number sheetThickness - The thickness of the sheet the border mount will hold. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number borderEdge - The width of each edge of the border mount. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. */ -module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, toothEdge) { +module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdge) { rotate([90, 0, 90]) { negativeExtrude(height=length, center=true) { borderBottomProfile( @@ -112,11 +112,11 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, tooth } translateZ(borderEdge) { rotateX(90) { - borderTeethFull( + borderNotchesFull( length = length, thickness = sheetThickness, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative = false, center = true ); @@ -130,9 +130,9 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, tooth * @param Number sheetThickness - The thickness of the sheet the border mount will hold. * @param Number slotDepth - The depth of the slot that will hold the border sheet. * @param Number borderEdge - The width of each edge of the border mount. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. */ -module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdge) { +module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge) { rotate([90, 0, 90]) { negativeExtrude(height=length, center=true) { borderTopProfile( @@ -144,11 +144,11 @@ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdg } translateZ(borderEdge) { rotateX(90) { - borderTeethFull( + borderNotchesFull( length = length, thickness = sheetThickness, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative = false, center = true ); @@ -162,20 +162,20 @@ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, toothEdg * @param Number height - The height of the chunk * @param Number thickness - The thickness of the border sheet. * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. */ -module borderSheet(length, height, thickness, slotDepth, toothEdge) { +module borderSheet(length, height, thickness, slotDepth, notchEdge) { difference() { box(size = [length, height, thickness], center = true); repeatMirror(axis=[0, 1, 0]) { translateY(-height / 2) { translateX(-length / 2) { - borderTeeth( + borderNotches( length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative = true, center = true ); @@ -191,19 +191,19 @@ module borderSheet(length, height, thickness, slotDepth, toothEdge) { * @param Number height - The height of the chunk * @param Number thickness - The thickness of the border sheet. * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number toothEdge - The width of a tooth edge. + * @param Number notchEdge - The width of a notch edge. */ -module borderSheetFull(length, height, thickness, slotDepth, toothEdge) { +module borderSheetFull(length, height, thickness, slotDepth, notchEdge) { difference() { box(size = [length, height, thickness], center = true); repeatMirror(axis=[0, 1, 0]) { translateY(-height / 2) { - borderTeethFull( + borderNotchesFull( length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = toothEdge, + edge = notchEdge, negative = true, center = true ); diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 472afc9..557580d 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -47,44 +47,44 @@ applyMode(mode=renderMode) { slotDepth = getSlotDepth(), edge = getTopEdge() ); - // test the border tooth profile - *borderToothProfile( + // test the border notch profile + *borderNotchProfile( slotDepth = getSlotDepth(), - edge = getBottomEdge(), + edge = getNotchEdge(), direction = -1, negative = true ); - // test the border teeth profile - *borderTeethProfile( + // test the border notches profile + *borderNotchesProfile( length = getChunkLength() / 2, slotDepth = getSlotDepth(), - edge = getBottomEdge(), + edge = getNotchEdge(), negative = true ); - // test the border tooth shape - *borderTooth( + // test the border notch shape + *borderNotch( thickness = getSlotWidth(), slotDepth = getSlotDepth(), - edge = getBottomEdge(), + edge = getNotchEdge(), direction = -1, negative = true, center = true ); - // test the border teeth shape - *borderTeeth( + // test the border notches shape + *borderNotches( length = getChunkLength(), thickness = getSlotWidth(), slotDepth = getSlotDepth(), - edge = getBottomEdge(), + edge = getNotchEdge(), negative = true, center = true ); - // test the border teeth shape for a full chunk - *borderTeethFull( + // test the border notches shape for a full chunk + *borderNotchesFull( length = getChunkLength(), thickness = getSlotWidth(), slotDepth = getSlotDepth(), - edge = getBottomEdge(), + edge = getNotchEdge(), negative = true, center = true ); @@ -94,7 +94,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() - printTolerance + notchEdge = getNotchEdge() ); // test the top border mount shape for a straight chunk *straightBorderTop( @@ -102,14 +102,14 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() - printTolerance + notchEdge = getNotchEdge() ); - // test the curved border tooth - *curveBorderTooth( + // test the curved border notch + *curveBorderNotch( radius = getChunkLength(), thickness = getSlotWidth(), slotDepth = getSlotDepth(), - edge = getToothEdge(), + edge = getNotchEdge(), direction = 1, negative = true ); @@ -119,7 +119,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - toothEdge = getToothEdge() - printTolerance, + notchEdge = getNotchEdge(), ratio = 1 ); // test the top border mount shape for a curved chunk @@ -128,7 +128,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() - printTolerance, + notchEdge = getNotchEdge(), ratio = 1 ); // test the border sheet shape for a straight chunk @@ -137,7 +137,7 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + printTolerance + notchEdge = getNotchEdge() ); // test the full border sheet shape for a straight chunk borderSheetFull( @@ -145,6 +145,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - toothEdge = getToothEdge() + printTolerance + notchEdge = getNotchEdge() ); } diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad index d7e649e..e4d09bd 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/top-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() - printTolerance, + notchEdge = getNotchEdge() - printTolerance, ratio = 1 ); } diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad index 9cd675b..4344865 100644 --- a/rcmodels/tracks/top-border-straight.scad +++ b/rcmodels/tracks/top-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - toothEdge = getToothEdge() - printTolerance + notchEdge = getNotchEdge() - printTolerance ); } diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 19e0045..2c4816c 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -62,10 +62,10 @@ function getBottomEdge() = adjustToNozzle(borderBottomEdge); function getTopEdge() = adjustToNozzle(borderTopEdge); /** - * Gets the width of the border tooth edge, adjusted to better fit the printer. + * Gets the width of the border notch edge, adjusted to better fit the printer. * @returns Number */ -function getToothEdge() = adjustToNozzle(borderToothEdge); +function getNotchEdge() = adjustToNozzle(borderNotchEdge); /** * Gets the width of the slot that will hold the border sheet. @@ -124,10 +124,10 @@ function getBorderHeight() = ; /** - * Gets the minimal length for a simple sheet (a sheet that should fit between 2 border teeth) + * Gets the minimal length for a simple sheet (a sheet that should fit between 2 border notches) * @returns Number */ -function getMinSheetLength() = 5 * getToothEdge(); +function getMinSheetLength() = 5 * getNotchEdge(); /** * Gets the minimal length for a straight chunk From a96048f0f1991d89b53a9d8e243e8e6475054ca2 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sun, 26 Jan 2020 19:42:58 +0100 Subject: [PATCH 30/33] feat: add a hook to better fasten chunks together --- rcmodels/tracks/border-sheet-curve.scad | 2 +- rcmodels/tracks/border-sheet-full.scad | 2 +- rcmodels/tracks/bottom-border-curved.scad | 2 +- rcmodels/tracks/bottom-border-straight.scad | 2 +- rcmodels/tracks/config/config.scad | 6 +- rcmodels/tracks/shapes/curve.scad | 121 +++++++++++++------ rcmodels/tracks/shapes/straight.scad | 125 ++++++++++++++------ rcmodels/tracks/test/wip.scad | 6 + rcmodels/tracks/top-border-curved.scad | 2 +- rcmodels/tracks/top-border-straight.scad | 2 +- rcmodels/tracks/util/functions.scad | 2 +- 11 files changed, 188 insertions(+), 84 deletions(-) diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad index 35b9cbf..c2e525f 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + printTolerance + notchEdge = getNotchEdge() ); } diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad index 7a2c79a..8f7d5aa 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/border-sheet-full.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { height = getSheetHeight(), thickness = getSheetThickness(), slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + printTolerance + notchEdge = getNotchEdge() ); } diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad index 77b908d..94f5e91 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - notchEdge = getNotchEdge() - printTolerance, + notchEdge = getNotchEdge(), ratio = 1 ); } diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad index 41c6880..0225021 100644 --- a/rcmodels/tracks/bottom-border-straight.scad +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getBottomEdge(), - notchEdge = getNotchEdge() - printTolerance + notchEdge = getNotchEdge() ); } diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 19341d8..88c4a65 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -46,7 +46,7 @@ chunkLength = 200; // The constraints of the track border borderHeight = 40; borderThickness = 0.6; -borderTopEdge = 1; -borderNotchEdge = 1; +borderTopEdge = 2; borderBottomEdge = 2; -borderSlotDepth = 8; +borderNotchEdge = 2; +borderSlotDepth = 6; diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index d50a9ce..845eaaf 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -127,29 +127,51 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdg radius = length * ratio; defaultAngle = 90; angle = defaultAngle / ratio; + ratioAngle = defaultAngle - angle; - rotateZ((defaultAngle - angle) / 2) { - rotate_extrude(angle=angle, convexity=10) { + rotateZ(ratioAngle / 2) { + difference() { + union() { + rotate_extrude(angle=angle, convexity=10) { + translateX(radius) { + borderBottomProfile( + slotWidth = sheetThickness + printTolerance, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + translateZ(borderEdge) { + curveBorderNotches( + radius = radius, + length = length, + angle = angle / 2, + thickness = borderEdge + borderEdge, + slotDepth = slotDepth, + edge = notchEdge - printTolerance, + negative=false + ); + } + rotateZ(-ratioAngle) { + translateY(radius) { + borderHook( + edge = notchEdge, + thickness = borderEdge - printResolution * 2, + negative = false + ); + } + } + } translateX(radius) { - borderBottomProfile( - slotWidth = sheetThickness, - slotDepth = slotDepth, - edge = borderEdge - ); + rotateZ(-90) { + borderHook( + edge = notchEdge + printTolerance, + thickness = borderEdge - printResolution, + negative = true + ); + } } } - - translateZ(borderEdge) { - curveBorderNotches( - radius = radius, - length = length, - angle = angle / 2, - thickness = borderEdge, - slotDepth = slotDepth, - edge = notchEdge, - negative=false - ); - } } } @@ -166,28 +188,51 @@ module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge, radius = length * ratio; defaultAngle = 90; angle = defaultAngle / ratio; + ratioAngle = defaultAngle - angle; - rotateZ((defaultAngle - angle) / 2) { - rotate_extrude(angle=angle, convexity=10) { + rotateZ(ratioAngle / 2) { + difference() { + union() { + rotate_extrude(angle=angle, convexity=10) { + translateX(radius) { + borderTopProfile( + slotWidth = sheetThickness + printTolerance, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + + translateZ(borderEdge) { + curveBorderNotches( + radius = radius, + length = length, + angle = angle / 2, + thickness = borderEdge + borderEdge, + slotDepth = slotDepth, + edge = notchEdge - printTolerance, + negative=false + ); + } + rotateZ(-ratioAngle) { + translateY(radius) { + borderHook( + edge = notchEdge, + thickness = borderEdge - printResolution * 2, + negative = false + ); + } + } + } translateX(radius) { - borderTopProfile( - slotWidth = sheetThickness, - slotDepth = slotDepth, - edge = borderEdge - ); + rotateZ(-90) { + borderHook( + edge = notchEdge + printTolerance, + thickness = borderEdge - printResolution, + negative = true + ); + } } } - - translateZ(borderEdge) { - curveBorderNotches( - radius = radius, - length = length, - angle = angle / 2, - thickness = borderEdge, - slotDepth = slotDepth, - edge = notchEdge, - negative=false - ); - } } } diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index fd168c6..520dabc 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -30,6 +30,23 @@ * @version 0.1.0 */ +/** + * Draws the shape of a border mount hook. + * @param Number edge - The width of each edge of the hook. + * @param Number thickness - The thickness of the hook + * @param Boolean [negative] - The shape will be used in a difference operation + */ +module borderHook(edge, thickness, negative=false) { + start = negative ? 1 : 0; + edge = adjustToNozzle(edge / 2) * 2; + translateZ(-start) { + box([edge * 2, edge, thickness + start]); + translateX(-edge) { + slot([edge, edge * 2, thickness + start]); + } + } +} + /** * Draws the shape of border mount notch. * @param Number thickness - The thickness of the shape @@ -101,24 +118,42 @@ module borderNotchesFull(length, thickness, slotDepth, edge, negative=false, cen * @param Number notchEdge - The width of a notch edge. */ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdge) { - rotate([90, 0, 90]) { - negativeExtrude(height=length, center=true) { - borderBottomProfile( - slotWidth = sheetThickness, - slotDepth = slotDepth, - edge = borderEdge - ); + difference() { + union() { + rotate([90, 0, 90]) { + negativeExtrude(height=length, center=true) { + borderBottomProfile( + slotWidth = sheetThickness + printTolerance, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + translateZ(borderEdge) { + rotateX(90) { + borderNotchesFull( + length = length, + thickness = sheetThickness + borderEdge, + slotDepth = slotDepth, + edge = notchEdge - printTolerance, + negative = false, + center = true + ); + } + } + translateX(-length / 2) { + borderHook( + edge = notchEdge, + thickness = borderEdge - printResolution * 2, + negative = false + ); + } } - } - translateZ(borderEdge) { - rotateX(90) { - borderNotchesFull( - length = length, - thickness = sheetThickness, - slotDepth = slotDepth, - edge = notchEdge, - negative = false, - center = true + translateX(length / 2) { + borderHook( + edge = notchEdge + printTolerance, + thickness = borderEdge - printResolution, + negative = true ); } } @@ -133,24 +168,42 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, notch * @param Number notchEdge - The width of a notch edge. */ module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge) { - rotate([90, 0, 90]) { - negativeExtrude(height=length, center=true) { - borderTopProfile( - slotWidth = sheetThickness, - slotDepth = slotDepth, - edge = borderEdge - ); + difference() { + union() { + rotate([90, 0, 90]) { + negativeExtrude(height=length, center=true) { + borderTopProfile( + slotWidth = sheetThickness + printTolerance, + slotDepth = slotDepth, + edge = borderEdge + ); + } + } + translateZ(borderEdge) { + rotateX(90) { + borderNotchesFull( + length = length, + thickness = sheetThickness + borderEdge, + slotDepth = slotDepth, + edge = notchEdge - printTolerance, + negative = false, + center = true + ); + } + } + translateX(-length / 2) { + borderHook( + edge = notchEdge, + thickness = borderEdge - printResolution * 2, + negative = false + ); + } } - } - translateZ(borderEdge) { - rotateX(90) { - borderNotchesFull( - length = length, - thickness = sheetThickness, - slotDepth = slotDepth, - edge = notchEdge, - negative = false, - center = true + translateX(length / 2) { + borderHook( + edge = notchEdge + printTolerance, + thickness = borderEdge - printResolution, + negative = true ); } } @@ -175,7 +228,7 @@ module borderSheet(length, height, thickness, slotDepth, notchEdge) { length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = notchEdge, + edge = notchEdge + printTolerance, negative = true, center = true ); @@ -203,7 +256,7 @@ module borderSheetFull(length, height, thickness, slotDepth, notchEdge) { length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = notchEdge, + edge = notchEdge + printTolerance, negative = true, center = true ); diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 557580d..b1e4aa0 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -61,6 +61,12 @@ applyMode(mode=renderMode) { edge = getNotchEdge(), negative = true ); + // test the border hook shape + *borderHook( + edge = getNotchEdge(), + thickness = getNotchEdge(), + negative=false + ); // test the border notch shape *borderNotch( thickness = getSlotWidth(), diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad index e4d09bd..0ca129a 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/top-border-curved.scad @@ -42,7 +42,7 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - notchEdge = getNotchEdge() - printTolerance, + notchEdge = getNotchEdge(), ratio = 1 ); } diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad index 4344865..b3296a8 100644 --- a/rcmodels/tracks/top-border-straight.scad +++ b/rcmodels/tracks/top-border-straight.scad @@ -42,6 +42,6 @@ applyMode(mode=renderMode) { sheetThickness = getSlotWidth(), slotDepth = getSlotDepth(), borderEdge = getTopEdge(), - notchEdge = getNotchEdge() - printTolerance + notchEdge = getNotchEdge() ); } diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 2c4816c..2ac7f20 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -71,7 +71,7 @@ function getNotchEdge() = adjustToNozzle(borderNotchEdge); * Gets the width of the slot that will hold the border sheet. * @returns Number */ -function getSlotWidth() = getSheetThickness() + printTolerance; +function getSlotWidth() = getSheetThickness(); /** * Gets the depth of the slot that will hold the border sheet. From c51ca58489700e7d32b23c2a21030ee56bc9c4e7 Mon Sep 17 00:00:00 2001 From: jsconan Date: Sun, 26 Jan 2020 19:48:18 +0100 Subject: [PATCH 31/33] doc: give a better project description --- rcmodels/tracks/border-sheet-curve.scad | 2 +- rcmodels/tracks/border-sheet-full.scad | 2 +- rcmodels/tracks/bottom-border-curved.scad | 2 +- rcmodels/tracks/bottom-border-straight.scad | 2 +- rcmodels/tracks/config/config.scad | 2 +- rcmodels/tracks/render.sh | 4 +++- rcmodels/tracks/shapes/curve.scad | 2 +- rcmodels/tracks/shapes/profiles.scad | 2 +- rcmodels/tracks/shapes/straight.scad | 2 +- rcmodels/tracks/test/wip.scad | 2 +- rcmodels/tracks/top-border-curved.scad | 2 +- rcmodels/tracks/top-border-straight.scad | 2 +- rcmodels/tracks/util/functions.scad | 2 +- rcmodels/tracks/util/setup.scad | 2 +- 14 files changed, 16 insertions(+), 14 deletions(-) diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/border-sheet-curve.scad index c2e525f..4c03065 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/border-sheet-curve.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * An additional border sheet for a curved track chunk. * diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/border-sheet-full.scad index 8f7d5aa..4b44539 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/border-sheet-full.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * A full border sheet for a straight track chunk. * diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/bottom-border-curved.scad index 94f5e91..f6f75a6 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/bottom-border-curved.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * A bottom border mount for a curved track chunk. * diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad index 0225021..3803d03 100644 --- a/rcmodels/tracks/bottom-border-straight.scad +++ b/rcmodels/tracks/bottom-border-straight.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * A bottom border mount for a straight track chunk. * diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index 88c4a65..d9b4b99 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -21,7 +21,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Defines the config. * diff --git a/rcmodels/tracks/render.sh b/rcmodels/tracks/render.sh index ce7922b..73d92c9 100755 --- a/rcmodels/tracks/render.sh +++ b/rcmodels/tracks/render.sh @@ -21,7 +21,9 @@ # # -# Generates the STL files for the 1/24 RC track system. +# A race track system for 1/24 to 1/32 scale RC cars. +# +# Generates the STL files for the project. # # @author jsconan # diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index 845eaaf..ca03ea2 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Defines some curved chunk shapes. * diff --git a/rcmodels/tracks/shapes/profiles.scad b/rcmodels/tracks/shapes/profiles.scad index f77c47b..c31a87d 100644 --- a/rcmodels/tracks/shapes/profiles.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Defines some profile shapes. * diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index 520dabc..c005828 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Defines some straight chunk shapes. * diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index b1e4aa0..192f9d7 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Work in progress. * diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/top-border-curved.scad index 0ca129a..8c15bbb 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/top-border-curved.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * A top border mount for a curved track chunk. * diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad index b3296a8..5b1b291 100644 --- a/rcmodels/tracks/top-border-straight.scad +++ b/rcmodels/tracks/top-border-straight.scad @@ -22,7 +22,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * A top border mount for a straight track chunk. * diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 2ac7f20..5e97013 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -21,7 +21,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Defines some functions. * diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index fdcfb4f..60ac35c 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -21,7 +21,7 @@ */ /** - * A 1/24 RC track system. + * A race track system for 1/24 to 1/32 scale RC cars. * * Setup the context. * From 9b68b4de1dd75a98cd3cce0c0daae426740599ae Mon Sep 17 00:00:00 2001 From: jsconan Date: Sun, 26 Jan 2020 22:16:43 +0100 Subject: [PATCH 32/33] refactor: rename and simplify the shapes (no more bottom and top) --- ...heet-full.scad => barrier-body-curve.scad} | 14 +- ...curved.scad => barrier-body-straight.scad} | 15 +- ...-curved.scad => barrier-holder-curve.scad} | 14 +- ...urve.scad => barrier-holder-straight.scad} | 14 +- rcmodels/tracks/bottom-border-straight.scad | 47 ----- rcmodels/tracks/config/config.scad | 23 ++- rcmodels/tracks/render.sh | 24 +-- rcmodels/tracks/shapes/curve.scad | 128 ++++--------- rcmodels/tracks/shapes/profiles.scad | 118 +++++------- rcmodels/tracks/shapes/straight.scad | 168 ++++++------------ rcmodels/tracks/test/wip.scad | 151 +++++++--------- rcmodels/tracks/top-border-straight.scad | 47 ----- rcmodels/tracks/util/functions.scad | 64 +++---- rcmodels/tracks/util/setup.scad | 12 +- 14 files changed, 282 insertions(+), 557 deletions(-) rename rcmodels/tracks/{border-sheet-full.scad => barrier-body-curve.scad} (80%) rename rcmodels/tracks/{top-border-curved.scad => barrier-body-straight.scad} (81%) rename rcmodels/tracks/{bottom-border-curved.scad => barrier-holder-curve.scad} (81%) rename rcmodels/tracks/{border-sheet-curve.scad => barrier-holder-straight.scad} (81%) delete mode 100644 rcmodels/tracks/bottom-border-straight.scad delete mode 100644 rcmodels/tracks/top-border-straight.scad diff --git a/rcmodels/tracks/border-sheet-full.scad b/rcmodels/tracks/barrier-body-curve.scad similarity index 80% rename from rcmodels/tracks/border-sheet-full.scad rename to rcmodels/tracks/barrier-body-curve.scad index 4b44539..e4fb50a 100644 --- a/rcmodels/tracks/border-sheet-full.scad +++ b/rcmodels/tracks/barrier-body-curve.scad @@ -24,7 +24,7 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * A full border sheet for a straight track chunk. + * An additional barrier body for a curved track part. * * @author jsconan * @version 0.1.0 @@ -37,11 +37,11 @@ include applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - borderSheetFull( - length = getChunkLength(), - height = getSheetHeight(), - thickness = getSheetThickness(), - slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + barrierBody( + length = getCurveRemainingLength(getChunkSize()), + height = getBarrierBodyHeight(), + thickness = getBarrierThickness(), + slotDepth = getBarrierHolderDepth(), + notchBase = getBarrierNotchBase() ); } diff --git a/rcmodels/tracks/top-border-curved.scad b/rcmodels/tracks/barrier-body-straight.scad similarity index 81% rename from rcmodels/tracks/top-border-curved.scad rename to rcmodels/tracks/barrier-body-straight.scad index 8c15bbb..156ac85 100644 --- a/rcmodels/tracks/top-border-curved.scad +++ b/rcmodels/tracks/barrier-body-straight.scad @@ -24,7 +24,7 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * A top border mount for a curved track chunk. + * A barrier body for a straight track part. * * @author jsconan * @version 0.1.0 @@ -37,12 +37,11 @@ include applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - curveBorderTop( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getTopEdge(), - notchEdge = getNotchEdge(), - ratio = 1 + barrierBodyFull( + length = getChunkSize(), + height = getBarrierBodyHeight(), + thickness = getBarrierThickness(), + slotDepth = getBarrierHolderDepth(), + notchBase = getBarrierNotchBase() ); } diff --git a/rcmodels/tracks/bottom-border-curved.scad b/rcmodels/tracks/barrier-holder-curve.scad similarity index 81% rename from rcmodels/tracks/bottom-border-curved.scad rename to rcmodels/tracks/barrier-holder-curve.scad index f6f75a6..48398aa 100644 --- a/rcmodels/tracks/bottom-border-curved.scad +++ b/rcmodels/tracks/barrier-holder-curve.scad @@ -24,7 +24,7 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * A bottom border mount for a curved track chunk. + * A barrier holder for a curved track part. * * @author jsconan * @version 0.1.0 @@ -37,12 +37,12 @@ include applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - curveBorderBottom( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getBottomEdge(), - notchEdge = getNotchEdge(), + curveBarrierHolder( + length = getChunkSize(), + bodyThickness = getSlotWidth(), + slotDepth = getBarrierHolderDepth(), + barrierBase = getBarrierHolderBase(), + notchBase = getBarrierNotchBase(), ratio = 1 ); } diff --git a/rcmodels/tracks/border-sheet-curve.scad b/rcmodels/tracks/barrier-holder-straight.scad similarity index 81% rename from rcmodels/tracks/border-sheet-curve.scad rename to rcmodels/tracks/barrier-holder-straight.scad index 4c03065..647cada 100644 --- a/rcmodels/tracks/border-sheet-curve.scad +++ b/rcmodels/tracks/barrier-holder-straight.scad @@ -24,7 +24,7 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * An additional border sheet for a curved track chunk. + * A barrier holder for a straight track part. * * @author jsconan * @version 0.1.0 @@ -37,11 +37,11 @@ include applyMode(mode=renderMode) { // Uncomment the next line to cut a sample from the object //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - borderSheet( - length = getCurveRemainingLength(getChunkLength()), - height = getSheetHeight(), - thickness = getSheetThickness(), - slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + straightBarrierHolder( + length = getChunkSize(), + bodyThickness = getSlotWidth(), + slotDepth = getBarrierHolderDepth(), + barrierBase = getBarrierHolderBase(), + notchBase = getBarrierNotchBase() ); } diff --git a/rcmodels/tracks/bottom-border-straight.scad b/rcmodels/tracks/bottom-border-straight.scad deleted file mode 100644 index 3803d03..0000000 --- a/rcmodels/tracks/bottom-border-straight.scad +++ /dev/null @@ -1,47 +0,0 @@ - -/** - * @license - * GPLv3 License - * - * Copyright (c) 2020 Jean-Sebastien CONAN - * - * This file is part of jsconan/things. - * - * jsconan/things is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * jsconan/things is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with jsconan/things. If not, see . - */ - -/** - * A race track system for 1/24 to 1/32 scale RC cars. - * - * A bottom border mount for a straight track chunk. - * - * @author jsconan - * @version 0.1.0 - */ - -// Import the project's setup. -include - -// Sets the minimum facet angle and size using the defined render mode. -applyMode(mode=renderMode) { - // Uncomment the next line to cut a sample from the object - //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - straightBorderBottom( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getBottomEdge(), - notchEdge = getNotchEdge() - ); -} diff --git a/rcmodels/tracks/config/config.scad b/rcmodels/tracks/config/config.scad index d9b4b99..6b82dea 100644 --- a/rcmodels/tracks/config/config.scad +++ b/rcmodels/tracks/config/config.scad @@ -33,20 +33,19 @@ renderMode = MODE_PROD; // Defines the constraints of the print. -printResolution = 0.2; // the target layer height -nozzleWidth = 0.4; // the size of the print nozzle -printTolerance = 0.1; // the print tolerance when pieces need to be assembled +printResolution = 0.2; // The target layer height +nozzleWidth = 0.4; // The size of the print nozzle +printTolerance = 0.1; // The print tolerance when pieces need to be assembled // Defines options -heightWithFasteners = true; // Should the height be with or without the fastener elements? +heightWithFasteners = true; // Should the height be with or without the fastener elements? // The dimensions of a track chunk -chunkLength = 200; +chunkSize = 200; // The nominal size of a chunk: the length for straight chunk, or the width for a curved chunk -// The constraints of the track border -borderHeight = 40; -borderThickness = 0.6; -borderTopEdge = 2; -borderBottomEdge = 2; -borderNotchEdge = 2; -borderSlotDepth = 6; +// The constraints of the track barrier +barrierThickness = 0.6; // The thickness of the barrier body +barrierHeight = 40; // The height of the barrier, depending on the option heightWithFasteners +barrierHolderDepth = 6; // The depth of the barrier holder to clamp the barrier body +barrierHolderBase = 2; // The base value used to design the barrier holder +barrierNotchBase = 2; // The base value used to design the barrier notches diff --git a/rcmodels/tracks/render.sh b/rcmodels/tracks/render.sh index 73d92c9..8640c6d 100755 --- a/rcmodels/tracks/render.sh +++ b/rcmodels/tracks/render.sh @@ -30,8 +30,8 @@ # application params heightWithFasteners= -chunkLength= -borderHeight= +chunkSize= +barrierHeight= # script config scriptpath=$(dirname $0) @@ -44,12 +44,12 @@ source "${scriptpath}/../../lib/camelSCAD/scripts/utils.sh" # load parameters while (( "$#" )); do case $1 in - "-l"|"--chunkLength") - chunkLength=$2 + "-l"|"--chunkSize") + chunkSize=$2 shift ;; - "-w"|"--borderHeight") - borderHeight=$2 + "-w"|"--barrierHeight") + barrierHeight=$2 shift ;; "-i"|"--innerHeight") @@ -64,10 +64,10 @@ while (( "$#" )); do echo -e "${C_CTX}\t$0 [-h|--help] [-o|--option value] files${C_RST}" echo echo -e "${C_MSG} -h, --help ${C_RST}Show this help" - echo -e "${C_MSG} -l, --chunkLength ${C_RST}Set the length of a track chunk" - echo -e "${C_MSG} -w --borderHeight ${C_RST}Set the height of the track border" - echo -e "${C_MSG} -i, --innerHeight ${C_RST}The height of the border does not contains the size of the mount fasteners" - echo -e "${C_MSG} -o, --outerHeight ${C_RST}The height of the border contains the size of the mount fasteners" + echo -e "${C_MSG} -l, --chunkSize ${C_RST}Set the length of a track chunk" + echo -e "${C_MSG} -w --barrierHeight ${C_RST}Set the height of the track barrier" + echo -e "${C_MSG} -i, --innerHeight ${C_RST}The height of the barrier does not contains the size of the holders" + echo -e "${C_MSG} -o, --outerHeight ${C_RST}The height of the barrier contains the size of the holders" echo exit 0 ;; @@ -88,6 +88,6 @@ scadcheck # render the files, if exist scadtostlall "${srcpath}" "${dstpath}" "" \ - "$(varif "chunkLength" ${chunkLength})" \ - "$(varif "borderHeight" ${borderHeight})" \ + "$(varif "chunkSize" ${chunkSize})" \ + "$(varif "barrierHeight" ${barrierHeight})" \ "$(varif "heightWithFasteners" ${heightWithFasteners})" diff --git a/rcmodels/tracks/shapes/curve.scad b/rcmodels/tracks/shapes/curve.scad index ca03ea2..cfa0987 100644 --- a/rcmodels/tracks/shapes/curve.scad +++ b/rcmodels/tracks/shapes/curve.scad @@ -24,25 +24,25 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * Defines some curved chunk shapes. + * Defines some curved track parts. * * @author jsconan * @version 0.1.0 */ /** - * Draws the shape of a curved border mount notch. + * Draws the shape of a curved barrier holder notch. * @param Number radius - The radius of the curve. * @param Number thickness - The thickness of the shape - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation */ -module curveBorderNotch(radius, thickness, slotDepth, edge, direction=1, negative=false) { +module curveBarrierNotch(radius, thickness, slotDepth, base, direction=1, negative=false) { start = negative ? 1 : 0; direction = direction >= 0 ? 1 : -1; - length = edge * 2; + length = base * 2; angle = getArcAngle(radius = radius, length = length); chord = getChordLength(radius = radius, angle = angle / 2); @@ -76,34 +76,34 @@ module curveBorderNotch(radius, thickness, slotDepth, edge, direction=1, negativ } /** - * Draws the shape of a curved border mount notches for a full chunk. + * Draws the shape of a curved barrier holder notches for a full chunk. * @param Number radius - The radius of the curve. * @param Number length - The length of a chunk * @param Number angle - The angle of the curve * @param Number thickness - The thickness of the shape - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Boolean [negative] - The shape will be used in a difference operation */ -module curveBorderNotches(radius, length, angle, thickness, slotDepth, edge, negative=false) { +module curveBarrierNotches(radius, length, angle, thickness, slotDepth, base, negative=false) { rotateZ(angle) { repeatMirror(axis=[0, 1, 0]) { rotateZ(-angle) { - curveBorderNotch( + curveBarrierNotch( radius = radius, thickness = thickness, slotDepth = slotDepth, - edge = edge, + base = base, direction = 1, negative = negative ); rotateZ(getArcAngle(radius = radius, length = length / 2)) { repeatMirror(axis=[0, 1, 0]) { - curveBorderNotch( + curveBarrierNotch( radius = radius, thickness = thickness, slotDepth = slotDepth, - edge = edge, + base = base, direction = -1, negative = negative ); @@ -115,15 +115,15 @@ module curveBorderNotches(radius, length, angle, thickness, slotDepth, edge, neg } /** - * Draws the bottom border mount for a curved chunk + * Draws the barrier holder for a curved chunk * @param Number length - The length of a chunk - * @param Number sheetThickness - The thickness of the sheet the border mount will hold. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number borderEdge - The width of each edge of the border mount. - * @param Number notchEdge - The width of a notch edge. + * @param Number bodyThickness - The thickness of the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number barrierBase - The base value used to design the barrier holder. + * @param Number notchBase - The width of a notch base. * @param Number ratio - The ratio of the chunk */ -module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdge, ratio = 1) { +module curveBarrierHolder(length, bodyThickness, slotDepth, barrierBase, notchBase, ratio = 1) { radius = length * ratio; defaultAngle = 90; angle = defaultAngle / ratio; @@ -134,29 +134,29 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdg union() { rotate_extrude(angle=angle, convexity=10) { translateX(radius) { - borderBottomProfile( - slotWidth = sheetThickness + printTolerance, + barrierHolderProfile( + slotWidth = bodyThickness + printTolerance, slotDepth = slotDepth, - edge = borderEdge + base = barrierBase ); } } - translateZ(borderEdge) { - curveBorderNotches( + translateZ(barrierBase) { + curveBarrierNotches( radius = radius, length = length, angle = angle / 2, - thickness = borderEdge + borderEdge, + thickness = barrierBase + barrierBase, slotDepth = slotDepth, - edge = notchEdge - printTolerance, + base = notchBase - printTolerance, negative=false ); } rotateZ(-ratioAngle) { translateY(radius) { - borderHook( - edge = notchEdge, - thickness = borderEdge - printResolution * 2, + barrierHook( + base = notchBase, + thickness = barrierBase - printResolution * 2, negative = false ); } @@ -164,71 +164,9 @@ module curveBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdg } translateX(radius) { rotateZ(-90) { - borderHook( - edge = notchEdge + printTolerance, - thickness = borderEdge - printResolution, - negative = true - ); - } - } - } - } -} - -/** - * Draws the top border mount for a curved chunk - * @param Number length - The length of a chunk - * @param Number sheetThickness - The thickness of the sheet the border mount will hold. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number borderEdge - The width of each edge of the border mount. - * @param Number notchEdge - The width of a notch edge. - * @param Number ratio - The ratio of the chunk - */ -module curveBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge, ratio = 1) { - radius = length * ratio; - defaultAngle = 90; - angle = defaultAngle / ratio; - ratioAngle = defaultAngle - angle; - - rotateZ(ratioAngle / 2) { - difference() { - union() { - rotate_extrude(angle=angle, convexity=10) { - translateX(radius) { - borderTopProfile( - slotWidth = sheetThickness + printTolerance, - slotDepth = slotDepth, - edge = borderEdge - ); - } - } - - translateZ(borderEdge) { - curveBorderNotches( - radius = radius, - length = length, - angle = angle / 2, - thickness = borderEdge + borderEdge, - slotDepth = slotDepth, - edge = notchEdge - printTolerance, - negative=false - ); - } - rotateZ(-ratioAngle) { - translateY(radius) { - borderHook( - edge = notchEdge, - thickness = borderEdge - printResolution * 2, - negative = false - ); - } - } - } - translateX(radius) { - rotateZ(-90) { - borderHook( - edge = notchEdge + printTolerance, - thickness = borderEdge - printResolution, + barrierHook( + base = notchBase + printTolerance, + thickness = barrierBase - printResolution, negative = true ); } diff --git a/rcmodels/tracks/shapes/profiles.scad b/rcmodels/tracks/shapes/profiles.scad index c31a87d..2386853 100644 --- a/rcmodels/tracks/shapes/profiles.scad +++ b/rcmodels/tracks/shapes/profiles.scad @@ -31,139 +31,101 @@ */ /** - * Computes the points defining the profile of the bottom border mount. - * @param Number slotWidth - The width of the slot that will hold the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * Computes the points defining the profile of the barrier holder. + * @param Number slotWidth - The width of the slot that will hold the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier holder. * @returns Vector[] */ -function getBorderBottomPoints(slotWidth, slotDepth, edge) = +function getBarrierHolderPoints(slotWidth, slotDepth, base) = let( - width = edge * 4 + slotWidth + width = base * 4 + slotWidth ) path([ ["P", -width / 2, 0], - ["V", edge], - ["L", edge, slotDepth], - ["H", edge], + ["V", base], + ["L", base, slotDepth], + ["H", base], ["V", -slotDepth], ["H", slotWidth], ["V", slotDepth], - ["H", edge], - ["L", edge, -slotDepth], - ["V", -edge] + ["H", base], + ["L", base, -slotDepth], + ["V", -base] ]) ; /** - * Computes the points defining the profile of the top border mount. - * @param Number slotWidth - The width of the slot that will hold the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. - * @returns Vector[] - */ -function getBorderTopPoints(slotWidth, slotDepth, edge) = - let( - width = edge * 2 + slotWidth, - height = edge + slotDepth - ) - path([ - ["P", -width / 2, 0], - ["V", height], - ["H", edge], - ["V", -slotDepth], - ["H", slotWidth], - ["V", slotDepth], - ["H", edge], - ["V", -height] - ]) -; - -/** - * Computes the points defining the profile of a border mount notch. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * Computes the points defining the profile of a barrier holder notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation * @returns Vector[] */ -function getBorderNotchPoints(slotDepth, edge, direction=1, negative=false) = +function getBarrierNotchPoints(slotDepth, base, direction=1, negative=false) = let( start = negative ? 1 : 0, direction = direction >= 0 ? 1 : -1, - width = edge * 2 + width = base * 2 ) path([ ["P", direction * -start, slotDepth], - ["H", direction * (edge + start)], - ["L", direction * edge, -slotDepth], + ["H", direction * (base + start)], + ["L", direction * base, -slotDepth], ["V", -start], ["H", direction * -(width + start)] ]) ; /** - * Draws the profile of the bottom border mount. - * @param Number slotWidth - The width of the slot that will hold the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. - */ -module borderBottomProfile(slotWidth, slotDepth, edge) { - polygon(getBorderBottomPoints( - slotWidth = slotWidth, - slotDepth = slotDepth, - edge = edge - )); -} - -/** - * Draws the profile of the top border mount. - * @param Number slotWidth - The width of the slot that will hold the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the border mount. + * Draws the profile of the barrier holder. + * @param Number slotWidth - The width of the slot that will hold the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier holder. */ -module borderTopProfile(slotWidth, slotDepth, edge) { - polygon(getBorderTopPoints( +module barrierHolderProfile(slotWidth, slotDepth, base) { + polygon(getBarrierHolderPoints( slotWidth = slotWidth, slotDepth = slotDepth, - edge = edge + base = base )); } /** - * Draws the profile of a border mount notch. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * Draws the profile of a barrier holder notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation */ -module borderNotchProfile(slotDepth, edge, direction=1, negative=false) { - polygon(getBorderNotchPoints( +module barrierNotchProfile(slotDepth, base, direction=1, negative=false) { + polygon(getBarrierNotchPoints( slotDepth = slotDepth, - edge = edge, + base = base, direction = direction, negative = negative )); } /** - * Draws the profile of a set of border mount notches. + * Draws the profile of a set of barrier holder notches. * @param Number length - The length of the set - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Boolean [negative] - The shape will be used in a difference operation */ -module borderNotchesProfile(length, slotDepth, edge, negative=false) { - borderNotchProfile( +module barrierNotchesProfile(length, slotDepth, base, negative=false) { + barrierNotchProfile( slotDepth = slotDepth, - edge = edge, + base = base, direction = 1, negative = negative ); translateX(length) { - borderNotchProfile( + barrierNotchProfile( slotDepth = slotDepth, - edge = edge, + base = base, direction = -1, negative = negative ); diff --git a/rcmodels/tracks/shapes/straight.scad b/rcmodels/tracks/shapes/straight.scad index c005828..2d41183 100644 --- a/rcmodels/tracks/shapes/straight.scad +++ b/rcmodels/tracks/shapes/straight.scad @@ -24,43 +24,43 @@ /** * A race track system for 1/24 to 1/32 scale RC cars. * - * Defines some straight chunk shapes. + * Defines some straight track parts. * * @author jsconan * @version 0.1.0 */ /** - * Draws the shape of a border mount hook. - * @param Number edge - The width of each edge of the hook. + * Draws the shape of a barrier holder hook. + * @param Number base - The width of each base of the hook. * @param Number thickness - The thickness of the hook * @param Boolean [negative] - The shape will be used in a difference operation */ -module borderHook(edge, thickness, negative=false) { +module barrierHook(base, thickness, negative=false) { start = negative ? 1 : 0; - edge = adjustToNozzle(edge / 2) * 2; + base = adjustToNozzle(base / 2) * 2; translateZ(-start) { - box([edge * 2, edge, thickness + start]); - translateX(-edge) { - slot([edge, edge * 2, thickness + start]); + box([base * 2, base, thickness + start]); + translateX(-base) { + slot([base, base * 2, thickness + start]); } } } /** - * Draws the shape of border mount notch. + * Draws the shape of barrier holder notch. * @param Number thickness - The thickness of the shape - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Number [direction] - The direction of the shape (1: right, -1: left) * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderNotch(thickness, slotDepth, edge, direction=1, negative=false, center=false) { +module barrierNotch(thickness, slotDepth, base, direction=1, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - borderNotchProfile( + barrierNotchProfile( slotDepth = slotDepth, - edge = edge, + base = base, direction = direction, negative = negative ); @@ -68,41 +68,41 @@ module borderNotch(thickness, slotDepth, edge, direction=1, negative=false, cent } /** - * Draws the shape of border mount notches. + * Draws the shape of barrier holder notches. * @param Number length - The length of the chunk * @param Number thickness - The thickness of the shape - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderNotches(length, thickness, slotDepth, edge, negative=false, center=false) { +module barrierNotches(length, thickness, slotDepth, base, negative=false, center=false) { negativeExtrude(height=thickness, center=center) { - borderNotchesProfile( + barrierNotchesProfile( length = length, slotDepth = slotDepth, - edge = edge, + base = base, negative = negative ); } } /** - * Draws the shape of border mount notches for a full chunk. + * Draws the shape of barrier holder notches for a full chunk. * @param Number length - The length of the chunk * @param Number thickness - The thickness of the shape - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number edge - The width of each edge of the notch. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number base - The base value used to design the barrier notches. * @param Boolean [negative] - The shape will be used in a difference operation * @param Boolean [center] - The shape is centered vertically */ -module borderNotchesFull(length, thickness, slotDepth, edge, negative=false, center=false) { +module barrierNotchesFull(length, thickness, slotDepth, base, negative=false, center=false) { repeatMirror() { - borderNotches( + barrierNotches( length = length / 2, thickness = thickness, slotDepth = slotDepth, - edge = edge, + base = base, negative = negative, center = center ); @@ -110,49 +110,49 @@ module borderNotchesFull(length, thickness, slotDepth, edge, negative=false, cen } /** - * Draws the bottom border mount for a straight chunk + * Draws the barrier holder for a straight chunk * @param Number length - The length of the chunk - * @param Number sheetThickness - The thickness of the sheet the border mount will hold. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number borderEdge - The width of each edge of the border mount. - * @param Number notchEdge - The width of a notch edge. + * @param Number bodyThickness - The thickness of the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number barrierBase - The base value used to design the barrier holder. + * @param Number notchBase - The width of a notch base. */ -module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, notchEdge) { +module straightBarrierHolder(length, bodyThickness, slotDepth, barrierBase, notchBase) { difference() { union() { rotate([90, 0, 90]) { negativeExtrude(height=length, center=true) { - borderBottomProfile( - slotWidth = sheetThickness + printTolerance, + barrierHolderProfile( + slotWidth = bodyThickness + printTolerance, slotDepth = slotDepth, - edge = borderEdge + base = barrierBase ); } } - translateZ(borderEdge) { + translateZ(barrierBase) { rotateX(90) { - borderNotchesFull( + barrierNotchesFull( length = length, - thickness = sheetThickness + borderEdge, + thickness = bodyThickness + barrierBase, slotDepth = slotDepth, - edge = notchEdge - printTolerance, + base = notchBase - printTolerance, negative = false, center = true ); } } translateX(-length / 2) { - borderHook( - edge = notchEdge, - thickness = borderEdge - printResolution * 2, + barrierHook( + base = notchBase, + thickness = barrierBase - printResolution * 2, negative = false ); } } translateX(length / 2) { - borderHook( - edge = notchEdge + printTolerance, - thickness = borderEdge - printResolution, + barrierHook( + base = notchBase + printTolerance, + thickness = barrierBase - printResolution, negative = true ); } @@ -160,75 +160,25 @@ module straightBorderBottom(length, sheetThickness, slotDepth, borderEdge, notch } /** - * Draws the top border mount for a straight chunk - * @param Number length - The length of the chunk - * @param Number sheetThickness - The thickness of the sheet the border mount will hold. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number borderEdge - The width of each edge of the border mount. - * @param Number notchEdge - The width of a notch edge. - */ -module straightBorderTop(length, sheetThickness, slotDepth, borderEdge, notchEdge) { - difference() { - union() { - rotate([90, 0, 90]) { - negativeExtrude(height=length, center=true) { - borderTopProfile( - slotWidth = sheetThickness + printTolerance, - slotDepth = slotDepth, - edge = borderEdge - ); - } - } - translateZ(borderEdge) { - rotateX(90) { - borderNotchesFull( - length = length, - thickness = sheetThickness + borderEdge, - slotDepth = slotDepth, - edge = notchEdge - printTolerance, - negative = false, - center = true - ); - } - } - translateX(-length / 2) { - borderHook( - edge = notchEdge, - thickness = borderEdge - printResolution * 2, - negative = false - ); - } - } - translateX(length / 2) { - borderHook( - edge = notchEdge + printTolerance, - thickness = borderEdge - printResolution, - negative = true - ); - } - } -} - -/** - * Draws the border sheet for a straight chunk + * Draws the barrier body for a straight chunk * @param Number length - The length of the chunk * @param Number height - The height of the chunk - * @param Number thickness - The thickness of the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number notchEdge - The width of a notch edge. + * @param Number thickness - The thickness of the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number notchBase - The width of a notch base. */ -module borderSheet(length, height, thickness, slotDepth, notchEdge) { +module barrierBody(length, height, thickness, slotDepth, notchBase) { difference() { box(size = [length, height, thickness], center = true); repeatMirror(axis=[0, 1, 0]) { translateY(-height / 2) { translateX(-length / 2) { - borderNotches( + barrierNotches( length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = notchEdge + printTolerance, + base = notchBase + printTolerance, negative = true, center = true ); @@ -239,24 +189,24 @@ module borderSheet(length, height, thickness, slotDepth, notchEdge) { } /** - * Draws the full border sheet for a straight chunk + * Draws the full barrier body for a straight chunk * @param Number length - The length of the chunk * @param Number height - The height of the chunk - * @param Number thickness - The thickness of the border sheet. - * @param Number slotDepth - The depth of the slot that will hold the border sheet. - * @param Number notchEdge - The width of a notch edge. + * @param Number thickness - The thickness of the barrier body. + * @param Number slotDepth - The depth of the slot that will hold the barrier body. + * @param Number notchBase - The width of a notch base. */ -module borderSheetFull(length, height, thickness, slotDepth, notchEdge) { +module barrierBodyFull(length, height, thickness, slotDepth, notchBase) { difference() { box(size = [length, height, thickness], center = true); repeatMirror(axis=[0, 1, 0]) { translateY(-height / 2) { - borderNotchesFull( + barrierNotchesFull( length = length, thickness = thickness + 1, slotDepth = slotDepth, - edge = notchEdge + printTolerance, + base = notchBase + printTolerance, negative = true, center = true ); diff --git a/rcmodels/tracks/test/wip.scad b/rcmodels/tracks/test/wip.scad index 192f9d7..20cc2a5 100644 --- a/rcmodels/tracks/test/wip.scad +++ b/rcmodels/tracks/test/wip.scad @@ -35,122 +35,99 @@ include <../util/setup.scad> // Sets the minimum facet angle and size using the defined render mode. applyMode(mode=renderMode) { - // test the bottom border profile - *borderBottomProfile( + // test the barrier profile + *barrierHolderProfile( slotWidth = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getBottomEdge() + slotDepth = getBarrierHolderDepth(), + base = getBarrierHolderBase() ); - // test the top border profile - *borderTopProfile( - slotWidth = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getTopEdge() - ); - // test the border notch profile - *borderNotchProfile( - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + // test the barrier notch profile + *barrierNotchProfile( + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), direction = -1, negative = true ); - // test the border notches profile - *borderNotchesProfile( - length = getChunkLength() / 2, - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + // test the barrier notches profile + *barrierNotchesProfile( + length = getChunkSize() / 2, + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), negative = true ); - // test the border hook shape - *borderHook( - edge = getNotchEdge(), - thickness = getNotchEdge(), + // test the barrier hook shape + *barrierHook( + base = getBarrierNotchBase(), + thickness = getBarrierNotchBase(), negative=false ); - // test the border notch shape - *borderNotch( + // test the barrier notch shape + *barrierNotch( thickness = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), direction = -1, negative = true, center = true ); - // test the border notches shape - *borderNotches( - length = getChunkLength(), + // test the barrier notches shape + *barrierNotches( + length = getChunkSize(), thickness = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), negative = true, center = true ); - // test the border notches shape for a full chunk - *borderNotchesFull( - length = getChunkLength(), + // test the barrier notches shape for a full chunk + *barrierNotchesFull( + length = getChunkSize(), thickness = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), negative = true, center = true ); - // test the bottom border mount shape for a straight chunk - *straightBorderBottom( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getBottomEdge(), - notchEdge = getNotchEdge() - ); - // test the top border mount shape for a straight chunk - *straightBorderTop( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getTopEdge(), - notchEdge = getNotchEdge() + // test the barrier holder shape for a straight chunk + *straightBarrierHolder( + length = getChunkSize(), + bodyThickness = getSlotWidth(), + slotDepth = getBarrierHolderDepth(), + barrierBase = getBarrierHolderBase(), + notchBase = getBarrierNotchBase() ); - // test the curved border notch - *curveBorderNotch( - radius = getChunkLength(), + // test the curved barrier notch + *curveBarrierNotch( + radius = getChunkSize(), thickness = getSlotWidth(), - slotDepth = getSlotDepth(), - edge = getNotchEdge(), + slotDepth = getBarrierHolderDepth(), + base = getBarrierNotchBase(), direction = 1, negative = true ); - // test the bottom border mount shape for a curved chunk - *curveBorderBottom( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getBottomEdge(), - notchEdge = getNotchEdge(), - ratio = 1 - ); - // test the top border mount shape for a curved chunk - *curveBorderTop( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getTopEdge(), - notchEdge = getNotchEdge(), + // test the barrier holder shape for a curved chunk + *curveBarrierHolder( + length = getChunkSize(), + bodyThickness = getSlotWidth(), + slotDepth = getBarrierHolderDepth(), + barrierBase = getBarrierHolderBase(), + notchBase = getBarrierNotchBase(), ratio = 1 ); - // test the border sheet shape for a straight chunk - *borderSheet( - length = getCurveRemainingLength(getChunkLength()), - height = getSheetHeight(), - thickness = getSheetThickness(), - slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + // test the barrier body shape for a straight chunk + *barrierBody( + length = getCurveRemainingLength(getChunkSize()), + height = getBarrierBodyHeight(), + thickness = getBarrierThickness(), + slotDepth = getBarrierHolderDepth(), + notchBase = getBarrierNotchBase() ); - // test the full border sheet shape for a straight chunk - borderSheetFull( - length = getChunkLength(), - height = getSheetHeight(), - thickness = getSheetThickness(), - slotDepth = getSlotDepth(), - notchEdge = getNotchEdge() + // test the full barrier body shape for a straight chunk + *barrierBodyFull( + length = getChunkSize(), + height = getBarrierBodyHeight(), + thickness = getBarrierThickness(), + slotDepth = getBarrierHolderDepth(), + notchBase = getBarrierNotchBase() ); } diff --git a/rcmodels/tracks/top-border-straight.scad b/rcmodels/tracks/top-border-straight.scad deleted file mode 100644 index 5b1b291..0000000 --- a/rcmodels/tracks/top-border-straight.scad +++ /dev/null @@ -1,47 +0,0 @@ - -/** - * @license - * GPLv3 License - * - * Copyright (c) 2020 Jean-Sebastien CONAN - * - * This file is part of jsconan/things. - * - * jsconan/things is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * jsconan/things is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with jsconan/things. If not, see . - */ - -/** - * A race track system for 1/24 to 1/32 scale RC cars. - * - * A top border mount for a straight track chunk. - * - * @author jsconan - * @version 0.1.0 - */ - -// Import the project's setup. -include - -// Sets the minimum facet angle and size using the defined render mode. -applyMode(mode=renderMode) { - // Uncomment the next line to cut a sample from the object - //sample(size=[DEFAULT_BUILD_PLATE_SIZE, DEFAULT_BUILD_PLATE_SIZE, 5], offset=[0, 0, 0]) - straightBorderTop( - length = getChunkLength(), - sheetThickness = getSlotWidth(), - slotDepth = getSlotDepth(), - borderEdge = getTopEdge(), - notchEdge = getNotchEdge() - ); -} diff --git a/rcmodels/tracks/util/functions.scad b/rcmodels/tracks/util/functions.scad index 5e97013..49578fd 100644 --- a/rcmodels/tracks/util/functions.scad +++ b/rcmodels/tracks/util/functions.scad @@ -44,99 +44,93 @@ function adjustToLayer(height) = roundBy(height, printResolution); function adjustToNozzle(width) = roundBy(width, nozzleWidth); /** - * Gets the thickness of the border sheet, adjusted to better fit the printer. + * Gets the thickness of the barrier body, adjusted to better fit the printer. * @returns Number */ -function getSheetThickness() = adjustToLayer(borderThickness); +function getBarrierThickness() = adjustToLayer(barrierThickness); /** - * Gets the width of the bottom border edge, adjusted to better fit the printer. + * Gets the base value used to design the barrier holder, adjusted to better fit the printer. * @returns Number */ -function getBottomEdge() = adjustToNozzle(borderBottomEdge); +function getBarrierHolderBase() = adjustToNozzle(barrierHolderBase); /** - * Gets the width of the top border edge, adjusted to better fit the printer. + * Gets the base value used to design the barrier notches, adjusted to better fit the printer. * @returns Number */ -function getTopEdge() = adjustToNozzle(borderTopEdge); +function getBarrierNotchBase() = adjustToNozzle(barrierNotchBase); /** - * Gets the width of the border notch edge, adjusted to better fit the printer. + * Gets the width of the slot that will hold the barrier body. * @returns Number */ -function getNotchEdge() = adjustToNozzle(borderNotchEdge); +function getSlotWidth() = getBarrierThickness(); /** - * Gets the width of the slot that will hold the border sheet. + * Gets the depth of the slot that will hold the barrier body. * @returns Number */ -function getSlotWidth() = getSheetThickness(); +function getBarrierHolderDepth() = adjustToLayer(barrierHolderDepth); /** - * Gets the depth of the slot that will hold the border sheet. + * Gets the nominal size of a track chunk. * @returns Number */ -function getSlotDepth() = adjustToLayer(borderSlotDepth); - -/** - * Gets the length of a track chunk. - * @returns Number - */ -function getChunkLength() = chunkLength; +function getChunkSize() = chunkSize; /** * Gets the length of a curved chunk (the length of the arc of the curve). - * @param Number chunkLength - The length of a straight chunk + * @param Number chunkSize - The length of a straight chunk * @returns Number */ -function getCurveLength(chunkLength) = getArcLength(radius = chunkLength, angle = 90); +function getCurveLength(chunkSize) = getArcLength(radius = chunkSize, angle = 90); /** * Gets the difference between the length of a curved chunk and a regular straight chunk - * @param Number chunkLength - The length of a straight chunk + * @param Number chunkSize - The length of a straight chunk * @returns Number */ -function getCurveRemainingLength(chunkLength) = getCurveLength(chunkLength) - chunkLength; +function getCurveRemainingLength(chunkSize) = getCurveLength(chunkSize) - chunkSize; /** - * Gets the height of the border sheet, depending on the option heightWithFasteners + * Gets the height of the barrier body, depending on the option heightWithFasteners * @returns Number */ -function getSheetHeight() = +function getBarrierBodyHeight() = let( correction = heightWithFasteners - ?-(borderBottomEdge + borderTopEdge) - :borderSlotDepth * 2 + ?-barrierHolderBase * 2 + :barrierHolderDepth * 2 ) - borderHeight + correction + barrierHeight + correction ; /** - * Gets the height of the assembled border, depending on the option heightWithFasteners + * Gets the height of the assembled barrier, depending on the option heightWithFasteners * @returns Number */ -function getBorderHeight() = +function getBarrierHeight() = let( - correction = heightWithFasteners ? 0 : borderBottomEdge + borderTopEdge + borderSlotDepth * 2 + correction = heightWithFasteners ? 0 : (barrierHolderBase + barrierHolderDepth) * 2 ) - borderHeight + correction + barrierHeight + correction ; /** - * Gets the minimal length for a simple sheet (a sheet that should fit between 2 border notches) + * Gets the minimal length for a simple body body (a body that should fit between 2 barrier notches) * @returns Number */ -function getMinSheetLength() = 5 * getNotchEdge(); +function getMinBodyLength() = 5 * getBarrierNotchBase(); /** * Gets the minimal length for a straight chunk * @returns Number */ -function getMinStraightLength() = 2 * getMinSheetLength(); +function getMinStraightLength() = 2 * getMinBodyLength(); /** * Gets the minimal arc length for a curved chunk * @returns Number */ -function getMinCurveLength() = 3 * getMinSheetLength(); +function getMinCurveLength() = 3 * getMinBodyLength(); diff --git a/rcmodels/tracks/util/setup.scad b/rcmodels/tracks/util/setup.scad index 60ac35c..661c59a 100644 --- a/rcmodels/tracks/util/setup.scad +++ b/rcmodels/tracks/util/setup.scad @@ -43,20 +43,20 @@ include <../shapes/curve.scad> // Validate the critical constraints assert( - chunkLength >= getMinStraightLength(), + chunkSize >= getMinStraightLength(), str( - "The length for a track chunk is too small! The minimum length for a straight element is ", + "The size for a straight chunk is too small! The minimum length is ", getMinStraightLength(), ". The current value is ", - chunkLength + chunkSize ) ); assert( - getArcLength(radius = chunkLength, angle = 90) >= getMinCurveLength(), + getArcLength(radius = chunkSize, angle = 90) >= getMinCurveLength(), str( - "The length for a track chunk is too small! The minimum arc length for a curved element is ", + "The length for a curved chunk is too small! The minimum arc length is ", getMinCurveLength(), ". The current value is ", - getArcLength(radius = chunkLength, angle = 90) + getArcLength(radius = chunkSize, angle = 90) ) ); From 5f7a7a1ace8338f3072e3bca0d9c7f125896e02f Mon Sep 17 00:00:00 2001 From: jsconan Date: Fri, 7 Jan 2022 10:55:02 +0100 Subject: [PATCH 33/33] chore: add history file --- HISTORY.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 HISTORY.md diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..06a07f9 --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,11 @@ +# rc-tracks history + +## [Version 0.1.0](https://github.com/jsconan/rc-tracks/releases/tag/v0.1.0) + +Design a race track system for 1/24 to 1/32 scale RC cars. + +--- + +Import from the repository [jsconan/things](https://github.com/jsconan/things) + +Extract of the pull request https://github.com/jsconan/things/pull/37