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
HiNC-2025-win-desktop-Deploy/App/wwwroot/HiAPI-docsite/api/Hi.Numerical.Acts.ActUtil.html
T
2026-09-09 17:35:23 +08:00

511 lines
20 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class ActUtil | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class ActUtil | HiAPI-C# 2025 ">
<meta name="description" content="Provides utility methods for numerical control actions.">
<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="ManagedReference">
<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="Hi.Numerical.Acts.ActUtil">
<h1 id="Hi_Numerical_Acts_ActUtil" data-uid="Hi.Numerical.Acts.ActUtil" class="text-break">
Class ActUtil
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="Hi.html">Hi</a>.<a class="xref" href="Hi.Numerical.html">Numerical</a>.<a class="xref" href="Hi.Numerical.Acts.html">Acts</a></dd></dl>
<dl><dt>Assembly</dt><dd>HiMech.dll</dd></dl>
</div>
<div class="markdown summary"><p>Provides utility methods for numerical control actions.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class ActUtil</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">ActUtil</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="fields">Fields
</h2>
<h3 id="Hi_Numerical_Acts_ActUtil_MaxStepNumPerAct" data-uid="Hi.Numerical.Acts.ActUtil.MaxStepNumPerAct">
MaxStepNumPerAct
</h3>
<div class="markdown level1 summary"><p>Hard cap on the number of steps one act may split into. The finest
machining resolution the runner accepts (1/4096 mm, the lower bound of
the machining-resolution clamp) over a one-metre traverse is ~4M steps; a real quotient
beyond that means a degenerate resolution or geometry, not a finer
request. Without the cap, <code>(int)</code> of an infinite or huge
quotient saturates to <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32.maxvalue">MaxValue</a> on .NET 9+ and the
act plays as 2^31 zero-duration steps — the &ldquo;one line, frozen cycle
time, step index climbing forever&rdquo; hang.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int MaxStepNumPerAct = 4000000</code></pre>
</div>
<h4 class="section">Field Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
</dl>
<h2 class="section" id="methods">Methods
</h2>
<a id="Hi_Numerical_Acts_ActUtil_GetClSteps_" data-uid="Hi.Numerical.Acts.ActUtil.GetClSteps*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_GetClSteps_Hi_Numerical_Acts_IActClMove_System_Int32_Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_" data-uid="Hi.Numerical.Acts.ActUtil.GetClSteps(Hi.Numerical.Acts.IActClMove,System.Int32,Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution)">
GetClSteps(IActClMove, int, IMachiningMotionResolution)
</h3>
<div class="markdown level1 summary"><p>Splits a cutter location movement into a sequence of steps according to the NC resolution and desired step count.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IEnumerable&lt;ActClStep&gt; GetClSteps(this IActClMove actClMove, int stepNum, IMachiningMotionResolution ncResolution)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>actClMove</code> <a class="xref" href="Hi.Numerical.Acts.IActClMove.html">IActClMove</a></dt>
<dd><p>The cutter location movement action.</p>
</dd>
<dt><code>stepNum</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The number of steps to split into.</p>
</dd>
<dt><code>ncResolution</code> <a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html">IMachiningMotionResolution</a></dt>
<dd><p>The machining motion resolution.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a class="xref" href="Hi.Numerical.Acts.ActClStep.html">ActClStep</a>&gt;</dt>
<dd><p>An enumerable sequence of <a class="xref" href="Hi.Numerical.Acts.ActClStep.html">ActClStep</a>.</p>
</dd>
</dl>
<a id="Hi_Numerical_Acts_ActUtil_GetStepNum_" data-uid="Hi.Numerical.Acts.ActUtil.GetStepNum*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_GetStepNum_Hi_Common_SeqPair_Hi_Geom_DVec3d__Hi_Numerical_Xyzabc_IMachineKinematics_System_Double_Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_System_TimeSpan_" data-uid="Hi.Numerical.Acts.ActUtil.GetStepNum(Hi.Common.SeqPair{Hi.Geom.DVec3d},Hi.Numerical.Xyzabc.IMachineKinematics,System.Double,Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution,System.TimeSpan)">
GetStepNum(SeqPair&lt;DVec3d&gt;, IMachineKinematics, double, IMachiningMotionResolution, TimeSpan)
</h3>
<div class="markdown level1 summary"><p>Gets the step number for a rotary-bearing (XYZABC) machine coordinate
move. Two motions are bounded separately and the larger count wins:</p>
<ul><li>the posture change — each rotary axis delta over
<a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html#Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_RotaryAxisResolution_rad">RotaryAxisResolution_rad</a>;</li><li>the travel — by the resolution's time criterion
(<a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html#Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_GetStepNumByDuration_System_TimeSpan_System_Double_">GetStepNumByDuration(TimeSpan, double)</a>, one
step per spindle cycle) when it applies, otherwise the real tool-tip
travel of the equipped tool over
<a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html#Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_LinearResolution_mm">LinearResolution_mm</a>.</li></ul>
With a posture change the tip travel is never divided by a feed-derived
linear resolution: that resolution describes the controller's commanded
CL point, and under RTCP the real tip can sweep hundreds of millimetres
while the CL point stands still. Without a posture change the tip
translates with the CL point, so the tip travel over the linear
resolution is the CL point's own count — the act keeps the distance
form, exactly the number the XYZ-only splitters produce (Soft/Hard
parity on a 3-axis move that one engine wraps as an XYZABC act; a
time count would differ by one on <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a> tick rounding).
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int GetStepNum(SeqPair&lt;DVec3d&gt; mcSeq, IMachineKinematics coordinateConverter, double toolHeightForComputingStepNum, IMachiningMotionResolution ncResolution, TimeSpan duration)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>mcSeq</code> <a class="xref" href="Hi.Common.SeqPair-1.html">SeqPair</a>&lt;<a class="xref" href="Hi.Geom.DVec3d.html">DVec3d</a>&gt;</dt>
<dd><p>The machine coordinate sequence.</p>
</dd>
<dt><code>coordinateConverter</code> <a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html">IMachineKinematics</a></dt>
<dd><p>The coordinate converter to use; null when no tool-tip travel is available.</p>
</dd>
<dt><code>toolHeightForComputingStepNum</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The equipped tool's spindle-buckle-to-tip length.</p>
</dd>
<dt><code>ncResolution</code> <a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html">IMachiningMotionResolution</a></dt>
<dd><p>The machining motion resolution.</p>
</dd>
<dt><code>duration</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.timespan">TimeSpan</a></dt>
<dd><p>The act's duration, for the time criterion.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The calculated step number.</p>
</dd>
</dl>
<a id="Hi_Numerical_Acts_ActUtil_GetStepNumOnPolarInterpolationMode_" data-uid="Hi.Numerical.Acts.ActUtil.GetStepNumOnPolarInterpolationMode*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_GetStepNumOnPolarInterpolationMode_Hi_Common_SeqPair_Hi_Geom_Vec3d__Hi_Numerical_MachiningMotionResolutionUtils_IMachiningMotionResolution_" data-uid="Hi.Numerical.Acts.ActUtil.GetStepNumOnPolarInterpolationMode(Hi.Common.SeqPair{Hi.Geom.Vec3d},Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution)">
GetStepNumOnPolarInterpolationMode(SeqPair&lt;Vec3d&gt;, IMachiningMotionResolution)
</h3>
<div class="markdown level1 summary"><p>Gets the step number for a polar interpolation mode.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int GetStepNumOnPolarInterpolationMode(SeqPair&lt;Vec3d&gt; programPolarXczSeq, IMachiningMotionResolution ncResolution)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>programPolarXczSeq</code> <a class="xref" href="Hi.Common.SeqPair-1.html">SeqPair</a>&lt;<a class="xref" href="Hi.Geom.Vec3d.html">Vec3d</a>&gt;</dt>
<dd><p>The program polar XCZ sequence.</p>
</dd>
<dt><code>ncResolution</code> <a class="xref" href="Hi.Numerical.MachiningMotionResolutionUtils.IMachiningMotionResolution.html">IMachiningMotionResolution</a></dt>
<dd><p>The machining motion resolution.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The calculated step number.</p>
</dd>
</dl>
<a id="Hi_Numerical_Acts_ActUtil_GetToolTipTravel_" data-uid="Hi.Numerical.Acts.ActUtil.GetToolTipTravel*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_GetToolTipTravel_Hi_Geom_DVec3d_Hi_Geom_DVec3d_Hi_Numerical_Xyzabc_IMachineKinematics_System_Double_" data-uid="Hi.Numerical.Acts.ActUtil.GetToolTipTravel(Hi.Geom.DVec3d,Hi.Geom.DVec3d,Hi.Numerical.Xyzabc.IMachineKinematics,System.Double)">
GetToolTipTravel(DVec3d, DVec3d, IMachineKinematics, double)
</h3>
<div class="markdown level1 summary"><p>Real tool-tip travel between two machine coordinates: the chord between
the tips of the equipped tool (<code class="paramref">compensationHeight</code>
below the spindle buckle along the tool normal) at both poses.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static double GetToolTipTravel(DVec3d mcXyzabc0, DVec3d mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>mcXyzabc0</code> <a class="xref" href="Hi.Geom.DVec3d.html">DVec3d</a></dt>
<dd></dd>
<dt><code>mcXyzabc1</code> <a class="xref" href="Hi.Geom.DVec3d.html">DVec3d</a></dt>
<dd></dd>
<dt><code>coordinateConverter</code> <a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html">IMachineKinematics</a></dt>
<dd></dd>
<dt><code>compensationHeight</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
</dl>
<a id="Hi_Numerical_Acts_ActUtil_ToStepNum_" data-uid="Hi.Numerical.Acts.ActUtil.ToStepNum*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_ToStepNum_System_Double_" data-uid="Hi.Numerical.Acts.ActUtil.ToStepNum(System.Double)">
ToStepNum(double)
</h3>
<div class="markdown level1 summary"><p>Converts a real-valued step quotient (<code>total / unitPerStep</code>)
into a bounded step count: NaN or non-positive → 0; otherwise the
ceiling, clamped to <a class="xref" href="Hi.Numerical.Acts.ActUtil.html#Hi_Numerical_Acts_ActUtil_MaxStepNumPerAct">MaxStepNumPerAct</a>. Every act's
step-number derivation goes through here so no division can turn
into a saturated integer.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static int ToStepNum(double stepQuotient)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>stepQuotient</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd></dd>
</dl>
<a id="Hi_Numerical_Acts_ActUtil_UpdateStepNumByCl_" data-uid="Hi.Numerical.Acts.ActUtil.UpdateStepNumByCl*"></a>
<h3 id="Hi_Numerical_Acts_ActUtil_UpdateStepNumByCl_Hi_Geom_DVec3d_Hi_Geom_DVec3d_Hi_Numerical_Xyzabc_IMachineKinematics_System_Double_System_Double_System_Int32__" data-uid="Hi.Numerical.Acts.ActUtil.UpdateStepNumByCl(Hi.Geom.DVec3d,Hi.Geom.DVec3d,Hi.Numerical.Xyzabc.IMachineKinematics,System.Double,System.Double,System.Int32@)">
UpdateStepNumByCl(DVec3d, DVec3d, IMachineKinematics, double, double, ref int)
</h3>
<div class="markdown level1 summary"><p>Updates the step number based on cutter location points.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static void UpdateStepNumByCl(DVec3d mcXyzabc0, DVec3d mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight, double linearResolution_mm, ref int stepNum)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>mcXyzabc0</code> <a class="xref" href="Hi.Geom.DVec3d.html">DVec3d</a></dt>
<dd><p>The starting machine coordinate.</p>
</dd>
<dt><code>mcXyzabc1</code> <a class="xref" href="Hi.Geom.DVec3d.html">DVec3d</a></dt>
<dd><p>The ending machine coordinate.</p>
</dd>
<dt><code>coordinateConverter</code> <a class="xref" href="Hi.Numerical.Xyzabc.IMachineKinematics.html">IMachineKinematics</a></dt>
<dd><p>The coordinate converter to use.</p>
</dd>
<dt><code>compensationHeight</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The compensation height value.</p>
</dd>
<dt><code>linearResolution_mm</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.double">double</a></dt>
<dd><p>The linear resolution in millimeters.</p>
</dd>
<dt><code>stepNum</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></dt>
<dd><p>The step number to update.</p>
</dd>
</dl>
</article>
<div class="contribution d-print-none">
</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>