Table of Contents

Class SetupAngleEstimationCommand

Namespace
Hi.SessionCommands
Assembly
HiNc.dll

Command that estimates a cutter's setup angle — how far it is turned in the holder, SetupAngle_deg — from the smart holder's recording of the tool's first seconds of contact, and (unless the gate refuses) applies it to the tool and recomputes the finished steps. The mission-list form of ArmSetupAngleEstimation(int, double, string, bool, string, double, string, SampleFlag) (Timing = DuringThePlay, before the program) and of EstimateSetupAngleByFirstContact(int, double, string, bool, string, double, string, int, SampleFlag) (Now, after it). The channels the estimate reads are the command's own selection (UseMx, UseMy, UseMz — the sampleFlags of the script forms); a selection the tool's holder does not declare is refused by the engine (Sample-Channel–NotObserved), never guessed.

[CultureText("zh-Hant", "安裝角估算")]
[CultureText("zh-Hans", "安装角估算")]
[CultureText("vi", "Ước lượng góc gá dao")]
[CultureText("ja", "取付け角の推定")]
[CultureText("zh-Hant", "下一把接觸的刀", Key = "Next Tool")]
[CultureText("zh-Hans", "下一把接触的刀", Key = "Next Tool")]
[CultureText("vi", "Dao tiếp theo", Key = "Next Tool")]
[CultureText("ja", "次に切削する工具", Key = "Next Tool")]
[CultureText("zh-Hant", "智慧刀把", Key = "Smart Holder")]
[CultureText("zh-Hans", "智能刀把", Key = "Smart Holder")]
[CultureText("vi", "Đầu kẹp thông minh", Key = "Smart Holder")]
[CultureText("ja", "インテリジェントホルダ", Key = "Smart Holder")]
[CultureText("zh-Hant", "估算", Key = "Estimate")]
[CultureText("zh-Hans", "估算", Key = "Estimate")]
[CultureText("vi", "Ước lượng", Key = "Estimate")]
[CultureText("ja", "推定", Key = "Estimate")]
[CommandCatalog(CommandCategory.Measurement, Order = 0, Aliases = new string[] { "Smart Holder", "Estimate" })]
public class SetupAngleEstimationCommand : ITitleCommand, ISessionCommand, IMakeXmlSource
Inheritance
SetupAngleEstimationCommand
Implements
Inherited Members
Extension Methods

Constructors

SetupAngleEstimationCommand()

Default constructor: during the play, the next tool that cuts, its first 30 s of contact, Mx and My, applied to the tool.

public SetupAngleEstimationCommand()

SetupAngleEstimationCommand(XElement, string)

Ctor. An absent element keeps the property's default; an unknown Timing or channel text keeps the default too.

public SetupAngleEstimationCommand(XElement src, string baseDirectory)

Parameters

src XElement

XML

baseDirectory string

Base directory for resolving relative paths

Properties

ApplyToTool

Advance the tool's setup angle by the estimate and recompute the finished steps; false only reports. The gate still refuses a low-contrast, widely scattered or mirror-preferred estimate, and a one-channel estimate of a one- or two-flute cutter with two candidate angles (GetApplyRefusal(SetupAngleEstimate, double)).

[CultureText("zh-Hant", "套用到刀具")]
[CultureText("zh-Hans", "应用到刀具")]
[CultureText("vi", "Áp dụng cho dao")]
[CultureText("ja", "工具に適用")]
public bool ApplyToTool { get; set; }

Property Value

bool

ContactSeconds

Contact time to sample: the tool's touched steps from its first cut until their durations sum to this.

[CultureText("zh-Hant", "接觸秒數")]
[CultureText("zh-Hans", "接触秒数")]
[CultureText("vi", "Thời gian tiếp xúc")]
[CultureText("ja", "接触時間")]
public double ContactSeconds { get; set; }

Property Value

double

DstRelFile

Optional JSON report (relative to the project directory); blank = none.

[CultureText("zh-Hant", "報告檔(JSON,選用)", Key = "Report File (JSON)")]
[CultureText("zh-Hans", "报告文件(JSON,可选)", Key = "Report File (JSON)")]
[CultureText("vi", "Tệp báo cáo (JSON)", Key = "Report File (JSON)")]
[CultureText("ja", "レポートファイル (JSON)", Key = "Report File (JSON)")]
public string DstRelFile { get; set; }

Property Value

string

KnownParaRelFile

Optional cutting-parameter file (relative to the project directory) to build the model from instead of the workpiece's. It must not come from this holder at an unknown angle. Blank = the workpiece's.

[CultureText("zh-Hant", "已知切削參數檔(空白=工件的)", Key = "Known Cutting Parameter File")]
[CultureText("zh-Hans", "已知切削参数文件(空白=工件的)", Key = "Known Cutting Parameter File")]
[CultureText("vi", "Tệp thông số cắt đã biết", Key = "Known Cutting Parameter File")]
[CultureText("ja", "既知の切削パラメータファイル", Key = "Known Cutting Parameter File")]
public string KnownParaRelFile { get; set; }

Property Value

string

OutlierRatio

Fraction of the worst-fitting steps trimmed before the final estimate.

[CultureText("zh-Hant", "離群修剪比例")]
[CultureText("zh-Hans", "离群修剪比例")]
[CultureText("vi", "Tỷ lệ loại bỏ giá trị ngoại lai")]
[CultureText("ja", "外れ値除外率")]
public double OutlierRatio { get; set; }

Property Value

double

SampleFlags

The channels as one flag — the sampleFlags handed to the shell — composed from UseMx, UseMy and UseMz; setting it sets the three.

