@@ -157,6 +157,25 @@ internal static class FwlibNative
|
||||
short length,
|
||||
ref OPMSG3 buffer);
|
||||
|
||||
// ---- Figure (per-axis decimal scaling) ----
|
||||
|
||||
/// <summary>
|
||||
/// <c>cnc_getfigure</c> — read per-axis figure info (decimal-place counts + units).
|
||||
/// <paramref name="kind"/>: 0 = absolute / relative / machine position figures,
|
||||
/// 1 = work-coord shift figures (per Fanuc reference). The reply struct holds
|
||||
/// up to <see cref="MAX_AXIS"/> axis entries; the managed side reads the count
|
||||
/// out via <paramref name="outCount"/>. Position values from <c>cnc_absolute</c>
|
||||
/// / <c>cnc_machine</c> / <c>cnc_relative</c> / <c>cnc_distance</c> / <c>cnc_actf</c>
|
||||
/// are scaled integers — divide by <c>10^figureinfo[axis].dec</c> for user units
|
||||
/// (issue #262, plan PR F1-f).
|
||||
/// </summary>
|
||||
[DllImport(Library, EntryPoint = "cnc_getfigure", ExactSpelling = true)]
|
||||
public static extern short GetFigure(
|
||||
ushort handle,
|
||||
short kind,
|
||||
ref short outCount,
|
||||
ref IODBAXIS figureinfo);
|
||||
|
||||
// ---- Currently-executing block ----
|
||||
|
||||
/// <summary>
|
||||
@@ -298,6 +317,31 @@ internal static class FwlibNative
|
||||
public byte[] Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum axis count per the FWLIB <c>fwlib32.h</c> ceiling for figure-info reads.
|
||||
/// Real Fanuc CNCs cap at 8 simultaneous axes for most series; we marshal an
|
||||
/// 8-entry array (matches <see cref="IODBAXIS"/>) so the call completes regardless
|
||||
/// of the deployment's axis count (issue #262).
|
||||
/// </summary>
|
||||
public const int MAX_AXIS = 8;
|
||||
|
||||
/// <summary>
|
||||
/// IODBAXIS — per-axis figure info read buffer for <c>cnc_getfigure</c>. Each
|
||||
/// axis entry carries the decimal-place count (<c>dec</c>) the CNC reports for
|
||||
/// that axis's increment system + a unit code. The managed side reads the first
|
||||
/// <c>outCount</c> entries returned by FWLIB; we marshal a fixed 8-entry ceiling
|
||||
/// (issue #262, plan PR F1-f).
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct IODBAXIS
|
||||
{
|
||||
// Each entry per fwlib32.h is { short dec, short unit, short reserved, short reserved2 }
|
||||
// = 8 bytes. 8 axes * 8 bytes = 64 bytes; we marshal a fixed byte buffer + decode on
|
||||
// the managed side so axis-count growth doesn't churn the P/Invoke surface.
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8 * 8)]
|
||||
public byte[] Data;
|
||||
}
|
||||
|
||||
/// <summary>ODBST — CNC status info. Machine state, alarm flags, automatic / edit mode.</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct ODBST
|
||||
|
||||
Reference in New Issue
Block a user