Tool

From SDK
Jump to navigation Jump to search
Back.jpg

The Tool object represents a tool within the program. All the methods for creating toolpaths take one or more Tool objects as arguments. Any of the supported tool types can be accessed from the ToolDatabase as shown in the section describing the ToolDatabase:SelectTool() method. In addition, the most common tool types (BallNose, EndMill, VBit and Drill) can be created programmatically from Lua.

Constructor

Tool( string name, ToolType tool_type)

Create a new tool. Only a limited number of tool types are supported for creation from script. To access the full range of tools use the ToolDatabase:SelectTool() method to allow users to select tools from the tool database. Name (string) Name for the too to be created tool_type (integer)Type of tool to create.

Valid values are:
Tool.BALL_NOSE
Tool.END_MILL
Tool.VBIT
Tool.THROUGH_DRILL

NOTE: If you change ANY parameters or properties on a tool retrieved from an EXISTING toolpath, you MUST call UpdateParameters() after you have finished editing tool properties to flush the changes through to the toolpath.

Properties

.ClearStepover

Interaction: Read and Write

Returns:(double) Clearance pass stepover for tool (VBits only)


.InMM

Interaction: Read and Write

Returns:(bool) flag indicating if tool is in mm or inches


.FeedRate

Interaction: Read and Write

Returns:(double) Feedrate for tool (see RateUnits for the units)


.Name

Interaction: Read Only

Returns: (string) name of tool


.Notes

Interaction: Read and Write

Returns: (string) Notes field for tool . (Aspire 4.015 or VCP 7.015 onwards only)


.PlungeRate

Interaction: Read and Write

Returns: (double) Feed rate for tool

Note: see RateUnits for the units


.RateUnits

Interaction: Read and Write

Returns: (integer) Feed rate units for tool.
Valid values are:
Tool.MM_SEC
Tool.MM_MIN
Tool.METRES_MIN
Tool.INCHES_SEC
Tool.INCHES_MIN
Tool.FEET_MIN


.RateUnitsText

Interaction: Read Only

Returns: (string) Feed rate units for tool as a string for display For Example:

"mm or sec" or "inch or sec" 


.SpindleSpeed

Interaction: Read and Write

Returns:(integer) Spindle speed for tool


.Stepdown

Interaction: Read and Write

Returns:(double) Stepdown for tool


.Stepover

Interaction: Read and Write

Returns:(double) Stepover for tool


.ToolDB_Location

Interaction: Read Only

Returns: (string) path to tool in tool database

Note: not including tool name


.ToolType

Interaction: Read Only

Returns: (integer) an integer indicating the type of the tool values are:
Tool.BALL_NOSE
Tool.END_MILL
Tool.RADIUSED_END_MILL
Tool.VBIT
Tool.ENGRAVING
Tool.RADIUSED_ENGRAVING
Tool.THROUGH_DRILL
Tool.FORM_TOOL
Tool.DIAMOND_DRAG
Tool.RADIUSED_FLAT_ENGRAVING


.ToolTypeText

Interaction: Read Only

Returns: (string) a string indicating the type of the tool


.ToolDia

Interaction: Read and Write

Returns: (double) Diameter of tool


.ToolNumber

Interaction: Read and Write

Returns: (integer) Tool number for tool

.ToolDBId

Interaction: Read and Write

Returns: (integer) ToolDBId – The Id describing the location in the tool database

.VBit_Angle

Interaction: Read and Write

Returns: (double) Included angle for VBit tools

Methods

:ConvertRateUnitsTo( integer new_units)

Convert the feed and plunge rates for the tool into the passed units. new_units (integer)new units for feed and plunge rate.

Valid values are the same as for .RateUnits


:IsCompatibleFeedRates( Tool tool_to_check)

Returns: (bool) true if this tool has same feed, plunge and spindles speeds as passed tool. Does not check geometry or cut depths (see: IsCompatibleTool and :IsCompatibleCutDepthss)
tool_to_check (Tool) tool we check for compatibility

:IsCompatibleTool( Tool tool_to_check)

Returns: (bool) true if this tool is compatible (same type and geometry) as passed tool. Does not check cut depths or feed rates (see :IsCompatibleCutDepths and :IsCompatibleFeedRates for this data)
tool_to_check (Tool) tool we check for compatibility


:IsCompatibleCutDepths( Tool tool_to_check)

Returns: (bool) true if this tool is has same cut depths as passed tool. Does not check geometry or feed rates

(see: IsCompatibleTool and:IsCompatibleFeedRates)

Tool_to_check (Tool) tool we check for compatibility


:FlatRadius( bool in_mm)

Retrieve the flat radius for tools flat tools otherwise returns zero.

in_mm (bool) If true, return the tip radius in millimeters


:GetBool( string parameter_name, bool default_value)

Retrieve a Boolean flag (true or false) with the passed name, if no value with passed name returns the passed default value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name of the parameter
default_value(bool) the value which will be returned if there is no existing value stored


:GetDouble( string parameter_name, double default_value,)

Retrieve a double with the passed name, if no value with passed name returns passed default value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name of the parameter
default_value(double) the value which will be returned if there is no existing value stored

:GetInt( string parameter_name, integer default_value)

Retrieve an integer with the passed name, if no value with passed name returns the passed default value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name of the parameter
value (integer) the value which will be returned if there is no existing value stored


:ParameterExists( string parameter_name, utParameterType type)

Returns: (bool) true if there is an existing parameter with passed name and type. (Aspire 4.015 or VCP 7.015 onwards only)
parameter_name (string) the name of the parameter
type (utParameterType) the type of parameter

:SetBool(string parameter_name, bool value)

Store a Boolean flag (true or false) with the passed name and value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name which will be used to store and retrieve the value
value (bool) the value which will be stored in the parameter list


:SetDouble(string parameter_name, double value)

Store a double with the passed name and value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name which will be used to store and retrieve the value
value(double) the value which will be stored in the parameter list


:SetInt(string parameter_name, integer value)

Store an integer with the passed name and value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name which will be used to store and retrieve the value
value (integer) the value which will be stored in the parameter list


:SetString(string parameter_name, string value)

Store a string with the passed name and value. (Aspire 4.015 or VCP 7.015 onwards only)

parameter_name (string) the name which will be used to store and retrieve the value
value (string) the value which will be stored in the parameter list


:TipRadius( bool in_mm)

Retrieve the tip radius for tools of type Tool.RADIUSED_END_MILL or Tool.RADIUSED_ENGRAVING otherwise return zero.

in_mm (bool) If true, return the tip radius in millimeters


:UpdateParameters()

If editing a tool on an existing toolpath update feed rates and other parameters set on the tool to new values.

NOTE: You MUST call this method if you have edited any parameters on an existing tool, otherwise your changes will be ignored!

For Example:

 -- Create tool we will use to machine vectors
   local tool = Tool(
                     "Lua End Mill",
                      Tool.END_MILL      -- BALL_NOSE, END_MILL, VBIT
                    )
   tool.InMM = tool_in_mm
   tool.ToolDia = tool_dia
   tool.Stepdown = tool_stepdown
   tool.Stepover = tool_dia * 0.25
   tool.RateUnits = Tool.MM_SEC -- MM_SEC, MM_MIN, METRES_MIN,
                                -- INCHES_SEC, INCHES_MIN, FEET_MIN
   tool.FeedRate = 30
   tool.PlungeRate = 10
   tool.SpindleSpeed = 20000
   tool.ToolNumber = 1
   tool.VBitAngle = 90.0                    -- used for vbit only
   tool.ClearStepover = tool_dia * 0.5      -- used for vbit only




Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21, 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information