Table of Contents

Class SessionShellController

Namespace
Hi.MachiningProcs
Assembly
HiNc.dll

HTTP controller exposing SessionShell over the web API. Each action delegates to the underlying SessionShell instance owned by Hi.MachiningProcs.SessionShellController.LocalProjectService.

[ApiController]
[Route("api/[controller]/[action]")]
[ProducesResponseType(typeof(ApiActionResult), 409)]
public class SessionShellController : ControllerBase
Inheritance
SessionShellController
Inherited Members
Extension Methods

Constructors

SessionShellController(LocalProjectService)

Initializes a new instance.

public SessionShellController(LocalProjectService projectService)

Parameters

projectService LocalProjectService

Properties

DefaultParaTemplateDimension

[JsAce]
public int DefaultParaTemplateDimension { get; set; }

Property Value

int

DiffVisualRadius_mm

Gets or sets the visual radius in millimeters for difference visualization. Controls the radius used for highlighting differences between workpiece states.

[JsAce]
public double DiffVisualRadius_mm { get; set; }

Property Value

double

DispCacheMb

Gets or sets the display cache size in megabytes.

[Obsolete]
public long DispCacheMb { get; set; }

Property Value

long

DispCache_Mb

Gets or sets the display cache size in megabytes.

[JsAce]
public long DispCache_Mb { get; set; }

Property Value

long

EnableAutoMapOnSelectionEnd

Gets or sets whether to automatically map selections when they end.

[JsAce]
public bool EnableAutoMapOnSelectionEnd { get; set; }

Property Value

bool

EnableCollisionDetection

Gets or sets whether collision detection is enabled.

[JsAce(DocContentHtml = "Enable Collision Detection.")]
public bool EnableCollisionDetection { get; set; }

Property Value

bool

EnableCwePhasePairing

EnableCwePhasePairing: CWE phase pairing for the steps built from this position of the play on.

public bool EnableCwePhasePairing { get; set; }

Property Value

bool

EnablePauseOnFailure

[JsAce(DocContentHtml = "Enable Pause On Failure.")]
public bool EnablePauseOnFailure { get; set; }

Property Value

bool

EnablePhysics

Gets or sets whether milling force evaluation is enabled.

[JsAce(DocContentHtml = "Enable milling force evaluation.")]
public bool EnablePhysics { get; set; }

Property Value

bool

EnableWearEffect

Gets or sets whether tool wear effects are enabled in simulation.

[JsAce]
public bool EnableWearEffect { get; set; }

Property Value

bool

FeedPerCycle

Gets a new feed per cycle machining motion resolution instance.

[JsAce]
public FeedPerCycleMachiningMotionResolution FeedPerCycle { get; }

Property Value

FeedPerCycleMachiningMotionResolution

FeedPerTooth

Gets a new feed per tooth machining motion resolution instance.

[JsAce]
public FeedPerToothMachiningMotionResolution FeedPerTooth { get; }

Property Value

FeedPerToothMachiningMotionResolution

Global

[JsAce("Global[$1key]")]
public Dictionary<object, object> Global { get; }

Property Value

Dictionary<object, object>

InitSpindleTemperature_C

Gets or sets the initial spindle temperature in degrees Celsius.

[JsAce(DocContentHtml = "Spindle Temperature on initialization.")]
public double InitSpindleTemperature_C { get; set; }

Property Value

double

JsAceCompletionProfileJsonArray

Internal used.

public static JsonArray JsAceCompletionProfileJsonArray { get; }

Property Value

JsonArray

MachiningMotionResolution

Gets or sets the machining motion resolution.

[JsAce]
public IMachiningMotionResolution MachiningMotionResolution { get; set; }

Property Value

IMachiningMotionResolution

MachiningResolution

Gets or sets the machining resolution in millimeters. For legacy compatable.

[JsAce]
[Obsolete]
public double MachiningResolution { get; set; }

Property Value

double

MachiningResolution_mm

Gets or sets the machining resolution in millimeters.

[JsAce]
public double MachiningResolution_mm { get; set; }

Property Value

double

MachiningSession

public MachiningSession MachiningSession { get; }

Property Value

MachiningSession

MapTask

Task tracking the status of mapping operations.

public Task MapTask { get; set; }

Property Value

Task

MillingCycleDivisionNum

Gets or sets the number of divisions per cycle for milling force calculation. This property should be set before milling force evaluation if TrainMillingPara(SampleFlag, string, double) is intended to be used.

[JsAce]
public static int MillingCycleDivisionNum { get; set; }

Property Value

int

MillingForceCycleDivisionNum

Gets or sets the number of divisions per cycle for milling force calculation. This property should be set before milling force evaluation if TrainMillingPara(SampleFlag, string, double) is intended to be used.

[JsAce]
[Obsolete]
public static int MillingForceCycleDivisionNum { get; set; }

Property Value

int

NcOptOption

[JsAce]
public NcOptOption NcOptOption { get; set; }

