Table of Contents

Class LocalProjectServiceController

Namespace
Hi.MachiningProcs
Assembly
HiNc.dll

HTTP controller exposing the project-level (session-independent) operations of Hi.MachiningProcs.LocalProjectServiceController.LocalProjectService — the lean API-user surface, parallel to SessionShellController (which mirrors the session-scoped SessionShell). A controller mirrors exactly one body; project-level settings belong here, not bolted onto the session controller.

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

Remarks

This controller also demonstrates the per-request message-return pattern: each mutating action injects a fresh MessageCollector into the have-both project-level function (one taking IProgress<IMessage> messageProgress) and returns the collected IMessage items in its HTTP response. A REST / AI caller therefore sees the progress / success / error notifications inline in the response, rather than only out-of-band via the SignalR broadcast. The shared ApiActionResult envelope is also used by the session-scoped surface: RequireActiveSessionAttribute returns it (with HTTP 409) to answer a “no active session” call, rather than throwing a null-reference 500.

Constructors

LocalProjectServiceController(LocalProjectService)

Initializes a new instance. Hi.MachiningProcs.LocalProjectServiceController.LocalProjectService is a DI singleton.

public LocalProjectServiceController(LocalProjectService projectService)

Parameters

projectService LocalProjectService

Methods

CloseNcResultReview()

Closes the review (CloseNcResultReview(IProgress<IMessage>)): the runtime is reset. Answers 200 with the messages when a review was closed; 409 with the refusal (NcResult-Review–Busy, NcResult-Review–BusyAnotherThread, or NcResult-Review–NotReviewing when none is open) otherwise.

[HttpPost]
[ProducesResponseType(typeof(ApiActionResult), 200)]
public ActionResult<ApiActionResult> CloseNcResultReview()

Returns

ActionResult<ApiActionResult>

EnableCollisionDetection(bool)

Enables or disables collision detection and returns the messages reported during the call (e.g. the “preparing collision items” progress / done notifications).

[HttpPost]
public ApiActionResult EnableCollisionDetection(bool value)

Parameters

value bool

Whether collision detection should be enabled.

Returns

ApiActionResult

IsCollisionDetectionEnabled()

Gets whether collision detection is currently enabled (project-level read; no session needed).

[HttpGet]
public bool IsCollisionDetectionEnabled()

Returns

bool

OpenNcResultReview(string)

Reviews a recorded play result (OpenNcResultReview(string, IProgress<IMessage>)): the strip, the steps and the physics charts are rebuilt from the result file and the finished stock, when the result holds one, is loaded as the workpiece, without a play; a recording open is ended first and the runtime reset. A project-level call: the review is a state of the service, not of a session, so no session need be open. Answers 200 with an ApiActionResult holding the review's messages when the result is under review. Answers 409 with the refusal – NcResult-Review–Busy while the player is running or paused, NcResult-Review–BusyAnotherThread while another thread plays NC on the session; NcResult-Review–Recording for the folder being recorded into – or the NcResult-Review–Cancelled of a fill the player stopped; nothing is under review then. A folder that holds no result file, or a result file this build does not read, is a 500 with the exception. The messages reach the session's shell too, when a session is open.

[HttpPost]
[ProducesResponseType(typeof(ApiActionResult), 200)]
public ActionResult<ApiActionResult> OpenNcResultReview(string relResultDirectory = "")

Parameters

relResultDirectory string

The result folder, relative to the project folder; empty for the newest completed result under Output/results.

Returns

ActionResult<ApiActionResult>

SetMachiningResolution_mm(double)

Sets the machining resolution (mm) and returns the messages reported during the call.

[HttpPost]
public ApiActionResult SetMachiningResolution_mm(double value)

Parameters

value double

The machining resolution in millimeters.

Returns

ApiActionResult