Fixes in scripts:
scadrenderallrecurse
: render the child files from the root folder when recursingslic3rsliceallrecurse
: slice the child files from the root folder when recursing
Features:
-
Add a way to specify a string variable for the CLI scripts.
The script helper
varif()
will build a string variable when a third parameter is set:varif "foo" "bar" # will write foo=bar varif "foo" "bar" # will write foo="bar"
Fixes:
- Fix the wrong license header in the scripts.
Add operators extruding polygons given as points.
extrudePolygon()
: Extrudes a polygon defined by the given points, optionally increasing the size by adding a distance to the outline.extrudePolygonBox()
: Extrudes a box defined by the given polygon points, optionally increasing the size by adding a distance to the outline.
Add visual tests for the operators and the shapes. Add shapes and operators to present visual tests:
testElement(c="red", angle=0, size=1, center=false)
: Renders a test element. If no children is given, a cube with an arrow on top is rendered.testbedColor(alpha)
: Colorizes a test element.testbedExtrude(alpha)
: Extrudes and colorizes a test element.visualTest(index, length, width, title="test", margin=1, cols=0)
: Renders a test area, moving the tested shapes in it.visualTestSuite(length, width, title="test", margin=1, cols=0, center=false)
: Renders a test area for each child module, moving the tested shapes in it.
Fixes:
- properly use the build box and the render mode in the sample tube-cap
- typo in doc
- make the operation operator resilient to wrong parameters or children
- prevent dividing by 0 when
count
is 1 in rotate operator - a wrong function was used to get the size of the chamfered box
- set the default height to 1 if none supplied to the link shape
- take care of the h parameter in buildVolume
- properly position the sample from the object to slice
- assume default values in rotateOrigin
Add script utils:
distfile
: Makes sure a file exists. Otherwise creates a copy from the dist file.
Fix script utils:
- use the provided path to Slic3r to get the version in
slic3rversion
- use the function
slic3rversion
to get the version of Slic3r
Add core functions:
interpolationThreshold()
: Computes the threshold for a particular interpolation step considering the expected number of steps, and with respect to start and end thresholds.
Add operators:
presentAnimate()
: Presents the child modules only between the start and end thresholds, with respect to the$t
variable.
Update script utils:
- Add color for the warning messages.
- Add the function
buildpath
to build a destination path from a list of parts. - Add the function
scadversion
to get the version of the installed OpenSCAD. - Add the function
sclic3rversion
to get the version of the installed Slic3r. - Add the function
scadpreview
to render a capture of a SCAD model. - Add the function
scadecho
to capture the echos printed by a model. - Accept other parameters than variable definitions when calling OpenSCAD.
Add operators to ease scenes animation:
mirrorAnimate()
: Mirrors the child modules, interpolating the axis with respect to the$t
variable.resizeAnimate()
: Resizes the child modules, interpolating the sizes with respect to the$t
variable.rotateAnimate()
: Rotates the child modules, interpolating the angles with respect to the$t
variable.scaleAnimate()
: Scales the child modules, interpolating the scale ratios with respect to the$t
variable.translateAnimate()
: Translates the child modules, interpolating the coordinates with respect to the$t
variable.
Fixes:
- Use a less confusing parameter name for the domain of values applied to compute percentage ratio. This impacts
percentage()
,simpleInterpolationRange()
,interpolationRange()
,interpolationStep()
,simpleInterpolationRange2D()
,interpolationRange2D()
,interpolationStep2D()
,simpleInterpolationRange3D()
,interpolationRange3D()
,interpolationStep3D()
Add core functions:
percentage()
: Gets a percentage value as a number between -1 and 1.simpleInterpolationRange()
: Generates a range to interpolate a value given a step between 0 and 1, from a low and high value.interpolationRange()
: Generates a range to interpolate a value given a step between 0 and 1, from a list of values.interpolateStep()
: Interpolates a value given a step between 0 and 1.simpleInterpolationRange2D()
: Generates a range to interpolate 2D coordinates given a step between 0 and 1, from a low and high coordinate.interpolationRange2D()
: Generates a range to interpolate 2D coordinates given a step between 0 and 1, from a list of coordinates.interpolateStep2D()
: Interpolates 2D coordinates given a step between 0 and 1.simpleInterpolationRange3D()
: Generates a range to interpolate 3D coordinates given a step between 0 and 1, from a low and high coordinate.interpolationRange3D()
: Generates a range to interpolate 3D coordinates given a step between 0 and 1, from a list of coordinates.interpolateStep3D()
: Interpolates 3D coordinates given a step between 0 and 1.
Add core functions:
iToX()
: Extract the X-coordinate from a linear position.iToY()
: Extract the Y-coordinate from a linear position.
Refactor operators:
distributeGrid()
: Use the functions converting linear to 2D coordinates.repeatGrid()
: Use the functions converting linear to 2D coordinates.
Add core functions:
even()
: Tells whether a value is even or not.odd()
: Tells whether a value is odd or not.
Add constants:
ORIGIN_2D
: A 2D-vector for the origin coordinates.ORIGIN_3D
: A 3D-vector for the origin coordinates.
Add operators:
repeatAlternate()
: Repeats the children modulescount
times with the providedinterval
, only rendering the odd or even positions. This means that the children will be rendered less thancount
times as half of the positions will be left empty.repeatAlternate2D()
: Repeats the children modules in two directionscount
times with the providedinterval
, only rendering the odd or even positions. This means that the children will be rendered less thancount
times as half of the positions will be left empty.repeatAlternate3D()
: Repeats the children modules in three directionscount
times with the providedinterval
, only rendering the odd or even positions. This means that the children will be rendered less thancount
times as half of the positions will be left empty.
Refactor operators:
repeat2D()
: Use direct loop instead of nesting operators and duplicating the translates.repeat3D()
: Use direct loop instead of nesting operators and duplicating the translates.
Add core functions:
xAxis2D()
: Produces a 2D vector that only contains a value for the X-axis. Other components are zeroed.yAxis2D()
: Produces a 2D vector that only contains a value for the Y-axis. Other components are zeroed.xAxis3D()
: Produces a 3D vector that only contains a value for the X-axis. Other components are zeroed.yAxis3D()
: Produces a 3D vector that only contains a value for the Y-axis. Other components are zeroed.zAxis3D()
: Produces a 3D vector that only contains a value for the Z-axis. Other components are zeroed.
Add operators:
repeatGrid()
: Repeats the children modulecount
times and place each copy on a grid with the providedinterval
, up toline
elements per line.
Fix operators:
distributeGrid()
: The centering of elements was producing wrong results when the number of elements was lower than a line, or when the number of lines was even.
Fix a comparison issue occurring with complete(collection, start, end)
, when the collection start and end elements are very close to the elements to add. When these elements are different only after the Nth decimal, when N > 5, the function can add duplicate values.
Support update for OpenSCAD 2019 and OpenSCAD 2021.
Fixes:
- Warnings messages appearing after the update to OpenSCAD 2019.05.
- Failing unit tests after the update to OpenSCAD 2021.01.
Features:
- Improve the readability of the unit tests error report from the CLI script (at least with dark background).
Breaking changes:
- The default return value of some API have been changed (
rotp()
,mirp()
,arcp()
), when used with wrong parameters. - Use new API added by OpenSCAD 2019.05 to test types.
- Require OpenSCAD 2019.05 as minimal version.
Refactoring:
- Use dot notation indexing instead of list indexing when relevant.
Fix a script early break when the source path only contains folders.
Add script utils:
recursepath()
: print the list of subfoldersscadrenderallrecurse()
: render all files in the path and its sub-foldersslic3rsliceallrecurse()
: slice all files in the path and its sub-folders
Improve the util scripts, adding parameters to make them configurable.
./scripts/render.sh
:
Renders OpenSCAD files
Usage:
./scripts/render.sh [command] [-h|--help] [-o|--option value]
-h, --help Show this help
-i --input Set the folder that contains the input files (default: ./)
-o --output Set the folder that contains the output files (default: ./output)
-f --format Set the output format
-p --parallel Set the number of parallel processes
-c --clean Clean up the output folder before rendering
-r --recurse Recurse into sub-directories
./scripts/slice.sh
:
Slices model files
Usage:
./scripts/slice.sh [command] [-h|--help] [-o|--option value]
-h, --help Show this help
-i --input Set the folder that contains the input files (default: ./output)
-o --output Set the folder that contains the output files (default: ./dist)
-s --config Set the path to the config file
-f --format Set the output format
-p --parallel Set the number of parallel processes
-c --clean Clean up the output folder before rendering
-r --recurse Recurse into sub-directories
-ps --prusaslicer Use PrusaSlicer instead of Slic3r
./scripts/test.sh
:
Runs a tests suite for OpenSCAD files
Usage:
./scripts/test.sh [command] [-h|--help] [-o|--option value] "test suite"
-h, --help Show this help
-i --input Set the folder that contains the input files (default: ./test)
-o --output Set the folder that contains the output files (default: ./output)
-d --default Set the default test suite (default: suite)
-c --clean Clean up the output folder before running the tests suite
Add shapes to add a link between parts:
linkProfile(neck, bulb, w, h, rx, ry, dx, dy, distance = 0)
: Draws the profile of a link.link(neck, bulb, height, w, h, rx, ry, dx, dy, distance = 0, center=false)
: Draws a link.
Improve the internal handling of format and extension in the slicer script.
Rename the utils function sclic3rmodel
to slic3rformat
for better consistency in API.
Fix the message displayed by the script utils when no config file is set for the slicer.
Improve the render script utils:
scripts/utils/slic3r.sh
: set of function to apply Slic3r on model files.scripts/slice.sh
: slices each model file contained in a folder.
Fixes:
- Use of
buildBox()
andbuildPlate()
in samples - Missing history in previous releases
Add core functions:
getChordHeight()
: Gets the height of a chord given the radius and the anglegetChordDistance()
: Gets the distance to a chord given the radius and the length
Improve the render script utils:
- spawn several processes when rendering multiple files
- add function
scadprocesses()
: set and display the number of parallel processes to spawn when rendering multiple files
Rework the build box shapes, making them more consistent. They now offer a center
option, false
by default so that the build box will have its origin at [0, 0, 0]
.
Breaking change: the buildBox()
shape does not apply the render mode anymore.
Fixes:
- Fix the planarity of faces generated by the function
simplePolyhedronFaces()
. Generate triangles instead of rectangles. - Fix typos in annotations.
Improvements:
- Add the sinusoid command to the
path()
function. - Allow drawing sinusoid and co-sinusoid in reverse (from right to left instead of left to right).
- Allow adding an initial translation to sinusoid and co-sinusoid.
- add function
tolower()
in render script utils: print the value to lower case - add function
toupper()
in render script utils: print the value to upper case - add function
scadformat()
in render script utils: set the output format for rendered files
Breaking changes:
scadtostl()
renamed toscadrender()
scadtostlall()
renamed toscadrenderall()
- add a
suffix
parameter toscadrender()
andscadrenderall()
Add operators:
repeatMap(map, offset, x, y, z)
: Repeats the children modules on every position given in themap
.repeatRotateMap(map, offset, x, y, z)
: Repeats the children modules on every angle given in themap
.
Improvements:
- Add an option to center the repeated shapes in
repeat*
,mirror*
,rotate*
, anddistributed*
operators,false
by default.
Add core functions:
getArcLength()
: Gets the length of an arc given the radius and the anglegetArcAngle()
: Gets the angle of an arc given the radius and the lengthgetChordLength()
: Gets the length of a chord given the radius and the anglegetChordAngle()
: Gets the angle of a chord given the radius and the length
Add shapes:
ringSegment(r, w, a=RIGHT, d, a1, a2, rx, ry, dx, dy, wx, wy)
: Creates a ring section at the origin.pipeSegment(r, h, w=0.1, a=90, d, a1, a2, rx, ry, dx, dy, wx, wy, center)
: Creates a pipe segment at the origin.
Fixes:
- Fixed wrong parameter name used in
chord()
shape
Add core functions:
times()
: fills an array by repeating a value N times. Arrays will be concatained. The result will be a flatten array.isNAN()
: Checks if the value is NAN (Not A Number).isInfinity()
: Checks if the value is infinite.
Fixes:
- Fix warnings that occurs when using
sinusoid()
orcosinusoid()
with an empty length. - Ignore empty var definitions in additional params for
scadcall()
- Missing parameter in
drawPlate()
. - Fix compatibility issue with camelSCAD and OpenSCAD 2019.05 due to change in strings management.
- check array of strings in
flatten()
- check string in
vadd()
,vsub()
,vmin()
,vmax()
,vpow()
,vabs()
,vsign()
- fix stricness issue in unit test for
apothem()
- improve detection of numbers
- check array of strings in
- Fix context initialization in unit tests, as a lot of warnings regarding context variables were displayed with OpenSCAD 2019.05.
Improvements:
- Improve the core function
path
by adding commands to nest or repeat a subpath. - Improve types management in core functions.
- Add constant
INFINITY
. - Add constant
NAN
. - Refactoring on the scripts side, adding some shared utils:
scripts/test.sh
: unit tests the project using thetest
folder. By default target the file namessuite.scad
.scripts/render.sh
: renders each OpenSCAD file contained in a folder.
Add core functions:
vangle()
: Computes the angle between two vectors.getAngle()
: Computes the angle of a point on a circle.vertexAngle2D()
: Computes the vertex angle given three 2D points.vertexAngle3D()
: Computes the vertex angle given three 3D points.vertexOutline2D()
: Computes the outline of a vertex at the given distance from the edges.outline()
: Computes the outline of a polygon. The outline can be at a particular distance.getPolygonAngle()
: Gets the angle value at a particular index in a regular polygon.lineAdd()
: Adds a value to each point of a line.simplePolyhedronFaces()
: Builds a vector of faces to be used in a polyhedron. The function accepts the number of points defining one main face of the polyhedron, then returns the faces vector that contains the indices of each face enclosing the solid. This only apply on simple polyhedron where two opposite faces share the same number of points.simplePolyhedronPoints()
: Composes a list of points to be used in a simple polyhedron.sizeCross()
: Computes the size of a cross shape.sizeCrossBox()
: Computes the size of a cross shape.drawCross()
: Computes the points that draws the sketch of a cross shape.quadrant()
: gets a point on a particular quadrant.
With the add of vangle()
and getAngle()
, the following functions have beed updated:
angle2D()
andangle3D()
now make use ofvangle()
to compute the angle instead of directly applying the formula.tangent2D()
,isosceles2D()
,protractor()
now make use ofgetAngle()
to compute the angles. The biggest change is on theprotractor()
that should always return a positive value within the0..360
range.
Add 2D shapes:
regularCross
: Creates a cross at the origin.
Add 3D shapes:
regularCrossBox()
: Creates a cross box at the origin.simplePolyhedron
: Creates a simple polyhedron, where only two opposite faces are defined by a list of points.
Add operators:
repeatShape2D(size, count=1)
: Repeats horizontally a shape on two directions, the interval is set by the shape size. An option allows to center the repeated shapes in repeatShape operators,false
by default.repeatShape3D(size, count=1)
: Repeats a shape on three directions, the interval is set by the shape size. An option allows to center the repeated shapes in repeatShape operators,false
by default.
Features:
- Filter the extension from the name of the package to test. Now the test script accept the name of a package with or without the extension. So both commands are now equivalent:
./scripts/test.sh core/vector-2d
./scripts/test.sh core/vector-2d.scad
Fixes:
- Fix non manifold issue in simplePolyhedron. The issue was due to a counter clock wise order used to define faces.
- Fix typo in the name of function
pythagoras()
(waspythagore()
before)
Add core functions:
parallel2D()
: computes a parallel line.intersect2D()
: computes the point at the intersection of two lines defined by four points.tangent2D()
: computes the point at the tangent between a circle and a line passing through a particular point.isosceles2D()
: computes the third edge of an isosceles triangle defined by the two other edges and either the height or the angle.protractor()
: computes the angle of a line defined by two points.extend2D()
: computes the 2D point at the wanted distance from the origin on the defined 2D line.extend3D()
: computes the 3D point at the wanted distance from the origin on the defined 3D line.apothem()
: Computes the apothem of a regular N-sides polygon. An apothem is a line from the center of a regular polygon at right angles to any of its sides.circumradius()
: Computes the radius of a circle circumscribing a regular N-sides polygon.quadraticEquation()
: Resolve a quadratic equation given the A, B and C terms.circleLineIntersect2D()
: Computes the points at the intersection of a circle and a line.circleIntersect2D()
: Computes the points at the intersection of two circles.
Add shapes:
chamferedRectangle(size, chamfer, l, w, cl, cw)
: Creates a chamfered rectangle at the origin.chamferedBox(size, chamfer, l, w, h, cl, cw, center)
: Creates a chamfered box at the origin.
Improvements on the core function path()
:
- accept either points or separated coordinates in commands
P
,L
, andT
. - added commands to compute intersection and tangent lines from the last point.
Fixes:
- Fix an issue occurring with the function
arc()
, when the provided angles are descending. - Fix misuse of cat command, that could lead to a performance issue.
Add core functions:
floorBy()
: Rounds a value by the provided unit to the lowest.ceilBy()
: Rounds a value by the provided unit to the highest.path()
: Computes a line/polygon from a path.
Bring back the samples into the main branch.
Fix a typo in the unit test of arcPoint.
Add bezier curves functions:
quadraticBezierPoint()
: computes the coordinates of a point along a quadratic bezier curve.cubicBezierPoint()
: computes the coordinates of a point along a cubic bezier curve.quadraticBezierCurve()
: computes the coordinates of a quadratic bezier curve.cubicBezierCurve()
: computes the coordinates of a cubic bezier curve.
Add core functions:
splice()
: Changes the contents of an array by removing existing elements and/or adding new elements.straight()
: Ensures an angle is defined within an absolute straight angle range (0..180).
Add global constants related to angles and circle quadrants, maximum recursion, ...
Shapes:
controlPoints()
: Displays a list of control points.
Fixes:
- Fix the computation of fragments in
sinusoid()
andcosinusoid()
- typo and other errors in annotations
New features:
- Core:
- Global constants (render modes, common values, default values, etc.)
- Operations on hex grids (position, size, count)
- Functions (maths:
roundBy()
,decimals()
, type:isZero()
, util:align()
) - Improved entry points (nested includes)
- Operators:
applyMode
: applies a render mode onto the children modules.negativeExtrude
: extrudes linearly the children modules, and applies a wall adjustment to ensure the final object will not produce artifacts after adifference()
operation.sample()
: takes a sample of the scene and place it at the origin.translateX()
,translateY()
,translateZ()
: translates the children modules along a particular axis.testUnitContext()
: declares a unit test context. That allows to isolate context data from other unit tests.
- Shapes:
- Hexagons can now be oriented (flat topped or pointy topped)
mesh()
,meshBox()
: creates a mesh with honeycomb cells using a hex grid pattern.buildPlate()
,buildVolume
,buildBox()
: shape operators that allow to visualize the build box context.
- Fixes:
- Annotations
- Better consistency in parameters of array operators
- Unit tests
First features of the library. More to come...