Property Value

NcOptOption

OptEnableDepthCompensation

Enables or disables depth compensation during optimization.

[JsAce]
public bool OptEnableDepthCompensation { get; set; }

Property Value

bool

OptEnableFeedrate

Gets or sets whether to enable feed rate optimization in NC optimization.

[JsAce]
public bool OptEnableFeedrate { get; set; }

Property Value

bool

OptEnableForwardCompensation

Enables or disables forward compensation during optimization.

[JsAce]
public bool OptEnableForwardCompensation { get; set; }

Property Value

bool

OptEnableInterpolation

Enables or disables reinterpolation for optimization.

[JsAce]
public bool OptEnableInterpolation { get; set; }

Property Value

bool

OptEnableSideCompensation

Enables or disables side compensation during optimization.

[JsAce]
public bool OptEnableSideCompensation { get; set; }

Property Value

bool

OptExtendedPostDistance_mm

Gets or sets the extended post-distance in millimeters for NC optimization. This is the distance after the current segment that will be considered for optimization.

[JsAce]
public double OptExtendedPostDistance_mm { get; set; }

Property Value

double

OptExtendedPreDistance_mm

Gets or sets the extended pre-distance in millimeters for NC optimization. This is the distance before the current segment that will be considered for optimization.

[JsAce]
public double OptExtendedPreDistance_mm { get; set; }

Property Value

double

OptFeedrateAssignmentRatio

Gets or sets the feedrate assignment ratio for optimization. If the feedrate change exceeds this ratio, the feedrate in the NC line will be updated.

[JsAce]
public double OptFeedrateAssignmentRatio { get; set; }

Property Value

double

OptMaxAcceleration_mmds2

Maximum acceleration in mm/s² during optimization. Only takes effect on reinterpolated section.

[JsAce(DocContentHtml = "Only take effect on reinterpolated section.")]
public double OptMaxAcceleration_mmds2 { get; set; }

Property Value

double

OptMaxFeedPerTooth_mm

Gets or sets the maximum feed per tooth in millimeters for optimization.

[JsAce]
public double OptMaxFeedPerTooth_mm { get; set; }

Property Value

double

OptMaxFeedrate_mmdmin

Maximum feed rate in mm/min for cutting movements during optimization.

[JsAce]
public double OptMaxFeedrate_mmdmin { get; set; }

Property Value

double

OptMaxJerk_mmds3

Maximum jerk in mm/s³ during optimization. Only takes effect on reinterpolated section.

[JsAce(DocContentHtml = "Only take effect on reinterpolated section.")]
public double OptMaxJerk_mmds3 { get; set; }

Property Value

double

OptMinFeedPerTooth_mm

Gets or sets the minimum feed per tooth in millimeters for optimization.

[JsAce]
public double OptMinFeedPerTooth_mm { get; set; }

Property Value

double

OptMinFeedrate_mmdmin

Minimum feed rate in mm/min for cutting movements during optimization.

[JsAce]
public double OptMinFeedrate_mmdmin { get; set; }

Property Value

double

OptPreferedForce_N

Preferred force in N for optimization.

[JsAce]
public double OptPreferedForce_N { get; set; }

Property Value

double

OptRapidFeed_mmdmin

Rapid feed rate in mm/min for non-cutting movements during optimization.

[JsAce]
public double OptRapidFeed_mmdmin { get; set; }

Property Value

double

OptSpindlePowerSafetyFactor

Safety factor for spindle power during optimization.

[JsAce]
public double OptSpindlePowerSafetyFactor { get; set; }

Property Value

double

OptSpindlePowerUtilizationFactor

Utilization factor for spindle power during optimization. It is the reciprocal of the spindle power safety factor.

[JsAce]
public double OptSpindlePowerUtilizationFactor { get; set; }

Property Value

double

OptSpindleTorqueSafetyFactor

Safety factor for spindle torque during optimization.

[JsAce]
public double OptSpindleTorqueSafetyFactor { get; set; }

Property Value

double

OptSpindleTorqueUtilizationFactor

Utilization factor for spindle torque during optimization. It is the reciprocal of the spindle torque safety factor.

[JsAce]
public double OptSpindleTorqueUtilizationFactor { get; set; }

Property Value

double

OptThermalYieldSafetyFactor

Safety factor for thermal yield during optimization.

[JsAce]
public double OptThermalYieldSafetyFactor { get; set; }

Property Value

double

OptThermalYieldUtilizationFactor

Utilization factor for thermal yield during optimization. It is the reciprocal of the thermal yield safety factor.

[JsAce]
public double OptThermalYieldUtilizationFactor { get; set; }

Property Value

double

OptYieldingSafetyFactor

Safety factor for yielding during optimization.

[JsAce]
public double OptYieldingSafetyFactor { get; set; }

Property Value

double

OptYieldingUtilizationFactor

Utilization factor for yielding during optimization. It is the reciprocal of the yielding safety factor.

