Module - Tool script <PRO>
This Lua module is used in the tool editor and provides functions for creating the tool geometry. This module can be used to generate geometry segments such as lines and arcs, from which the rotational profile for the tool is created.
The alignment and dimensions of the geometry segments are subject to certain restrictions:
- The segment must not intersect the tool axis.
- The end point of each segment in both axes must always be greater than or equal to the starting point (to avoid undercuts).
- Some parameters are contradictory. For example, an oblique line cannot have a fixed length and an absolute target coordinate at the same time.
Script sequence
A tool script works according to the following principle: The script is processed from the top line to the last line.
For each segment to be created, all parameters are first set with different functions. Then the command to create the segment is given.
The tool is constructed from the tool tip. The first element always starts at X0 and Z0. The geometry always ends at the maximum radius of the tool end, i.e. at the end of the shaft.
Geometry parameters
All length specifications are interpreted as user units.
All degrees start at 0° (parallel to the tool axis, vertical in the preview) and go up to 90° (perpendicular to the tool axis, horizontal in the preview).
Absolute coordinates refer to the tool radius (not to the diameter).
An overview of all functions and methods for setting the parameters are listed in the Lua chapter.
Example
tl = s2.tlgeo.new() -- Create a new tool geometry definition
tl:depthOfCut(5) -- Height of the cutting edge (always needed)
tl:toX(2) -- next line should reach global tool radius of 2
tl:emitLine() -- emit line
tl:arcRad(2) -- next arc should have a radius of 2
tl:slopeOut(10) -- next arc should end with angle 10
tl:emitArcA() -- emit arc
tl:tangent() -- next arc should be tangent to the last arc
tl:length(20) -- next line should have length 20
tl:emitLine() -- emit line
tl:slopeIn(45) -- next line should have a slope of 45
tl:toX(12) -- next line should have a global tool radius of 12
tl:emitLine() -- emit line
tl:toZ(80) -- next line should have a global tool length of 80
tl:emitLine() -- emit line
return tl -- return the generated tool geometry to the system

Note:
This example shows how a complex tool geometry can be created with just a few lines.