Class ToolOffsetTable
- Namespace
- Hi.NcParsers.Dependencys.Generic
- Assembly
- HiMech.dll
Integer-keyed tool offset table implementing IToolOffsetConfig. Suitable for Fanuc (H/D), Heidenhain (tool number), Mazak, Okuma, and other ISO-compatible controllers. Key = offset number (Fanuc H or D number).
public class ToolOffsetTable : INcDependency, IMakeXmlSource, IToolOffsetConfig
- Inheritance
-
ToolOffsetTable
- Implements
- Inherited Members
- Extension Methods
Constructors
ToolOffsetTable()
Initializes a new instance with an empty Offsets table.
public ToolOffsetTable()
ToolOffsetTable(XElement)
Initializes a new instance by deserializing from src.
public ToolOffsetTable(XElement src)
Parameters
srcXElementXML element produced by MakeXmlSource(string, string, bool).
Properties
Offsets
Tool offset rows keyed by offset number (Fanuc H or D number, Heidenhain tool number, etc.).
public Dictionary<int, ToolOffsetRow> Offsets { get; set; }
Property Value
XName
XML element name used to register this dependency with XFactory.
public static string XName { get; }
Property Value
Methods
GetToolHeightOffset_mm(int)
Gets the effective tool height offset (geometry - wear) in mm. Returns 0 if the offset number is not configured — indistinguishable from a configured zero; a consumer that must warn on a vacant row uses TryGetToolHeightOffset_mm(int, out double).
public double GetToolHeightOffset_mm(int offsetNumber)
Parameters
offsetNumberintOffset number: Fanuc H number, Heidenhain tool number, etc.
Returns
GetToolRadiusOffset_mm(int)
Gets the effective tool radius offset (geometry - wear) in mm. Returns 0 if the offset number is not configured — indistinguishable from a configured zero; a consumer that must warn on a vacant row uses TryGetToolRadiusOffset_mm(int, out double).
public double GetToolRadiusOffset_mm(int offsetNumber)
Parameters
offsetNumberintOffset number: Fanuc D number, Heidenhain tool number, etc.
Returns
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
SetToolOffset(int, double, double, double, double)
Sets all four offset components for the given offset number.
public void SetToolOffset(int offsetNumber, double idealHeight_mm, double axialWear_mm, double idealRadius_mm, double radialWear_mm)
Parameters
offsetNumberintidealHeight_mmdoubleaxialWear_mmdoubleidealRadius_mmdoubleradialWear_mmdouble
TryGetToolHeightOffset_mm(int, out double)
Attempts to get the effective tool height offset (geometry - wear)
in mm. Returns false when offsetNumber has
no configured row — the only reliable miss signal, since 0 is a
legal configured offset. The compensation syntaxes warn on a miss
(Comp-ToolHeight–RowMissing) instead of silently machining
with a zero-length tool.
public bool TryGetToolHeightOffset_mm(int offsetNumber, out double height_mm)
Parameters
offsetNumberintOffset number: Fanuc H number, Heidenhain tool number, etc.
height_mmdoubleThe effective height offset; 0 on miss.
Returns
TryGetToolRadiusOffset_mm(int, out double)
Attempts to get the effective tool radius offset (geometry - wear)
in mm. Returns false when offsetNumber has
no configured row (see TryGetToolHeightOffset_mm(int, out double)).
public bool TryGetToolRadiusOffset_mm(int offsetNumber, out double radius_mm)
Parameters
offsetNumberintOffset number: Fanuc D number, Heidenhain tool number, etc.
radius_mmdoubleThe effective radius offset; 0 on miss.
Returns
UpdateIdealByToolHouse(MachiningToolHouse, RadiusOffsetBasis)
Refreshes the ideal (geometry) components from the tool house — ideal
height = the tool's spindle-buckle→tool-tip length, ideal radius of a
milling-cutter row = the cutter profile's max radius under
CutterRadius or 0 under
ZeroBased — preserving accumulated
wear, and drops rows whose tool id no longer exists in the house.
Offset number maps 1:1 to the tool id. Mirrors the HardNc
MillingToolOffsetTable.UpdateIdealMillingToolOffsetTableByToolHouse
semantics so H/D offsets follow the tool house when the project's
IsIdealOffsetDependentOnToolHouse is on.
public void UpdateIdealByToolHouse(MachiningToolHouse toolHouse, RadiusOffsetBasis radiusBasis = RadiusOffsetBasis.CutterRadius)
Parameters
toolHouseMachiningToolHouseSource tool house; no-op when null.
radiusBasisRadiusOffsetBasisThe project's cutter-radius compensation strategy; decides the ideal radius written for milling-cutter rows. Heights are refreshed the same way under both.