[JsAce]
public double OptYieldingUtilizationFactor { get; set; }

Property Value

double

ScriptOptions

public ScriptOptions ScriptOptions { get; set; }

Property Value

ScriptOptions

SessionShell

Gets the underlying SessionShell instance.

public SessionShell SessionShell { get; }

Property Value

SessionShell

StepCount

Gets the total number of milling steps.

[JsAce]
public int StepCount { get; }

Property Value

int

Methods

AddTimeDataByFile(string, string, double, double)

Adds time-based data from a file to the time mapping dictionary with specified time bounds in seconds.

[JsAce("AddTimeDataByFile($1key, $2relFile, $3beginTime, $4endTime)")]
[NonAction]
public bool AddTimeDataByFile(string key, string relFile, double beginTime, double endTime)

Parameters

key string

Key to identify the data

relFile string

Relative path to the data file

beginTime double

Beginning time in seconds

endTime double

Ending time in seconds

Returns

bool

True if the data was successfully added, false otherwise

AddTimeDataByFile(string, string, string, string)

Adds time-based data from a file to the time mapping dictionary with specified time bounds.

[JsAce("AddTimeDataByFile($1key, $2relFile, $3beginTime, $4endTime)")]
[HttpPost]
public bool AddTimeDataByFile(string key, string relFile, string beginTimeText, string endTimeText)

Parameters

key string

Key to identify the data

relFile string

Relative path to the data file

beginTimeText string

Beginning time as text (seconds or TimeSpan format)

endTimeText string

Ending time as text (seconds or TimeSpan format)

Returns

bool

True if the data was successfully added, false otherwise

AppendMessagesToFile(string, params string[])

Appends messages to a file, optionally filtered by tags.

[JsAce("AppendMessagesToFile(\"dstRelFile\",flags)")]
[HttpPost]
public void AppendMessagesToFile(string dstRelFile, params string[] flags)

Parameters

dstRelFile string

Destination relative file path

flags string[]

Optional flags to filter messages by tags

BeginPreserve()

Begin Preserve section in optimzation process.

[JsAce("BeginPreserve()")]
[HttpPost]
public void BeginPreserve()

BeginSelection(string, AnchorMode, IStepShift)

Begin mark on current line. milling step() has not triggered yet.

[NonAction]
public void BeginSelection(string key, AnchorMode anchorMode = AnchorMode.LineBegin, IStepShift shift = null)

Parameters

key string

Identifier key for the selection

anchorMode AnchorMode

Mode for anchoring the beginning of selection

shift IStepShift

Step shift to apply

BeginSession()

BeginSession(). Callable without an active session (it is how a session is started) but still requires a loaded project; routes straight to Hi.MachiningProcs.SessionShellController.LocalProjectService so it does not touch the null session-scoped facade. Answers 200 with an empty body when a session was begun, and when one is alive already: the call does nothing then, whatever the player does. Answers 409 with an ApiActionResult body holding the one refusal, id BeginSession–Busy, while the player is running or paused and no session is open – its run still beginning its own session, or a mission script between its EndSession() and BeginSession(): no session is begun, and the body alone carries the refusal (there is no shell yet).

[HttpPost]
[ProducesResponseType(200)]
public ActionResult BeginSession()

Returns

ActionResult

ClearTimeMappingData()

Clears all time mapping data.

[JsAce]
[HttpPost]
public void ClearTimeMappingData()

ConvertClToNcFiles(string)

Converts the CLSF play of the current session into Fanuc NC files (writeback synthesis — MSYS tilt becomes G68.2, tool posture becomes G43.4 RTCP with rotary words).

[JsAce(Snippet = "ConvertClToNcFiles(\"Output/[NcName].nc\")", DocContentHtml = "Convert the played CLSF into Fanuc NC files by substitute template keyword \"[NcName]\"")]
[HttpPost]
public IReadOnlyList<string> ConvertClToNcFiles(string relNcFileTemplate = "Output/[NcName].nc")

Parameters

relNcFileTemplate string

Output path template; [NcName] is replaced by the source file name.

Returns

IReadOnlyList<string>

Diff(double)

Performs a difference analysis on the workpiece geometry to detect variations.

[JsAce("Diff($1detectionRadius_mm)")]
[HttpPost]
public void Diff(double detectionRadius_mm)

Parameters

detectionRadius_mm double

Radius for detecting differences

EmbedSingleDataPerStepByCsvFile(string)

Reads a CSV file and performs time-based interpolation to map data to milling steps. It is one (step) - one (embedded-data) mapping. Every data column becomes a step variable the charts and the 3D view can pick (unless its key is registered already, which keeps its name, unit and format); a column named like a built-in step property is not mapped, and a message names those columns.

[JsAce(Snippet = "EmbedSingleDataPerStepByCsvFile($1\"csvFile\")")]
[HttpPost]
public void EmbedSingleDataPerStepByCsvFile(string csvFile)

Parameters

csvFile string

Path to the CSV file relative to the base directory

