Moved no_point(str) from belt.scad to global.scad

This commit is contained in:
Chris Palmer 2020-09-06 11:51:33 +01:00
parent 1eb8b378e9
commit 04f2499a9e
3 changed files with 2 additions and 2 deletions

View File

@ -5798,6 +5798,7 @@ Global constants, functions and modules. This file is used directly or indirectl
| ```inch(x)``` | Inch to mm conversion (For fractional inches, 'inch(1 + 7/8)' will work as expected.) |
| ```m(x)``` | m to mm conversion |
| ```mm(x)``` | Explicit mm specified |
| ```no_point(str)``` | Replace decimal point in string with 'p' |
| ```r2sides(r)``` | Replicates the OpenSCAD logic to calculate the number of sides from the radius |
| ```r2sides4n(r)``` | Round up the number of sides to a multiple of 4 to ensure points land on all axes |
| ```sqr(x)``` | Returns the square of ```x``` |

View File

@ -31,6 +31,7 @@ function m(x) = x * 1000.0;
function sqr(x) = x * x; //! Returns the square of ```x```
function echoit(x) = echo(x) x; //! Echo expression and return it, useful for debugging
function no_point(str) = chr([for(c = str(str)) if(c == ".") ord("p") else ord(c)]);//! Replace decimal point in string with 'p'
function in(list, x) = !!len([for(v = list) if(v == x) true]); //! Returns true if ```x``` is an element in the ```list```
function Len(x) = is_list(x) ? len(x) : 0; //! Returns the length of a list or 0 if ```x``` is not a list
function r2sides(r) = $fn ? $fn : ceil(max(min(360/ $fa, r * 2 * PI / $fs), 5)); //! Replicates the OpenSCAD logic to calculate the number of sides from the radius

View File

@ -39,8 +39,6 @@ function belt_tooth_height(type) = type[4]; //! Tooth height
function belt_pitch_height(type) = type[5] + belt_tooth_height(type); //! Offset of the pitch radius from the tips of the teeth
function belt_pitch_to_back(type) = belt_thickness(type) - belt_pitch_height(type); //! Offset of the back from the pitch radius
function no_point(str) = chr([for(c = str) if(c == ".") ord("p") else ord(c)]);
//
// We model the belt path at the pitch radius of the pulleys and the pitch line of the belt to get an accurate length.
// The belt is then drawn by offseting each side from the pitch line.