Class SessionShell
- Namespace
- Hi.MachiningProcs
- Assembly
- HiNc.dll
End-user-facing facade for a machining session: aggregates session lifecycle, NC playback, optimization, geometry I/O, and scripting infrastructure into a single delegation surface. Used as the C# script globals object and as the concrete target of ISessionCommand implementations.
public class SessionShell : ISessionShell
- Inheritance
-
SessionShell
- Implements
- Inherited Members
- Extension Methods
Fields
DefaultScriptOptions
The default Roslyn ScriptOptions for session scripts — references the SessionShell-domain assemblies and imports. Used as the initial value of the project-level ScriptOptions.
public static readonly ScriptOptions DefaultScriptOptions
Field Value
Properties
DefaultParaTemplateDimension
Gets or sets the parameter template dimension (2D or 3D).
[JsAce]
public int DefaultParaTemplateDimension { get; set; }
Property Value
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
DispCacheMb
Gets or sets the display cache size in megabytes.
[Obsolete]
public long DispCacheMb { get; set; }
Property Value
DispCache_Mb
Gets or sets the display cache size in megabytes.
[JsAce]
public long DispCache_Mb { get; set; }
Property Value
EmbeddedLogMode
Gets or sets the embedded log mode for NC optimization.
[JsAce]
public static NcOptimizationEmbeddedLogMode EmbeddedLogMode { get; set; }
Property Value
EnableCollisionDetection
Gets or sets whether collision detection is enabled.
[JsAce(DocContentHtml = "Enable Collision Detection.")]
public bool EnableCollisionDetection { get; set; }
Property Value
EnableIndividualStepAdjustmentLog
Gets or sets whether to enable individual step adjustment logging. The setter drives both optimization pipelines: the legacy HardNc EnableIndividualStepAdjustmentLog and the SoftNc EnableStepAdjustmentLog statics are assigned together; the getter reads the legacy static (the pair only diverges when a static is assigned directly, bypassing this proxy).
[JsAce]
public static bool EnableIndividualStepAdjustmentLog { get; set; }
Property Value
EnableMapOnSelectionEnd
Gets or sets whether to automatically map selections when they end.
[JsAce]
public bool EnableMapOnSelectionEnd { get; set; }
Property Value
EnableMotionDependentMachiningResolution
Gets or sets whether motion-dependent machining resolution is enabled.
[JsAce]
public bool EnableMotionDependentMachiningResolution { get; set; }
Property Value
EnableMzLeverWeightingOnTraining
Gets or sets whether Mz lever weighting is enabled on training.
[Obsolete]
public bool EnableMzLeverWeightingOnTraining { get; set; }
Property Value
EnablePauseOnCollision
Gets or sets whether to pause execution when a collision is detected. This property only has an effect if collision detection is enabled.
[Obsolete]
public bool EnablePauseOnCollision { get; set; }
Property Value
EnablePauseOnFailure
Gets or sets whether to pause on failure during execution.
[JsAce(DocContentHtml = "Enable Pause On Failure.")]
public bool EnablePauseOnFailure { get; set; }
Property Value
EnablePhysics
Gets or sets whether milling force evaluation is enabled.
[JsAce(DocContentHtml = "Enable milling force evaluation.")]
public bool EnablePhysics { get; set; }
Property Value
EnableSampleNormalization
[Obsolete]
public bool EnableSampleNormalization { get; set; }
Property Value
Remarks
The input normalization deminish the quantity effect. The R-value decrease from 99% to 70% in moment training case from NKUST\nkust2024-milling-para-training-plan\workingx.hincproj Don't apply this option.
EnableSoftNcRunner
Switches between SoftNcRunner and the legacy
HardNcRunner. Default true; set false to
fall back to the legacy runner (e.g. for NC optimization, which still
reads NcLines).
Will be removed when HardNcRunner is fully replaced.
[JsAce(DocContentHtml = "Enable SoftNcRunner (default) instead of legacy HardNcRunner.")]
public bool EnableSoftNcRunner { get; set; }
Property Value
EnableWearEffect
Gets or sets whether tool wear effects are enabled in simulation.
[JsAce]
public bool EnableWearEffect { get; set; }
Property Value
FeedPerCycle
Gets a new feed per cycle machining motion resolution instance.
[JsAce]
public FeedPerCycleMachiningMotionResolution FeedPerCycle { get; }
Property Value
FeedPerTooth
Gets a new feed per tooth machining motion resolution instance.
[JsAce]
public FeedPerToothMachiningMotionResolution FeedPerTooth { get; }
Property Value
Fixture
Gets or sets the fixture.
[JsAce]
public Fixture Fixture { get; set; }
Property Value
Global
[JsAce("Global[$1key]")]
public Dictionary<object, object> Global { get; }
Property Value
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
JsAceCompletionProfileJsonArray
Internal used.
public static JsonArray JsAceCompletionProfileJsonArray { get; }
Property Value
MachiningMotionResolution
Gets or sets the machining motion resolution.
[JsAce]
public IMachiningMotionResolution MachiningMotionResolution { get; set; }
Property Value
MachiningResolution
Gets or sets the machining resolution in millimeters.
[JsAce]
[Obsolete("Use MachiningResolution_mm instead.")]
public double MachiningResolution { get; set; }
Property Value
MachiningResolution_mm
Gets or sets the machining resolution in millimeters.
[JsAce]
public double MachiningResolution_mm { get; set; }
Property Value
MachiningSession
public MachiningSession MachiningSession { get; }
Property Value
MapTask
Task tracking the status of mapping operations.
public Task MapTask { get; set; }
Property Value
MappingAnchorDateTime
Project-scoped anchor that converts an absolute-time mapping window / sensor stream into a relative timecode. Delegates to MappingAnchorDateTime; auto-set from the first controller instant on PlayCsvFile(string), or set here.
[JsAce]
public DateTime? MappingAnchorDateTime { get; set; }
Property Value
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, ICuttingPara) is intended to be used.
[JsAce]
public static int MillingCycleDivisionNum { get; set; }
Property Value
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, ICuttingPara) is intended to be used.
[JsAce(DocContentHtml = "Obsoleted. Use MillingCycleDivisionNum instead.")]
[Obsolete("Use MillingCycleDivisionNum instead.")]
public static int MillingForceCycleDivisionNum { get; set; }
Property Value
NcOptOption
Gets or sets the NC optimization options.
[JsAce]
public NcOptOption NcOptOption { get; set; }
Property Value
OptEnableDepthCompensation
Enables or disables depth compensation during optimization.
[JsAce]
public bool OptEnableDepthCompensation { get; set; }
Property Value
OptEnableFeedrate
Gets or sets whether to enable feed rate optimization in NC optimization.
[JsAce]
public bool OptEnableFeedrate { get; set; }
Property Value
OptEnableForwardCompensation
Enables or disables forward compensation during optimization.
[JsAce]
public bool OptEnableForwardCompensation { get; set; }
Property Value
OptEnableInterpolation
Enables or disables reinterpolation for optimization.
[JsAce]
public bool OptEnableInterpolation { get; set; }
Property Value
OptEnableSideCompensation
Enables or disables side compensation during optimization.
[JsAce]
public bool OptEnableSideCompensation { get; set; }
Property Value
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
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
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
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
OptMaxFeedPerTooth_mm
Gets or sets the maximum feed per tooth in millimeters for optimization.
[JsAce]
public double OptMaxFeedPerTooth_mm { get; set; }
Property Value
OptMaxFeedrate_mmdmin
Maximum feed rate in mm/min for cutting movements during optimization.
[JsAce]
public double OptMaxFeedrate_mmdmin { get; set; }
Property Value
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
OptMinFeedPerTooth_mm
Gets or sets the minimum feed per tooth in millimeters for optimization.
[JsAce]
public double OptMinFeedPerTooth_mm { get; set; }
Property Value
OptMinFeedrate_mmdmin
Minimum feed rate in mm/min for cutting movements during optimization.
[JsAce]
public double OptMinFeedrate_mmdmin { get; set; }
Property Value
OptPreferedForce_N
Preferred force in N for optimization.
[JsAce]
public double OptPreferedForce_N { get; set; }
Property Value
OptRapidFeed_mmdmin
Rapid feed rate in mm/min for non-cutting movements during optimization.
[JsAce]
public double OptRapidFeed_mmdmin { get; set; }
Property Value
OptSpindlePowerSafetyFactor
Safety factor for MAX spindle power during optimization.
[JsAce]
public double OptSpindlePowerSafetyFactor { get; set; }
Property Value
OptSpindlePowerUtilizationFactor
Utilization factor for MAX spindle power during optimization. It is the reciprocal of the spindle power safety factor.
[JsAce]
public double OptSpindlePowerUtilizationFactor { get; set; }
Property Value
OptSpindleTorqueSafetyFactor
Gets or sets the MAX spindle torque safety factor for NC optimization.
[JsAce]
public double OptSpindleTorqueSafetyFactor { get; set; }
Property Value
OptSpindleTorqueUtilizationFactor
Utilization factor for MAX spindle torque during optimization. It is the reciprocal of the spindle torque safety factor.
[JsAce]
public double OptSpindleTorqueUtilizationFactor { get; set; }
Property Value
OptThermalYieldSafetyFactor
Safety factor for spindle torque during optimization.
[JsAce]
public double OptThermalYieldSafetyFactor { get; set; }
Property Value
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
OptYieldingSafetyFactor
Safety factor for yielding during optimization.
[JsAce]
public double OptYieldingSafetyFactor { get; set; }
Property Value
OptYieldingUtilizationFactor
Utilization factor for yielding during optimization. It is the reciprocal of the yielding safety factor.
[JsAce]
public double OptYieldingUtilizationFactor { get; set; }
Property Value
ScriptOptions
ScriptOptions.
public ScriptOptions ScriptOptions { get; set; }
Property Value
ShellProgress
Session-level routine / lifecycle message sink on the IMessage channel (cache reset, file progress, session start/done). Owned by MachiningSession (truly session-scoped); exposed here for scripts and the session facade.
[JsAce]
public ShellProgress ShellProgress { get; }
Property Value
StepCount
Gets the total number of milling steps.
[JsAce]
public int StepCount { get; }
Property Value
StepDiagnosticProgress
Step-anchored message sink on the IMessage channel (see StepDiagnosticProgress).
[JsAce]
public StepDiagnosticProgress StepDiagnosticProgress { get; }
Property Value
Workpiece
Gets or sets the workpiece.
[JsAce]
public Workpiece Workpiece { get; set; }
Property Value
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)")]
public bool AddTimeDataByFile(string key, string relFile, double beginTime, double endTime)
Parameters
keystringKey to identify the data
relFilestringRelative path to the data file
beginTimedoubleBeginning time in seconds
endTimedoubleEnding 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)")]
public bool AddTimeDataByFile(string key, string relFile, string beginTimeText, string endTimeText)
Parameters
keystringKey to identify the data
relFilestringRelative path to the data file
beginTimeTextstringBeginning time as text (seconds or TimeSpan format)
endTimeTextstringEnding time as text (seconds or TimeSpan format)
Returns
- bool
True if the data was successfully added, false otherwise
AdjustedFeedPerCycle(double, double)
Gets a new feed per cycle machining motion resolution instance with adjusted scale and minimum linear resolution.
[JsAce("AdjustedFeedPerCycle($1scale,$2minLinearResolution_mm)")]
public FeedPerCycleMachiningMotionResolution AdjustedFeedPerCycle(double scale, double minLinearResolution_mm = 0)
Parameters
scaledoubleThe scale factor for the resolution.
minLinearResolution_mmdoubleThe minimum linear resolution in millimeters. Default is 0.
Returns
- FeedPerCycleMachiningMotionResolution
A new FeedPerCycleMachiningMotionResolution instance with the specified parameters.
AlignWorkpieceProgramZeroToIso(string)
Places workpiece + fixture so that ProgramZeroAnchor
coincides with the world position the spindle reaches when the machine
coordinate equals isoCoordId's entry (G54/G55/...).
The buckle anchors must already be set per the general rule (typically by
the project XML): FixtureBuckle at the bottom
center of the workpiece geom, WorkpieceBuckle at the
top center of the fixture geom, ProgramZeroAnchor
at the workpiece-geom top center (or any chosen tip). Only
GeomToTableTransformer is mutated. Delegates topology
math to AlignWorkpieceProgramZeroToIso(IMachiningEquipment, Vec3d).
[JsAce]
public void AlignWorkpieceProgramZeroToIso(string isoCoordId)
Parameters
isoCoordIdstringID into the IsoCoordinateTable, e.g.
“G54”.
AppendMessagesToFile(string, params string[])
Appends messages to a file, optionally filtered by tags.
[JsAce("AppendMessagesToFile(\"dstRelFile\",flags)")]
public void AppendMessagesToFile(string dstRelFile, params string[] flags)
Parameters
dstRelFilestringDestination relative file path
flagsstring[]Optional flags to filter messages by tags
BeginPreserve()
Begin Preserve section in optimzation process.
[JsAce("BeginPreserve()")]
public void BeginPreserve()
BeginSelection(string, AnchorMode, IStepShift)
Begin mark on current line. milling step() has not triggered yet.
public void BeginSelection(string key, AnchorMode anchorMode = AnchorMode.LineBegin, IStepShift shift = null)
Parameters
keystringIdentifier key for the selection
anchorModeAnchorModeMode for anchoring the beginning of selection
shiftIStepShiftStep shift to apply
BeginSession()
Begins a new machining session. Not for end user.
public void BeginSession()
ClearDefectDisplayee()
Clears the defect displayee from the workpiece.
[JsAce]
public void ClearDefectDisplayee()
ClearTimeMappingData()
Clears all time mapping data.
[JsAce]
public void ClearTimeMappingData()
ConvertClToNcFiles(string)
Converts the CLSF play of the current session into Fanuc NC files
(writeback synthesis): the MSYS frame becomes a G68.2 tilted
working plane, tool posture becomes G43.4 RTCP with rotary
words, motions become G00/G01/G02/G03. Play the CL file on an
XYZABC machine chain first, then convert.
[JsAce(Snippet = "ConvertClToNcFiles(\"Output/[NcName].nc\")", DocContentHtml = "Convert the played CLSF into Fanuc NC files by substitute template keyword \"[NcName]\"")]
public void ConvertClToNcFiles(string relNcFileTemplate = "Output/[NcName].nc")
Parameters
relNcFileTemplatestringOutput path template;
[NcName]is replaced by the source file name.
Diff(double)
Performs a difference analysis on the workpiece geometry to detect variations.
[JsAce("Diff($1detectionRadius_mm)")]
public void Diff(double detectionRadius_mm)
Parameters
detectionRadius_mmdoubleRadius for detecting differences
EndPreserve()
End Preserve section in optimzation process.
[JsAce("EndPreserve()")]
public void EndPreserve()
EndSelection(string, AnchorMode, IStepShift)
End mark on current line for selection.
public void EndSelection(string key, AnchorMode anchorMode = AnchorMode.LineEnd, IStepShift shift = null)
Parameters
keystringIdentifier key for the selection
anchorModeAnchorModeMode for anchoring the end of selection
shiftIStepShiftStep shift to apply
EndSession()
Ends the current machining session. Not for end user.
public void EndSession()
ErrorMessage(string)
Displays an error message in the message host.
[JsAce("ErrorMessage($1message)")]
public void ErrorMessage(string message)
Parameters
messagestringThe error message to display
ExportMeshedGeomToObj(string, double)
Exports the current meshed geometry to a Wavefront OBJ file with per-vertex RGB.
[JsAce("ExportMeshedGeomToObj($1\"dstFile\",$2resolution_mm)")]
public void ExportMeshedGeomToObj(string relFile, double resolution_mm = 0)
Parameters
relFilestringRelative path to the output OBJ file
resolution_mmdoubleResolution in millimeters (0 for default)
ExportMeshedGeomToPly(string, double)
Exports the current meshed geometry to a binary PLY file with per-vertex RGB.
[JsAce("ExportMeshedGeomToPly($1\"dstFile\",$2resolution_mm)")]
public void ExportMeshedGeomToPly(string relFile, double resolution_mm = 0)
Parameters
relFilestringRelative path to the output PLY file
resolution_mmdoubleResolution in millimeters (0 for default)
ExportMeshedGeomToStl(string, double)
Exports the current meshed geometry to an STL file.
[JsAce("ExportMeshedGeomToStl($1\"dstFile\",$2resolution_mm)")]
public void ExportMeshedGeomToStl(string relFile, double resolution_mm = 0)
Parameters
relFilestringRelative path to the output STL file
resolution_mmdoubleResolution in millimeters (0 for default)
ExportRuntimeGeomToObj(string, double)
Legacy script alias of ExportMeshedGeomToObj(string, double); kept so old player scripts keep working.
[Obsolete("Legacy alias; use ExportMeshedGeomToObj instead.")]
public void ExportRuntimeGeomToObj(string relFile, double resolution_mm = 0)
Parameters
ExportRuntimeGeomToPly(string, double)
Legacy script alias of ExportMeshedGeomToPly(string, double); kept so old player scripts keep working.
[Obsolete("Legacy alias; use ExportMeshedGeomToPly instead.")]
public void ExportRuntimeGeomToPly(string relFile, double resolution_mm = 0)
Parameters
ExportRuntimeGeomToStl(string, double)
Legacy script alias of ExportMeshedGeomToStl(string, double); kept so old player scripts keep working.
[Obsolete("Legacy alias; use ExportMeshedGeomToStl instead.")]
public void ExportRuntimeGeomToStl(string relFile, double resolution_mm = 0)
Parameters
FixedPace(double, double)
Creates a fixed machining motion resolution with specified parameters.
[JsAce("FixedPace($1linearResolution_mm, $2rotaryResolution_deg)")]
public FixedMachiningMotionResolution FixedPace(double linearResolution_mm, double rotaryResolution_deg)
Parameters
linearResolution_mmdoubleLinear resolution in millimeters
rotaryResolution_degdoubleRotary resolution in degrees
Returns
- FixedMachiningMotionResolution
A new fixed machining motion resolution instance
GetMillingStep(int)
Retrieves a milling step at the specified index.
[JsAce(Snippet = "GetMillingStep($1\"stepIndex\")")]
public MachiningStep GetMillingStep(int stepIndex)
Parameters
stepIndexintIndex of the milling step to retrieve
Returns
- MachiningStep
The milling step at the specified index
GetStickMachiningToolObservationHeight_mm(int)
Gets the observation height in millimeters for the specified stick machining tool.
[JsAce("GetStickMachiningToolObservationHeight_mm($1toolId)")]
public double GetStickMachiningToolObservationHeight_mm(int toolId)
Parameters
toolIdintThe ID of the tool
Returns
- double
The observation height in millimeters
GetUniformContourTrayShiftAngle_deg(int)
Gets the shift angle in degrees for the uniform contour tray of the specified tool.
[JsAce("GetUniformContourTrayShiftAngle_deg($1toolId)")]
public double GetUniformContourTrayShiftAngle_deg(int toolId)
Parameters
toolIdintThe ID of the tool
Returns
- double
The shift angle in degrees
LineSelection(string, AnchorMode, IStepShift, AnchorMode, IStepShift)
Create a line selection from begin to end mark.
public void LineSelection(string key, AnchorMode beginAnchorMode = AnchorMode.LineBegin, IStepShift beginShift = null, AnchorMode endAnchorMode = AnchorMode.LineEnd, IStepShift endShift = null)
Parameters
keystringIdentifier key for the selection
beginAnchorModeAnchorModeMode for anchoring the beginning of selection
beginShiftIStepShiftStep shift to apply at beginning
endAnchorModeAnchorModeMode for anchoring the end of selection
endShiftIStepShiftStep shift to apply at end
LoadCuttingParaByFile(string)
Loads cutting parameters from a file.
[JsAce("LoadCuttingParaByFile($1\"relFile\")")]
public void LoadCuttingParaByFile(string relFile)
Parameters
relFilestringFile path relative to BaseDirectory.
Map(string, IFileTimeSection, CycleSamplingMode?)
Maps selection data to time section.
public Task Map(string key, IFileTimeSection fileTimeSection = null, StepTimeShotUtil.CycleSamplingMode? cycleSamplingMode = CycleSamplingMode.SpindleCycle)
Parameters
keystringIdentifier key for the selection
fileTimeSectionIFileTimeSectionFile time section, or null to use the one associated with the key
cycleSamplingModeStepTimeShotUtil.CycleSamplingMode?Cycle sampling mode
Returns
- Task
Task representing the asynchronous mapping operation
MapByActualTime(string, CycleSamplingMode)
Maps machining steps by actual time from a time shot file.
[Obsolete]
public void MapByActualTime(string timeShotRelFile, StepTimeShotUtil.CycleSamplingMode cycleSamplingMode = CycleSamplingMode.SpindleCycle)
Parameters
timeShotRelFilestringRelative path to the time shot file.
cycleSamplingModeStepTimeShotUtil.CycleSamplingModeThe cycle sampling mode.
MapSeriesByCsvFile(string, CycleSamplingMode)
Maps machining steps by actual time from a time shot csv file.
[JsAce("MapSeriesByCsvFile($1timeShotRelFile)")]
public void MapSeriesByCsvFile(string timeShotRelFile, StepTimeShotUtil.CycleSamplingMode cycleSamplingMode = CycleSamplingMode.SpindleCycle)
Parameters
timeShotRelFilestringRelative path to the time shot file.
cycleSamplingModeStepTimeShotUtil.CycleSamplingModeThe cycle sampling mode.
MapSingleByCsvFile(string)
Reads a CSV file and performs time-based interpolation to map data to milling steps. It is one (step) - one (embedded-data) mapping.
[JsAce(Snippet = "MapSingleByCsvFile($1\"csvFile\")")]
public void MapSingleByCsvFile(string csvFile)
Parameters
csvFilestringPath to the CSV file relative to the base directory
Message(string)
Displays a message in the message host.
[JsAce("Message($1message)")]
public void Message(string message)
Parameters
messagestringThe message to display
OptCallPreferFuncIndexDictionary()
Gets the dictionary of preferred function index for NC optimization.
[JsAce("OptCallPreferFuncIndexDictionary()")]
public Dictionary<Func<MillingPhysicsBrief, double>, double> OptCallPreferFuncIndexDictionary()
Returns
- Dictionary<Func<MillingPhysicsBrief, double>, double>
Dictionary mapping functions to their preference indexes.
OptimizeToFiles(string)
Optimizes NC files and saves results using the specified file template.
Routing rule: when EnableSoftNcRunner
is on and the session holds played SoftNc
SyntaxPieceLayers (non-empty), the
SoftNc pipeline (OptimizeNcFiles(string, string, ICuttingPara, IProgress<IMessage>, CancellationToken, Func<int, MillingStepLuggage>, Action) /
Hi.NcOpt.SoftNcOptProc) is used; otherwise the legacy HardNc
OptimizeToFiles(ICuttingPara, MachiningSession, LinkedList<HardNcLine>, HardNcEnv, MachiningToolHouse, ClStrip, string, IProgress<IMessage>, CancellationToken, string) path runs unchanged. Both paths
first clear every cutter's MillingCutterOptLimit cache.
[JsAce(Snippet = "OptimizeToFiles(\"Output/Opt-[NcName]\")", DocContentHtml = "Optimize To Files by substitude template keywoard \"[NcName]\"")]
public void OptimizeToFiles(string relFileTemplate = "Output/Opt-[NcName]")
Parameters
relFileTemplatestringTemplate for output file path, can include [NcName] placeholder
Pace()
A pausable mark for the playing process. The function enables Pause() to take effect.
[JsAce("Pace();")]
public void Pace()
Remarks
Waits for the player to signal the next pace.
Pause()
Pause Player
[JsAce(DocContentHtml = "Pause Player")]
public void Pause()
PlayAct(IAct, ISentenceCarrier, CancellationToken?)
Plays an act with pacing control.
[JsAce]
public void PlayAct(IAct act, ISentenceCarrier sourceCommand = null, CancellationToken? cancellationToken = null)
Parameters
actIActThe act to play.
sourceCommandISentenceCarrierThe source command.
cancellationTokenCancellationToken?Cancellation token.
PlayClFile(string)
Plays an NX-CL (CLSF) file with the specified relative path.
[JsAce("PlayClFile($1\"clFile\");")]
public void PlayClFile(string relFilePath)
Parameters
relFilePathstringRelative path to the CLSF file
PlayClTeleport(double, double, double, double, double, double)
Plays a CL (cutter location) teleport operation.
[JsAce]
public void PlayClTeleport(double x, double y, double z, double i, double j, double k)
Parameters
xdoubleX coordinate.
ydoubleY coordinate.
zdoubleZ coordinate.
idoubleI vector component.
jdoubleJ vector component.
kdoubleK vector component.
PlayCsvFile(string)
Plays an Csv file with the specified relative path.
[JsAce("PlayCsvFile($1\"csvFile\");")]
public void PlayCsvFile(string relFilePath)
Parameters
relFilePathstringRelative 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.")]
public void PlayNc(string ncText, string fileNameAlternative = "--")
Parameters
PlayNcFile(string)
Plays an NC file with the specified relative path.
[JsAce("PlayNcFile($1\"ncFile\");")]
public void PlayNcFile(string relNcFilePath)
Parameters
relNcFilePathstringRelative path to the NC file
PlayToolingTeleport(int)
Plays a tooling teleport operation.
[JsAce]
public void PlayToolingTeleport(int toolId)
Parameters
toolIdintThe tool ID to teleport.
PowerReset()
Performs a controller power reset: every IPowerResettable dependency
in the active NcDependencyList clears its volatile subset (e.g. Fanuc
common volatile macro variables #100-#499). Persistent state is left intact.
[JsAce("PowerReset();")]
public void PowerReset()
Preserve()
Preserve one line NC code in optimzation process.
[JsAce("Preserve()")]
public void Preserve()
ProgressMessage(string)
Displays a progress message in the message host.
[JsAce("ProgressMessage($1message)")]
public void ProgressMessage(string message)
Parameters
messagestringThe progress message to display
ReTrainMillingPara(SampleFlag, string, double)
Re-trains milling parameters using the specified sample flag.
[JsAce("ReTrainMillingPara(Fx|Fy|Fz, $1dstFile)")]
public void ReTrainMillingPara(SampleFlag sampleFlag, string dstRelFile, double outlierRatio = 0.1)
Parameters
sampleFlagSampleFlagSample flag indicating which components to train
dstRelFilestringDestination relative file path
outlierRatiodoubleOutlier ratio for data filtering
ReadCsvByTimeInterpolation(string)
Reads a CSV file and performs time-based interpolation to map data to milling steps. It is one (step) - one (embedded-data) mapping.
[Obsolete]
public void ReadCsvByTimeInterpolation(string csvFile)
Parameters
csvFilestringPath to the CSV file relative to the base directory
ReadMeshedGeom(string)
Reads meshed geometry from a file.
[JsAce("ReadMeshedGeom($1\"srcFile\")")]
public void ReadMeshedGeom(string relFile)
Parameters
relFilestringRelative 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.")]
public void ReadRuntimeGeom(string relFile)
Parameters
relFilestring
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>")]
public void RegisterStepVariable(string key, string name, string unit, string formatString, Func<MachiningStep, object> variableFunc = null)
Parameters
keystringUnique key to identify the variable
namestringHuman-readable name of the variable
unitstringPhysical unit of the variable (can be null)
formatStringstringFormat string for displaying the variable (can be null)
variableFuncFunc<MachiningStep, object>Function to compute the variable value from a milling step (can be null)
RegisterWriteSyntaxPieces(string)
Registers a text writer so each executed SyntaxPiece is appended to
relOutputFile under the machining project base directory for debugging.
[JsAce(Snippet = "RegisterWriteSyntaxPieces($1\"Cache/syntax-pieces-output.txt\")")]
public void RegisterWriteSyntaxPieces(string relOutputFile)
Parameters
relOutputFilestringRelative path for the output log file.
RegisterWriteSyntaxPiecesWithActs(string)
Registers a writer that outputs each SyntaxPiece once, followed by its associated IAct entries (one-to-many).
[JsAce(Snippet = "RegisterWriteSyntaxPiecesWithActs($1\"Cache/syntax-pieces-acts-output.txt\")")]
public void RegisterWriteSyntaxPiecesWithActs(string relOutputFile)
Parameters
relOutputFilestringOutput file path relative to BaseDirectory.
RemoveFlyPiece()
Removes any disconnected or “flying” pieces from the workpiece geometry.
[JsAce]
public void RemoveFlyPiece()
Reset()
Reset Player
[JsAce(DocContentHtml = "Reset Player")]
public void Reset()
ResetRuntime()
Clears internal buffers.
[JsAce]
public void ResetRuntime()
RunNc(string, string)
Runs NC code directly from a string. Not for end user with no programing skill.
[JsAce(Snippet = "RunNc($1\"ncCommand\",$2\"\"(Direct Command)\"\");", DocContentHtml = "Run NC. second parameter is the file name alternative shows in the log.")]
public IEnumerable<Action> RunNc(string ncText, string fileNameAlternative = "--")
Parameters
Returns
- IEnumerable<Action>
Enumerable sequence of actions to be executed
RunNcFile(string)
Runs an NC file with the specified relative path. Not for end user with no programing skill.
[JsAce("RunNcFile($1\"ncFile\");")]
public IEnumerable<Action> RunNcFile(string relNcFilePath)
Parameters
relNcFilePathstringRelative path to the NC file
Returns
- IEnumerable<Action>
Enumerable sequence of actions to be executed
ScaledFeedPerCycle(double)
Gets a new feed per cycle machining motion resolution instance with the specified scale.
[JsAce("ScaledFeedPerCycle($1scale)")]
public FeedPerCycleMachiningMotionResolution ScaledFeedPerCycle(double scale)
Parameters
scaledoubleThe scale factor for the resolution.
Returns
- FeedPerCycleMachiningMotionResolution
A new FeedPerCycleMachiningMotionResolution instance with the specified scale.
ScanMeshedGeomInfDefect()
Scans the meshed geometry for defects. After scanning, the scanned defects will render in the workpiece.
[JsAce]
public bool? ScanMeshedGeomInfDefect()
Returns
- bool?
True if defects are found, false otherwise, or null if the operation cannot be performed.
ScanRuntimeGeomInfDefect()
Legacy script alias of ScanMeshedGeomInfDefect(); kept so old player scripts keep working.
[Obsolete("Legacy alias; use ScanMeshedGeomInfDefect instead.")]
public bool? ScanRuntimeGeomInfDefect()
Returns
- bool?
SetAllSnapshotSyntaxEnabled(bool)
Sets IsEnabled on every SnapshotSyntax reachable from the
active SoftNcRunner's NcSyntaxList (top-level slots
and inside BundleSyntax). No-op when SoftNcRunner
is not the active runner.
[JsAce(DocContentHtml = "Enable or disable every SnapshotSyntax in the active SoftNcRunner pipeline at once.")]
public void SetAllSnapshotSyntaxEnabled(bool isEnabled)
Parameters
isEnabledbool
SetNcResolutionFeedPerCycle()
Sets NC resolution to feed per cycle mode.
public void SetNcResolutionFeedPerCycle()
SetNcResolutionFeedPerTooth()
Sets NC resolution to feed per tooth mode.
public void SetNcResolutionFeedPerTooth()
SetNcResolutionFixed(double, double)
Sets NC resolution to fixed mode with specified resolution values.
public void SetNcResolutionFixed(double linearResolution_mm, double rotaryResolution_deg)
Parameters
linearResolution_mmdoubleLinear resolution in millimeters.
rotaryResolution_degdoubleRotary 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)")]
public void SetStickMachiningToolObservationHeight_mm(int toolId, double height)
Parameters
SetUniformContourTrayShiftAngle_deg(int, double)
Sets the shift angle in degrees for the uniform contour tray of the specified tool.
[JsAce("SetUniformContourTrayShiftAngle_deg($1toolId,$2angle_deg)")]
public void SetUniformContourTrayShiftAngle_deg(int toolId, double angle_deg)
Parameters
ShiftDistance_mm(double)
Creates a distance shift object representing the specified distance in millimeters.
public DistanceShift ShiftDistance_mm(double distanceShift_mm)
Parameters
distanceShift_mmdoubleDistance shift in millimeters
Returns
- DistanceShift
Distance shift object
ShiftTime_s(double)
Creates a time shift object representing the specified time in seconds.
public TimeShift ShiftTime_s(double seconds)
Parameters
secondsdoubleTime in seconds
Returns
- TimeShift
Time shift object
TrainMillingPara(SampleFlag, string, double, ICuttingPara)
Trains milling parameters using the specified sample flag.
[JsAce("TrainMillingPara(Fx|Fy|Fz, $1dstFile)")]
public void TrainMillingPara(SampleFlag sampleFlag, string dstRelFile, double outlierRatio = 0.1, ICuttingPara paraTemplate = null)
Parameters
sampleFlagSampleFlagSample flag indicating which components to train
dstRelFilestringDestination relative file path
outlierRatiodoubleOutlier ratio for data filtering
paraTemplateICuttingParaOptional parameter template for cutting operations.
WarningMessage(string)
Displays a warning message in the message host.
[JsAce("WarningMessage($1message)")]
public void WarningMessage(string message)
Parameters
messagestringThe warning message to display
WriteMeshedGeom(string)
Writes the current meshed geometry to a file.
[JsAce("WriteMeshedGeom($1\"dstFile\")")]
public void WriteMeshedGeom(string relFile)
Parameters
relFilestringRelative 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.")]
public void WriteRuntimeGeom(string relFile)
Parameters
relFilestring
WriteShotFiles(double, string)
Writes time-series data to shot files with the specified resolution period (alternative parameter order).
public void WriteShotFiles(double resolutionPeroid_ms, string relFileTemplate)
Parameters
resolutionPeroid_msdoubleResolution period in milliseconds
relFileTemplatestringTemplate 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")]
public void WriteShotFiles(string relFileTemplate = "Output/[NcName].shot.csv", double resolutionPeroid_ms = 1)
Parameters
relFileTemplatestringTemplate for output file path, can include [NcName] placeholder
resolutionPeroid_msdoubleResolution 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.")]
public void WriteStepFiles(string relFileTemplate = "Output/[NcName].step.csv")
Parameters
relFileTemplatestringTemplate for output file path, can include [NcName] placeholder
Events
MachiningStepBuilt
Session-scoped event triggered when a machining step is built. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession(). For app-lifetime event, use MachiningStepBuilt instead.
[Obsolete("Use SessionStepBuilt instead.")]
public event MachiningActRunner.MachiningStepBuiltDelegate MachiningStepBuilt
Event Type
MachiningStepSelected
Session-scoped event triggered when a machining step is selected. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession().
[Obsolete("Use SessionStepSelected instead.")]
public event Action<MachiningStep> MachiningStepSelected
Event Type
SessionSourcedActEntry
Session-scoped event triggered for each SourcedActEntry produced during NC/CSV execution. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession().
[JsAce(Snippet = "SessionSourcedActEntry+=($1entry)=>{$2Command};", DocContentHtml = "Session-scoped event triggered for each SourcedActEntry. entry.SentenceSource is the source sentence; entry.Act is the associated act (may be null).")]
public event Action<SourcedActEntry> SessionSourcedActEntry
Event Type
SessionStepBuilt
Session-scoped event triggered when a machining step is built. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession(). For app-lifetime event, use MachiningStepBuilt instead.
[JsAce(Snippet = "SessionStepBuilt+=($1preStep,$2curStep)=>{$3Command};", DocContentHtml = "Session-scoped step built event. preStep is the Previous Milling Step; curStep is the Current Milling Step. preStep is null if no previous step existed.")]
public event MachiningActRunner.MachiningStepBuiltDelegate SessionStepBuilt
Event Type
SessionStepSelected
Session-scoped event triggered when a machining step is selected. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession().
[JsAce(Snippet = "SessionStepSelected+=($1millingStep)=>{$2Command};")]
public event Action<MachiningStep> SessionStepSelected
Event Type
SessionSyntaxPieceRan
Session-scoped event triggered when a syntax piece has been executed. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession().
[JsAce(Snippet = "SessionSyntaxPieceRan+=($1syntaxPiece)=>{$2Command};", DocContentHtml = "Session-scoped event triggered after each SyntaxPiece is executed. syntaxPiece may be null if the source command is not a SyntaxPiece.")]
public event Action<SyntaxPiece> SessionSyntaxPieceRan
Event Type
SyntaxPieceRan
Session-scoped event triggered when a syntax piece has been executed. Lifetime is bound to MachiningSession: created by BeginSession(), released by EndSession().
[Obsolete("Use SessionSyntaxPieceRan instead.")]
public event Action<SyntaxPiece> SyntaxPieceRan