EndPreserve()

End Preserve section in optimzation process.

[JsAce("EndPreserve()")]
[HttpPost]
public void EndPreserve()

EndSelection(string, AnchorMode, IStepShift)

End mark on current line for selection.

[NonAction]
public void EndSelection(string key, AnchorMode anchorMode = AnchorMode.LineEnd, IStepShift shift = null)

Parameters

key string

Identifier key for the selection

anchorMode AnchorMode

Mode for anchoring the end of selection

shift IStepShift

Step shift to apply

EndSession()

EndSession(). Callable without an active session (a no-op when none is active); routes straight to Hi.MachiningProcs.SessionShellController.LocalProjectService. Answers 200 with an empty body when the session was ended or none was active. Answers 409 with an ApiActionResult body holding the one refusal, id EndSession–Busy while the player is running or paused, or EndSession–BusyAnotherThread while another thread plays NC on the session (a PlayNcFile(string, NcKind) request, for one): the session is kept, and its shell hears the refusal too.

[HttpPost]
[ProducesResponseType(200)]
public ActionResult EndSession()

Returns

ActionResult

ErrorMessage(string)

Displays an error message in the message host.

[JsAce("ErrorMessage($1message)")]
[HttpPost]
public void ErrorMessage(string message)

Parameters

message string

The error message to display

ExportMeshedGeomToStl(string, double)

Exports the current meshed geometry to an STL file.

[JsAce("ExportMeshedGeomToStl($1\"dstFile\",$2resolution_mm)")]
[HttpPost]
public void ExportMeshedGeomToStl(string relFile, double resolution_mm = 0)

Parameters

relFile string

Relative path to the output STL file

resolution_mm double

Resolution in millimeters (0 for default)

ExportRuntimeGeomToStl(string, double)

Legacy script alias of ExportMeshedGeomToStl(string, double); kept so old player scripts keep working.

[Obsolete("Legacy alias; use ExportMeshedGeomToStl instead.")]
[HttpPost]
public void ExportRuntimeGeomToStl(string relFile, double resolution_mm = 0)

Parameters

relFile string
resolution_mm double

FixedPace(double, double)

Creates a fixed machining motion resolution with specified parameters.

[JsAce("FixedPace($1linearResolution_mm, $2rotaryResolution_deg)")]
[NonAction]
public FixedMachiningMotionResolution FixedPace(double linearResolution_mm, double rotaryResolution_deg)

Parameters

linearResolution_mm double

Linear resolution in millimeters

rotaryResolution_deg double

Rotary resolution in degrees

Returns

FixedMachiningMotionResolution

A new fixed machining motion resolution instance

GetMachiningStep(int)

Retrieves the machining step at the specified index; null for an index the strip does not hold or a step not built yet.

[JsAce(Snippet = "GetMachiningStep($1\"stepIndex\")")]
[NonAction]
public MachiningStep GetMachiningStep(int stepIndex)

Parameters

stepIndex int

Index of the machining step to retrieve

Returns

MachiningStep

The machining step at the specified index

GetMillingStep(int)

The former name of GetMachiningStep(int), kept for the scripts that call it.

[Obsolete("Renamed GetMachiningStep: the method returns a MachiningStep.")]
[NonAction]
public MachiningStep GetMillingStep(int stepIndex)

Parameters

stepIndex int

Index of the machining step to retrieve

Returns

MachiningStep

The machining step at the specified index

GetStickMachiningToolObservationHeight_mm(int)

Gets the observation height in millimeters for the specified stick machining tool.

[JsAce("GetStickMachiningToolObservationHeight_mm($1toolId)")]
[HttpGet]
public double GetStickMachiningToolObservationHeight_mm(int toolId)

Parameters

toolId int

The ID of the tool

Returns

double

The observation height in millimeters

GetToolSetupAngle_deg(int)

GetToolSetupAngle_deg(int): the setup angle in degrees of the specified tool — how far the cutter is turned in the holder.

[JsAce("GetToolSetupAngle_deg($1toolId)")]
[HttpGet]
public double GetToolSetupAngle_deg(int toolId)

Parameters

toolId int

The ID of the tool

Returns

double

The setup angle in degrees

GetUniformFlutingOffsetAngle_deg(int)

Gets the flute offset angle in degrees of the uniform fluting of the specified tool, that is, for a cutter whose flutes all share one baseline flute contour.

[JsAce("GetUniformFlutingOffsetAngle_deg($1toolId)")]
[HttpGet]
public double GetUniformFlutingOffsetAngle_deg(int toolId)

Parameters

toolId int

The ID of the tool

Returns

double

The flute offset angle in degrees

LineSelection(string, AnchorMode, IStepShift, AnchorMode, IStepShift)

Create a line selection from begin to end mark.

[NonAction]
public void LineSelection(string key, AnchorMode beginAnchorMode = AnchorMode.LineBegin, IStepShift beginShift = null, AnchorMode endAnchorMode = AnchorMode.LineEnd, IStepShift endShift = null)

