TL;DR
When using the bundled fwlibNCG.dll / fwlibNCG64.dll against a running Fanuc NCGuide simulator on the same Windows host, the working call is cnc_allclibhndl2(node=9, &handle) — not cnc_allclibhndl3 over TCP. Posting this here in case it's useful for the README or for other users who land in the same spot.
Background
The compatibility matrix on the README lists FWLIBNCG.DLL / FWLIBNCG64.DLL as the libraries for NCGuide-Pro, but doesn't go into the call-side specifics, and the natural assumption (cnc_allclibhndl3("127.0.0.1", 8193, ...) — same as a real CNC) doesn't work against standard NCGuide. It returns EW_MMCSYS (-15) because standard NCGuide doesn't actually serve FOCAS2/Ethernet on TCP 8193 — port listens, TCP handshakes, but the application-layer FOCAS protocol isn't implemented unless NCGuide-Pro or NCGuide_COMM is licensed.
What actually works
fwlibNCG64.dll's exports don't include cnc_allclibhndl3 at all (verified via ctypes AttributeError), only cnc_allclibhndl and cnc_allclibhndl2. That's the design hint: NCGuide's FOCAS surface is HSSB-style local IPC only, talked to via shared memory + global mutexes + \\.\pipe\CNCGUIDE1, all accessible at normal user privilege.
import ctypes
from ctypes import c_short, c_ushort, byref
fw = ctypes.WinDLL("fwlibNCG64.dll")
fw.cnc_allclibhndl2.argtypes = [c_short, ctypes.POINTER(c_ushort)]
fw.cnc_allclibhndl2.restype = c_short
h = c_ushort(0)
rc = fw.cnc_allclibhndl2(9, byref(h)) # node = 9
# rc == 0, h.value valid; then cnc_sysinfo, cnc_statinfo, etc. all work
node=9 is the magic value against a default NCGuide install. Found by brute-forcing -1..50 while Simbase was running — only 9 returned EW_OK, every other value returned EW_NUMBER (-3). Confirmed against FS30i-B and FS30i-B Plus controller variants.
Coverage
Out of 28 common FOCAS calls I tried via this path, 22 worked on a vanilla NCGuide install. The ones that didn't (cnc_absolute/machine/relative, cnc_toolnum, cnc_rdcncid, cnc_rdopmsg) fail with EW_FORMAT (-2) or EW_NOOPT (-6) — likely struct-packing issues on my side and/or options not present in standard NCGuide's license.
Full writeup + reference impl
I posted the longer version with the full diagnostic story + working HTTP proxy (http.server-based, exposes the FOCAS calls as JSON endpoints for VM/remote consumption) over on Ladder99's repo: Ladder99/fanuc-driver#123
Happy to PR a README addition or examples/ncguide/ snippet if useful — let me know the preferred shape.
TL;DR
When using the bundled
fwlibNCG.dll/fwlibNCG64.dllagainst a running Fanuc NCGuide simulator on the same Windows host, the working call iscnc_allclibhndl2(node=9, &handle)— notcnc_allclibhndl3over TCP. Posting this here in case it's useful for the README or for other users who land in the same spot.Background
The compatibility matrix on the README lists
FWLIBNCG.DLL/FWLIBNCG64.DLLas the libraries for NCGuide-Pro, but doesn't go into the call-side specifics, and the natural assumption (cnc_allclibhndl3("127.0.0.1", 8193, ...)— same as a real CNC) doesn't work against standard NCGuide. It returnsEW_MMCSYS (-15)because standard NCGuide doesn't actually serve FOCAS2/Ethernet on TCP 8193 — port listens, TCP handshakes, but the application-layer FOCAS protocol isn't implemented unless NCGuide-Pro or NCGuide_COMM is licensed.What actually works
fwlibNCG64.dll's exports don't includecnc_allclibhndl3at all (verified viactypesAttributeError), onlycnc_allclibhndlandcnc_allclibhndl2. That's the design hint: NCGuide's FOCAS surface is HSSB-style local IPC only, talked to via shared memory + global mutexes +\\.\pipe\CNCGUIDE1, all accessible at normal user privilege.node=9is the magic value against a default NCGuide install. Found by brute-forcing-1..50while Simbase was running — only9returnedEW_OK, every other value returnedEW_NUMBER (-3). Confirmed againstFS30i-BandFS30i-B Pluscontroller variants.Coverage
Out of 28 common FOCAS calls I tried via this path, 22 worked on a vanilla NCGuide install. The ones that didn't (
cnc_absolute/machine/relative,cnc_toolnum,cnc_rdcncid,cnc_rdopmsg) fail withEW_FORMAT (-2)orEW_NOOPT (-6)— likely struct-packing issues on my side and/or options not present in standard NCGuide's license.Full writeup + reference impl
I posted the longer version with the full diagnostic story + working HTTP proxy (
http.server-based, exposes the FOCAS calls as JSON endpoints for VM/remote consumption) over on Ladder99's repo: Ladder99/fanuc-driver#123Happy to PR a README addition or
examples/ncguide/snippet if useful — let me know the preferred shape.