public SampleFlag SampleFlags { get; set; }

Property Value

SampleFlag

ShotRelFile

The holder recording, relative to the project directory: the CSV played (controller and holder columns in one file) or a shot file written beside it. Re-read at every estimation.

[CultureText("zh-Hant", "刀把錄製檔", Key = "Recording File")]
[CultureText("zh-Hans", "刀把录制文件", Key = "Recording File")]
[CultureText("vi", "Tệp bản ghi đo", Key = "Recording File")]
[CultureText("ja", "計測データファイル", Key = "Recording File")]
public string ShotRelFile { get; set; }

Property Value

string

Timing

When the estimation runs: armed here and run by the play (DuringThePlay, the command placed before the program), or now, on the steps built so far (Now, placed after it).

[CultureText("zh-Hant", "時機")]
[CultureText("zh-Hans", "时机")]
[CultureText("vi", "Thời điểm")]
[CultureText("ja", "タイミング")]
public SetupAngleEstimationTiming Timing { get; set; }

Property Value

SetupAngleEstimationTiming

ToolId

Tool-house id of the cutter to estimate; a negative value means the first tool that cuts: under DuringThePlay the first tool that touches the workpiece after the command (the mounted tool when the command runs mid-play), under Now the first tool that touched the strip from its first step.

[CultureText("zh-Hant", "刀號(-1=第一把切削的刀)", Key = "Tool Id (-1: the first tool that cuts)")]
[CultureText("zh-Hans", "刀号(-1=第一把切削的刀)", Key = "Tool Id (-1: the first tool that cuts)")]
[CultureText("vi", "Số dao (-1: dao đầu tiên cắt vào phôi)", Key = "Tool Id (-1: the first tool that cuts)")]
[CultureText("ja", "工具番号(-1:最初に切削する工具)", Key = "Tool Id (-1: the first tool that cuts)")]
public int ToolId { get; set; }

Property Value

int

UseMx

Read the Mx channel (a transverse moment the angle is read from).

[CultureText("zh-Hant", "通道 Mx", Key = "Channel Mx")]
[CultureText("zh-Hans", "通道 Mx", Key = "Channel Mx")]
[CultureText("vi", "Kênh Mx", Key = "Channel Mx")]
[CultureText("ja", "Mx チャンネル", Key = "Channel Mx")]
public bool UseMx { get; set; }

Property Value

bool

UseMy

Read the My channel (a transverse moment the angle is read from).

[CultureText("zh-Hant", "通道 My", Key = "Channel My")]
[CultureText("zh-Hans", "通道 My", Key = "Channel My")]
[CultureText("vi", "Kênh My", Key = "Channel My")]
[CultureText("ja", "My チャンネル", Key = "Channel My")]
public bool UseMy { get; set; }

Property Value

bool

UseMz

Read the Mz channel too (sharpens the per-step phase and the scale; not the angle itself).

[CultureText("zh-Hant", "通道 Mz", Key = "Channel Mz")]
[CultureText("zh-Hans", "通道 Mz", Key = "Channel Mz")]
[CultureText("vi", "Kênh Mz", Key = "Channel Mz")]
[CultureText("ja", "Mz チャンネル", Key = "Channel Mz")]
public bool UseMz { get; set; }

Property Value

bool

XName

Name for XML IO.

public static string XName { get; }

Property Value

string

Methods

GetCommandTitle(ICommandTextSource)

Gets the title of the command — one row in a command list or a mission tree — composed from the caller's vocabulary: the command owns the composition and degradation rules, the caller owns the language.

The shape is Name, or Name [detail] once there is a detail worth showing. The NAME always leads and is never dropped: a row must say WHAT it is even when the detail is a title the user wrote, otherwise a newcomer cannot tell a command list from a script. The detail trails because these rows truncate from the right. An empty detail takes the bare-name form rather than rendering dangling brackets.

public string GetCommandTitle(ICommandTextSource text)

Parameters

text ICommandTextSource

Culture-bearing vocabulary the static words are taken from.

Returns

string

The command title.

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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

factory XFactory

Run(SessionShell)

Runs the command, delegating execution to the provided session shell.

public IEnumerable<Action> Run(SessionShell sessionShell)

Parameters

sessionShell SessionShell

Session shell that exposes the machining facade to commands.

Returns

IEnumerable<Action>

Sequence of actions to be executed. A command may do its work as it is enumerated and yield null between the pieces of it. The player invokes each action in order and paces after it – a Pause holds there, jobs queued for the run's pace point run there, and a Stop of its run ends the run there – and it ends a stopped run at a null item too, and before the next row of a ListCommand. An action is not checked for a Stop before it runs: one handed over after the Stop runs, and the run ends at the pace after it. Where the run ends, the player disposes the enumeration: the command's code after that item does not run, and what must run whatever happens belongs in a finally of the iterator. An exception that leaves the enumeration while the run is live ends the run as a fault: the player reports it as Player-Run–Fault, the run ends there as not finished, and no later row of a ListCommand runs; a command that catches and reports its own failure (a ScriptCommand‘s ScriptCommand-Run–Fault, the CSV mapping commands’ Map-SingleCsv–Fault and Map-SeriesCsv–Fault) lets the mission go on. Once the run is stopped, whatever leaves the enumeration – the run's own cancellation, or an exception its unwinding throws – is the Stop, and no message is said for it. A command that catches and reports its own failure still says it after the Stop: a ScriptCommand reports any exception other than a cancellation that comes out of its script's body – the body's own, or one the stopped run's unwinding throws inside the body – as ScriptCommand-Run–Fault, and the CSV mapping commands' catches let a cancellation through alone; the stopped run then starts no later row.