Parameters

key string

Identifier key for the selection

beginAnchorMode AnchorMode

Mode for anchoring the beginning of selection

beginShift IStepShift

Step shift to apply at beginning

endAnchorMode AnchorMode

Mode for anchoring the end of selection

endShift IStepShift

Step shift to apply at end

Map(string, IFileTimeSection, CycleSamplingMode?)

Maps selection data to time section.

[HttpPost]
public Task Map(string key, IFileTimeSection fileTimeSection = null, StepTimeShotUtil.CycleSamplingMode? cycleSamplingMode = null)

Parameters

key string

Identifier key for the selection

fileTimeSection IFileTimeSection

File time section, or null to use the one associated with the key

cycleSamplingMode StepTimeShotUtil.CycleSamplingMode?

Cycle sampling mode

Returns

Task

Task representing the asynchronous mapping operation

Message(string)

Displays a message in the message host.

[JsAce("Message($1message)")]
[HttpPost]
public void Message(string message)

Parameters

message string

The message to display

OptimizeToFiles(string)

Optimizes NC files and saves results using the specified file template (OptimizeToFiles(string) over HTTP) while the player is idle. While the player is running or paused the request is refused instead, since the session's play may still be growing and the files could hold a partly played program: the call reports the error OptimizeToFiles–Busy on the session's ShellProgress, writes nothing and returns, as ConvertClToNcFiles(string) does with ConvertClToNc–Busy.

[JsAce(Snippet = "OptimizeToFiles(\"Output/Opt-[NcName]\")", DocContentHtml = "Optimize To Files by substitude template keywoard \"[NcName]\"")]
[HttpPost]
public void OptimizeToFiles(string relFileTemplate = "Output/Opt-[NcName]")

Parameters

relFileTemplate string

Template for output file path, can include [NcName] placeholder

Remarks

The check is this HTTP mirror's alone: a mission's own optimizations (OptimizeToFilesCommand, PostExecutionCommand, a call in a mission script) run on the player thread inside the run, where the mission places them, and do not pass it. Should a run start just as the optimization begins, after the check, the optimization runs under that run's cancellation: a Stop of the run ends it on its canceled rows, and the request still returns.

Pace()

Controls the pace of machining operations during execution: the request's thread calls Pace(), a pace point and not a query. While no run (or one-shot) is live the pass is open and the call returns at once; while one is paused it parks until Resume or Stop.

[JsAce("Pace();")]
[HttpPost]
public void Pace()

Pause()

Pause Player

[JsAce(DocContentHtml = "Pause Player")]
[HttpPost]
public void Pause()

PlayAct(IAct, ISentenceCarrier, CancellationToken?)

[JsAce]
[NonAction]
public void PlayAct(IAct act, ISentenceCarrier sourceCommand = null, CancellationToken? cancellationToken = null)

Parameters

act IAct
sourceCommand ISentenceCarrier
cancellationToken CancellationToken?

PlayBrandNcFile(string)

Plays a famous-brand NC code file with the specified relative path (no kind dispatch — always the brand runner).

[JsAce("PlayBrandNcFile($1\"ncFile\");")]
[HttpPost]
public void PlayBrandNcFile(string relNcFilePath)

Parameters

relNcFilePath string

Relative path to the NC file

PlayClFile(string)

Plays an NX-CL (CLSF) file with the specified relative path.

[JsAce("PlayClFile($1\"clFile\");")]
[HttpPost]
public void PlayClFile(string relFilePath)

Parameters

relFilePath string

Relative path to the CLSF file

PlayClTeleport(double, double, double, double, double, double)

[JsAce]
[HttpPost]
public void PlayClTeleport(double x, double y, double z, double i, double j, double k)

Parameters

x double
y double
z double
i double
j double
k double

PlayCsvFile(string)

Plays an CSV file with the specified relative path.

[JsAce("PlayCsvFile($1\"csvFile\");")]
[HttpPost]
public void PlayCsvFile(string relFilePath)

Parameters

relFilePath string

Relative path to the CSV file

PlayNc(string, string)

Plays NC code directly from a string, executing each action and pacing between them.

[JsAce(Snippet = "PlayNc($1\"ncCommand\",$2\"\"(Direct Command)\"\");", DocContentHtml = "Play NC. second parameter is the file name alternative shows in the log.")]
[HttpPost]
public void PlayNc(string ncText, string fileNameAlternative = "--")

Parameters

ncText string

NC code as a string

fileNameAlternative string

Alternative name to display in logs

PlayNcFile(string, NcKind)

Plays an NC program file with the specified relative path, the runner picked by kind (Auto = by file extension: .cl/.cls/.clsf play as CL, .csv as CSV, anything else as brand NC). A play that follows a stop in this session starts in the program-end reset state, at the pose the machine stopped at (see RunNcLines(INcRunner, string, IEnumerable<string>, CancellationToken)).

