This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2026-09-09 17:35:23 +08:00

228 lines
13 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cutter-Location (CL) Playback | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Cutter-Location (CL) Playback | HiAPI-C# 2025 ">
<link rel="icon" href="../../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
<meta name="docfx:navrel" content="../../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../../index.html">
<img id="logo" class="svg" src="../../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="CutterLocation-Playback">
<h1 id="cutter-location-cl-playback">Cutter-Location (CL) Playback</h1>
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayClFile_">PlayClFile</a> replays a <strong>CAM cutter-location file</strong> — an NX CLSF (<code>.cls</code>) / APT-source toolpath — directly as tool motion, without a post-processor. Use it to verify the <em>programmed</em> toolpath itself (gouge, overcut, engagement) <strong>before</strong> it is post-processed for any particular machine.</p>
<p>The same file can also be played onto a real machine-tool chain, and a played CL program can be written back out as Fanuc NC — see <a href="#two-chains-two-questions">Two chains, two questions</a> and <a href="#converting-cl-to-nc">Converting CL to NC</a>.</p>
<h2 id="cl-vs-nc--two-different-inputs">CL vs. NC — two different inputs</h2>
<table>
<thead>
<tr>
<th></th>
<th><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayNcFile_">PlayNcFile</a> (NC / G-code)</th>
<th><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayClFile_">PlayClFile</a> (CL / CLSF)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Source</td>
<td>Post-processed G-code for <strong>one specific machine</strong></td>
<td>CAM cutter-location output, <strong>before</strong> post-processing, machine-independent</td>
</tr>
<tr>
<td>Content</td>
<td>Axis moves (<code>G01 X.. Y.. Z..</code>), work offsets, canned cycles</td>
<td>Cutter locations (<code>GOTO</code>), arcs (<code>CIRCLE</code>), tool axis vectors</td>
</tr>
<tr>
<td>Drives</td>
<td>A <strong>machine-tool chain</strong> (X/Y/Z/A/B/C axes) through kinematics</td>
<td>Either chain — see below</td>
</tr>
<tr>
<td>Answers</td>
<td>&ldquo;What does <em>this machine</em> do with this program?&rdquo;</td>
<td>&ldquo;Is the <em>programmed path</em> correct?&rdquo; — or, on a machine chain, both questions at once</td>
</tr>
</tbody>
</table>
<p>A cutter location is a <strong>point plus a tool-axis direction</strong> in workpiece coordinates. <code>PlayClFile</code> places the tool at each location in turn and sweeps the removed material between them.</p>
<h2 id="two-chains-two-questions">Two chains, two questions</h2>
<p>The chain configured in project setup decides what a CL play means.</p>
<p><strong>On a <a class="xref" href="../../api/HiMachining.Milling.ClMillingDevice.html">ClMillingDevice</a></strong> the cutter location is applied straight to the tool: no inverse kinematics, no work-coordinate offsets, no controller dialect. This is the machine-independent check — it answers whether the CAM output itself is correct, and it is the right chain when you do not yet know which machine will run the job.</p>
<p><strong>On a machine-tool chain</strong> every CLSF motion endpoint is inverse-solved at parse time and expressed in the same program-to-machine transform vocabulary the NC pipeline uses — a tool-height entry from the active tool, a pivot entry anchored to the workpiece frame, and the solved rotary axes — so the shared machine-coordinate and rotary-wrap handling is reused unchanged. This answers what a <em>particular</em> machine would do with the path, including reach and rotary behaviour, without a post-processor in between.</p>
<div class="NOTE">
<h5>Note</h5>
<p>A machine-chain play needs the project's kinematics to resolve to a live solver. Where an endpoint cannot be solved, the motion is reported rather than silently dropped — watch for <code>ClToMc--EndpointIkFailed</code> and <code>ClToMc--NoToolOffset</code> in the diagnostics.</p>
</div>
<h2 id="converting-cl-to-nc">Converting CL to NC</h2>
<p><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_ConvertClToNcFiles_">ConvertClToNcFiles</a> writes a played CL program back out as Fanuc NC, one file per source file, template-substituting <code>[NcName]</code> (default <code>Output/[NcName].nc</code>). It requires a prior play <strong>on a machine chain</strong> — a <code>ClMillingDevice</code> leaves no machine-solved data to serialize — and reports <code>ConvertClToNc--NoPlay</code> otherwise. A mission can declare the writeback through <a class="xref" href="../../api/Hi.SessionCommands.PostExecutionCommand.html#Hi_SessionCommands_PostExecutionCommand_EnableConvertClToNcFiles">EnableConvertClToNcFiles</a> and <a class="xref" href="../../api/Hi.SessionCommands.PostExecutionCommand.html#Hi_SessionCommands_PostExecutionCommand_ClToNcFileTemplate">ClToNcFileTemplate</a>.</p>
<h2 id="file-format">File format</h2>
<p>The reader parses <strong>NX CLSF</strong> records (the APT-source language):</p>
<table>
<thead>
<tr>
<th>Record</th>
<th>Effect</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>GOTO</code></td>
<td>Cutter location — first one positions the tool (rapid teleport); subsequent ones cut a straight CL path</td>
</tr>
<tr>
<td><code>CIRCLE</code> / <code>MOVARC</code></td>
<td>Arms an arc; the following <code>GOTO</code> closes it into a true circular CL path</td>
</tr>
<tr>
<td><code>RAPID</code></td>
<td>Marks the next move as a non-cutting rapid</td>
</tr>
<tr>
<td><code>FEDRAT</code></td>
<td>Feed rate (<code>MMPM</code> / <code>IPM</code>)</td>
</tr>
<tr>
<td><code>SPINDL</code></td>
<td>Spindle speed and direction</td>
</tr>
<tr>
<td><code>COOLNT</code></td>
<td>Coolant mode (<code>ON</code> / <code>FLOOD</code> / <code>MIST</code> / <code>OFF</code>)</td>
</tr>
<tr>
<td><code>TLDATA</code></td>
<td>Tool geometry (diameter, corner radius, length, angles)</td>
</tr>
<tr>
<td><code>LOAD/TOOL</code></td>
<td>Tool change to a tool id</td>
</tr>
</tbody>
</table>
<p>Comments (<code>$$</code> to end of line) and line continuation (trailing <code>$</code>) are honored. Records outside this set (<code>PAINT</code>, <code>TOOLNO</code>, <code>TOOL PATH</code>, …) are skipped.</p>
<div class="NOTE">
<h5>Note</h5>
<p>&ldquo;APT&rdquo; here means the APT <strong>toolpath language</strong> (<code>GOTO</code>, <code>CIRCLE</code>, …). This is a different use of the word from the <a class="xref" href="../milling-physics/cutter-geometry.html">Cutter Geometry</a> page, which defines cutter <strong>geometry</strong>. A CL file's <code>TLDATA</code> feeds that same tool-geometry model — see below.</p>
</div>
<p>The dialect parsed is Siemens NX (<code>.cls</code>). Other CAM systems emit the same APT record family under different names (CATIA APTSOURCE, Creo CL files); those dialects are not yet parsed.</p>
<h2 id="tools-from-the-file">Tools from the file</h2>
<p>A CL file usually carries its own tool definitions. On <code>LOAD/TOOL,&lt;id&gt;</code>, if the tool house has no matching id, the preceding <code>TLDATA</code> geometry is used to create the tool automatically. An id <strong>already present</strong> in the tool house keeps its configured tool — so you can pre-configure tools for accuracy, or let simple files be self-contained.</p>
<h2 id="example">Example</h2>
<pre><code class="lang-csharp">// The machining chain must be a ClMillingDevice (set in project setup).
MachiningResolution_mm = 0.125;
EnablePhysics = false; // geometry-only check first
PlayClFile(&quot;CL/part-op10.cls&quot;); // replay the CAM cutter-location file
Diff(&quot;target/part-op10.stl&quot;); // compare the cut against the design target
</code></pre>
<p>The project keeps a dedicated CL runner suit (<a class="xref" href="../../api/Hi.MachiningProcs.MachiningProject.html#Hi_MachiningProcs_MachiningProject_ClsfRunnerSuit">ClsfRunnerSuit</a>) alongside its NC and CSV suits; the parser itself is the <a class="xref" href="../../api/Hi.Numerical.ClsfParsers.NxClRunner.html">NxClRunner</a> preset.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a class="xref" href="../../api/Hi.MachiningProcs.SessionShell.html#Hi_MachiningProcs_SessionShell_PlayClFile_">PlayClFile</a> — the script command</li>
<li><a class="xref" href="../../api/HiMachining.Milling.ClMillingDevice.html">ClMillingDevice</a> — the cutter-location-driven chain</li>
<li><a class="xref" href="../milling-physics/cutter-geometry.html">Cutter Geometry</a> — cutter geometry (the other meaning of &ldquo;APT&rdquo;)</li>
<li><a class="xref" href="script-command.html">Script Commands</a> — what is a script command</li>
</ul>
</article>
<div class="contribution d-print-none">
</div>
<div class="next-article d-print-none border-top" id="nextArticle"></div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>