fix SoftNcRunner GM code normalization.
This commit is contained in:
@@ -88,8 +88,8 @@
|
||||
<h1 id="glossary-script-commands">Glossary: Script Commands</h1>
|
||||
|
||||
<h2 id="what-is-a-script-command">What Is a Script Command?</h2>
|
||||
<p>A <strong>script command</strong> is a C# statement executed by the HiNC scripting engine. Scripts directly reference members and methods of <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html">RuntimeApi</a>, which serves as the global scope — no explicit object reference is needed.</p>
|
||||
<pre><code class="lang-csharp">// These are all RuntimeApi members used directly as globals
|
||||
<p>A <strong>script command</strong> is a C# statement executed by the HiNC scripting engine. Scripts directly reference members and methods of <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html">SessionShell</a>, which serves as the global scope — no explicit object reference is needed.</p>
|
||||
<pre><code class="lang-csharp">// These are all SessionShell members used directly as globals
|
||||
EnablePhysics = true;
|
||||
MachiningResolution_mm = 0.125;
|
||||
PlayNcFile("NC/file1.nc");
|
||||
@@ -145,19 +145,19 @@ Message("Done");
|
||||
<h3 id="session-lifecycle">Session Lifecycle</h3>
|
||||
<ol>
|
||||
<li>Scripts execute in order on the <strong>Task</strong> page</li>
|
||||
<li>A <a class="xref" href="../../api/Hi.Common.PacePlayer.html">PacePlayer</a><small>(API)</small> controls playback — script commands like <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_PlayNcFile_">PlayNcFile</a><small>(API)</small> block until the NC program completes</li>
|
||||
<li>Player control commands (<a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Pace">Pace()</a><small>(API)</small>, <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Pause">Pause()</a><small>(API)</small>, <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Reset">Reset()</a><small>(API)</small>) interact with the <a class="xref" href="../../api/Hi.Common.PacePlayer.html">PacePlayer</a><small>(API)</small></li>
|
||||
<li><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ResetRuntime_">ResetRuntime</a><small>(API)</small> clears event handlers, buffers, and runtime state</li>
|
||||
<li>A <a class="xref" href="../../api/Hi.Common.PacePlayer.html">PacePlayer</a><small>(API)</small> controls playback — script commands like <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayNcFile_">PlayNcFile</a><small>(API)</small> block until the NC program completes</li>
|
||||
<li>Player control commands (<a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_Pace">Pace()</a><small>(API)</small>, <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_Pause">Pause()</a><small>(API)</small>, <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_Reset">Reset()</a><small>(API)</small>) interact with the <a class="xref" href="../../api/Hi.Common.PacePlayer.html">PacePlayer</a><small>(API)</small></li>
|
||||
<li><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_ResetRuntime_">ResetRuntime</a><small>(API)</small> clears event handlers, buffers, and runtime state</li>
|
||||
</ol>
|
||||
<h3 id="event-driven-execution">Event-Driven Execution</h3>
|
||||
<p>Events like <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionStepBuilt">SessionStepBuilt</a><small>(API)</small> fire during simulation and allow per-step logic:</p>
|
||||
<p>Events like <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_SessionStepBuilt">SessionStepBuilt</a><small>(API)</small> fire during simulation and allow per-step logic:</p>
|
||||
<pre><code class="lang-csharp">SessionStepBuilt += (preStep, curStep) => {
|
||||
if (curStep != null)
|
||||
Message($"Step: ToolId={curStep.ToolId}");
|
||||
};
|
||||
PlayNcFile("NC/file1.nc");
|
||||
</code></pre>
|
||||
<p>Events are cleared by <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_ResetRuntime_">ResetRuntime</a>.</p>
|
||||
<p>Events are cleared by <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_ResetRuntime_">ResetRuntime</a>.</p>
|
||||
<hr>
|
||||
<h2 id="script-commands-in-nc-code">Script Commands in NC Code</h2>
|
||||
<p>Script commands can be embedded inside NC code comments. Lines starting with <code>;@</code> execute before that NC line runs:</p>
|
||||
@@ -184,11 +184,11 @@ WriteShotFiles("Output/[NcName].shot.csv", 1);
|
||||
<li><strong>Do not save the project during simulation.</strong> System-internal configuration (e.g., training-specific resolution overrides) may overwrite your settings.</li>
|
||||
<li><strong>Do not reset the player during milling coefficient training.</strong> Close the project instead of pressing the reset button to avoid unexpected errors.</li>
|
||||
<li><strong>Do not modify resolution, tool, or controller settings during training.</strong> Changing these mid-training invalidates the results.</li>
|
||||
<li><strong>Do not combine <code>UpdateNcOptOption</code> in <a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_SessionStepBuilt">SessionStepBuilt</a><small>(API)</small> with NC-embedded optimization commands.</strong> Parallel computation may cause undefined behavior.</li>
|
||||
<li><strong>Do not combine <code>UpdateNcOptOption</code> in <a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_SessionStepBuilt">SessionStepBuilt</a><small>(API)</small> with NC-embedded optimization commands.</strong> Parallel computation may cause undefined behavior.</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<h2 id="global-variables">Global Variables</h2>
|
||||
<p><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html#Hi_MachiningProcs_RuntimeApi_Global">Global</a> provides a key-value dictionary for sharing data across scripts:</p>
|
||||
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_Global">Global</a> provides a key-value dictionary for sharing data across scripts:</p>
|
||||
<pre><code class="lang-csharp">Global["material"] = "Steel";
|
||||
var material = Global["material"];
|
||||
</code></pre>
|
||||
@@ -196,12 +196,12 @@ var material = Global["material"];
|
||||
<h2 id="full-api-reference">Full API Reference</h2>
|
||||
<p>For the complete list of available commands, properties, and events, see:</p>
|
||||
<ul>
|
||||
<li><a class="xref" href="../../api/Hi.MachiningProcs.RuntimeApi.html">RuntimeApi</a> — full API documentation</li>
|
||||
<li><a class="xref" href="runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — categorized quick-reference table</li>
|
||||
<li><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html">SessionShell</a> — full API documentation</li>
|
||||
<li><a class="xref" href="session-shell.html">Glossary: SessionShell Quick-Reference</a> — categorized quick-reference table</li>
|
||||
</ul>
|
||||
<h2 id="see-also">See Also</h2>
|
||||
<ul>
|
||||
<li><a class="xref" href="runtime-api.html">Glossary: RuntimeApi Quick-Reference</a> — RuntimeApi quick-reference</li>
|
||||
<li><a class="xref" href="session-shell.html">Glossary: SessionShell Quick-Reference</a> — SessionShell quick-reference</li>
|
||||
<li><a class="xref" href="machining-step.html">Glossary: Machining Step</a> — machining step data model</li>
|
||||
<li><a class="xref" href="../../workflows/basic-simulation.html">Workflow: Basic Machining Simulation</a> — using scripts in a simulation workflow</li>
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user