[JsAce("PlayNcFile($1\"ncFile\");")]
[HttpPost]
public void PlayNcFile(string relNcFilePath, NcKind kind = NcKind.Auto)

Parameters

relNcFilePath string

Relative path to the NC program file

kind NcKind

Which runner plays the file; Auto detects by extension.

PlayToolingTeleport(int)

[JsAce]
[HttpPost]
public void PlayToolingTeleport(int toolId)

Parameters

toolId int

Preserve()

Preserve one line NC code in optimzation process.

[JsAce("Preserve()")]
[HttpPost]
public void Preserve()

ProgressMessage(string)

Displays a progress message in the message host.

[JsAce("ProgressMessage($1message)")]
[HttpPost]
public void ProgressMessage(string message)

Parameters

message string

The progress message to display

ReTrainMillingPara(SampleFlag, string, double)

Re-trains milling parameters using the specified sample flag (ReTrainMillingPara(SampleFlag, string, double)).

[JsAce("ReTrainMillingPara(Fx|Fy|Fz, $1dstFile)")]
[HttpPost]
public void ReTrainMillingPara(SampleFlag sampleFlag, string dstRelFile, double outlierRatio = 0.1)

Parameters

sampleFlag SampleFlag

Sample flag indicating which components to train

dstRelFile string

Destination relative file path

outlierRatio double

Fraction of the worst-fitting touched instances trimmed before the final fit; 0.1 by default, the same as the script entry. A ratio of 1 or more trims every touched instance (the training then warns; what is left to regress on is the untouched air).

ReadMeshedGeom(string)

Reads meshed geometry from a file.

[JsAce("ReadMeshedGeom($1\"srcFile\")")]
[HttpPost]
public void ReadMeshedGeom(string relFile)

Parameters

relFile string

Relative path to the input file

ReadRuntimeGeom(string)

Legacy script alias of ReadMeshedGeom(string); kept so old player scripts keep working.

[Obsolete("Legacy alias; use ReadMeshedGeom instead.")]
[HttpPost]
public void ReadRuntimeGeom(string relFile)

Parameters

relFile string

RecomputeStepPhysics(int?)

RecomputeStepPhysics(int?) over HTTP: recomputes the finished steps' physics in place from the stored engagement and the current inputs. Unlike the script mirror, this runs the recompute on the player (RecomputeStepPhysicsOnPlayerAsync(int?, IProgress<IMessage>)): on an idle player as a one-shot — the player shows Running meanwhile, Pause parks it at a chunk boundary and Stop cancels it there — and while a mission runs or is paused on the player thread itself from its next pace point, chunk by chunk, holding the play there until the recompute has finished: Pause parks the recompute at a chunk boundary and Resume goes on, exactly as for the play; a paused play is resumed for the recompute (the status shows Running while it computes) and paused again when it is done — including the usual mission whose script calls PlayNcFile itself. A request that lands while another request is playing an NC program on the session (PlayNcFile(string, NcKind) and its siblings run on their own thread, with the player idle), while another recompute is in flight, or while a play does not reach a pace point in time is refused with StepPhysics-Recompute–Busy. Blocks until the recompute has ended. The messages of the run come back inline, tee'd to the session's ShellProgress as well; Success is true only for a completed recompute or a confirmed no-change. A fault after a chunk was written also answers false, with StepPhysics-Recompute–FaultKeptRange, which names the replaced range [b, e) whose steps keep the recomputed values, ahead of the –Fault (the exception's own text); run the recompute again to finish.

[JsAce("RecomputeStepPhysics()")]
[HttpPost]
[ProducesResponseType(typeof(ApiActionResult), 200)]
public Task<ApiActionResult> RecomputeStepPhysics(int? toolId = null)

Parameters

toolId int?

Optional scope override; see RecomputeStepPhysics(int?).

Returns

Task<ApiActionResult>

The outcome envelope with the run's messages.

RegisterStepColorTree(StepColorTree)

Registers a color tree for this session: a step property whose value is the id of the leaf a step falls into, with a color per leaf (StepColorTree), which the charts, the 3D view and the step CSV can pick until the session ends; a tree the project keeps goes in StepColorTreeList instead. The tree is copied and compiled here: a change to tree afterwards changes nothing until it is registered again, and registering the key again in the session replaces its definition. A node without an id is numbered from the tree's NextId — 1, 2, 3… in tree order when none is given — the same numbers every time the script runs. The key must not be a built-in step property's, under MC., or one the project defines a step variable or a color tree under; a tree without a key, with a term without a key, a comparison without a threshold, an id repeated or out of range, or an operation or a join this version does not know (a value it writes but does not read back) is not registered; each is reported once per session. The conditions read the step properties they name through the registry, a step variable the script registers included; a key that matches none reads as no value and is reported after the play.

