Class MillingCutter
Represents a milling cutter with its geometric and physical properties.
public class MillingCutter : ICutter, IGetSweptable, IAnchoredDisplayee, IGetFletchMount, IMakeXmlSource, IAbstractNote, IAnchoredCollidableStem, IAnchoredCollidableNode, IAnchoredCollidableBased, IDisposable, INameNote, IGetFluteHeight, IDisplayee, IExpandToBox3d, IUpdateByContent, IClearCache, IGetThermalLayerList, ITopo, IGetAsmb, IGetAnchor, IGetTopoIndex, IGetAnchoredDisplayeeList, IDuplicate, IGetInitStickConvex, IVolumeRemover, IGetZrList
- Inheritance
-
MillingCutter
- Implements
- Inherited Members
- Extension Methods
Remarks
The cutter can be solid end or insert end. The term “Flute” is the edge part of the solid end cutter or the full insert of the insert end body. The term “Shank” is the full part except for edge part (i.e. Flute) of the solid end cutter. Shank and Flute compose the full cutter.
Constructors
MillingCutter()
Initializes a new instance of the MillingCutter class.
public MillingCutter()
MillingCutter(XElement, string, string, IProgress<IMessage>, object[])
Ctor.
public MillingCutter(XElement src, string baseDirectory, string relFile, IProgress<IMessage> progress, object[] res)
Parameters
srcXElementXML
baseDirectorystringBase directory path for resolving relative paths
relFilestringRelative file path
progressIProgress<IMessage>Progress reporter for diagnostic messages emitted during construction.
resobject[]Additional optional resources
Properties
AbstractNote
Gets a descriptive note or abstract about the object.
public string AbstractNote { get; }
Property Value
AnyThermalMaterialNotGiven
Whether a material the thermal model reads for this cutter — the flute material, the shank
material, a coating layer's material — is present with a thermal constant not given
(HasThermalConstants false: a material file without the element
reads it as NaN). Such a material is treated as the model treats a missing one: no thermal step
runs for the cutter (BuildCuttingTemperatureAndWear(SeqPhysicsState, MachineMotionStep, MachineMotionStep, double, SpindleCapability, IMachiningTool, Workpiece, int, Substraction, LayerMillingEngagement, MillingForceBrief, CoolantHeatCondition, CoolantMode, bool, MillingToolPhysicsPack, Action<string>)) and the
material is named where the thermal constants are checked
(Material-ThermalConstants–NotGiven). A null material is not judged here: its own
warning and the kernels' null guards own it.
public bool AnyThermalMaterialNotGiven { get; }
Property Value
BeamMaterial
The material the cutter's beam — the flute core and the exposed upper beam alike — is made of, which the deflection parameters and the yielding stress ratio read: a SolidEnd cutter is one piece of FluteMaterial (its ShankMaterial is a mirror of it, see the XML constructor), an InsertEnd cutter's beam is the body the inserts sit on, ShankMaterial. Null when that material is missing — never the other one in its place; the physics reports NaN rather than computing with a substitute.
public IStructureMaterial BeamMaterial { get; }
Property Value
CoatingLayerList
Gets or sets the list of coating thermal layers. The sequence starts from surface, i.e. from outer to inner.
public List<ThermalLayer1D> CoatingLayerList { get; set; }
Property Value
CollidableName
Gets the name of the collidable object.
public string CollidableName { get; }
Property Value
CutterTip
Gets the anchor point at the cutter tip.
public Anchor CutterTip { get; }
Property Value
DefaultAngleResolution_rad
Gets or sets the default angle resolution in radians.
public static double DefaultAngleResolution_rad { get; set; }
Property Value
DefaultLinearResolution_mm
Gets or sets the default linear resolution in millimeters.
public static double DefaultLinearResolution_mm { get; set; }
Property Value
DefaultShaperStlResolution
Mesh resolution a fresh cutter's shaper solid is born with — the explicit Setup-face display-quality contract. A play swaps the solid for one born with the runtime-derived resolution (see SetShaperStlResolution(PolarResolution2d)).
public static PolarResolution2d DefaultShaperStlResolution { get; }
Property Value
DefaultStlLongitudeNum
Gets or sets the default number of longitude lines for STL generation.
public static int DefaultStlLongitudeNum { get; set; }
Property Value
EffectiveCuttingDiameter_mm
Cutting Diameter for calculate cutting speed. Pure computation — deliberately uncached (see Hi.Milling.Cutters.MillingCutter.SideRakeAngle_rad); per-step session paths read the value from MillingToolPhysicsPack.
public double EffectiveCuttingDiameter_mm { get; }
Property Value
ExposedHeight_mm
Has to be simultanous with ExposedCutterHeight_mm.
public double ExposedHeight_mm { get; set; }
Property Value
FluteHeight_mm
Gets the height of the flute in millimeters.
public double FluteHeight_mm { get; }
Property Value
FluteMaterial
Material of the flute.
public CutterMaterial FluteMaterial { get; set; }
Property Value
FluteMaterialFile
Gets or sets the file path for the flute material definition.
public string FluteMaterialFile { get; set; }
Property Value
Fluting
Gets or sets the cutter's fluting — the whole set of flute contours, either one shared baseline repeated evenly around the cutter (UniformFluting) or one contour defined per flute (FreeFluting).
public IFluting Fluting { get; set; }
Property Value
FullHeight_mm
Gets the full height of the cutter in millimeters.
public double FullHeight_mm { get; }
Property Value
HoneRadius_mm
Gets or sets the hone radius in millimeters.
public double HoneRadius_mm { get; set; }
Property Value
HoneRadius_um
Gets the hone radius in micrometers.
public double HoneRadius_um { get; set; }
Property Value
InnerBeamProfile
Gets or sets the inner beam profile.
public IShaperProfile InnerBeamProfile { get; set; }
Property Value
Remarks
InnerBeamProfile may be dependent on ShaperProfile. InnerBeamProfile.ClearCache() and initialization must be performed after ShaperProfile.ClearCache() and initialization.
InsertNum
Gets or sets Insert Number. The property should be used Only if IntegralMode is InsertEnd. However, there is no exception mechanism.
public int InsertNum { get; set; }
Property Value
InsertThickness_mm
Thickness of an insert. Only available if the cutter is InsertEnd.
public double InsertThickness_mm { get; set; }
Property Value
IntegralMode
Gets or sets the main integral mode of the cutter.
public MillingCutter.IntegralModeEnum IntegralMode { get; set; }
Property Value
IsSpinningCutter
Is cutter spining when machining.
public bool IsSpinningCutter { get; }
Property Value
- bool
Is cutter spining when machining.
MillingCutterOptLimit
The cutter's own NC optimization limit: whether the lines it cuts may be
optimized, and the bounds on its feed per tooth. A new cutter, and a
cutter read from XML whose element is empty or missing, carry
new MillingCutterOptOption(); a duplicate carries what its source
holds, so only code assigning null makes a cutter without one.
The optimizer optimizes no line of a tool whose limit is null or has
EnableOpt off — they keep their
source feeds — and warns once per tool that it did.
public MillingCutterOptOption MillingCutterOptLimit { get; set; }
Property Value
Name
Name.
public string Name { get; set; }
Property Value
Note
Note.
public string Note { get; set; }
Property Value
ReliefAngle_deg
Gets or sets the relief angle in degrees.
public double ReliefAngle_deg { get; set; }
Property Value
ReliefAngle_rad
Gets or sets the relief angle in radians.
public double ReliefAngle_rad { get; set; }
Property Value
ShankMassAssignmentMode
Gets or sets the mass assignment mode for the shank.
public MillingCutter.MassAssignmentMode ShankMassAssignmentMode { get; set; }
Property Value
ShankMass_g
Gets or sets the cutter shank mass in grams. If IntegralMode is SolidEnd, the mass is the full cutter mass. If IntegralMode is InsertEnd, the mass is the shank mass. since the flute mass is assumed small and dynamic depends on the CWE (Cutter-Workpiece-Engagement).
public double ShankMass_g { get; set; }
Property Value
ShankMaterial
Material of the shank: the mass and the thermal model read it. On a SolidEnd cutter it mirrors FluteMaterial (the XML constructor and the web service's material endpoints keep it so); on an InsertEnd cutter it is the body the inserts sit on, and the beam physics read it through BeamMaterial. The default is a 42CrMo steel, the usual insert-cutter body.
public IStructureMaterial ShankMaterial { get; set; }
Property Value
ShankMaterialFile
Gets or sets the file path for the shank material definition. Mirrors FluteMaterialFile on a SolidEnd cutter.
public string ShankMaterialFile { get; set; }
Property Value
ShaperProfile
Gets or sets the shaper profile that defines the cutter's shape.
public IShaperProfile ShaperProfile { get; set; }
Property Value
ShaperProfileRefusesGeometry
Whether the ShaperProfile is an AptProfile whose APT
refuses its flute geometry (RefusesGeometry): the cutter
then has no flute envelope — GetZrList(), GetSweptable(double)
and GetInitStickConvex() are all null — and the checks that read
the flute ZR list (the upper-beam / shank ones) have nothing to judge.
public bool ShaperProfileRefusesGeometry { get; }
Property Value
ShaperTopoBrick
cutable part of cutter. the part cut the workpiece if overlapped.
public ITopoBrick ShaperTopoBrick { get; }
Property Value
SingleInsertMass_g
Gets or sets the total inserts' mass in grams. The property should be used Only if IntegralMode is InsertEnd. However, there is no exception mechanism.
public double SingleInsertMass_g { get; set; }
Property Value
StrutTopoBrick
uncutable part of cutter. the part triggers collision to workpiece if overlapped.
public ITopoBrick StrutTopoBrick { get; }
Property Value
SumInsertMass_g
Gets the total mass of all inserts in grams calculated from SingleInsertMass_g * InsertNum.
public double SumInsertMass_g { get; }
Property Value
SurfaceMaterial
Gets the surface material of the cutter.
public CutterMaterial SurfaceMaterial { get; }
Property Value
UpperBeamGeom
Gets the upper beam geometry of the cutter.
public IGetStl UpperBeamGeom { get; set; }
Property Value
XName
Name for XML IO.
public static string XName { get; }
Property Value
Methods
ClearCache()
Clears all cached data.
public void ClearCache()
ClearThermalLayerListCache()
Clears the thermal layer list cache (the flute layers and the shank's thermal contour) and moves the cache generation, so a list a reader is building across the clear is not published under an unchanged generation. ClearCache() drops the same two caches and moves the generation once, at its end.
public void ClearThermalLayerListCache()
Display(Bind)
Display function called in DispEngine rendering loop.
public void Display(Bind bind)
Parameters
bindBindBind with DispEngine. See Bind.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
Duplicate(params object[])
Creates a deep copy of the object, excluding any source file references.
public object Duplicate(params object[] res)
Parameters
resobject[]Optional parameters that may be needed during the duplication process
Returns
- object
A new instance that is a deep copy of the original object
ExpandToBox3d(ref box3d_t)
Expands the destination box.
This function is usually used to compute the bounding box of elements.
box3d_t is a value type, so the destination is passed by reference
(the C++ expand_to_box3d(box3&) shape); an implementation writes
dst = dst.Expanded(...) or forwards ref dst to its parts.
public void ExpandToBox3d(ref box3d_t dst)
Parameters
dstbox3d_tDestination box, expanded in place
GetAnchor()
Get key anchor. (i.e. root anchor)
public Anchor GetAnchor()
Returns
- Anchor
key anchor
GetAnchoredCollidableNode()
Gets the anchored collidable node associated with this object.
public IAnchoredCollidableNode GetAnchoredCollidableNode()
Returns
- IAnchoredCollidableNode
The anchored collidable node.
GetAnchoredCollidables()
Gets the list of anchored collidable nodes contained by this stem.
public List<IAnchoredCollidableNode> GetAnchoredCollidables()
Returns
- List<IAnchoredCollidableNode>
A list of anchored collidable nodes.
GetAnchoredDisplayeeList()
Gets a list of anchored displayable objects.
public List<IAnchoredDisplayee> GetAnchoredDisplayeeList()
Returns
- List<IAnchoredDisplayee>
A list of IAnchoredDisplayee objects
GetAsmb()
Gets the key asmb.
public Asmb GetAsmb()
Returns
- Asmb
The key asmb.
GetBeamCompliance()
The compliance of the exposed cutter as a cantilever gripped at the
holder (z = ExposedHeight_mm), as a function of the
height its load sits at — see CutterBeamCompliance. The
beam is the InnerBeamProfile contour (the flute core)
continued by UpperBeamGeom, both ending at the grip,
sliced to at most min(0.1 mm, L/1000); E is the
BeamMaterial's ElasticModulus_GPa.
Pure computation, deliberately uncached (a lazy cache on this shared
object races with the parallel per-step force build); the per-step
session paths read the frozen copy in
BeamCompliance.
Null when the beam material is missing or the exposed height is not
positive — a tool whose ExposedCutterHeight_mm
was never set hands its 0 to the cutter it mounts — since no beam is no
compliance to state, not a rigid tool.
public CutterBeamCompliance GetBeamCompliance()
Returns
- CutterBeamCompliance
The compliance, or null.
Exceptions
- Exception
The inner beam contour has fewer than two points, so there is no beam to integrate.
GetCutterFluteDisplayee()
Gets the cutter flute displayee for visualization.
public IAnchoredDisplayee GetCutterFluteDisplayee()
Returns
- IAnchoredDisplayee
The anchored displayee for the cutter flute.
GetDeflectionPara_umdN(out double, out double)
The compliance of the exposed cutter for a load at its tip (z = 0):
bendingPara_umdN is the lateral tip deflection per
unit lateral tip force, ∫₀ᴸ z²/(E·I(z)) dz with the area moment
I = π·r⁴/4, zDeflectionPara_umdN the axial
shortening per unit axial force, ∫₀ᴸ 1/(E·A(z)) dz with A = π·r²; with
E in GPa and lengths in mm both are in µm/N. These are the tip end of
the curve GetBeamCompliance() builds: the per-step
deflection reads that curve at the height the step's cutting force
sits at, which is the tip for a cutter engaged at its bottom. Both are
NaN when there is no beam to state (null from
GetBeamCompliance()) and on a pointed cutter — a cone, a
drill, a V bit — whose tip is a point no load can sit on
(IsPointed): the tip integral has
no limit there, and the number a slice width would produce is not
stated.
public void GetDeflectionPara_umdN(out double bendingPara_umdN, out double zDeflectionPara_umdN)
Parameters
bendingPara_umdNdoubleLateral tip deflection per unit lateral tip force, µm/N.
zDeflectionPara_umdNdoubleAxial tip deflection per unit axial force, µm/N.
Exceptions
- Exception
The inner beam contour has fewer than two points, so there is no beam to integrate.
GetFletchMount()
Get fletch mount anchor. the anchor that generally connect to fixed part such as ground and triggering(motor)-side.
public Anchor GetFletchMount()
Returns
- Anchor
mount anchor
GetFluteThermalLayerList()
Flute material layer From outer(i.e. surface) to inner; null when the APT refuses its geometry (ShaperProfileRefusesGeometry): no flute envelope, no flute thermal layers, as GetZrList(), the shaper profile's GenStl(IPolarResolution2d) and GetInitStickConvex() answer for it.
public List<ThermalLayer1D> GetFluteThermalLayerList()
Returns
GetGuessShankMass_g()
Get guess mass by volume and density. The volume is count from InnerBeamProfile and UpperBeamGeom.
public double GetGuessShankMass_g()
Returns
GetInitStickConvex()
A share of the stick convex (see InitStickConvex), which the caller owns
and gives back with Dispose() (a using; the
subtraction keeps it on its GeomBoolCache, which gives it back when the
step is done); null when there is none. Every call is one share of the same
native object; the native object is freed when the profile has cleared its cache and
every share is given back.
public InitStickConvex GetInitStickConvex()
Returns
- InitStickConvex
A share the caller owns, or
null
GetMinimumUncutChipThickness_mm(ICuttingPara)
Gets the minimum uncut chip thickness in millimeters for the specified cutting parameters. The value is dependent on HoneRadius_um. Pure computation — deliberately uncached (see GetStagnantAngle_rad(ICuttingPara)); session paths read the value from MillingToolPhysicsPack.
public double GetMinimumUncutChipThickness_mm(ICuttingPara millingPara)
Parameters
millingParaICuttingParaThe cutting parameters to use for calculation.
Returns
- double
The minimum uncut chip thickness in millimeters.
GetMinimumUncutChipThickness_um(ICuttingPara)
Gets the minimum uncut chip thickness in micrometers for the specified cutting parameters.
public double GetMinimumUncutChipThickness_um(ICuttingPara millingPara)
Parameters
millingParaICuttingParaThe cutting parameters to use for calculation.
Returns
- double
The minimum uncut chip thickness in micrometers.
GetNobleAnchoredDisplayee()
Gets a noble anchored displayee for visualization.
public AnchoredDisplayee GetNobleAnchoredDisplayee()
Returns
- AnchoredDisplayee
The anchored displayee.
GetShaperProfileIssues()
The issue ReportShaperProfileIssues(IProgress<IMessage>, object) would report, as an
(Id, Message) pair — the id in the structured-id convention of the
IMessage channel (Cutter-ShaperProfile–AptRefused), the message
its rendered English notification. Empty when the profile agrees with itself or
is not APT based.
The web API's edit-time view of the same detection (warnings[] of the
shaper-profile endpoint).
public List<(string Id, string Message)> GetShaperProfileIssues()
Returns
GetSweptable(double)
Get Sweptable.
public Sweptable GetSweptable(double fractionTolerance)
Parameters
fractionTolerancedoubleThe fraction tolerance for the sweptable.
Returns
- Sweptable
Sweptable
GetTestBallCutter()
Creates a test ball cutter.
public static MillingCutter GetTestBallCutter()
Returns
- MillingCutter
A new ball cutter instance for testing.
GetTestBottomCutter()
Creates a test bottom cutter.
public static MillingCutter GetTestBottomCutter()
Returns
- MillingCutter
A new bottom cutter instance for testing.
GetTestFreeCutter()
Creates a test free cutter.
public static MillingCutter GetTestFreeCutter()
Returns
- MillingCutter
A new free cutter instance for testing.
GetThermalLayerList()
Gets the list of thermal layers.
public List<ThermalLayer1D> GetThermalLayerList()
Returns
- List<ThermalLayer1D>
List of thermal layers.
GetUpperBeamGeometryIssues()
The issues ReportUpperBeamGeometryIssues(IProgress<IMessage>, object) would report, as
(Id, Message) pairs — the id in the structured-id convention of the
IMessage channel (e.g. Cutter-UpperBeam–ExtendedCylinderFullLengthTooShort),
the message its rendered English notification. Empty when the upper beam has no
ZR contour, the beam is consistent and the shank model builds (or fails for a reason
that is not the beam's), or the flute profile refuses its geometry.
The web API's edit-time view of the same detection (warnings[] of the
upper-beam endpoints).
public List<(string Id, string Message)> GetUpperBeamGeometryIssues()
Returns
GetZrList()
Gets a list of Z-R coordinate pairs.
public List<PairZr> GetZrList()
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
and chains Reg(factory) on dependents. Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory
ReportShaperProfileIssues(IProgress<IMessage>, object)
Reports the self-agreement issue of an APT ShaperProfile — the
setting that used to surface nowhere: a sharp-cornered APT whose parameters
contradict each other (the BCAM blade Showcase case, a TaperApt
whose Rz was meant as a ball round) was built as an infinite bottom cone that
the step-by-step subtraction path removed from the stock 20 mm clear of the
cutter — at most one per call. A refusing APT (RefusesGeometry:
a sharp corner or a round off its lines by more than the tolerance, D off the
flank/bottom meeting point, a round across the stick axis, an angle out of range)
is a ConfigurationError: no flute envelope is built, so the tool removes
no material and runs no cutting physics. Nothing is reported when the profile is
not APT based, has no APT, or agrees with itself — within the tolerance it is
snapped to the exact values silently (see AptDerivative). The
wording lives here, one literal id and one literal template, because the
engine-message gate reads both off the call: the runner hands in its
step-anchored sink at tool change, the web API a MessageCollector
through GetShaperProfileIssues() (post-edit validation warnings).
public int ReportShaperProfileIssues(IProgress<IMessage> sink, object detail = null)
Parameters
sinkIProgress<IMessage>Destination of the message; null is a no-op.
detailobjectOptional detail payload attached to the message — the runner names the tool here, since the template is shared with the web API and cannot carry a tool prefix.
Returns
- int
The number of issues detected, 0 or 1 — reported on
sinkwhen it is non-null.
ReportUpperBeamGeometryIssues(IProgress<IMessage>, object)
Reports the configuration issue on the upper-beam / shank geometry — the
settings that used to surface only as an opaque per-step
NullReferenceException cascade inside the thermal physics
(e.g. an ExtendedCylinder beam whose
FullLength is below the flute height, so the
shank solid inverts and Hi.Milling.Cutters.MillingCutter.GetShankThermalZrList() cannot build) —
as a ConfigurationError on sink, at most one per
call. Nothing is reported when the upper beam has no ZR contour — none configured
(a legal state: the shank thermal model is built from the inner beam alone), or an
empty or unloaded one — when the beam is consistent and the shank model builds, or
when the flute profile refuses its geometry (ShaperProfileRefusesGeometry:
the beam's start section reads the flute ZR list, which then does not exist, so the
refusal is the one finding). A shank thermal model that cannot build for a reason
that is not the beam's is not a geometry issue either: no inner-beam profile (the
physics runner says Cutter-Shank–ThermalModelUnavailable), or a shank material
that is missing or has a thermal constant not given
(HasThermalConstants) — the runner's material
warnings name the material and the thermal step is skipped for the cutter.
The wordings live
here, one literal id and one literal template per emit, because the
engine-message gate reads both off the call: the physics runner hands in its
step-anchored sink at tool change, the web API a MessageCollector
through GetUpperBeamGeometryIssues() (post-edit validation warnings).
public int ReportUpperBeamGeometryIssues(IProgress<IMessage> sink, object detail = null)
Parameters
sinkIProgress<IMessage>Destination of the error; null is a no-op.
detailobjectOptional detail payload attached to the error — the runner names the tool here, since the templates are shared with the web API and cannot carry a tool prefix.
Returns
- int
The number of issues detected, 0 or 1 — reported on
sinkwhen it is non-null.
SetShaperStlResolution(PolarResolution2d)
Equips the runtime-derived mesh resolution: swaps the shaper solid for one
born with resolution and drops the swept-mesh cache; a
matching resolution keeps the current solid untouched. Runtime-only — the
authored cutter data and its serialized form never carry the value. The
strut (upper-beam) solid is equipped by the sibling
SetStrutStlResolution(PolarResolution2d).
public void SetShaperStlResolution(PolarResolution2d resolution)
Parameters
resolutionPolarResolution2dRuntime-derived mesh resolution; null lets the shaper profile apply its own default.
SetStrutStlResolution(PolarResolution2d)
Equips the runtime-derived mesh resolution on the strut (upper-beam) solid — the same swap-not-mutate contract as SetShaperStlResolution(PolarResolution2d): a matching resolution keeps the current solid untouched, and the authored cutter data never carries the value. At rest the strut solid stays on its born-with null resolution (the geometry's own default).
public void SetStrutStlResolution(PolarResolution2d resolution)
Parameters
resolutionPolarResolution2dRuntime-derived mesh resolution; null lets the geometry apply its own default.
UpdateByContent()
Updates the object based on its current content.
public void UpdateByContent()