[JsAce(Snippet = "RegisterStepColorTree($1tree)", DocContentHtml = "<p>Register a color tree for this session: a step property whose value is the id of the leaf a step falls into, colored one color per leaf.</p> <p>Build the tree with object initializers: new StepColorTree { Key = \"Load\", Nodes = [ new StepColorLeaf { Name = \"Rapid\", When = StepColorCondition.All(new StepColorTerm(\"IsRapid\", StepColorOp.Eq, 1)) }, new StepColorLeaf { Name = \"Cutting\", ValueKey = \"Mrr_mm3ds\" } ] }. A leaf without When takes every step that reaches it; a leaf without Hue_deg gets a hue of its own.</p>")]
[NonAction]
public void RegisterStepColorTree(StepColorTree tree)

Parameters

tree StepColorTree

The tree; null registers nothing.

RegisterStepVariable(string, string, string, string, Func<MachiningStep, object>)

Registers a step variable for tracking during execution.

[JsAce(Snippet = "RegisterStepVariable(\"$1key\",\"$2name\",\"$3unit\",\"$4formatString\",\"$5variableFunc\")", DocContentHtml = "<p>Register Step Variable.</p> <p>\"unit\" is nullable</p> <p>\"formatString\" is nullable</p>")]
[NonAction]
public void RegisterStepVariable(string key, string name, string unit, string formatString, Func<MachiningStep, object> variableFunc = null)

Parameters

key string

Unique key to identify the variable

name string

Human-readable name of the variable

unit string

Physical unit of the variable (can be null)

formatString string

Format string for displaying the variable (can be null)

variableFunc Func<MachiningStep, object>

Function to compute the variable value from a milling step (can be null)

RemoveFlyPiece()

Removes any disconnected or “flying” pieces from the workpiece geometry.

[JsAce]
[HttpPost]
public void RemoveFlyPiece()

Reset()

Reset Player (ResetPlayer(IProgress<IMessage>)): the run stopped and waited for, the runtime reset and the session ended. Answers 200 with an empty body when the player was reset; 409 with an ApiActionResult body holding the one refusal, id Reset–Busy, while an NC program is being played on the session by another thread than the player's (a PlayNcFile request, for one): nothing is reset, and the session's shell hears the refusal too. Reset–Refused, the refusal from the mission script's own thread, is never the body of a request.

[JsAce(DocContentHtml = "Reset Player")]
[HttpPost]
[ProducesResponseType(200)]
public ActionResult Reset()

Returns

ActionResult

ResetRuntime()

Clears internal buffers (ResetRuntime(IProgress<IMessage>)). Answers 200 with an empty body when the runtime was reset. Answers 409 with an ApiActionResult body holding the one refusal, id ResetRuntime–Busy while the player is running or paused, or ResetRuntime–BusyAnotherThread while another thread plays NC on the session (a PlayNcFile(string, NcKind) request, for one): nothing is reset, and the session's shell hears the refusal too. ResetRuntime–Refused, the refusal from inside a run, is never the body of a request: the thread serving this request is not inside a run.

[JsAce]
[HttpPost]
[ProducesResponseType(200)]
public ActionResult ResetRuntime()

Returns

ActionResult

RunBrandNcFile(string)

Runs a famous-brand NC code file with the specified relative path (no kind dispatch — always the brand runner).

[JsAce("RunBrandNcFile($1\"ncFile\");")]
[NonAction]
public IEnumerable<Action> RunBrandNcFile(string relNcFilePath)

Parameters

relNcFilePath string

Relative path to the NC file

Returns

IEnumerable<Action>

Enumerable sequence of actions to be executed

RunNc(string, string)

Runs NC code directly from a string.

[JsAce(Snippet = "RunNc($1\"ncCommand\",$2\"\"(Direct Command)\"\");", DocContentHtml = "Run NC. second parameter is the file name alternative shows in the log.")]
[NonAction]
public IEnumerable<Action> RunNc(string ncText, string fileNameAlternative = "--")

Parameters

ncText string

NC code as a string

fileNameAlternative string

Alternative name to display in logs

Returns

IEnumerable<Action>

Enumerable sequence of actions to be executed

RunNcFile(string, NcKind)

Runs an NC program file with the specified relative path, the runner picked by kind (Auto = by file extension).

[JsAce("RunNcFile($1\"ncFile\");")]
[NonAction]
public IEnumerable<Action> RunNcFile(string relNcFilePath, NcKind kind = NcKind.Auto)

Parameters

relNcFilePath string

Relative path to the NC program file

kind NcKind

Which runner runs the file; Auto detects by extension.

Returns

IEnumerable<Action>

Enumerable sequence of actions to be executed

SetNcResolutionFeedPerCycle()

Sets NC resolution to feed per cycle mode.

[HttpPost]
public void SetNcResolutionFeedPerCycle()

SetNcResolutionFeedPerTooth()

Sets NC resolution to feed per tooth mode.

[HttpPost]
public void SetNcResolutionFeedPerTooth()

SetNcResolutionFixed(double, double)

Sets NC resolution to fixed mode with specified resolution values.

[HttpPost]
public void SetNcResolutionFixed(double linearResolution_mm, double rotaryResolution_deg)

Parameters

linearResolution_mm double

Linear resolution in millimeters.

rotaryResolution_deg double

Rotary resolution in degrees.

SetStickMachiningToolObservationHeight_mm(int, double)

Sets the observation height in millimeters for the specified stick machining tool.

[JsAce("SetStickMachiningToolObservationHeight_mm($1toolId,$2height_mm)")]
[HttpPost]
public void SetStickMachiningToolObservationHeight_mm(int toolId, double height)

Parameters

toolId int

The ID of the tool

height double

The observation height in millimeters to set

SetToolSetupAngle_deg(int, double)

SetToolSetupAngle_deg(int, double): sets the setup angle in degrees of the specified tool — how far the cutter is turned in the holder.

[JsAce("SetToolSetupAngle_deg($1toolId,$2angle_deg)")]
[HttpPost]
public void SetToolSetupAngle_deg(int toolId, double angle_deg)

Parameters

toolId int

The ID of the tool

angle_deg double

The setup angle in degrees to set

SetUniformFlutingOffsetAngle_deg(int, double)

Sets the flute offset angle in degrees of the uniform fluting of the specified tool, that is, for a cutter whose flutes all share one baseline flute contour.

[JsAce("SetUniformFlutingOffsetAngle_deg($1toolId,$2angle_deg)")]
[HttpPost]
public void SetUniformFlutingOffsetAngle_deg(int toolId, double angle_deg)

Parameters

toolId int

The ID of the tool

angle_deg double

The flute offset angle in degrees to set

ShiftDistance_mm(double)

Creates a distance shift object representing the specified distance in millimeters.

[NonAction]
public DistanceShift ShiftDistance_mm(double distanceShift_mm)

Parameters

distanceShift_mm double

Distance shift in millimeters

Returns

DistanceShift

Distance shift object

ShiftTime_s(double)

Creates a time shift object representing the specified time in seconds.

[NonAction]
public TimeShift ShiftTime_s(double seconds)

Parameters

seconds double

Time in seconds

Returns

TimeShift

Time shift object

TrainMillingPara(SampleFlag, string, double)

Trains milling parameters using the specified sample flag (TrainMillingPara(SampleFlag, string, double, ICuttingPara)).

[JsAce("TrainMillingPara(Fx|Fy|Fz, $1dstFile)")]
[HttpPost]
public void TrainMillingPara(SampleFlag sampleFlag, string dstRelFile, double outlierRatio = 0.1)

Parameters

sampleFlag SampleFlag

Sample flag indicating which components to train

dstRelFile string

Destination relative file path

outlierRatio double

Fraction of the worst-fitting touched instances trimmed before the final fit; 0.1 by default, the same as the script entry. A ratio of 1 or more trims every touched instance (the training then warns and fails for want of samples).

WarningMessage(string)

Displays a warning message in the message host.

[JsAce("WarningMessage($1message)")]
[HttpPost]
public void WarningMessage(string message)

Parameters

message string

The warning message to display

WriteMeshedGeom(string)

Writes the current meshed geometry to a file.

[JsAce("WriteMeshedGeom($1\"dstFile\")")]
[HttpPost]
public void WriteMeshedGeom(string relFile)

Parameters

relFile string

Relative path to the output file

WriteRuntimeGeom(string)

Legacy script alias of WriteMeshedGeom(string); kept so old player scripts keep working.

[Obsolete("Legacy alias; use WriteMeshedGeom instead.")]
[HttpPost]
public void WriteRuntimeGeom(string relFile)

Parameters

relFile string

WriteShotFiles(double, string)

Writes time-series data to shot files with the specified resolution period (alternative parameter order).

[NonAction]
public void WriteShotFiles(double resolutionPeroid_ms, string relFileTemplate)

Parameters

resolutionPeroid_ms double

Resolution period in milliseconds

relFileTemplate string

Template for output file path, can include [NcName] placeholder

WriteShotFiles(string, double)

Writes time-series data to shot files with the specified resolution period.

[JsAce(Snippet = "WriteShotFiles(\"Output/[NcName].shot.csv\",resolutionPeroid_ms)", DocContentHtml = "Write time series data by resolutionPeroid_ms")]
[HttpPost]
public void WriteShotFiles(string relFileTemplate = "Output/[NcName].shot.csv", double resolutionPeroid_ms = 1)

Parameters

relFileTemplate string

Template for output file path, can include [NcName] placeholder

resolutionPeroid_ms double

Resolution period in milliseconds

WriteStepFiles(string)

Writes step-series data to files with the specified file template.

[JsAce(Snippet = "WriteStepFiles(\"Output/[NcName].step.csv\")", DocContentHtml = "Write step series data.")]
[HttpPost]
public void WriteStepFiles(string relFileTemplate = "Output/[NcName].step.csv")

Parameters

relFileTemplate string

Template for output file path, can include [NcName] placeholder